fill some capella/EIP4844 missing implementations (#4585)

This commit is contained in:
tersec 2023-02-02 23:24:06 +01:00 committed by GitHub
parent eb56762d41
commit 956aee2d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 13 deletions

View File

@ -392,14 +392,10 @@ iterator getBlockIds*(
# `case` ensures we're on a fork for which the `PartialBeaconState`
# definition is consistent
case db.cfg.stateForkAtEpoch(slot.epoch)
of ConsensusFork.Phase0, ConsensusFork.Altair, ConsensusFork.Bellatrix:
of ConsensusFork.Phase0 .. ConsensusFork.EIP4844:
let stateSlot = (slot.era() + 1).start_slot()
if not getPartialState(db, historical_roots, stateSlot, state[]):
state = nil # No `return` in iterators
of ConsensusFork.Capella:
debugRaiseAssert $capellaImplementationMissing & ": era_db.nim: getBlockIds"
of ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": era_db.nim: getBlockIds"
if state == nil:
break

View File

@ -56,7 +56,7 @@ type
message*: BLSToExecutionChange
signature*: ValidatorSig
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#historicalsummary
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#historicalsummary
HistoricalSummary* = object
# `HistoricalSummary` matches the components of the phase0
# `HistoricalBatch` making the two hash_tree_root-compatible.
@ -83,7 +83,7 @@ type
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD] # [New in Capella]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#executionpayloadheader
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#executionpayloadheader
ExecutionPayloadHeader* = object
parent_hash*: Eth2Digest
fee_recipient*: ExecutionAddress

View File

@ -268,7 +268,8 @@ proc collectEpochRewardsAndPenalties*(
proc collectEpochRewardsAndPenalties*(
rewardsAndPenalties: var seq[RewardsAndPenalties],
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState),
state: var (altair.BeaconState | bellatrix.BeaconState |
capella.BeaconState | eip4844.BeaconState),
cache: var StateCache, cfg: RuntimeConfig, flags: UpdateFlags) =
if get_current_epoch(state) == GENESIS_EPOCH:
return

View File

@ -1035,11 +1035,8 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) =
if nextSlot.is_epoch:
withState(tmpState[]):
var stateData = newClone(forkyState.data)
when stateFork == ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": ncli_db.nim:cmdValidatorDb"
else:
rewardsAndPenalties.collectEpochRewardsAndPenalties(
stateData[], cache, cfg, flags)
rewardsAndPenalties.collectEpochRewardsAndPenalties(
stateData[], cache, cfg, flags)
let res = process_slots(cfg, tmpState[], nextSlot, cache, forkedInfo, flags)
doAssert res.isOk, "Slot processing can't fail with correct inputs"