mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 05:44:40 +00:00
d8a1adacaa
* Part of EIP-4895: add withdrawals processing to block processing.
* Refactoring: extracted the engine API handler bodies into procs.
Intending to implement the V2 versions next. (I need the bodies to be
in separate procs so that multiple versions can use them.)
* Working on Engine API changes for Shanghai.
* Updated nim-web3, resolved ambiguity in Hash256 type.
* Updated nim-eth3 to point to master, now that I've merged that.
* I'm confused about what's going on with engine_client.
But let's try resolving this Hash256 ambiguity.
* Still trying to fix this conflict with the Hash256 types.
* Does this work now that nimbus-eth2 has been updated?
* Corrected blockValue in getPayload responses back to UInt256.
c834f67a37
* Working on getting the withdrawals-related tests to pass.
* Fixing more of those Hash256 ambiguities.
(I'm not sure why the nim-web3 library introduced a conflicting type
named Hash256, but right now I just want to get this code to compile again.)
* Bumped a couple of libraries to fix some error messages.
* Needed to get "make fluffy-tools" to pass, too.
* Getting "make nimbus_verified_proxy" to build.
55 lines
1.7 KiB
Nim
55 lines
1.7 KiB
Nim
# Nimbus
|
|
# Copyright (c) 2022 Status Research & Development GmbH
|
|
# Licensed under either of
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
# at your option.
|
|
# This file may not be copied, modified, or distributed except according to
|
|
# those terms.
|
|
import
|
|
eth/common
|
|
|
|
type
|
|
CasperRef* = ref object
|
|
feeRecipient* : EthAddress
|
|
timestamp* : EthTime
|
|
prevRandao* : Hash256
|
|
|
|
proc prepare*(ctx: CasperRef, header: var BlockHeader) =
|
|
header.coinbase = ctx.feeRecipient
|
|
header.timestamp = ctx.timestamp
|
|
header.prevRandao = ctx.prevRandao
|
|
header.difficulty = DifficultyInt.zero
|
|
|
|
proc prepareForSeal*(ctx: CasperRef, header: var BlockHeader) =
|
|
header.nonce = default(BlockNonce)
|
|
header.extraData = @[] # TODO: probably this should be configurable by user?
|
|
# this repetition, assigning prevRandao is because how txpool works
|
|
header.prevRandao = ctx.prevRandao
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Getters
|
|
# ------------------------------------------------------------------------------
|
|
|
|
func feeRecipient*(ctx: CasperRef): EthAddress =
|
|
ctx.feeRecipient
|
|
|
|
func timestamp*(ctx: CasperRef): EthTime =
|
|
ctx.timestamp
|
|
|
|
func prevRandao*(ctx: CasperRef): Hash256 =
|
|
ctx.prevRandao
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Setters
|
|
# ------------------------------------------------------------------------------
|
|
|
|
proc `feeRecipient=`*(ctx: CasperRef, val: EthAddress) =
|
|
ctx.feeRecipient = val
|
|
|
|
proc `timestamp=`*(ctx: CasperRef, val: EthTime) =
|
|
ctx.timestamp = val
|
|
|
|
proc `prevRandao=`*(ctx: CasperRef, val: Hash256) =
|
|
ctx.prevRandao = val
|