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

REVIEW: Don't abort after AnteHandler if CheckTx #510

Merged
merged 1 commit into from
Feb 28, 2018
Merged

Conversation

adrianbrink
Copy link
Contributor

@adrianbrink adrianbrink commented Feb 25, 2018

Currently we are aborting running a transaction after the AnteHandler in
case it is a checkTx. This means that the handler never gets the chance
to check the validity of a transaction. Furthermore the AnteHandler
should not handle CheckTx logic.

The AnteHandler should handle global validation, whereas each Handler
should handle module validation.

closes #433

Currently we are aborting running a transaction after the AnteHandler in
case it is a checkTx. This means that the handler never gets the chance
to check the validity of a transaction. Furthermore the AnteHandler
should not handle CheckTx logic.

The AnteHandler should handle global validation, whereas each Handler
should handle module validation.
@codecov
Copy link

codecov bot commented Feb 25, 2018

Codecov Report

Merging #510 into develop will increase coverage by 0.01%.
The diff coverage is 87.5%.

@@             Coverage Diff             @@
##           develop     #510      +/-   ##
===========================================
+ Coverage    53.89%   53.91%   +0.01%     
===========================================
  Files           27       27              
  Lines         1542     1547       +5     
===========================================
+ Hits           831      834       +3     
- Misses         660      661       +1     
- Partials        51       52       +1

@adrianbrink adrianbrink changed the title Don't abort after AnteHandler if CheckTx REVIEW: Don't abort after AnteHandler if CheckTx Feb 26, 2018
Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

The minimal change to the cache is correct. However, none of the handlers differentiate between CheckTx and DeliverTx.

I think this deserves a test case or two, and updating the handlers so they return an GasEstimate

app.anteHandler = ah
}

// nolint - Get functions
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove this?
Maybe add a proper comment if you don't like the placeholder.

@@ -172,7 +170,6 @@ func (app *BaseApp) NewContext(isCheckTx bool, header abci.Header) sdk.Context {

// Implements ABCI
func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo {

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually prefer these leading spaces when there is a long function header.
I think it is personal preference, and maybe you can respect the code style in the repo. These lines came from Jae, and I agree with this style.

// Run the ante handler.
newCtx, result, abort := app.anteHandler(ctx, tx)
if isCheckTx || abort {
if abort {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct, but did you make sure all implementations handle checktx properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What implementations are you referring to?

In the worst case all implementations will now just do extra work against the CheckTx state. So in the case of the EVM, it would now run the full transaction through the EVM instead of returning beforehand.

Copy link
Contributor

Choose a reason for hiding this comment

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

CheckTx is supposed to return a non-zero count.
I refer to at least bank/handler. But also other Handlers that are in the codebase.

@ebuchman
Copy link
Member

ebuchman commented Feb 28, 2018

Thanks. I like the spaces after long function sigs too.

This is fine - our handlers are all sufficiently simple that we want them to run in full, but we need to better distinguish the difference between check/deliver and how fees work ... see #518

Also it means, before this PR, we cant send coins to someone with 0 coins and then have them send them on within a single block because the transfer doesn't run - so someone should write a test for this ... #517

@ebuchman ebuchman merged commit 57e8030 into develop Feb 28, 2018
@ebuchman ebuchman deleted the adrian/checktx branch February 28, 2018 00:55
@adrianbrink
Copy link
Contributor Author

I don't mind the spaces after function names. But we should be consistent.

chillyvee pushed a commit to chillyvee/cosmos-sdk that referenced this pull request Mar 1, 2024
Original PR opened by @jackzampolin
 cosmos/gaia#476

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
Co-authored-by: Colin Axner <colin@interchain.berlin>
Co-authored-by: Marko Baricevic <marko@interchain.berlin>
Co-authored-by: Josh Lee <josh@tendermint.com>
Co-authored-by: Gautier Marin <gautier@tendermint.com>
Co-authored-by: Sam Hart <sam@hxrts.com>
Co-authored-by: Shahan Khatchadourian <shahan.k.code@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Mircea Colonescu <mircea@tendermint.com>
Co-authored-by: Erik Grinaker <erik@tendermint.com>
Co-authored-by: Billy Rennekamp <billy@interchain.berlin>
Co-authored-by: Denis Fadeev <denis@tendermint.com>
Co-authored-by: Chris Goes <cwgoes@interchain.berlin>
Co-authored-by: Jacob Gadikian <jacobgadikian@gmail.com>
Co-authored-by: Gianguido Sora <me@gsora.xyz>
Co-authored-by: Zaki Manian <zaki@iqlusion.io>
Co-authored-by: Chris Remus
Co-authored-by: Melea
MSalopek added a commit to MSalopek/cosmos-sdk that referenced this pull request Apr 12, 2024
…#19312) (cosmos#510)

* feat(x/gov): implement a minimum amount per deposit (cosmos#18146)

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>

* Fix

* Fix test

* Fix e2e

* Fix e2e

* Fix test

* update changelog

* Include expedited proposal logic

* Update deposit.go

---------

Co-authored-by: MSalopek <matija.salopek994@gmail.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Adam Tucker <adam@osmosis.team>
Co-authored-by: Adam Tucker <adamleetucker@outlook.com>
MSalopek pushed a commit to MSalopek/cosmos-sdk that referenced this pull request Apr 12, 2024
p0mvn pushed a commit that referenced this pull request May 16, 2024
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.

CheckTx should not be stopped right after AnteHandler
3 participants