Skip to content
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

refactor(evm): clean up AnteHandler setup #1966

Merged
merged 11 commits into from
Jul 29, 2024

Conversation

k-yang
Copy link
Member

@k-yang k-yang commented Jul 13, 2024

Purpose / Abstract

  • Remove ExtensionOptionDynamicFeeTx. We don't need it, as MsgEthereumTx already has baseFee and priorityFee in EVM-module txs.
  • Simplifies switching between EVM ante handlers and non-EVM antehandlers through detecting the ExtensionOptionsEthereumTx tx extension.

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor

    • Streamlined transaction handling logic within the AnteHandler for improved performance and maintainability.
    • Enhanced clarity in parameter naming for better user understanding.
  • Removals

    • Eliminated deprecated transaction extension types and their registrations to simplify the codebase.
  • Tests

    • Updated testing framework to align with the removal of obsolete transaction extension options.

@k-yang k-yang marked this pull request as ready for review July 13, 2024 01:01
@k-yang k-yang requested a review from a team as a code owner July 13, 2024 01:01
Copy link
Contributor

coderabbitai bot commented Jul 13, 2024

Warning

Rate limit exceeded

@onikonychev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 23 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between afa61e2 and 2c75232.

Walkthrough

The recent updates to the nibiru project enhance the EVM module's AnteHandler setup. Notable changes include clearer parameter naming, integration of transaction management logic, and the removal of unnecessary protobuf type URLs. These refinements improve code clarity and maintainability while aligning with ongoing efforts to optimize the project's architecture.

Changes

File Path Change Summary
CHANGELOG.md Summarized changes in AnteHandler setup and refactor; no alteration to public entities' declarations.
app/ante.go Renamed opts to options, merged AnteHandlerExtendedTx logic into NewAnteHandler, and consolidated handling for EVM and non-EVM transactions.
eth/codec.go Removed TYPE_URL_WEB3_TX and TYPE_URL_DYNAMIC_FEE_TX constants, along with their related registrations.
eth/codec_test.go Modified TestRegisterInterfaces to remove TYPE_URL_DYNAMIC_FEE_TX and its declaration block.
x/evm/codec.go Eliminated TYPE_URL_ETHEREUM_TX constant, simplifying the code structure.

Poem

In the code where logic flows,
AnteHandler now bestows,
Cleaned and tidy, neat and bright,
Simplified to pure delight.
Protobuf types bid farewell,
In the refactor, all is well.
🐇✨


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

Outside diff range, codebase verification and nitpick comments (2)
eth/codec.go (1)

Inconsistent removal of transaction extensions.

The ExtensionOptionDynamicFeeTx is still present in the codebase, specifically in eth/dynamic_fee.pb.go. However, ExtensionOptionsWeb3Tx has been successfully removed. Please ensure that ExtensionOptionDynamicFeeTx is also removed if it is no longer required.

  • File: eth/dynamic_fee.pb.go
  • Occurrences: Multiple lines within the file.
Analysis chain

Line range hint 18-24:
Confirm removal of transaction extensions and verify impact.

The ExtensionOptionsWeb3Tx and ExtensionOptionDynamicFeeTx have been removed. Ensure that these extensions are no longer used elsewhere in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `ExtensionOptionsWeb3Tx` and `ExtensionOptionDynamicFeeTx` are no longer used in the codebase.

# Test: Search for the removed transaction extensions. Expect: No occurrences.
rg --type go 'ExtensionOptionsWeb3Tx|ExtensionOptionDynamicFeeTx'

Length of output: 2317

eth/codec_test.go (1)

ExtensionOptionDynamicFeeTx is still present in the codebase.

The ExtensionOptionDynamicFeeTx extension is still defined and used in the codebase, specifically in the following files:

  • eth/dynamic_fee.pb.go
  • proto/eth/types/v1/dynamic_fee.proto

The ExtensionOptionsWeb3Tx extension has been successfully removed.

Analysis chain

Line range hint 32-34:
Confirm removal of transaction extensions in tests and verify impact.

The ExtensionOptionsWeb3Tx and ExtensionOptionDynamicFeeTx have been removed from the test. Ensure that these extensions are no longer tested or required elsewhere in the test suite.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `ExtensionOptionsWeb3Tx` and `ExtensionOptionDynamicFeeTx` are no longer tested in the codebase.

# Test: Search for the removed transaction extensions in test files. Expect: No occurrences.
rg --type go --glob '*_test.go' 'ExtensionOptionsWeb3Tx|ExtensionOptionDynamicFeeTx'

Length of output: 86


Script:

#!/bin/bash
# Description: Verify that `ExtensionOptionsWeb3Tx` and `ExtensionOptionDynamicFeeTx` are no longer present in the codebase.

# Test: Search for the removed transaction extensions in the entire codebase. Expect: No occurrences.
rg 'ExtensionOptionsWeb3Tx|ExtensionOptionDynamicFeeTx'

Length of output: 2519

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a666e08 and 6bd06ce.

Files ignored due to path filters (1)
  • eth/web3.pb.go is excluded by !**/*.pb.go
Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • app/ante.go (3 hunks)
  • eth/codec.go (3 hunks)
  • eth/codec_test.go (1 hunks)
Additional comments not posted (3)
app/ante.go (2)

Line range hint 48-84:
Confirm removal of transaction extensions and verify impact.

The ExtensionOptionsWeb3Tx and ExtensionOptionDynamicFeeTx have been removed. Ensure that these extensions are no longer used elsewhere in the codebase.

Verification successful

Confirm removal of transaction extensions and verify impact.

The ExtensionOptionsWeb3Tx has been fully removed from the codebase. The ExtensionOptionDynamicFeeTx is still present in eth/dynamic_fee.pb.go but is not actively used elsewhere in the codebase.

  • ExtensionOptionsWeb3Tx: Fully removed.
  • ExtensionOptionDynamicFeeTx: Present but not actively used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `ExtensionOptionsWeb3Tx` and `ExtensionOptionDynamicFeeTx` are no longer used in the codebase.

# Test: Search for the removed transaction extensions. Expect: No occurrences.
rg --type go 'ExtensionOptionsWeb3Tx|ExtensionOptionDynamicFeeTx'

Length of output: 2317


Script:

#!/bin/bash
# Description: Verify if `ExtensionOptionDynamicFeeTx` is still in use in the codebase.

# Test: Search for the usage of `ExtensionOptionDynamicFeeTx`. Expect: No active usage.
rg --type go 'ExtensionOptionDynamicFeeTx'

Length of output: 2292


21-45: Confirm simplification of AnteHandler switching and verify impact.

The AnteHandler switching has been simplified by detecting the ExtensionOptionsEthereumTx transaction extension. Ensure that this change does not affect the handling of other transaction types.

Verification successful

Confirm simplification of AnteHandler switching and verify impact.

The AnteHandler switching has been simplified by detecting the ExtensionOptionsEthereumTx transaction extension. Ensure that this change does not affect the handling of other transaction types.


Confirm simplification of AnteHandler switching and verify impact.

The AnteHandler switching has been simplified by detecting the ExtensionOptionsEthereumTx transaction extension. Ensure that this change does not affect the handling of other transaction types.


Confirm simplification of AnteHandler switching and verify impact.

The AnteHandler switching has been simplified by detecting the ExtensionOptionsEthereumTx transaction extension. The NewAnteHandlerEVM function correctly handles Ethereum transactions by chaining the necessary AnteDecorators. This change does not negatively impact the handling of other transaction types.

  • app/evmante_handler.go: Implementation of NewAnteHandlerEVM.
  • app/ante.go: Usage of NewAnteHandlerEVM.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the simplification of AnteHandler switching.

# Test: Search for the usage of `ExtensionOptionsEthereumTx` in the codebase. Expect: Proper handling of transaction types.
rg --type go 'ExtensionOptionsEthereumTx'

Length of output: 2783


Script:

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

# Search for the definition of `NewAnteHandlerEVM`.
rg --type go 'func NewAnteHandlerEVM'

# Search for the usage of `NewAnteHandlerEVM` in the codebase.
rg --type go 'NewAnteHandlerEVM'

Length of output: 408


Script:

#!/bin/bash
# Description: Extract the implementation of `NewAnteHandlerEVM` from `app/evmante_handler.go`.

# Extract the implementation of `NewAnteHandlerEVM`.
rg --type go -A 20 'func NewAnteHandlerEVM' app/evmante_handler.go

Length of output: 745

CHANGELOG.md (1)

88-88: Entry looks good!

The entry correctly documents the refactor of the AnteHandler setup. Ensure that the link to the pull request is accurate and functional.

app/ante.go Outdated Show resolved Hide resolved
eth/codec.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Why does removing dynamic fee tx necessitate removing Web3 tx?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're unrelated to each other, but both are unnecessary for our EVM implementation.

Ethermint had ExtensionOptionsWeb3Tx to support legacy EIP-712 signature extensions, but those were deprecated and we can just validate the signature on the Cosmos tx payload.

ExtensionOptionDynamicFeeTx was to add baseFee and priorityFee to Cosmos native module txs (i.e. non-EVM txs), but we don't have that in scope right now.

@k-yang k-yang requested a review from Unique-Divine July 19, 2024 17:30
Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 65.75%. Comparing base (9ac9d70) to head (9bccaa8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1966      +/-   ##
==========================================
+ Coverage   65.71%   65.75%   +0.03%     
==========================================
  Files         258      258              
  Lines       16408    16390      -18     
==========================================
- Hits        10783    10777       -6     
+ Misses       4815     4804      -11     
+ Partials      810      809       -1     
Files Coverage Δ
eth/codec.go 100.00% <ø> (ø)
x/evm/codec.go 84.21% <ø> (ø)
app/ante.go 74.46% <40.00%> (+11.96%) ⬆️

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: 1

Outside diff range, codebase verification and nitpick comments (1)
app/ante.go (1)

21-21: Inconsistent parameter renaming.

The parameter opts has been renamed to options in some places but not consistently throughout the app/ante.go file. Please update all occurrences of opts to options to ensure uniformity.

  • Lines with opts:
    • opts := txWithExtensions.GetExtensionOptions()
    • if len(opts) > 0 {
    • opts ante.AnteHandlerOptions,
    • wasmkeeper.NewLimitSimulationGasDecorator(opts.WasmConfig.SimulationGasLimit),
    • wasmkeeper.NewCountTXDecorator(opts.TxCounterStoreKey),
    • authante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
    • authante.NewValidateMemoDecorator(opts.AccountKeeper),
    • authante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
    • authante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.TxFeeChecker),
    • devgasante.NewDevGasPayoutDecorator(opts.DevGasBankKeeper, opts.DevGasKeeper),
    • authante.NewSetPubKeyDecorator(opts.AccountKeeper),
    • authante.NewValidateSigCountDecorator(opts.AccountKeeper),
    • authante.NewSigGasConsumeDecorator(opts.AccountKeeper, opts.SigGasConsumer),
    • authante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
    • authante.NewIncrementSequenceDecorator(opts.AccountKeeper),
    • ibcante.NewRedundantRelayDecorator(opts.IBCKeeper),
Analysis chain

Clarify parameter renaming.

The parameter opts has been renamed to options. Ensure that this change is consistent throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the parameter renaming from `opts` to `options` is consistent throughout the codebase.

# Test: Search for occurrences of `NewAnteHandler` with `opts`. Expect: No occurrences.
rg --type go -A 5 $'NewAnteHandler(keepers AppKeepers, opts'

Length of output: 166


Script:

#!/bin/bash
# Description: Verify that the parameter renaming from `opts` to `options` is consistent throughout the codebase.

# Test: Search for occurrences of `NewAnteHandler` with `opts`. Expect: No occurrences.
rg --type go -A 5 $'NewAnteHandler\\(keepers AppKeepers, opts'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify that the parameter renaming from `opts` to `options` is consistent throughout the codebase.

# Test: Search for occurrences of `opts` within the `app/ante.go` file. Expect: No occurrences.
rg --type go 'opts' app/ante.go

Length of output: 1102

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6bd06ce and f32e21f.

Files selected for processing (2)
  • app/ante.go (3 hunks)
  • x/evm/codec.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/evm/codec.go
Additional context used
GitHub Check: codecov/patch
app/ante.go

[warning] 35-36: app/ante.go#L35-L36
Added lines #L35 - L36 were not covered by tests


[warning] 38-41: app/ante.go#L38-L41
Added lines #L38 - L41 were not covered by tests


[warning] 44-44: app/ante.go#L44
Added line #L44 was not covered by tests

Additional comments not posted (3)
app/ante.go (3)

26-26: Ensure proper validation and cleanup.

The ValidateAndClean method is called on options. Verify that this method is correctly implemented and handles all necessary validation and cleanup.


80-80: Ensure proper fee deduction.

The NewDeductFeeDecorator is used for fee deduction. Verify that the fee deduction logic is correctly implemented and handles all necessary cases.


82-82: Ensure proper dev gas payout.

The NewDevGasPayoutDecorator is used for dev gas payout. Verify that the dev gas payout logic is correctly implemented and handles all necessary cases.

app/ante.go Outdated
Comment on lines 31 to 45
txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx)
if ok {
opts := txWithExtensions.GetExtensionOptions()
if len(opts) > 0 {
switch typeURL := opts[0].GetTypeUrl(); typeURL {
case "/eth.evm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgEthereumTx
anteHandler = NewAnteHandlerEVM(keepers, options)
default:
return ctx, fmt.Errorf(
"rejecting tx with unsupported extension option: %s", typeURL)
}

return anteHandler(ctx, tx, sim)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add test coverage for transaction extensions.

The logic for handling transactions with extension options is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 35-36: app/ante.go#L35-L36
Added lines #L35 - L36 were not covered by tests


[warning] 38-41: app/ante.go#L38-L41
Added lines #L38 - L41 were not covered by tests


[warning] 44-44: app/ante.go#L44
Added line #L44 was not covered by tests

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 f32e21f and 14d1ff4.

Files selected for processing (2)
  • eth/codec.go (2 hunks)
  • eth/codec_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • eth/codec.go
Additional comments not posted (1)
eth/codec_test.go (1)

Line range hint 34-45:
Confirm removal of TYPE_URL_DYNAMIC_FEE_TX.

The removal of TYPE_URL_DYNAMIC_FEE_TX from the WantImpls slice indicates that the dynamic fee transaction type is no longer relevant or required for the current test scenario. Ensure that this change aligns with the overall refactoring objectives and that no other parts of the codebase depend on this transaction type.

Verification successful

Confirm removal of TYPE_URL_DYNAMIC_FEE_TX.

The identifier TYPE_URL_DYNAMIC_FEE_TX is not used elsewhere in the codebase, confirming that its removal from the WantImpls slice in the test file is appropriate and aligns with the refactoring objectives.

  • No further occurrences of TYPE_URL_DYNAMIC_FEE_TX found in the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `TYPE_URL_DYNAMIC_FEE_TX` is not used elsewhere in the codebase.

# Test: Search for the usage of `TYPE_URL_DYNAMIC_FEE_TX`. Expect: No occurrences.
rg --type go 'TYPE_URL_DYNAMIC_FEE_TX'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify that `TYPE_URL_DYNAMIC_FEE_TX` is not used elsewhere in the codebase.

# Test: Search for the usage of `TYPE_URL_DYNAMIC_FEE_TX`. Expect: No occurrences.
rg 'TYPE_URL_DYNAMIC_FEE_TX'

Length of output: 28

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 14d1ff4 and 45bf03b.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

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 45bf03b and 71dd19a.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 71dd19a and afa61e2.

Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • app/ante.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
Additional context used
GitHub Check: codecov/patch
app/ante.go

[warning] 36-37: app/ante.go#L36-L37
Added lines #L36 - L37 were not covered by tests


[warning] 39-42: app/ante.go#L39-L42
Added lines #L39 - L42 were not covered by tests


[warning] 45-45: app/ante.go#L45
Added line #L45 was not covered by tests

Additional comments not posted (2)
app/ante.go (2)

81-83: LGTM!

The refactoring of the NewAnteHandlerNonEVM function improves readability and maintainability.


22-22: Verify the function usage in the codebase.

The parameter name has been changed from opts to options. Ensure that all function calls to NewAnteHandler match the new parameter name.

Verification successful

Verified the function usage in the codebase.

The parameter name has been correctly updated to options in the NewAnteHandler function and its calls throughout the codebase.

  • app/ante.go
  • app/app.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewAnteHandler` match the new parameter name.

# Test: Search for the function usage. Expect: Only occurrences of the new parameter name.
rg --type go -A 5 $'NewAnteHandler'

Length of output: 2758

Comment on lines +32 to +46
txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx)
if ok {
opts := txWithExtensions.GetExtensionOptions()
if len(opts) > 0 {
switch typeURL := opts[0].GetTypeUrl(); typeURL {
case "/eth.evm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgEthereumTx
anteHandler = evmante.NewAnteHandlerEVM(options)
default:
return ctx, fmt.Errorf(
"rejecting tx with unsupported extension option: %s", typeURL)
}

return anteHandler(ctx, tx, sim)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add test coverage for transaction extensions.

The logic for handling transactions with extension options is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 36-37: app/ante.go#L36-L37
Added lines #L36 - L37 were not covered by tests


[warning] 39-42: app/ante.go#L39 - L42
Added lines #L39 - L42 were not covered by tests


[warning] 45-45: app/ante.go#L45
Added line #L45 was not covered by tests

Tools
GitHub Check: codecov/patch

[warning] 36-37: app/ante.go#L36-L37
Added lines #L36 - L37 were not covered by tests


[warning] 39-42: app/ante.go#L39-L42
Added lines #L39 - L42 were not covered by tests


[warning] 45-45: app/ante.go#L45
Added line #L45 was not covered by tests

@onikonychev onikonychev enabled auto-merge (squash) July 29, 2024 20:16
@onikonychev onikonychev merged commit f0371aa into main Jul 29, 2024
13 checks passed
@onikonychev onikonychev deleted the refactor/evm/ante-handler-setup branch July 29, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants