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
|
||||
return
|
||||
|
||||
newBalance = senderBalance - computation.msg.value
|
||||
computation.vmState.mutateStateDb:
|
||||
db.setBalance(computation.msg.sender, newBalance)
|
||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||
when opCode == Call:
|
||||
newBalance = senderBalance - computation.msg.value
|
||||
computation.vmState.mutateStateDb:
|
||||
db.setBalance(computation.msg.sender, newBalance)
|
||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||
|
||||
trace "Value transferred",
|
||||
source = computation.msg.sender,
|
||||
@ -151,7 +152,7 @@ proc applyMessage(computation: var BaseComputation, opCode: static[Op]) =
|
||||
else:
|
||||
# even though the value is zero, the account
|
||||
# should be exist.
|
||||
when opCode in {Call, CallCode}:
|
||||
when opCode == Call:
|
||||
computation.vmState.mutateStateDb:
|
||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||
|
||||
|
@ -71,6 +71,7 @@ type
|
||||
c_currentMemSize*: Natural
|
||||
c_memOffset*: Natural
|
||||
c_memLength*: Natural
|
||||
c_opCode*: Op
|
||||
else:
|
||||
discard
|
||||
|
||||
@ -293,7 +294,7 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
|
||||
)
|
||||
|
||||
# Cnew_account
|
||||
if gasParams.c_isNewAccount:
|
||||
if gasParams.c_isNewAccount and gasParams.c_opCode == Call:
|
||||
if fork < FkSpurious:
|
||||
# Pre-EIP161 all account creation calls consumed 25000 gas.
|
||||
result.gasCost += static(FeeSchedule[GasNewAccount])
|
||||
|
@ -708,7 +708,8 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
||||
c_contractGas: gas.truncate(GasInt),
|
||||
c_currentMemSize: computation.memory.len,
|
||||
c_memOffset: memOffset,
|
||||
c_memLength: memLength
|
||||
c_memLength: memLength,
|
||||
c_opCode: opCode
|
||||
))
|
||||
|
||||
trace "Call (" & callName.astToStr & ")", childGasLimit, childGasFee
|
||||
|
Loading…
x
Reference in New Issue
Block a user