diff --git a/beacon_chain/beacon_node_light_client.nim b/beacon_chain/beacon_node_light_client.nim index 07878a2e2..1df0ddb37 100644 --- a/beacon_chain/beacon_node_light_client.nim +++ b/beacon_chain/beacon_node_light_client.nim @@ -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 diff --git a/beacon_chain/spec/keystore.nim b/beacon_chain/spec/keystore.nim index d4e53af63..75ad3fea3 100644 --- a/beacon_chain/spec/keystore.nim +++ b/beacon_chain/spec/keystore.nim @@ -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` " & diff --git a/beacon_chain/validators/validator_pool.nim b/beacon_chain/validators/validator_pool.nim index 6ff4d8049..a949e23fc 100644 --- a/beacon_chain/validators/validator_pool.nim +++ b/beacon_chain/validators/validator_pool.nim @@ -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 diff --git a/ncli/ncli.nim b/ncli/ncli.nim index fcb8ae77b..e706e3a48 100644 --- a/ncli/ncli.nim +++ b/ncli/ncli.nim @@ -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" diff --git a/tests/consensus_spec/test_fixture_fork_choice.nim b/tests/consensus_spec/test_fixture_fork_choice.nim index 65c2788d5..230a9a5e8 100644 --- a/tests/consensus_spec/test_fixture_fork_choice.nim +++ b/tests/consensus_spec/test_fixture_fork_choice.nim @@ -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 = {}) diff --git a/tests/test_light_client.nim b/tests/test_light_client.nim index 588bebec3..9b549fa79 100644 --- a/tests/test_light_client.nim +++ b/tests/test_light_client.nim @@ -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 diff --git a/tests/test_remote_keystore.nim b/tests/test_remote_keystore.nim index c31a44ad9..dec0cacd8 100644 --- a/tests/test_remote_keystore.nim +++ b/tests/test_remote_keystore.nim @@ -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) \ No newline at end of file + check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801) + check keystore.provenBlockProperties[0].electraIndex == some GeneralizedIndex(801) \ No newline at end of file diff --git a/tests/test_signing_node.nim b/tests/test_signing_node.nim index 48f6e8fe1..3555d078d 100644 --- a/tests/test_signing_node.nim +++ b/tests/test_signing_node.nim @@ -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) ) diff --git a/tests/testdbutil.nim b/tests/testdbutil.nim index a0334372f..0a47d3dda 100644 --- a/tests/testdbutil.nim +++ b/tests/testdbutil.nim @@ -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 \ No newline at end of file + curBlck.root