Create Op now generates contract addresses & checks for collisions
This commit is contained in:
parent
7ed2403c5c
commit
a7c1168b3a
|
@ -546,13 +546,16 @@ op create, inline = false, value, startPosition, size:
|
||||||
|
|
||||||
## TODO dynamic gas that depends on remaining gas
|
## TODO dynamic gas that depends on remaining gas
|
||||||
|
|
||||||
##### getNonce type error: expression 'db' is of type: proc (vmState: untyped, readOnly: untyped, handler: untyped): untyped{.noSideEffect, gcsafe, locks: <unknown>.}
|
var
|
||||||
# computation.vmState.db(readOnly=true):
|
contractAddress: EthAddress
|
||||||
# let creationNonce = db.getNonce(computation.msg.storageAddress)
|
isCollision: bool
|
||||||
# db.incrementNonce(computation.msg.storageAddress)
|
|
||||||
let contractAddress = ZERO_ADDRESS # generateContractAddress(computation.msg.storageAddress, creationNonce)
|
|
||||||
|
|
||||||
let isCollision = false # TODO: db.accountHasCodeOrNonce ...
|
computation.vmState.mutateStateDB:
|
||||||
|
let creationNonce = db.getNonce(computation.msg.storageAddress)
|
||||||
|
db.setNonce(computation.msg.storageAddress, creationNonce + 1)
|
||||||
|
|
||||||
|
contractAddress = generateAddress(computation.msg.storageAddress, creationNonce)
|
||||||
|
isCollision = db.hasCodeOrNonce(contractAddress)
|
||||||
|
|
||||||
if isCollision:
|
if isCollision:
|
||||||
debug("Address collision while creating contract", address = contractAddress.toHex)
|
debug("Address collision while creating contract", address = contractAddress.toHex)
|
||||||
|
|
Loading…
Reference in New Issue