@@ -772,17 +772,9 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
772
772
// actual specified block, not any preceding blocks that we have to go through
773
773
// in order to obtain the state.
774
774
// Therefore, it's perfectly valid to specify `"futureForkBlock": 0`, to enable `futureFork`
775
-
776
775
if config != nil && config .Overrides != nil {
777
- // Copy the config, to not screw up the main config
778
- // Note: the Clique-part is _not_ deep copied
779
- chainConfigCopy := new (params.ChainConfig )
780
- * chainConfigCopy = * chainConfig
781
- chainConfig = chainConfigCopy
782
- if berlin := config .Config .Overrides .BerlinBlock ; berlin != nil {
783
- chainConfig .BerlinBlock = berlin
784
- canon = false
785
- }
776
+ // Note: This copies the config, to not screw up the main config
777
+ chainConfig , canon = overrideConfig (chainConfig , config .Overrides )
786
778
}
787
779
for i , tx := range block .Transactions () {
788
780
// Prepare the transaction for un-traced execution
@@ -1006,3 +998,48 @@ func APIs(backend Backend) []rpc.API {
1006
998
},
1007
999
}
1008
1000
}
1001
+
1002
+ // overrideConfig returns a copy of original with forks enabled by override enabled,
1003
+ // along with a boolean that indicates whether the copy is canonical (equivalent to the original).
1004
+ // Note: the Clique-part is _not_ deep copied
1005
+ func overrideConfig (original * params.ChainConfig , override * params.ChainConfig ) (* params.ChainConfig , bool ) {
1006
+ copy := new (params.ChainConfig )
1007
+ * copy = * original
1008
+ canon := true
1009
+
1010
+ // Apply forks (after Berlin) to the copy.
1011
+ if block := override .BerlinBlock ; block != nil {
1012
+ copy .BerlinBlock = block
1013
+ canon = false
1014
+ }
1015
+ if block := override .LondonBlock ; block != nil {
1016
+ copy .LondonBlock = block
1017
+ canon = false
1018
+ }
1019
+ if block := override .ArrowGlacierBlock ; block != nil {
1020
+ copy .ArrowGlacierBlock = block
1021
+ canon = false
1022
+ }
1023
+ if block := override .GrayGlacierBlock ; block != nil {
1024
+ copy .GrayGlacierBlock = block
1025
+ canon = false
1026
+ }
1027
+ if block := override .MergeNetsplitBlock ; block != nil {
1028
+ copy .MergeNetsplitBlock = block
1029
+ canon = false
1030
+ }
1031
+ if timestamp := override .ShanghaiTime ; timestamp != nil {
1032
+ copy .ShanghaiTime = timestamp
1033
+ canon = false
1034
+ }
1035
+ if timestamp := override .CancunTime ; timestamp != nil {
1036
+ copy .CancunTime = timestamp
1037
+ canon = false
1038
+ }
1039
+ if timestamp := override .PragueTime ; timestamp != nil {
1040
+ copy .PragueTime = timestamp
1041
+ canon = false
1042
+ }
1043
+
1044
+ return copy , canon
1045
+ }
0 commit comments