|
|
|
@ -196,7 +196,7 @@ func (t *StateTest) checkError(subtest StateSubtest, err error) error { |
|
|
|
|
|
|
|
|
|
// Run executes a specific subtest and verifies the post-state and logs
|
|
|
|
|
func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config, snapshotter bool, scheme string, postCheck func(err error, st *StateTestState)) (result error) { |
|
|
|
|
st, root, err := t.RunNoVerify(subtest, vmconfig, snapshotter, scheme) |
|
|
|
|
st, root, _, err := t.RunNoVerify(subtest, vmconfig, snapshotter, scheme) |
|
|
|
|
// Invoke the callback at the end of function for further analysis.
|
|
|
|
|
defer func() { |
|
|
|
|
postCheck(result, &st) |
|
|
|
@ -228,10 +228,10 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config, snapshotter bo |
|
|
|
|
|
|
|
|
|
// RunNoVerify runs a specific subtest and returns the statedb and post-state root.
|
|
|
|
|
// Remember to call state.Close after verifying the test result!
|
|
|
|
|
func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapshotter bool, scheme string) (st StateTestState, root common.Hash, err error) { |
|
|
|
|
func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapshotter bool, scheme string) (st StateTestState, root common.Hash, gasUsed uint64, err error) { |
|
|
|
|
config, eips, err := GetChainConfig(subtest.Fork) |
|
|
|
|
if err != nil { |
|
|
|
|
return st, common.Hash{}, UnsupportedForkError{subtest.Fork} |
|
|
|
|
return st, common.Hash{}, 0, UnsupportedForkError{subtest.Fork} |
|
|
|
|
} |
|
|
|
|
vmconfig.ExtraEips = eips |
|
|
|
|
|
|
|
|
@ -250,7 +250,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh |
|
|
|
|
post := t.json.Post[subtest.Fork][subtest.Index] |
|
|
|
|
msg, err := t.json.Tx.toMessage(post, baseFee) |
|
|
|
|
if err != nil { |
|
|
|
|
return st, common.Hash{}, err |
|
|
|
|
return st, common.Hash{}, 0, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{ // Blob transactions may be present after the Cancun fork.
|
|
|
|
@ -260,7 +260,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh |
|
|
|
|
// 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 st, common.Hash{}, errors.New("blob gas exceeds maximum") |
|
|
|
|
return st, common.Hash{}, 0, errors.New("blob gas exceeds maximum") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -269,10 +269,10 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh |
|
|
|
|
var ttx types.Transaction |
|
|
|
|
err := ttx.UnmarshalBinary(post.TxBytes) |
|
|
|
|
if err != nil { |
|
|
|
|
return st, common.Hash{}, err |
|
|
|
|
return st, common.Hash{}, 0, err |
|
|
|
|
} |
|
|
|
|
if _, err := types.Sender(types.LatestSigner(config), &ttx); err != nil { |
|
|
|
|
return st, common.Hash{}, err |
|
|
|
|
return st, common.Hash{}, 0, err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -322,7 +322,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh |
|
|
|
|
receipt := &types.Receipt{GasUsed: vmRet.UsedGas} |
|
|
|
|
tracer.OnTxEnd(receipt, nil) |
|
|
|
|
} |
|
|
|
|
return st, root, err |
|
|
|
|
return st, root, vmRet.UsedGas, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t *StateTest) gasLimit(subtest StateSubtest) uint64 { |
|
|
|
|