@@ -13,40 +13,48 @@ public class ConfigLoader {
1313 //only for unit test
1414 public static boolean disable = false ;
1515
16- public static void load (StoreFactory storeFactory ) {
16+ // isolate=true: a constant call bound to a non-HEAD (solidity/PBFT) snapshot installs its
17+ // snapshot into a thread-local view instead of the process-wide global, so it cannot pollute
18+ // the flags the block-processing path reads concurrently.
19+ public static void load (StoreFactory storeFactory , boolean isolate ) {
1720 if (!disable ) {
1821 DynamicPropertiesStore ds = storeFactory .getChainBaseManager ().getDynamicPropertiesStore ();
1922 VMConfig .setVmTrace (CommonParameter .getInstance ().isVmTrace ());
2023 if (ds != null ) {
2124 VMConfig .initVmHardFork (checkForEnergyLimit (ds ));
22- VMConfig .initAllowMultiSign (ds .getAllowMultiSign ());
23- VMConfig .initAllowTvmTransferTrc10 (ds .getAllowTvmTransferTrc10 ());
24- VMConfig .initAllowTvmConstantinople (ds .getAllowTvmConstantinople ());
25- VMConfig .initAllowTvmSolidity059 (ds .getAllowTvmSolidity059 ());
26- VMConfig .initAllowShieldedTRC20Transaction (ds .getAllowShieldedTRC20Transaction ());
27- VMConfig .initAllowTvmIstanbul (ds .getAllowTvmIstanbul ());
28- VMConfig .initAllowTvmFreeze (ds .getAllowTvmFreeze ());
29- VMConfig .initAllowTvmVote (ds .getAllowTvmVote ());
30- VMConfig .initAllowTvmLondon (ds .getAllowTvmLondon ());
31- VMConfig .initAllowTvmCompatibleEvm (ds .getAllowTvmCompatibleEvm ());
32- VMConfig .initAllowHigherLimitForMaxCpuTimeOfOneTx (
33- ds .getAllowHigherLimitForMaxCpuTimeOfOneTx ());
34- VMConfig .initAllowTvmFreezeV2 (ds .supportUnfreezeDelay () ? 1 : 0 );
35- VMConfig .initAllowOptimizedReturnValueOfChainId (
36- ds .getAllowOptimizedReturnValueOfChainId ());
37- VMConfig .initAllowDynamicEnergy (ds .getAllowDynamicEnergy ());
38- VMConfig .initDynamicEnergyThreshold (ds .getDynamicEnergyThreshold ());
39- VMConfig .initDynamicEnergyIncreaseFactor (ds .getDynamicEnergyIncreaseFactor ());
40- VMConfig .initDynamicEnergyMaxFactor (ds .getDynamicEnergyMaxFactor ());
41- VMConfig .initAllowTvmShangHai (ds .getAllowTvmShangHai ());
42- VMConfig .initAllowEnergyAdjustment (ds .getAllowEnergyAdjustment ());
43- VMConfig .initAllowStrictMath (ds .getAllowStrictMath ());
44- VMConfig .initAllowTvmCancun (ds .getAllowTvmCancun ());
45- VMConfig .initDisableJavaLangMath (ds .getConsensusLogicOptimization ());
46- VMConfig .initAllowTvmBlob (ds .getAllowTvmBlob ());
47- VMConfig .initAllowTvmSelfdestructRestriction (ds .getAllowTvmSelfdestructRestriction ());
48- VMConfig .initAllowTvmOsaka (ds .getAllowTvmOsaka ());
49- VMConfig .initAllowHardenResourceCalculation (ds .getAllowHardenResourceCalculation ());
25+ VMConfig .Snapshot snapshot = new VMConfig .Snapshot ();
26+ snapshot .allowMultiSign = ds .getAllowMultiSign () == 1 ;
27+ snapshot .allowTvmTransferTrc10 = ds .getAllowTvmTransferTrc10 () == 1 ;
28+ snapshot .allowTvmConstantinople = ds .getAllowTvmConstantinople () == 1 ;
29+ snapshot .allowTvmSolidity059 = ds .getAllowTvmSolidity059 () == 1 ;
30+ snapshot .allowShieldedTRC20Transaction = ds .getAllowShieldedTRC20Transaction () == 1 ;
31+ snapshot .allowTvmIstanbul = ds .getAllowTvmIstanbul () == 1 ;
32+ snapshot .allowTvmFreeze = ds .getAllowTvmFreeze () == 1 ;
33+ snapshot .allowTvmVote = ds .getAllowTvmVote () == 1 ;
34+ snapshot .allowTvmLondon = ds .getAllowTvmLondon () == 1 ;
35+ snapshot .allowTvmCompatibleEvm = ds .getAllowTvmCompatibleEvm () == 1 ;
36+ snapshot .allowHigherLimitForMaxCpuTimeOfOneTx =
37+ ds .getAllowHigherLimitForMaxCpuTimeOfOneTx () == 1 ;
38+ snapshot .allowTvmFreezeV2 = ds .supportUnfreezeDelay ();
39+ snapshot .allowOptimizedReturnValueOfChainId = ds .getAllowOptimizedReturnValueOfChainId () == 1 ;
40+ snapshot .allowDynamicEnergy = ds .getAllowDynamicEnergy () == 1 ;
41+ snapshot .dynamicEnergyThreshold = ds .getDynamicEnergyThreshold ();
42+ snapshot .dynamicEnergyIncreaseFactor = ds .getDynamicEnergyIncreaseFactor ();
43+ snapshot .dynamicEnergyMaxFactor = ds .getDynamicEnergyMaxFactor ();
44+ snapshot .allowTvmShanghai = ds .getAllowTvmShangHai () == 1 ;
45+ snapshot .allowEnergyAdjustment = ds .getAllowEnergyAdjustment () == 1 ;
46+ snapshot .allowStrictMath = ds .getAllowStrictMath () == 1 ;
47+ snapshot .allowTvmCancun = ds .getAllowTvmCancun () == 1 ;
48+ snapshot .disableJavaLangMath = ds .getConsensusLogicOptimization () == 1 ;
49+ snapshot .allowTvmBlob = ds .getAllowTvmBlob () == 1 ;
50+ snapshot .allowTvmSelfdestructRestriction = ds .getAllowTvmSelfdestructRestriction () == 1 ;
51+ snapshot .allowTvmOsaka = ds .getAllowTvmOsaka () == 1 ;
52+ snapshot .allowHardenResourceCalculation = ds .getAllowHardenResourceCalculation () == 1 ;
53+ if (isolate ) {
54+ VMConfig .setLocalSnapshot (snapshot );
55+ } else {
56+ VMConfig .setGlobalSnapshot (snapshot );
57+ }
5058 }
5159 }
5260 }
0 commit comments