From 4ada314fff1c688127b7d818b4edfadcc47f33d5 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 10 Jan 2023 08:22:43 -0500 Subject: [PATCH] tests: fix DIFFICULTY error in state executor (#26465) --- tests/state_test_util.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 67605a1273..b2e87fb004 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -249,16 +249,13 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh context.GetHash = vmTestBlockHash context.BaseFee = baseFee context.Random = nil - if config.IsLondon(new(big.Int)) { - if t.json.Env.Random != nil { - rnd := common.BigToHash(t.json.Env.Random) - context.Random = &rnd - } + if t.json.Env.Difficulty != nil { + context.Difficulty = new(big.Int).Set(t.json.Env.Difficulty) + } + if config.IsLondon(new(big.Int)) && t.json.Env.Random != nil { + rnd := common.BigToHash(t.json.Env.Random) + context.Random = &rnd context.Difficulty = big.NewInt(0) - } else { - if t.json.Env.Difficulty != nil { - context.Difficulty = new(big.Int).Set(t.json.Env.Difficulty) - } } evm := vm.NewEVM(context, txContext, statedb, config, vmconfig) // Execute the message.