fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -44,7 +44,7 @@ pub(super) fn calculate_primary_threshold(
|
||||
use num_traits::{cast::ToPrimitive, identities::One};
|
||||
|
||||
// Prevent div by zero and out of bounds access.
|
||||
// While Babe's pallet implementation that ships with FRAME performs a sanity check over
|
||||
// While Babe's pezpallet implementation that ships with FRAME performs a sanity check over
|
||||
// configuration parameters, this is not sufficient to guarantee that `c.1` is non-zero
|
||||
// (i.e. third party implementations are possible).
|
||||
if c.1 == 0 || authority_index >= authorities.len() {
|
||||
|
||||
@@ -283,7 +283,7 @@ where
|
||||
finality_notifications: &mut Fuse<FinalityNotifications<B>>,
|
||||
is_authority: bool,
|
||||
) -> Result<Self, Error> {
|
||||
// Wait for BEEFY pallet to be active before starting voter.
|
||||
// Wait for BEEFY pezpallet to be active before starting voter.
|
||||
let (beefy_genesis, best_grandpa) =
|
||||
wait_for_runtime_pallet(&*runtime, finality_notifications).await?;
|
||||
|
||||
@@ -335,7 +335,7 @@ where
|
||||
|
||||
// If no persisted state present, walk back the chain from first GRANDPA notification to either:
|
||||
// - latest BEEFY finalized block, or if none found on the way,
|
||||
// - BEEFY pallet genesis;
|
||||
// - BEEFY pezpallet genesis;
|
||||
// Enqueue any BEEFY mandatory blocks (session boundaries) found on the way, for voter to
|
||||
// finalize.
|
||||
async fn init_state(
|
||||
@@ -353,9 +353,9 @@ where
|
||||
.ok()
|
||||
.flatten()
|
||||
.filter(|genesis| *genesis == beefy_genesis)
|
||||
.ok_or_else(|| Error::Backend("BEEFY pallet expected to be active.".into()))?;
|
||||
.ok_or_else(|| Error::Backend("BEEFY pezpallet expected to be active.".into()))?;
|
||||
// Walk back the imported blocks and initialize voter either, at the last block with
|
||||
// a BEEFY justification, or at pallet genesis block; voter will resume from there.
|
||||
// a BEEFY justification, or at pezpallet genesis block; voter will resume from there.
|
||||
let mut sessions = VecDeque::new();
|
||||
let mut header = best_grandpa.clone();
|
||||
let state = loop {
|
||||
@@ -444,7 +444,7 @@ where
|
||||
) -> Result<PersistedState<B, AuthorityId>, Error> {
|
||||
// Initialize voter state from AUX DB if compatible.
|
||||
if let Some(mut state) = crate::aux_schema::load_persistent(backend.as_ref())?
|
||||
// Verify state pallet genesis matches runtime.
|
||||
// Verify state pezpallet genesis matches runtime.
|
||||
.filter(|state| state.pezpallet_genesis() == beefy_genesis)
|
||||
{
|
||||
// Overwrite persisted state with current best GRANDPA block.
|
||||
@@ -485,7 +485,7 @@ where
|
||||
return Ok(state);
|
||||
}
|
||||
|
||||
// No valid voter-state persisted, re-initialize from pallet genesis.
|
||||
// No valid voter-state persisted, re-initialize from pezpallet genesis.
|
||||
Self::init_state(beefy_genesis, best_grandpa, min_block_delta, backend, runtime).await
|
||||
}
|
||||
}
|
||||
@@ -557,8 +557,8 @@ pub async fn start_beefy_gadget<B, BE, C, N, P, R, S, AuthorityId>(
|
||||
|
||||
let mut block_import_justif = links.from_block_import_justif_stream.subscribe(100_000).fuse();
|
||||
|
||||
// Subscribe to finality notifications and justifications before waiting for runtime pallet and
|
||||
// reuse the streams, so we don't miss notifications while waiting for pallet to be available.
|
||||
// Subscribe to finality notifications and justifications before waiting for runtime pezpallet and
|
||||
// reuse the streams, so we don't miss notifications while waiting for pezpallet to be available.
|
||||
let finality_notifications = client.finality_notification_stream();
|
||||
let (mut transformer, mut finality_notifications) =
|
||||
finality_notification_transformer_future(finality_notifications);
|
||||
@@ -718,7 +718,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Wait for BEEFY runtime pallet to be available, return active validator set.
|
||||
/// Wait for BEEFY runtime pezpallet to be available, return active validator set.
|
||||
/// Should be called only once during worker initialization.
|
||||
async fn wait_for_runtime_pallet<B, R, AuthorityId: AuthorityIdBound>(
|
||||
runtime: &R,
|
||||
@@ -729,7 +729,7 @@ where
|
||||
R: ProvideRuntimeApi<B>,
|
||||
R::Api: BeefyApi<B, AuthorityId>,
|
||||
{
|
||||
info!(target: LOG_TARGET, "🥩 BEEFY gadget waiting for BEEFY pallet to become available...");
|
||||
info!(target: LOG_TARGET, "🥩 BEEFY gadget waiting for BEEFY pezpallet to become available...");
|
||||
loop {
|
||||
let notif = finality.next().await.ok_or_else(|| {
|
||||
let err_msg = "🥩 Finality stream has unexpectedly terminated.".into();
|
||||
@@ -739,10 +739,10 @@ where
|
||||
let at = notif.header.hash();
|
||||
if let Some(start) = runtime.runtime_api().beefy_genesis(at).ok().flatten() {
|
||||
if *notif.header.number() >= start {
|
||||
// Beefy pallet available, return header for best grandpa at the time.
|
||||
// Beefy pezpallet available, return header for best grandpa at the time.
|
||||
info!(
|
||||
target: LOG_TARGET,
|
||||
"🥩 BEEFY pallet available: block {:?} beefy genesis {:?}",
|
||||
"🥩 BEEFY pezpallet available: block {:?} beefy genesis {:?}",
|
||||
notif.header.number(), start
|
||||
);
|
||||
return Ok((start, notif.header));
|
||||
|
||||
@@ -828,7 +828,7 @@ async fn beefy_importing_justifications() {
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
|
||||
// Import block 2 with "valid" justification (beefy pallet genesis block not yet reached).
|
||||
// Import block 2 with "valid" justification (beefy pezpallet genesis block not yet reached).
|
||||
let block_num = 2;
|
||||
let builder = BlockBuilderBuilder::new(&*full_client)
|
||||
.on_parent_block(hashof1)
|
||||
@@ -1072,7 +1072,7 @@ async fn should_initialize_voter_at_custom_genesis() {
|
||||
let validator_set = ValidatorSet::new(make_beefy_ids(keys), 0).unwrap();
|
||||
let mut net = BeefyTestNet::new(1);
|
||||
let backend = net.peer(0).client().as_backend();
|
||||
// custom pallet genesis is block number 7
|
||||
// custom pezpallet genesis is block number 7
|
||||
let custom_pallet_genesis = 7;
|
||||
let api = TestApi::new(custom_pallet_genesis, &validator_set, GOOD_MMR_ROOT);
|
||||
|
||||
@@ -1118,7 +1118,7 @@ async fn should_initialize_voter_at_custom_genesis() {
|
||||
let api = TestApi::new(new_pallet_genesis, &new_validator_set, GOOD_MMR_ROOT);
|
||||
|
||||
net.peer(0).client().as_client().finalize_block(hashes[10], None).unwrap();
|
||||
// load persistent state - state preset in DB, but with different pallet genesis
|
||||
// load persistent state - state preset in DB, but with different pezpallet genesis
|
||||
let new_persisted_state =
|
||||
voter_init_setup(&mut net, &mut finality_notifications, &api).await.unwrap();
|
||||
|
||||
@@ -1259,7 +1259,7 @@ async fn should_initialize_voter_at_custom_genesis_when_state_unavailable() {
|
||||
let validator_set = ValidatorSet::new(make_beefy_ids(keys), 0).unwrap();
|
||||
let mut net = BeefyTestNet::new(1);
|
||||
let backend = net.peer(0).client().as_backend();
|
||||
// custom pallet genesis is block number 7
|
||||
// custom pezpallet genesis is block number 7
|
||||
let custom_pallet_genesis = 7;
|
||||
let mut api = TestApi::new(custom_pallet_genesis, &validator_set, GOOD_MMR_ROOT);
|
||||
// remove validator set from `TestApi`, practically simulating unavailable/pruned runtime state
|
||||
@@ -1395,7 +1395,7 @@ async fn beefy_finalizing_after_pallet_genesis() {
|
||||
|
||||
// Minimum BEEFY block delta is 1.
|
||||
|
||||
// GRANDPA finalize blocks leading up to BEEFY pallet genesis -> BEEFY should finalize nothing.
|
||||
// GRANDPA finalize blocks leading up to BEEFY pezpallet genesis -> BEEFY should finalize nothing.
|
||||
finalize_block_and_wait_for_beefy(&net, peers.clone(), &hashes[14], &[]).await;
|
||||
|
||||
// GRANDPA finalize block #16 -> BEEFY should finalize #15 (genesis mandatory) and #16.
|
||||
|
||||
@@ -280,7 +280,7 @@ pub(crate) struct PersistedState<B: Block, AuthorityId: AuthorityIdBound> {
|
||||
/// Chooses which incoming votes to accept and which votes to generate.
|
||||
/// Keeps track of voting seen for current and future rounds.
|
||||
voting_oracle: VoterOracle<B, AuthorityId>,
|
||||
/// Pallet-beefy genesis block - block number when BEEFY consensus started for this chain.
|
||||
/// Pezpallet-beefy genesis block - block number when BEEFY consensus started for this chain.
|
||||
pezpallet_genesis: NumberFor<B>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user