mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
cmd/evm: compare errors by value in timedExec instead of interface identity (#34733)
`timedExec` compares errors by direct interface inequality (haveErr != err). If execFunc returns newly constructed errors with the same message each run, this will panic even though behavior is equivalent.
This commit is contained in:
parent
89c1c16a46
commit
4c03a0631e
1 changed files with 5 additions and 2 deletions
|
|
@ -166,8 +166,11 @@ func timedExec(bench bool, execFunc func() ([]byte, uint64, error)) ([]byte, exe
|
||||||
if haveGasUsed != gasUsed {
|
if haveGasUsed != gasUsed {
|
||||||
panic(fmt.Sprintf("gas differs, have %v want %v", haveGasUsed, gasUsed))
|
panic(fmt.Sprintf("gas differs, have %v want %v", haveGasUsed, gasUsed))
|
||||||
}
|
}
|
||||||
if haveErr != err {
|
if (haveErr == nil) != (err == nil) {
|
||||||
panic(fmt.Sprintf("err differs, have %v want %v", haveErr, err))
|
panic(fmt.Sprintf("err differs in nil-ness, have %v want %v", haveErr, err))
|
||||||
|
}
|
||||||
|
if haveErr != nil && err != nil && haveErr.Error() != err.Error() {
|
||||||
|
panic(fmt.Sprintf("err differs, have %q want %q", haveErr.Error(), err.Error()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue