diff --git a/prover/zkevm/full.go b/prover/zkevm/full.go index 5d8945a1e04..3782917f79d 100644 --- a/prover/zkevm/full.go +++ b/prover/zkevm/full.go @@ -414,6 +414,5 @@ func FullZKEVMWithSuite( } // Initialize the Full zkEVM arithmetization - fullZkEvm = NewZkEVM(settings) - return fullZkEvm + return NewZkEVM(settings) } diff --git a/prover/zkevm/zkevm_test.go b/prover/zkevm/zkevm_test.go index a21a50db50d..4a91cb69bd7 100644 --- a/prover/zkevm/zkevm_test.go +++ b/prover/zkevm/zkevm_test.go @@ -18,3 +18,23 @@ func TestCanGenerateFullZkEVM(t *testing.T) { _ = FullZkEvm(&cfg.TracesLimits, cfg) } + +// FullZKEVMWithSuite must not overwrite memoized globals. +func TestFullZKEVMWithSuiteNoGlobalOverwrite(t *testing.T) { + cfg, err := config.NewConfigFromFileUnchecked("../config/config-mainnet-limitless.toml") + if err != nil { + t.Fatal(err) + } + + sentinel := &ZkEvm{} + original := fullZkEvm + fullZkEvm = sentinel + + _ = FullZKEVMWithSuite(&cfg.TracesLimits, cfg, dummyCompilationSuite, nil) + + if fullZkEvm != sentinel { + t.Fatal("FullZKEVMWithSuite overwrote the fullZkEvm global") + } + + fullZkEvm = original +}