mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-05 00:36:45 +00:00
fixes generateChildComputation
This commit is contained in:
parent
5701c8bacb
commit
e38b1bf803
@ -216,17 +216,24 @@ proc applyCreateMessage(fork: Fork, computation: var BaseComputation, opCode: st
|
|||||||
proc generateChildComputation*(fork: Fork, computation: BaseComputation, childMsg: Message, opCode: static[Op]): BaseComputation =
|
proc generateChildComputation*(fork: Fork, computation: BaseComputation, childMsg: Message, opCode: static[Op]): BaseComputation =
|
||||||
var childComp = newBaseComputation(
|
var childComp = newBaseComputation(
|
||||||
computation.vmState,
|
computation.vmState,
|
||||||
computation.vmState.blockHeader.blockNumber,
|
computation.vmState.blockNumber,
|
||||||
childMsg,
|
childMsg,
|
||||||
some(fork))
|
some(fork))
|
||||||
|
|
||||||
# Copy the fork op code executor proc (assumes child computation is in the same fork)
|
# Copy the fork op code executor proc (assumes child computation is in the same fork)
|
||||||
childComp.opCodeExec = computation.opCodeExec
|
childComp.opCodeExec = computation.opCodeExec
|
||||||
|
|
||||||
if childMsg.isCreate:
|
try:
|
||||||
fork.applyCreateMessage(childComp, opCode)
|
if childMsg.isCreate:
|
||||||
else:
|
fork.applyCreateMessage(childComp, opCode)
|
||||||
applyMessage(childComp, opCode)
|
else:
|
||||||
|
applyMessage(childComp, opCode)
|
||||||
|
except VMError:
|
||||||
|
# weird Nim bug
|
||||||
|
type T = vm_types.Error
|
||||||
|
childComp.error = T(info: getCurrentExceptionMsg())
|
||||||
|
debug "applyMesage() failed", error = getCurrentExceptionMsg()
|
||||||
|
|
||||||
return childComp
|
return childComp
|
||||||
|
|
||||||
proc addChildComputation(fork: Fork, computation: BaseComputation, child: BaseComputation) =
|
proc addChildComputation(fork: Fork, computation: BaseComputation, child: BaseComputation) =
|
||||||
@ -249,7 +256,7 @@ proc getFork*(computation: BaseComputation): Fork =
|
|||||||
if computation.forkOverride.isSome:
|
if computation.forkOverride.isSome:
|
||||||
computation.forkOverride.get
|
computation.forkOverride.get
|
||||||
else:
|
else:
|
||||||
computation.vmState.blockHeader.blockNumber.toFork
|
computation.vmState.blockNumber.toFork
|
||||||
|
|
||||||
proc applyChildComputation*(computation: BaseComputation, childMsg: Message, opCode: static[Op]): BaseComputation =
|
proc applyChildComputation*(computation: BaseComputation, childMsg: Message, opCode: static[Op]): BaseComputation =
|
||||||
## Apply the vm message childMsg as a child computation.
|
## Apply the vm message childMsg as a child computation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user