We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently a query result of new block height may be returned with the previous block timestamp if the block is committed but state not being set.
main
Make the following code change in baseapp/abci.go, then run the test case TestABCI_CreateQueryContext_Before_Set_CheckState in #21003.
baseapp/abci.go
TestABCI_CreateQueryContext_Before_Set_CheckState
diff --git a/baseapp/abci.go b/baseapp/abci.go index 513d8667fc..2278013f02 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -1245,6 +1245,15 @@ func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, e ) } + header := app.checkState.Context().BlockHeader() + if height == lastBlockHeight && header.Height != lastBlockHeight { + return sdk.Context{}, + errorsmod.Wrapf( + sdkerrors.ErrInvalidHeight, + "header height in check state context is not latest height (%d)", lastBlockHeight, + ) + } + // branch the commit multi-store for safety ctx := sdk.NewContext(cacheMS, true, app.logger). WithMinGasPrices(app.minGasPrices). @@ -1253,7 +1262,7 @@ func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, e ChainID: app.chainID, Height: height, }). - WithBlockHeader(app.checkState.Context().BlockHeader()). + WithBlockHeader(header). WithBlockHeight(height) if height != lastBlockHeight {
The text was updated successfully, but these errors were encountered:
Closed by #21003
Sorry, something went wrong.
mmsqe
No branches or pull requests
Is there an existing issue for this?
What happened?
Currently a query result of new block height may be returned with the previous block timestamp if the block is committed but state not being set.
Cosmos SDK Version
main
How to reproduce?
Make the following code change in
baseapp/abci.go
, then run the test caseTestABCI_CreateQueryContext_Before_Set_CheckState
in #21003.The text was updated successfully, but these errors were encountered: