eth/tracers: add support for block overrides in debug_traceCall (#24871)

This PR adds support for block overrides when doing debug_traceCall.

- Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
- With this change, we reject executing debug_traceCall against pending.
- And we add ability to override all evm-visible header fields.
This commit is contained in:
Martin Holst Swende
2022-06-02 11:39:36 +02:00
committed by GitHub
parent f9806dc872
commit d8a2305565
4 changed files with 120 additions and 42 deletions
+5
View File
@@ -84,6 +84,11 @@ func GetHashFn(ref *types.Header, chain ChainContext) func(n uint64) common.Hash
var cache []common.Hash
return func(n uint64) common.Hash {
if ref.Number.Uint64() <= n {
// This situation can happen if we're doing tracing and using
// block overrides.
return common.Hash{}
}
// If there's no hash cache yet, make one
if len(cache) == 0 {
cache = append(cache, ref.ParentHash)