mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-26 10:55:41 +00:00
fix block 81383 problem
This commit is contained in:
parent
345133e8eb
commit
0b9326f955
@ -208,8 +208,8 @@ proc applyCreateMessage(fork: Fork, computation: var BaseComputation, opCode: st
|
||||
raise newException(OutOfGas, &"Contract code size exceeds EIP170 limit of {EIP170_CODE_SIZE_LIMIT}. Got code of size: {contractCode.len}")
|
||||
|
||||
try:
|
||||
computation.gasMeter.consumeGas(
|
||||
computation.gasCosts[Create].m_handler(0, 0, contractCode.len),
|
||||
let gasCost = computation.gasCosts[Create].m_handler(0, 0, contractCode.len)
|
||||
computation.gasMeter.consumeGas(gasCost,
|
||||
reason = "Write contract code for CREATE")
|
||||
|
||||
let storageAddr = computation.msg.storageAddress
|
||||
|
@ -170,9 +170,10 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
|
||||
result += static(FeeSchedule[GasExpByte]) * (1 + log256(value))
|
||||
|
||||
func `prefix gasCreate`(currentMemSize, memOffset, memLength: Natural): GasInt {.nimcall.} =
|
||||
result =
|
||||
static(FeeSchedule[GasCreate]) +
|
||||
static(FeeSchedule[GasCodeDeposit]) * memLength
|
||||
if currentMemSize + memOffset + memLength == 0:
|
||||
result = static(FeeSchedule[GasCreate])
|
||||
else:
|
||||
result = static(FeeSchedule[GasCodeDeposit]) * memLength
|
||||
|
||||
func `prefix gasSha3`(currentMemSize, memOffset, memLength: Natural): GasInt {.nimcall.} =
|
||||
|
||||
|
@ -510,17 +510,14 @@ op create, inline = false, value, startPosition, size:
|
||||
# TODO: Forked create for Homestead
|
||||
|
||||
let (memPos, len) = (startPosition.cleanMemRef, size.cleanMemRef)
|
||||
let gasCost = computation.gasCosts[Create].m_handler(0, 0, 0)
|
||||
let reason = &"CREATE: GasCreate + {len} * memory expansion"
|
||||
|
||||
computation.gasMeter.consumeGas(
|
||||
computation.gasCosts[Create].m_handler(computation.memory.len, memPos, len),
|
||||
reason = &"CREATE: GasCreate + {len} * memory expansion"
|
||||
)
|
||||
|
||||
computation.gasMeter.consumeGas(gasCost, reason = reason)
|
||||
computation.memory.extend(memPos, len)
|
||||
|
||||
let senderBalance =
|
||||
computation.vmState.getStateDb(
|
||||
computation.vmState.blockHeader.rlphash).
|
||||
computation.vmState.readOnlyStateDb().
|
||||
getBalance(computation.msg.sender)
|
||||
|
||||
if senderBalance < value:
|
||||
@ -552,6 +549,7 @@ op create, inline = false, value, startPosition, size:
|
||||
let
|
||||
callData = computation.memory.read(memPos, len)
|
||||
createMsgGas = computation.getGasRemaining()
|
||||
|
||||
# Consume gas here that will be passed to child
|
||||
computation.gasMeter.consumeGas(createMsgGas, reason="CREATE")
|
||||
|
||||
@ -584,6 +582,7 @@ op create, inline = false, value, startPosition, size:
|
||||
options = MessageOptions(createAddress: contractAddress)
|
||||
)
|
||||
|
||||
childMsg.sender = computation.msg.storageAddress
|
||||
let childComputation = computation.applyChildComputation(childMsg, Create)
|
||||
|
||||
if childComputation.isError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user