Skip to content

?height=100 query context should be created with requested height #10826

Closed
@yun-yeo

Description

Summary

Currently when we do height query, the query context has latest block height not requested block height. Only CacheMultiStore has been updated to use the given block height.

It is causing some logical error when the querier using its context block height(i.e. ctx.BlockHeight()) to compute some value.

Proposal

We can make query context with requested block height in the function's

func (app *BaseApp) createQueryContext(height int64, prove bool) (sdk.Context, error) {

This line

cosmos-sdk/baseapp/abci.go

Lines 658 to 660 in b67c4b3

ctx := sdk.NewContext(
cacheMS, app.checkState.ctx.BlockHeader(), true, app.logger,
).WithMinGasPrices(app.minGasPrices)

It should be

 ctx := sdk.NewContext( 
 	cacheMS, app.checkState.ctx.BlockHeader(), true, app.logger, 
 ).WithMinGasPrices(app.minGasPrices).WithBlockHeight(height)

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions