@@ -133,9 +133,6 @@ type EVM struct {
133133 // jumpDests stores results of JUMPDEST analysis.
134134 jumpDests JumpDestCache
135135
136- hasher crypto.KeccakState // Keccak256 hasher instance shared across opcodes
137- hasherBuf common.Hash // Keccak256 hasher result array shared across opcodes
138-
139136 readOnly bool // Whether to throw on stateful modifications
140137 returnData []byte // Last CALL's return data for subsequent reuse
141138}
@@ -152,7 +149,6 @@ func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainCon
152149 chainConfig : chainConfig ,
153150 chainRules : chainConfig .Rules (blockCtx .BlockNumber , blockCtx .Random != nil , blockCtx .Time , blockCtx .ArbOSVersion ),
154151 jumpDests : newMapJumpDests (),
155- hasher : crypto .NewKeccakState (),
156152 }
157153 evm .ProcessingHook = DefaultTxProcessor {evm : evm }
158154 evm .precompiles = activePrecompiledContracts (evm .chainRules )
@@ -703,7 +699,7 @@ func (evm *EVM) Create(caller common.Address, code []byte, gas uint64, value *ui
703699// The different between Create2 with Create is Create2 uses keccak256(0xff ++ msg.sender ++ salt ++ keccak256(init_code))[12:]
704700// instead of the usual sender-and-nonce-hash as the address where the contract is initialized at.
705701func (evm * EVM ) Create2 (caller common.Address , code []byte , gas uint64 , endowment * uint256.Int , salt * uint256.Int ) (ret []byte , contractAddr common.Address , leftOverGas uint64 , usedMultiGas multigas.MultiGas , err error ) {
706- inithash := crypto .HashData ( evm . hasher , code )
702+ inithash := crypto .Keccak256Hash ( code )
707703 contractAddr = crypto .CreateAddress2 (caller , salt .Bytes32 (), inithash [:])
708704 return evm .create (caller , code , gas , endowment , contractAddr , CREATE2 )
709705}
0 commit comments