mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 21:34:33 +00:00
fixes callcode bug
This commit is contained in:
parent
d7bd55bd21
commit
8f9d1ae748
@ -127,10 +127,11 @@ proc applyMessage(computation: var BaseComputation, opCode: static[Op]) =
|
|||||||
push: 0
|
push: 0
|
||||||
return
|
return
|
||||||
|
|
||||||
newBalance = senderBalance - computation.msg.value
|
when opCode == Call:
|
||||||
computation.vmState.mutateStateDb:
|
newBalance = senderBalance - computation.msg.value
|
||||||
db.setBalance(computation.msg.sender, newBalance)
|
computation.vmState.mutateStateDb:
|
||||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
db.setBalance(computation.msg.sender, newBalance)
|
||||||
|
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||||
|
|
||||||
trace "Value transferred",
|
trace "Value transferred",
|
||||||
source = computation.msg.sender,
|
source = computation.msg.sender,
|
||||||
@ -151,7 +152,7 @@ proc applyMessage(computation: var BaseComputation, opCode: static[Op]) =
|
|||||||
else:
|
else:
|
||||||
# even though the value is zero, the account
|
# even though the value is zero, the account
|
||||||
# should be exist.
|
# should be exist.
|
||||||
when opCode in {Call, CallCode}:
|
when opCode == Call:
|
||||||
computation.vmState.mutateStateDb:
|
computation.vmState.mutateStateDb:
|
||||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ type
|
|||||||
c_currentMemSize*: Natural
|
c_currentMemSize*: Natural
|
||||||
c_memOffset*: Natural
|
c_memOffset*: Natural
|
||||||
c_memLength*: Natural
|
c_memLength*: Natural
|
||||||
|
c_opCode*: Op
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
@ -293,7 +294,7 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Cnew_account
|
# Cnew_account
|
||||||
if gasParams.c_isNewAccount:
|
if gasParams.c_isNewAccount and gasParams.c_opCode == Call:
|
||||||
if fork < FkSpurious:
|
if fork < FkSpurious:
|
||||||
# Pre-EIP161 all account creation calls consumed 25000 gas.
|
# Pre-EIP161 all account creation calls consumed 25000 gas.
|
||||||
result.gasCost += static(FeeSchedule[GasNewAccount])
|
result.gasCost += static(FeeSchedule[GasNewAccount])
|
||||||
|
@ -708,7 +708,8 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
|||||||
c_contractGas: gas.truncate(GasInt),
|
c_contractGas: gas.truncate(GasInt),
|
||||||
c_currentMemSize: computation.memory.len,
|
c_currentMemSize: computation.memory.len,
|
||||||
c_memOffset: memOffset,
|
c_memOffset: memOffset,
|
||||||
c_memLength: memLength
|
c_memLength: memLength,
|
||||||
|
c_opCode: opCode
|
||||||
))
|
))
|
||||||
|
|
||||||
trace "Call (" & callName.astToStr & ")", childGasLimit, childGasFee
|
trace "Call (" & callName.astToStr & ")", childGasLimit, childGasFee
|
||||||
|
Loading…
x
Reference in New Issue
Block a user