FinalizeTx after engine.Initialize (#5783)

AuRa storage changes made by `onEpochBegin` should be finalized.
Otherwise, `SSTORE` cost might be incorrect in block transactions when
[EIP-2200](https://eips.ethereum.org/EIPS/eip-2200) is active.
https://gnosisscan.io/tx/0xa6d45d903c977ad237165737ebc4e34fb7756675719d112a199af858bb1275e0
is an example of a transaction on Gnosis Chain whose gas used was
previously calculated incorrectly.
This commit is contained in:
Andrew Ashikhmin 2022-10-18 10:44:56 +02:00 committed by GitHub
parent 52c418993e
commit 0fb74172a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -572,5 +572,7 @@ func InitializeBlockExecution(engine consensus.Engine, chain consensus.ChainHead
engine.Initialize(cc, chain, epochReader, header, txs, uncles, func(contract common.Address, data []byte) ([]byte, error) {
return SysCallContract(contract, data, *cc, ibs, header, engine)
})
noop := state.NewNoopWriter()
ibs.FinalizeTx(cc.Rules(header.Number.Uint64()), noop)
return nil
}