Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions beacon_chain/beacon_node_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions beacon_chain/spec/keystore.nim
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ type
description*: Option[string]
capellaIndex*: Option[GeneralizedIndex]
denebIndex*: Option[GeneralizedIndex]
electraIndex*: Option[GeneralizedIndex]

KeystoreData* = object
version*: uint64
Expand Down Expand Up @@ -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` " &
Expand Down Expand Up @@ -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` " &
Expand Down
17 changes: 14 additions & 3 deletions beacon_chain/validators/validator_pool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ncli/ncli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
12 changes: 5 additions & 7 deletions tests/consensus_spec/test_fixture_fork_choice.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down
1 change: 0 additions & 1 deletion tests/test_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/test_remote_keystore.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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)
2 changes: 2 additions & 0 deletions tests/test_signing_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func getRemoteKeystoreData(data: string, basePort: int,
pubkey: publicKey
)

debugRaiseAssert "check electraIndex"
ok case rt
of RemoteSignerType.Web3Signer:
KeystoreData(
Expand All @@ -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)
)
Expand Down
6 changes: 2 additions & 4 deletions tests/testdbutil.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -97,4 +95,4 @@ proc getEarliestInvalidBlockRoot*(
break
curBlck = curBlck.parent

curBlck.root
curBlck.root