Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions x/vm/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ func (k *Keeper) BeginBlock(ctx sdk.Context) error {
})
}

// set current block hash in the contract storage, compatible with EIP-2935
ringIndex := uint64(ctx.BlockHeight() % ethparams.HistoryServeWindow) //nolint:gosec // G115 // won't exceed uint64
var key common.Hash
binary.BigEndian.PutUint64(key[24:], ringIndex)
k.SetState(ctx, ethparams.HistoryStorageAddress, key, ctx.HeaderHash())
acct := k.GetAccount(ctx, ethparams.HistoryStorageAddress)
if acct != nil && acct.IsContract() {
// set current block hash in the contract storage, compatible with EIP-2935
ringIndex := uint64(ctx.BlockHeight() % ethparams.HistoryServeWindow) //nolint:gosec // G115 // won't exceed uint64
var key common.Hash
binary.BigEndian.PutUint64(key[24:], ringIndex)
k.SetState(ctx, ethparams.HistoryStorageAddress, key, ctx.HeaderHash())
}
return nil
}

Expand Down
Loading