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

[Bug]: state changes during posthandler are ignored if tx is failed #22396

Open
1 task done
beer-1 opened this issue Oct 30, 2024 · 2 comments
Open
1 task done

[Bug]: state changes during posthandler are ignored if tx is failed #22396

beer-1 opened this issue Oct 30, 2024 · 2 comments
Assignees
Labels
S:needs more info This bug can't be addressed until more information is provided by the reporter. T:Bug

Comments

@beer-1
Copy link
Contributor

beer-1 commented Oct 30, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

If tx failed, all state changes during post handler are trashed.

This is normal if there is no input err == nil on posthandler call, but there is. SDK users may think this post handler can update state to handle tx failure actions due to that inputs. not sure the intension of that field.

If your intension is allowing sdk users to do update state during posthandler to handle tx failure, then please write the state changes on post handler even tx is failed.

Cosmos SDK Version

v0.50

How to reproduce?

No response

@julienrbrt
Copy link
Member

In which version 0.50 are you encountering this? This should have been fixed by #18627

@julienrbrt julienrbrt added the S:needs more info This bug can't be addressed until more information is provided by the reporter. label Nov 4, 2024
@beer-1
Copy link
Contributor Author

beer-1 commented Nov 7, 2024

Hey @julienrbrt, thanks for reply.

We are using latest version v0.5.10.

yea seem it is executed, but the state changes are committed only err (from runMsgs) is none.

cosmos-sdk/baseapp/baseapp.go

Lines 1008 to 1013 in 99b4858

if err == nil {
if mode == execModeFinalize {
// When block gas exceeds, it'll panic and won't commit the cached store.
consumeBlockGas()
msCache.Write()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S:needs more info This bug can't be addressed until more information is provided by the reporter. T:Bug
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants