mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-16 16:38:07 +00:00
remove some debugRaiseAsserts and fill in Electra functionality (#6177)
This commit is contained in:
parent
86a265308a
commit
06894dd2f6
@ -77,10 +77,7 @@ proc initLightClient*(
|
||||
|
||||
case node.dag.cfg.consensusForkAtEpoch(
|
||||
forkyBlck.message.slot.epoch)
|
||||
of ConsensusFork.Electra:
|
||||
debugRaiseAssert ""
|
||||
discard
|
||||
of ConsensusFork.Deneb:
|
||||
of ConsensusFork.Deneb, ConsensusFork.Electra:
|
||||
callForkchoiceUpdated(PayloadAttributesV3)
|
||||
of ConsensusFork.Capella:
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#specification-1
|
||||
|
@ -152,6 +152,7 @@ type
|
||||
description*: Option[string]
|
||||
capellaIndex*: Option[GeneralizedIndex]
|
||||
denebIndex*: Option[GeneralizedIndex]
|
||||
electraIndex*: Option[GeneralizedIndex]
|
||||
|
||||
KeystoreData* = object
|
||||
version*: uint64
|
||||
@ -728,14 +729,14 @@ func parseProvenBlockProperty*(propertyPath: string): Result[ProvenProperty, str
|
||||
ok ProvenProperty(
|
||||
path: propertyPath,
|
||||
capellaIndex: some GeneralizedIndex(401),
|
||||
denebIndex: some GeneralizedIndex(801))
|
||||
denebIndex: some GeneralizedIndex(801),
|
||||
electraIndex: some GeneralizedIndex(801))
|
||||
elif propertyPath == ".graffiti":
|
||||
ok ProvenProperty(
|
||||
path: propertyPath,
|
||||
# TODO: graffiti is present since genesis, so the correct index in the early
|
||||
# forks can be supplied here
|
||||
capellaIndex: some GeneralizedIndex(18),
|
||||
denebIndex: some GeneralizedIndex(18))
|
||||
denebIndex: some GeneralizedIndex(18),
|
||||
electraIndex: some GeneralizedIndex(18))
|
||||
else:
|
||||
err("Keystores with proven properties different than " &
|
||||
"`.execution_payload.fee_recipient` and `.graffiti` " &
|
||||
@ -844,11 +845,11 @@ proc readValue*(reader: var JsonReader, value: var RemoteKeystore)
|
||||
if prop.path == ".execution_payload.fee_recipient":
|
||||
prop.capellaIndex = some GeneralizedIndex(401)
|
||||
prop.denebIndex = some GeneralizedIndex(801)
|
||||
prop.electraIndex = some GeneralizedIndex(801)
|
||||
elif prop.path == ".graffiti":
|
||||
# TODO: graffiti is present since genesis, so the correct index in the early
|
||||
# forks can be supplied here
|
||||
prop.capellaIndex = some GeneralizedIndex(18)
|
||||
prop.denebIndex = some GeneralizedIndex(18)
|
||||
prop.electraIndex = some GeneralizedIndex(801)
|
||||
else:
|
||||
reader.raiseUnexpectedValue("Keystores with proven properties different than " &
|
||||
"`.execution_payload.fee_recipient` and `.graffiti` " &
|
||||
|
@ -508,7 +508,8 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||
type SomeBlockBody =
|
||||
capella.BeaconBlockBody |
|
||||
deneb.BeaconBlockBody |
|
||||
deneb_mev.BlindedBeaconBlockBody
|
||||
deneb_mev.BlindedBeaconBlockBody |
|
||||
electra.BeaconBlockBody
|
||||
|
||||
template blockPropertiesProofs(blockBody: SomeBlockBody,
|
||||
forkIndexField: untyped): seq[Web3SignerMerkleProof] =
|
||||
@ -648,8 +649,18 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||
data: blck.denebData.toBeaconBlockHeader),
|
||||
proofs)
|
||||
of ConsensusFork.Electra:
|
||||
debugRaiseAssert "validator pool"
|
||||
return SignatureResult.err("Invalid beacon block fork: electra")
|
||||
case v.data.remoteType
|
||||
of RemoteSignerType.Web3Signer:
|
||||
Web3SignerRequest.init(fork, genesis_validators_root,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Electra,
|
||||
data: blck.electraData.toBeaconBlockHeader))
|
||||
of RemoteSignerType.VerifyingWeb3Signer:
|
||||
let proofs = blockPropertiesProofs(
|
||||
blck.electraData.body, electraIndex)
|
||||
Web3SignerRequest.init(fork, genesis_validators_root,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Electra,
|
||||
data: blck.electraData.toBeaconBlockHeader),
|
||||
proofs)
|
||||
await v.signData(web3signerRequest)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#aggregate-signature
|
||||
|
@ -98,9 +98,7 @@ template saveSSZFile(filename: string, value: ForkedHashedBeaconState) =
|
||||
of ConsensusFork.Bellatrix: SSZ.saveFile(filename, value.bellatrixData.data)
|
||||
of ConsensusFork.Capella: SSZ.saveFile(filename, value.capellaData.data)
|
||||
of ConsensusFork.Deneb: SSZ.saveFile(filename, value.denebData.data)
|
||||
of ConsensusFork.Electra:
|
||||
debugRaiseAssert ""
|
||||
let x = 5
|
||||
of ConsensusFork.Electra: SSZ.saveFile(filename, value.electraData.data)
|
||||
except IOError:
|
||||
raiseAssert "error saving SSZ file"
|
||||
|
||||
|
@ -343,13 +343,11 @@ proc doRunTest(
|
||||
doAssert status.isOk == step.valid
|
||||
of opOnBlock:
|
||||
withBlck(step.blck):
|
||||
debugRaiseAssert "electra etc"
|
||||
when typeof(forkyBlck).kind != ConsensusFork.Electra:
|
||||
let status = stepOnBlock(
|
||||
stores.dag, stores.fkChoice,
|
||||
verifier, state[], stateCache,
|
||||
forkyBlck, step.blobData, time, invalidatedHashes)
|
||||
doAssert status.isOk == step.valid
|
||||
let status = stepOnBlock(
|
||||
stores.dag, stores.fkChoice,
|
||||
verifier, state[], stateCache,
|
||||
forkyBlck, step.blobData, time, invalidatedHashes)
|
||||
doAssert status.isOk == step.valid
|
||||
of opOnAttesterSlashing:
|
||||
let indices =
|
||||
check_attester_slashing(state[], step.attesterSlashing, flags = {})
|
||||
|
@ -31,7 +31,6 @@ suite "Light client" & preset():
|
||||
res.BELLATRIX_FORK_EPOCH = 2.Epoch
|
||||
res.CAPELLA_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 1).Epoch
|
||||
res.DENEB_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 2).Epoch
|
||||
debugRaiseAssert "don't use FAR_FUTURE_EPOCH"
|
||||
res.ELECTRA_FORK_EPOCH = FAR_FUTURE_EPOCH
|
||||
res
|
||||
altairStartSlot = cfg.ALTAIR_FORK_EPOCH.start_slot
|
||||
|
@ -137,6 +137,7 @@ suite "Remove keystore testing suite":
|
||||
check keystore.provenBlockProperties.len == 1
|
||||
check keystore.provenBlockProperties[0].capellaIndex == some GeneralizedIndex(401)
|
||||
check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801)
|
||||
check keystore.provenBlockProperties[0].electraIndex == some GeneralizedIndex(801)
|
||||
|
||||
test "Verifying Signer / Many remotes":
|
||||
for version in [3]:
|
||||
@ -184,4 +185,5 @@ suite "Remove keystore testing suite":
|
||||
check keystore.threshold == 2
|
||||
check keystore.provenBlockProperties.len == 1
|
||||
check keystore.provenBlockProperties[0].capellaIndex == some GeneralizedIndex(401)
|
||||
check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801)
|
||||
check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801)
|
||||
check keystore.provenBlockProperties[0].electraIndex == some GeneralizedIndex(801)
|
@ -255,6 +255,7 @@ func getRemoteKeystoreData(data: string, basePort: int,
|
||||
pubkey: publicKey
|
||||
)
|
||||
|
||||
debugRaiseAssert "check electraIndex"
|
||||
ok case rt
|
||||
of RemoteSignerType.Web3Signer:
|
||||
KeystoreData(
|
||||
@ -270,6 +271,7 @@ func getRemoteKeystoreData(data: string, basePort: int,
|
||||
provenBlockProperties: @[
|
||||
ProvenProperty(
|
||||
path: ".execution_payload.fee_recipient",
|
||||
electraIndex: some GeneralizedIndex(801),
|
||||
denebIndex: some GeneralizedIndex(801),
|
||||
capellaIndex: some GeneralizedIndex(401)
|
||||
)
|
||||
|
@ -48,9 +48,7 @@ proc makeTestDB*(
|
||||
# Upgrade genesis state to later fork, if required by fork schedule
|
||||
cfg.maybeUpgradeState(genState[])
|
||||
withState(genState[]):
|
||||
when consensusFork >= ConsensusFork.Electra:
|
||||
debugRaiseAssert "makeTestDB electra missing"
|
||||
elif consensusFork > ConsensusFork.Phase0:
|
||||
when consensusFork > ConsensusFork.Phase0:
|
||||
forkyState.data.fork.previous_version =
|
||||
forkyState.data.fork.current_version
|
||||
forkyState.data.latest_block_header.body_root =
|
||||
@ -97,4 +95,4 @@ proc getEarliestInvalidBlockRoot*(
|
||||
break
|
||||
curBlck = curBlck.parent
|
||||
|
||||
curBlck.root
|
||||
curBlck.root
|
||||
|
Loading…
x
Reference in New Issue
Block a user