Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Clara/sno 552 (paritytech#887)
Browse files Browse the repository at this point in the history
* Spacing

* Spacing

* Undo typo.

* Minor updates.

* Adds comment about IrrelevantUpdate.

* One more comment.

* Update error name.

---------

Co-authored-by: claravanstaden <Cats 4 life!>
  • Loading branch information
claravanstaden authored Jul 19, 2023
1 parent a99fc50 commit 5e25cd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions parachain/pallets/ethereum-beacon-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ pub mod pallet {
#[cfg_attr(test, derive(PartialEq))]
pub enum Error<T> {
SkippedSyncCommitteePeriod,
NotRelevant,
/// Attested header is older than latest finalized header.
IrrelevantUpdate,
NotBootstrapped,
SyncCommitteeParticipantsNotSupermajority,
InvalidHeaderMerkleProof,
Expand All @@ -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,
Expand Down Expand Up @@ -320,12 +322,10 @@ pub mod pallet {
update.attested_header.slot >= update.finalized_header.slot,
Error::<T>::InvalidUpdateSlot
);

// Retrieve latest finalized state.
let latest_finalized_state =
FinalizedBeaconState::<T>::get(LatestFinalizedBlockRoot::<T>::get())
.ok_or(Error::<T>::NotBootstrapped)?;

let store_period = compute_period(latest_finalized_state.slot);
let signature_period = compute_period(update.signature_slot);
if <NextSyncCommittee<T>>::exists() {
Expand All @@ -345,7 +345,7 @@ pub mod pallet {
ensure!(
update.attested_header.slot > latest_finalized_state.slot ||
update_has_next_sync_committee,
Error::<T>::NotRelevant
Error::<T>::IrrelevantUpdate
);

// Verify that the `finality_branch`, if present, confirms `finalized_header` to match
Expand Down
2 changes: 1 addition & 1 deletion parachain/pallets/ethereum-beacon-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ fn submit_irrelevant_update() {

assert_err!(
EthereumBeaconClient::submit(RuntimeOrigin::signed(1), update.clone()),
Error::<Test>::NotRelevant
Error::<Test>::IrrelevantUpdate
);
});
}
Expand Down

0 comments on commit 5e25cd0

Please sign in to comment.