forked from cerc-io/plugeth
eth/tracers: more fork overrides in traceBlockToFile (#26655)
This change allows all post-Berlin forks to be specified as overrides for futureForkBlock in the config parameter for traceBlockToFile.
This commit is contained in:
parent
2def62b99b
commit
7d29fff415
@ -772,17 +772,9 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
|
||||
// actual specified block, not any preceding blocks that we have to go through
|
||||
// in order to obtain the state.
|
||||
// Therefore, it's perfectly valid to specify `"futureForkBlock": 0`, to enable `futureFork`
|
||||
|
||||
if config != nil && config.Overrides != nil {
|
||||
// Copy the config, to not screw up the main config
|
||||
// Note: the Clique-part is _not_ deep copied
|
||||
chainConfigCopy := new(params.ChainConfig)
|
||||
*chainConfigCopy = *chainConfig
|
||||
chainConfig = chainConfigCopy
|
||||
if berlin := config.Config.Overrides.BerlinBlock; berlin != nil {
|
||||
chainConfig.BerlinBlock = berlin
|
||||
canon = false
|
||||
}
|
||||
// Note: This copies the config, to not screw up the main config
|
||||
chainConfig, canon = overrideConfig(chainConfig, config.Overrides)
|
||||
}
|
||||
for i, tx := range block.Transactions() {
|
||||
// Prepare the transaction for un-traced execution
|
||||
@ -1006,3 +998,48 @@ func APIs(backend Backend) []rpc.API {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// overrideConfig returns a copy of original with forks enabled by override enabled,
|
||||
// along with a boolean that indicates whether the copy is canonical (equivalent to the original).
|
||||
// Note: the Clique-part is _not_ deep copied
|
||||
func overrideConfig(original *params.ChainConfig, override *params.ChainConfig) (*params.ChainConfig, bool) {
|
||||
copy := new(params.ChainConfig)
|
||||
*copy = *original
|
||||
canon := true
|
||||
|
||||
// Apply forks (after Berlin) to the copy.
|
||||
if block := override.BerlinBlock; block != nil {
|
||||
copy.BerlinBlock = block
|
||||
canon = false
|
||||
}
|
||||
if block := override.LondonBlock; block != nil {
|
||||
copy.LondonBlock = block
|
||||
canon = false
|
||||
}
|
||||
if block := override.ArrowGlacierBlock; block != nil {
|
||||
copy.ArrowGlacierBlock = block
|
||||
canon = false
|
||||
}
|
||||
if block := override.GrayGlacierBlock; block != nil {
|
||||
copy.GrayGlacierBlock = block
|
||||
canon = false
|
||||
}
|
||||
if block := override.MergeNetsplitBlock; block != nil {
|
||||
copy.MergeNetsplitBlock = block
|
||||
canon = false
|
||||
}
|
||||
if timestamp := override.ShanghaiTime; timestamp != nil {
|
||||
copy.ShanghaiTime = timestamp
|
||||
canon = false
|
||||
}
|
||||
if timestamp := override.CancunTime; timestamp != nil {
|
||||
copy.CancunTime = timestamp
|
||||
canon = false
|
||||
}
|
||||
if timestamp := override.PragueTime; timestamp != nil {
|
||||
copy.PragueTime = timestamp
|
||||
canon = false
|
||||
}
|
||||
|
||||
return copy, canon
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user