Skip to content

Commit

Permalink
Problem: block gas used not set in context
Browse files Browse the repository at this point in the history
Solution:
- fix the way context is updated
  • Loading branch information
yihuang committed Apr 3, 2024
1 parent 1c80a47 commit 83b418f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,11 @@ func (app *BaseApp) internalFinalizeBlock(ctx context.Context, req *abci.Request
for _, res := range txResults {
blockGasUsed += uint64(res.GasUsed)
}
sdkCtx := app.finalizeBlockState.Context().WithBlockGasUsed(blockGasUsed)
app.finalizeBlockState.SetContext(
app.finalizeBlockState.Context().WithBlockGasUsed(blockGasUsed),
)

endBlock, err := app.endBlock(sdkCtx)
endBlock, err := app.endBlock(ctx)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ func (app *BaseApp) deliverTxWithMultiStore(tx []byte, txIndex int, txMultiStore

// endBlock is an application-defined function that is called after transactions
// have been processed in FinalizeBlock.
func (app *BaseApp) endBlock(ctx context.Context) (sdk.EndBlock, error) {
func (app *BaseApp) endBlock(_ context.Context) (sdk.EndBlock, error) {
var endblock sdk.EndBlock

if app.endBlocker != nil {
Expand Down

0 comments on commit 83b418f

Please sign in to comment.