From 5e25cd060fca8c888f797db2d6aa122cabca572c Mon Sep 17 00:00:00 2001 From: Clara van Staden Date: Wed, 19 Jul 2023 11:57:25 +0200 Subject: [PATCH] Clara/sno 552 (#887) * Spacing * Spacing * Undo typo. * Minor updates. * Adds comment about IrrelevantUpdate. * One more comment. * Update error name. --------- Co-authored-by: claravanstaden --- parachain/pallets/ethereum-beacon-client/src/lib.rs | 8 ++++---- parachain/pallets/ethereum-beacon-client/src/tests.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/parachain/pallets/ethereum-beacon-client/src/lib.rs b/parachain/pallets/ethereum-beacon-client/src/lib.rs index 1f670f40eb4d3..cee3c01fa74c7 100644 --- a/parachain/pallets/ethereum-beacon-client/src/lib.rs +++ b/parachain/pallets/ethereum-beacon-client/src/lib.rs @@ -93,7 +93,8 @@ pub mod pallet { #[cfg_attr(test, derive(PartialEq))] pub enum Error { SkippedSyncCommitteePeriod, - NotRelevant, + /// Attested header is older than latest finalized header. + IrrelevantUpdate, NotBootstrapped, SyncCommitteeParticipantsNotSupermajority, InvalidHeaderMerkleProof, @@ -114,6 +115,7 @@ pub mod pallet { BLSPreparePublicKeysFailed, BLSVerificationFailed(BlsError), InvalidUpdateSlot, + /// The given update is not in the expected period, or the given next sync committee does not match the next sync committee in storage. InvalidSyncCommitteeUpdate, ExecutionHeaderTooFarBehind, ExecutionHeaderSkippedSlot, @@ -320,12 +322,10 @@ pub mod pallet { update.attested_header.slot >= update.finalized_header.slot, Error::::InvalidUpdateSlot ); - // Retrieve latest finalized state. let latest_finalized_state = FinalizedBeaconState::::get(LatestFinalizedBlockRoot::::get()) .ok_or(Error::::NotBootstrapped)?; - let store_period = compute_period(latest_finalized_state.slot); let signature_period = compute_period(update.signature_slot); if >::exists() { @@ -345,7 +345,7 @@ pub mod pallet { ensure!( update.attested_header.slot > latest_finalized_state.slot || update_has_next_sync_committee, - Error::::NotRelevant + Error::::IrrelevantUpdate ); // Verify that the `finality_branch`, if present, confirms `finalized_header` to match diff --git a/parachain/pallets/ethereum-beacon-client/src/tests.rs b/parachain/pallets/ethereum-beacon-client/src/tests.rs index 432763282d2da..34070311befaa 100644 --- a/parachain/pallets/ethereum-beacon-client/src/tests.rs +++ b/parachain/pallets/ethereum-beacon-client/src/tests.rs @@ -432,7 +432,7 @@ fn submit_irrelevant_update() { assert_err!( EthereumBeaconClient::submit(RuntimeOrigin::signed(1), update.clone()), - Error::::NotRelevant + Error::::IrrelevantUpdate ); }); }