From 98464ca46329e3b3a8190eb47def387f5540fd6a Mon Sep 17 00:00:00 2001 From: philip-morlier Date: Wed, 28 Feb 2024 20:37:17 -0800 Subject: [PATCH] Further changes to enable the shanghai fork as well as redefining the random opcode --- core/vm/interpreter.go | 9 ++++++++- params/config.go | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index f34c082eb..1c175baf6 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -60,6 +60,11 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter { table = &cancunInstructionSet case evm.chainRules.IsShanghai: table = &shanghaiInstructionSet + // begin PluGeth injection + if !evm.chainRules.IsMerge { + table[RANDOM] = frontierInstructionSet[DIFFICULTY] + } + // end PluGeth injection case evm.chainRules.IsMerge: table = &mergeInstructionSet case evm.chainRules.IsLondon: @@ -72,10 +77,12 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter { table = &constantinopleInstructionSet case evm.chainRules.IsByzantium: table = &byzantiumInstructionSet + // begin PluGeth injection case evm.chainRules.IsEIP160: - // end PluGeth injection table = &spuriousDragonInstructionSet + // end PluGeth injection + case evm.chainRules.IsEIP150: table = &tangerineWhistleInstructionSet case evm.chainRules.IsHomestead: diff --git a/params/config.go b/params/config.go index f31f4f98c..9c4958569 100644 --- a/params/config.go +++ b/params/config.go @@ -933,7 +933,11 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsBerlin: c.IsBerlin(num), IsLondon: c.IsLondon(num), IsMerge: isMerge, - IsShanghai: isMerge && c.IsShanghai(num, timestamp), + // IsShanghai: isMerge && c.IsShanghai(num, timestamp), + // the above is being commented and replaced with the plugeth code below to hotwire the chainrules to allow shanghai without the merge + // begin PluGeth injection + IsShanghai: c.IsShanghai(num, timestamp), + // end PluGeth injection IsCancun: isMerge && c.IsCancun(num, timestamp), IsPrague: isMerge && c.IsPrague(num, timestamp), IsVerkle: isMerge && c.IsVerkle(num, timestamp),