attempt to fix ci
This commit is contained in:
parent
231e56d59b
commit
490d8964aa
|
@ -344,7 +344,7 @@ type
|
|||
template OnBlockAddedCallback*(kind: static ConsensusFork): auto =
|
||||
when kind == ConsensusFork.Fulu:
|
||||
typedesc[OnFuluBlockAdded]
|
||||
when kind == ConsensusFork.Electra:
|
||||
elif kind == ConsensusFork.Electra:
|
||||
typedesc[OnElectraBlockAdded]
|
||||
elif kind == ConsensusFork.Deneb:
|
||||
typedesc[OnDenebBlockAdded]
|
||||
|
|
|
@ -248,6 +248,8 @@ proc installApiHandlers*(node: SigningNodeRef) =
|
|||
(GeneralizedIndex(801), request.beaconBlockHeader.data)
|
||||
of ConsensusFork.Electra:
|
||||
(GeneralizedIndex(801), request.beaconBlockHeader.data)
|
||||
of ConsensusFork.Fulu:
|
||||
(GeneralizedIndex(801), request.beaconBlockHeader.data)
|
||||
|
||||
if request.proofs.isNone() or len(request.proofs.get()) == 0:
|
||||
return errorResponse(Http400, MissingMerkleProofError)
|
||||
|
|
|
@ -168,6 +168,9 @@ func noRollback*(state: var deneb.HashedBeaconState) =
|
|||
func noRollback*(state: var electra.HashedBeaconState) =
|
||||
trace "Skipping rollback of broken Electra state"
|
||||
|
||||
func noRollback*(state: var fulu.HashedBeaconState) =
|
||||
trace "Skipping rollback of broken Fulu state"
|
||||
|
||||
func maybeUpgradeStateToAltair(
|
||||
cfg: RuntimeConfig, state: var ForkedHashedBeaconState) =
|
||||
# Both process_slots() and state_transition_block() call this, so only run it
|
||||
|
|
|
@ -144,6 +144,50 @@ proc makeSimulationBlock(
|
|||
|
||||
ok(blck)
|
||||
|
||||
proc makeSimulationBlock(
|
||||
cfg: RuntimeConfig,
|
||||
state: var fulu.HashedBeaconState,
|
||||
proposer_index: ValidatorIndex,
|
||||
randao_reveal: ValidatorSig,
|
||||
eth1_data: Eth1Data,
|
||||
graffiti: GraffitiBytes,
|
||||
attestations: seq[electra.Attestation],
|
||||
deposits: seq[Deposit],
|
||||
exits: BeaconBlockValidatorChanges,
|
||||
sync_aggregate: SyncAggregate,
|
||||
execution_payload: fulu.ExecutionPayloadForSigning,
|
||||
bls_to_execution_changes: SignedBLSToExecutionChangeList,
|
||||
rollback: RollbackHashedProc[fulu.HashedBeaconState],
|
||||
cache: var StateCache,
|
||||
# TODO:
|
||||
# `verificationFlags` is needed only in tests and can be
|
||||
# removed if we don't use invalid signatures there
|
||||
verificationFlags: UpdateFlags = {}): Result[fulu.BeaconBlock, cstring] =
|
||||
## Create a block for the given state. The latest block applied to it will
|
||||
## be used for the parent_root value, and the slot will be take from
|
||||
## state.slot meaning process_slots must be called up to the slot for which
|
||||
## the block is to be created.
|
||||
|
||||
# To create a block, we'll first apply a partial block to the state, skipping
|
||||
# some validations.
|
||||
|
||||
var blck = partialBeaconBlock(
|
||||
cfg, state, proposer_index, randao_reveal, eth1_data, graffiti,
|
||||
attestations, deposits, exits, sync_aggregate, execution_payload,
|
||||
default(ExecutionRequests))
|
||||
|
||||
let res = process_block(
|
||||
cfg, state.data, blck.asSigVerified(), verificationFlags, cache)
|
||||
|
||||
if res.isErr:
|
||||
rollback(state)
|
||||
return err(res.error())
|
||||
|
||||
state.root = hash_tree_root(state.data)
|
||||
blck.state_root = state.root
|
||||
|
||||
ok(blck)
|
||||
|
||||
# TODO confutils is an impenetrable black box. how can a help text be added here?
|
||||
cli do(slots = SLOTS_PER_EPOCH * 7,
|
||||
validators = SLOTS_PER_EPOCH * 500,
|
||||
|
@ -369,6 +413,8 @@ cli do(slots = SLOTS_PER_EPOCH * 7,
|
|||
addr state.denebData
|
||||
elif T is electra.SignedBeaconBlock:
|
||||
addr state.electraData
|
||||
elif T is fulu.SignedBeaconBlock:
|
||||
addr state.fuluData
|
||||
else:
|
||||
static: doAssert false
|
||||
message = makeSimulationBlock(
|
||||
|
@ -383,6 +429,8 @@ cli do(slots = SLOTS_PER_EPOCH * 7,
|
|||
default(GraffitiBytes),
|
||||
when T is electra.SignedBeaconBlock:
|
||||
attPool.getElectraAttestationsForBlock(state, cache)
|
||||
elif T is fulu.SignedBeaconBlock:
|
||||
attPool.getElectraAttestationsForBlock(state, cache)
|
||||
else:
|
||||
attPool.getAttestationsForBlock(state, cache),
|
||||
eth1ProposalData.deposits,
|
||||
|
@ -390,6 +438,8 @@ cli do(slots = SLOTS_PER_EPOCH * 7,
|
|||
sync_aggregate,
|
||||
(when T is electra.SignedBeaconBlock:
|
||||
default(electra.ExecutionPayloadForSigning)
|
||||
elif T is fulu.SignedBeaconBlock:
|
||||
default(fulu.ExecutionPayloadForSigning)
|
||||
elif T is deneb.SignedBeaconBlock:
|
||||
default(deneb.ExecutionPayloadForSigning)
|
||||
else:
|
||||
|
@ -461,6 +511,28 @@ cli do(slots = SLOTS_PER_EPOCH * 7,
|
|||
do:
|
||||
raiseAssert "withUpdatedState failed"
|
||||
|
||||
proc proposeFuluBlock(slot: Slot) =
|
||||
if rand(r, 1.0) > blockRatio:
|
||||
return
|
||||
|
||||
dag.withUpdatedState(tmpState[], dag.getBlockIdAtSlot(slot).expect("block")) do:
|
||||
let
|
||||
newBlock = getNewBlock[fulu.SignedBeaconBlock](updatedState, slot, cache)
|
||||
added = dag.addHeadBlock(verifier, newBlock) do (
|
||||
blckRef: BlockRef, signedBlock: fulu.TrustedSignedBeaconBlock,
|
||||
epochRef: EpochRef, unrealized: FinalityCheckpoints):
|
||||
# Callback add to fork choice if valid
|
||||
attPool.addForkChoice(
|
||||
epochRef, blckRef, unrealized, signedBlock.message,
|
||||
blckRef.slot.start_beacon_time)
|
||||
|
||||
dag.updateHead(added[], quarantine[], [])
|
||||
if dag.needStateCachesAndForkChoicePruning():
|
||||
dag.pruneStateCachesDAG()
|
||||
attPool.prune()
|
||||
do:
|
||||
raiseAssert "withUpdatedState failed"
|
||||
|
||||
var
|
||||
lastEth1BlockAt = genesisTime
|
||||
eth1BlockNum = 1000
|
||||
|
@ -501,6 +573,7 @@ cli do(slots = SLOTS_PER_EPOCH * 7,
|
|||
if blockRatio > 0.0:
|
||||
withTimer(timers[t]):
|
||||
case dag.cfg.consensusForkAtEpoch(slot.epoch)
|
||||
of ConsensusFork.Fulu: proposeFuluBlock(slot)
|
||||
of ConsensusFork.Electra: proposeElectraBlock(slot)
|
||||
of ConsensusFork.Deneb: proposeDenebBlock(slot)
|
||||
of ConsensusFork.Phase0 .. ConsensusFork.Capella:
|
||||
|
|
|
@ -19,7 +19,7 @@ import
|
|||
../../../beacon_chain/spec/datatypes/[
|
||||
altair,
|
||||
deneb,
|
||||
eip7594],
|
||||
fulu],
|
||||
# Status libraries
|
||||
snappy,
|
||||
# Test utilities
|
||||
|
|
|
@ -47,6 +47,13 @@ func readValue*(r: var JsonReader, a: var seq[byte]) =
|
|||
func genesisTestRuntimeConfig*(consensusFork: ConsensusFork): RuntimeConfig =
|
||||
var res = defaultRuntimeConfig
|
||||
case consensusFork
|
||||
of ConsensusFork.Fulu:
|
||||
res.FULU_FORK_EPOCH = GENESIS_EPOCH
|
||||
res.ELECTRA_FORK_EPOCH = GENESIS_EPOCH
|
||||
res.DENEB_FORK_EPOCH = GENESIS_EPOCH
|
||||
res.CAPELLA_FORK_EPOCH = GENESIS_EPOCH
|
||||
res.BELLATRIX_FORK_EPOCH = GENESIS_EPOCH
|
||||
res.ALTAIR_FORK_EPOCH = GENESIS_EPOCH
|
||||
of ConsensusFork.Electra:
|
||||
res.ELECTRA_FORK_EPOCH = GENESIS_EPOCH
|
||||
res.DENEB_FORK_EPOCH = GENESIS_EPOCH
|
||||
|
|
|
@ -15,7 +15,7 @@ import
|
|||
kzg4844/[kzg_abi, kzg],
|
||||
./consensus_spec/[os_ops, fixtures_utils],
|
||||
../beacon_chain/spec/[helpers, eip7594_helpers],
|
||||
../beacon_chain/spec/datatypes/[eip7594, deneb]
|
||||
../beacon_chain/spec/datatypes/[fulu, deneb]
|
||||
|
||||
from std/strutils import rsplit
|
||||
|
||||
|
|
|
@ -217,8 +217,9 @@ proc addTestBlock*(
|
|||
deposit_count: forkyState.data.eth1_deposit_index + deposits.lenu64,
|
||||
block_hash: eth1_data.block_hash),
|
||||
graffiti,
|
||||
when consensusFork == ConsensusFork.Electra or
|
||||
consensusFork == ConsensusFork.Fulu:
|
||||
when consensusFork == ConsensusFork.Electra:
|
||||
electraAttestations
|
||||
elif consensusFork == ConsensusFork.Fulu:
|
||||
electraAttestations
|
||||
else:
|
||||
attestations,
|
||||
|
|
|
@ -79,7 +79,7 @@ proc getTestStates*(
|
|||
info = ForkedEpochInfo()
|
||||
cfg = defaultRuntimeConfig
|
||||
|
||||
static: doAssert high(ConsensusFork) == ConsensusFork.Electra
|
||||
static: doAssert high(ConsensusFork) == ConsensusFork.Fulu
|
||||
if consensusFork >= ConsensusFork.Altair:
|
||||
cfg.ALTAIR_FORK_EPOCH = 1.Epoch
|
||||
if consensusFork >= ConsensusFork.Bellatrix:
|
||||
|
@ -90,6 +90,8 @@ proc getTestStates*(
|
|||
cfg.DENEB_FORK_EPOCH = 4.Epoch
|
||||
if consensusFork >= ConsensusFork.Electra:
|
||||
cfg.ELECTRA_FORK_EPOCH = 5.Epoch
|
||||
if consensusFork >= ConsensusFork.Fulu:
|
||||
cfg.ELECTRA_FORK_EPOCH = 6.Epoch
|
||||
|
||||
for i, epoch in stateEpochs:
|
||||
let slot = epoch.Epoch.start_slot
|
||||
|
@ -109,7 +111,8 @@ from std/sequtils import allIt
|
|||
from ".."/beacon_chain/spec/beaconstate import get_expected_withdrawals
|
||||
|
||||
proc checkPerValidatorBalanceCalc*(
|
||||
state: deneb.BeaconState | electra.BeaconState): bool =
|
||||
state: deneb.BeaconState | electra.BeaconState |
|
||||
fulu.BeaconState): bool =
|
||||
var
|
||||
info: altair.EpochInfo
|
||||
cache: StateCache
|
||||
|
|
Loading…
Reference in New Issue