diff --git a/nimbus/vm2/computation.nim b/nimbus/vm2/computation.nim index 302de4637..c6a5aa371 100644 --- a/nimbus/vm2/computation.nim +++ b/nimbus/vm2/computation.nim @@ -35,7 +35,7 @@ when defined(chronicles_log_level): # Helpers # ------------------------------------------------------------------------------ -proc generateContractAddress(c: Computation, salt: Uint256): EthAddress = +proc generateContractAddress(c: Computation, salt: ContractSalt): EthAddress = if c.msg.kind == evmcCreate: let creationNonce = c.vmState.readOnlyStateDb().getNonce(c.msg.sender) result = generateAddress(c.msg.sender, creationNonce) @@ -105,8 +105,8 @@ template selfDestruct*(c: Computation, address: EthAddress) = template getCode*(c: Computation, address: EthAddress): seq[byte] = c.vmState.readOnlyStateDB.getCode(address) -proc newComputation*(vmState: BaseVMState, - message: Message, salt= 0.u256): Computation = +proc newComputation*(vmState: BaseVMState, message: Message, + salt: ContractSalt = ZERO_CONTRACTSALT): Computation = new result result.vmState = vmState result.msg = message diff --git a/nimbus/vm2/interpreter/op_handlers/oph_create.nim b/nimbus/vm2/interpreter/op_handlers/oph_create.nim index 45593f773..4e76c623a 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_create.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_create.nim @@ -16,6 +16,7 @@ import ../../../constants, ../../../errors, ../../../forks, + ../../../utils, ../../computation, ../../memory, ../../stack, @@ -37,7 +38,8 @@ import # Private helpers # ------------------------------------------------------------------------------ -proc execSubCreate(k: var Vm2Ctx; childMsg: Message; salt = 0.u256) = +proc execSubCreate(k: var Vm2Ctx; childMsg: Message; + salt: ContractSalt = ZERO_CONTRACTSALT) = ## Create new VM -- helper for `Create`-like operations # need to provide explicit and for capturing in chainTo proc() @@ -123,7 +125,7 @@ const endowment = k.cpt.stack.popInt() memPos = k.cpt.stack.popInt().safeInt memLen = k.cpt.stack.popInt().safeInt - salt = k.cpt.stack.peekInt() + salt = ContractSalt(bytes: k.cpt.stack.peekInt().toBytesBE) k.cpt.stack.top(0)