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 ); }); }