Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Make NewAnteHandler returns error if input is invalid #1173

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Jul 11, 2022

Description

make NewAnteHandler safer too use, and closer to cosmos-sdk api.
extracted from #1168


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

make NewAnteHandler safer too use, and closer to cosmos-sdk api.
extracted from evmos#1168
@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #1173 (de7a52a) into main (969794c) will decrease coverage by 0.03%.
The diff coverage is 55.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1173      +/-   ##
==========================================
- Coverage   62.30%   62.27%   -0.04%     
==========================================
  Files          91       91              
  Lines        7367     7369       +2     
==========================================
- Hits         4590     4589       -1     
- Misses       2551     2553       +2     
- Partials      226      227       +1     
Impacted Files Coverage Δ
app/ante/ante.go 55.17% <25.00%> (-3.01%) ⬇️
app/app.go 85.96% <75.00%> (-0.04%) ⬇️
app/ante/handler_options.go 80.00% <100.00%> (ø)

@yihuang yihuang changed the title NewAnteHandler returns error if input not valid NewAnteHandler returns error if input is invalid Jul 11, 2022
@yihuang yihuang changed the title NewAnteHandler returns error if input is invalid Make NewAnteHandler returns error if input is invalid Jul 12, 2022
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

What was wrong with the prev implementation?

@@ -28,7 +28,7 @@ type HandlerOptions struct {
MaxTxGasWanted uint64
}

func (options HandlerOptions) Validate() error {
func (options HandlerOptions) validate() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this private now?

Copy link
Contributor Author

@yihuang yihuang Jul 19, 2022

Choose a reason for hiding this comment

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

one less thing to maintain? the user should use NewAnteHandler directly.

@yihuang
Copy link
Contributor Author

yihuang commented Jul 19, 2022

What was wrong with the prev implementation?

Because previously NewAnteHandler could get passed an invalid HandlerOptions without validating it, the newer version is a little bit safer to use. And the new interface is the same as the cosmos-sdk one, so it keeps the app scaffolding code closer to cosmos-sdk one.

@fedekunze fedekunze merged commit ea81e15 into evmos:main Jul 19, 2022
@yihuang yihuang deleted the refactor-ante-api branch July 19, 2022 05:18
hoanguyenkh pushed a commit to AstraProtocol/ethermint that referenced this pull request Jul 27, 2022
make NewAnteHandler safer too use, and closer to cosmos-sdk api.
extracted from evmos#1168
facs95 pushed a commit that referenced this pull request Aug 12, 2022
make NewAnteHandler safer too use, and closer to cosmos-sdk api.
extracted from #1168
hoanguyenkh pushed a commit to AstraProtocol/ethermint that referenced this pull request Aug 17, 2022
make NewAnteHandler safer too use, and closer to cosmos-sdk api.
extracted from evmos#1168
devon-chain pushed a commit to PundiAI/ethermint that referenced this pull request Nov 17, 2022
make NewAnteHandler safer too use, and closer to cosmos-sdk api.
extracted from evmos#1168

(cherry picked from commit 52febec)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants