Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4339 - Submit abft score on chain #1868

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
fix stale check
mike1729 committed Nov 30, 2024
commit d2ae072d89aeb3895f71c43aef564b9be59eb8a6
11 changes: 7 additions & 4 deletions pallets/aleph/src/lib.rs
Original file line number Diff line number Diff line change
@@ -308,15 +308,17 @@ pub mod pallet {
}

fn check_score(
_round: &Round,
round: &Round,
_score: &Score,
_signature: &ScoreSignature,
) -> Result<(), TransactionValidityError> {
let current_block = <frame_system::Pallet<T>>::block_number();
let next_unsigned_at = NextUnsignedAt::<T>::get();
if next_unsigned_at > current_block {
if next_unsigned_at > (*round).into() {
return Err(InvalidTransaction::Stale.into());
}

// validate signature

Ok(())
}

@@ -482,7 +484,8 @@ pub mod pallet {
Self::check_score(round, score, signature)?;
ValidTransaction::with_tag_prefix("AbftScore")
.priority(*round) // this ensures that later rounds are first in tx queue
.and_provides((round, score))
// .requires(_) | those two can be used to build a dependency
// .and_provides() |
.longevity(TransactionLongevity::max_value()) // consider restricting longevity
.propagate(true)
.build()
2 changes: 1 addition & 1 deletion primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -416,5 +416,5 @@ pub mod staking {

pub type Score = Vec<Point>;
pub type Point = u64;
pub type Round = u64;
pub type Round = u32;
pub type ScoreSignature = u64;