fix(evm): fee and tip calc bug (#5252)

This commit is contained in:
Max Revitt 2022-09-02 04:04:49 +01:00 committed by GitHub
parent f379f6728c
commit 5c49726f53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -56,9 +56,7 @@ func stateTestCmd(ctx *cli.Context) error {
return errors.New("path-to-test argument required")
}
// Configure the go-ethereum logger
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StderrHandler))
//glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
//glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name)))
log.Root().SetHandler(log.LvlFilterHandler(log.LvlDebug, log.StderrHandler))
// Configure the EVM logger
config := &vm.LogConfig{

View File

@ -67,10 +67,10 @@ type stJSON struct {
}
type stPostState struct {
Root common.Hash `json:"hash"`
Logs common.Hash `json:"logs"`
Tx hexutil.Bytes `json:"txbytes"`
ExpectException string `json:"expectException"`
Root common.UnprefixedHash `json:"hash"`
Logs common.UnprefixedHash `json:"logs"`
Tx hexutil.Bytes `json:"txbytes"`
ExpectException string `json:"expectException"`
Indexes struct {
Data int `json:"data"`
Gas int `json:"gas"`
@ -172,10 +172,10 @@ func (t *StateTest) Run(rules *params.Rules, tx kv.RwTx, subtest StateSubtest, v
post := t.json.Post[subtest.Fork][subtest.Index]
// N.B: We need to do this in a two-step process, because the first Commit takes care
// of suicides, and we need to touch the coinbase _after_ it has potentially suicided.
if root != post.Root {
if root != common.Hash(post.Root) {
return state, fmt.Errorf("post state root mismatch: got %x, want %x", root, post.Root)
}
if logs := rlpHash(state.Logs()); logs != post.Logs {
if logs := rlpHash(state.Logs()); logs != common.Hash(post.Logs) {
return state, fmt.Errorf("post state logs hash mismatch: got %x, want %x", logs, post.Logs)
}
return state, nil
@ -435,8 +435,8 @@ func toMessage(tx stTransactionMarshaling, ps stPostState, baseFee *big.Int) (co
tx.MaxPriorityFeePerGas = tx.MaxFeePerGas
}
feeCap := big.Int(*tx.MaxPriorityFeePerGas)
tipCap := big.Int(*tx.MaxFeePerGas)
feeCap = big.Int(*tx.MaxPriorityFeePerGas)
tipCap = big.Int(*tx.MaxFeePerGas)
gp := math.BigMin(new(big.Int).Add(&feeCap, baseFee), &tipCap)
gasPrice = math.NewHexOrDecimal256(gp.Int64())