tests: verify blob gas used

This commit is contained in:
Martin Holst Swende 2024-01-10 10:13:36 +01:00
parent f9e7361d20
commit b774a00b3e
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -291,6 +291,17 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
} }
evm := vm.NewEVM(context, txContext, statedb, config, vmconfig) evm := vm.NewEVM(context, txContext, statedb, config, vmconfig)
{ // Blob transactions may be present after the Cancun fork.
// In production,
// - the header is verified against the max in eip4844.go:VerifyEIP4844Header
// - the block body is verified against the header in block_validator.go:ValidateBody
// Here, we just do this shortcut smaller fix, since state tests do not
// utilize those codepaths
if len(msg.BlobHashes)*params.BlobTxBlobGasPerBlob > params.MaxBlobGasPerBlock {
return nil, nil, nil, common.Hash{}, errors.New("blob gas exceeds maximum")
}
}
// Execute the message. // Execute the message.
snapshot := statedb.Snapshot() snapshot := statedb.Snapshot()
gaspool := new(core.GasPool) gaspool := new(core.GasPool)