mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 21:34:33 +00:00
fix NUMBER opcode regression
This commit is contained in:
parent
fdc9a15785
commit
d8db3d74d0
@ -140,6 +140,17 @@ proc makeReceipt(vmState: BaseVMState, cumulativeGasUsed: GasInt, fork = FkFront
|
|||||||
result.logs = vmState.getAndClearLogEntries()
|
result.logs = vmState.getAndClearLogEntries()
|
||||||
result.bloom = logsBloom(result.logs).value.toByteArrayBE
|
result.bloom = logsBloom(result.logs).value.toByteArrayBE
|
||||||
|
|
||||||
|
proc prepareVMState(vmState: BaseVMState, header: BlockHeader) =
|
||||||
|
# TODO: move this proc to somewhere else if it already complete
|
||||||
|
|
||||||
|
# blockNumber returned from VM should be current block number
|
||||||
|
# and not something else
|
||||||
|
vmState.blockHeader.blockNumber = header.blockNumber
|
||||||
|
|
||||||
|
# time stamp?
|
||||||
|
# gas limit?
|
||||||
|
# etc?
|
||||||
|
|
||||||
proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockBody, vmState: BaseVMState): ValidationResult =
|
proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockBody, vmState: BaseVMState): ValidationResult =
|
||||||
let blockReward = 5.u256 * pow(10.u256, 18) # 5 ETH
|
let blockReward = 5.u256 * pow(10.u256, 18) # 5 ETH
|
||||||
|
|
||||||
@ -147,6 +158,8 @@ proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockB
|
|||||||
debug "Mismatched txRoot", blockNumber=header.blockNumber
|
debug "Mismatched txRoot", blockNumber=header.blockNumber
|
||||||
return ValidationResult.Error
|
return ValidationResult.Error
|
||||||
|
|
||||||
|
prepareVMState(vmState, header)
|
||||||
|
|
||||||
var stateDb = vmState.accountDb
|
var stateDb = vmState.accountDb
|
||||||
if header.txRoot != BLANK_ROOT_HASH:
|
if header.txRoot != BLANK_ROOT_HASH:
|
||||||
if body.transactions.len == 0:
|
if body.transactions.len == 0:
|
||||||
|
@ -51,7 +51,7 @@ method timestamp*(vmState: BaseVMState): EthTime {.base, gcsafe.} =
|
|||||||
method blockNumber*(vmState: BaseVMState): BlockNumber {.base, gcsafe.} =
|
method blockNumber*(vmState: BaseVMState): BlockNumber {.base, gcsafe.} =
|
||||||
# it should return current block number
|
# it should return current block number
|
||||||
# and not head.blockNumber
|
# and not head.blockNumber
|
||||||
vmState.blockHeader.blockNumber + 1
|
vmState.blockHeader.blockNumber
|
||||||
|
|
||||||
method difficulty*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
|
method difficulty*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
|
||||||
vmState.blockHeader.difficulty
|
vmState.blockHeader.difficulty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user