10000 imp(evm): Minor improvements in precompiles by MalteHerrmann · Pull Request #2709 · evmos/evmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

imp(evm): Minor improvements in precompiles #2709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 31, 2024
Merged

Conversation

MalteHerrmann
Copy link
Contributor
@MalteHerrmann MalteHerrmann commented Jul 29, 2024

This PR removes a duplicate definition of the bank precompile address and it switches the blocked address function to use all available and not the default static precompiles, which may or may not change in the future as opposed to the available ones.

Summary by CodeRabbit

  • New Features

    • Updated the handling of blocked precompile addresses in the Evmos project, improving the determination process.
    • Enhanced maintainability by centralizing the bank precompile address reference.
  • Documentation

    • Added a new entry in the CHANGELOG.md for version 18.1.0, outlining recent improvements and updates.

@MalteHerrmann MalteHerrmann requested a review from a team as a code owner July 29, 2024 16:40
@MalteHerrmann MalteHerrmann requested review from ramacarlucho and 0xstepit and removed request for a team July 29, 2024 16:40
Copy link
Contributor
coderabbitai bot commented Jul 29, 2024

Walkthrough

This update to the Evmos project introduces a minor improvement in the precompiles-related code, enhancing the functionality of the BlockedAddrs method and centralizing references to precompile addresses. The changes streamline the codebase for better maintainability and consistency, ensuring that the handling of blocked precompiles accurately reflects the latest available addresses in the Ethereum Virtual Machine context.

Changes

File Change Summary
CHANGELOG.md Added entry for version 18.1.0, noting minor improvements to precompiles-related code linked to pull request #2709.
app/app.go Modified the BlockedAddrs function to use evmtypes.AvailableStaticPrecompiles instead of evmtypes.DefaultStaticPrecompiles.
precompiles/bank/bank.go Removed hardcoded PrecompileAddress constant and replaced it with a reference to evmtypes.BankPrecompileAddress for improved maintainability.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Evmos
    participant EVM

    User->>Evmos: Request blocked addresses
    Evmos->>EVM: Fetch available precompiles
    EVM-->>Evmos: Return available precompiles
    Evmos->>Evmos: Update blocked addresses
    Evmos-->>User: Return blocked addresses
Loading

Poem

🐰 In the world of code, where the bunnies hop,
Improvements sprout, and the changes don't stop.
With precompiles set, and addresses clear,
Evmos leaps forward, let’s all give a cheer!
A wink of a tail, a hop in the flow,
Together we code, together we grow! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 253305f and 22779a2.

Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • app/app.go (1 hunks)
  • precompiles/bank/bank.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
Additional comments not posted (2)
precompiles/bank/bank.go (1)

16-16: LGTM!

The change to use evmtypes.BankPrecompileAddress instead of a hardcoded address enhances maintainability and consistency.

Also applies to: 68-68

app/app.go (1)

949-949: LGTM!

The change to use evmtypes.AvailableStaticPrecompiles instead of evmtypes.DefaultStaticPrecompiles allows for greater flexibility and adaptability.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 253305f and 22779a2.

Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • app/app.go (1 hunks)
  • precompiles/bank/bank.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
Additional comments not posted (2)
precompiles/bank/bank.go (1)

68-68: LGTM! Verify the new reference.

The code changes are approved.

Ensure that evmtypes.BankPrecompileAddress is correctly defined and used consistently across the codebase.

Verification successful

The new reference to evmtypes.BankPrecompileAddress is correctly defined and used consistently across the codebase.

  • Definition: x/evm/types/precompiles.go
  • Usages:
    • x/evm/types/precompiles.go
    • x/evm/types/params.go
    • precompiles/bank/bank.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `BankPrecompileAddress`.

# Test: Search for the definition. Expect: Only one occurrence.
rg --type go --pattern 'BankPrecompileAddress' --files-with-matches | xargs rg --type go --pattern 'const BankPrecompileAddress'

# Test: Search for the usage. Expect: Multiple occurrences.
rg --type go --pattern 'BankPrecompileAddress'

Length of output: 1411


Script:

#!/bin/bash
# Description: Verify the definition and usage of `BankPrecompileAddress`.

# Test: Search for the definition. Expect: Only one occurrence.
rg --type go 'BankPrecompileAddress' --files-with-matches | xargs rg 'const BankPrecompileAddress'

# Test: Search for the usage. Expect: Multiple occurrences.
rg --type go 'BankPrecompileAddress'

Length of output: 457

app/app.go (1)

949-949: LGTM! Verify the new reference.

The code changes are approved.

Ensure that evmtypes.AvailableStaticPrecompiles is correctly defined and used consistently across the codebase.

Verification successful

The new reference evmtypes.AvailableStaticPrecompiles is correctly defined and used consistently across the codebase.

  • Definition found in x/evm/types/precompiles.go:

    var AvailableStaticPrecompiles = []string{
  • Usage found in multiple files:

    • x/evm/types/precompiles.go
    • x/evm/keeper/static_precompiles.go
    • app/app.go
    • app/app_test.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `AvailableStaticPrecompiles`.

# Test: Search for the definition. Expect: Only one occurrence.
rg --type go --pattern 'AvailableStaticPrecompiles' --files-with-matches | xargs rg --type go --pattern 'var AvailableStaticPrecompiles'

# Test: Search for the usage. Expect: Multiple occurrences.
rg --type go --pattern 'AvailableStaticPrecompiles'

Length of output: 1424


Script:

#!/bin/bash
# Description: Verify the definition and usage of `AvailableStaticPrecompiles`.

# Test: Search for the definition. Expect: Only one occurrence.
rg --type go 'var AvailableStaticPrecompiles'

# Test: Search for the usage. Expect: Multiple occurrences.
rg --type go 'AvailableStaticPrecompiles'

Length of output: 868

Copy link
Contributor
@0xstepit 0xstepit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @MalteHerrmann !

Copy link
Contributor
@GAtom22 GAtom22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Thanks @MalteHerrmann!!

@MalteHerrmann MalteHerrmann merged commit 2cd4415 into main Jul 31, 2024
50 checks passed
@MalteHerrmann MalteHerrmann deleted the malte/minor-cleanup branch July 31, 2024 09:32
@coderabbitai coderabbitai bot mentioned this pull request Oct 31, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0