Refactoring Checkpoint: (WIP)
This commit is contained in:
@@ -28,7 +28,7 @@ use std::{
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
/// Common arguments accross all generate key commands, subkey and node.
|
||||
/// Common arguments accross all generate key commands, pez_subkey and node.
|
||||
#[derive(Debug, Args, Clone)]
|
||||
pub struct GenerateKeyCmdCommon {
|
||||
/// Name of file to save secret key to.
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! Integration tests for subkey commands.
|
||||
//! Integration tests for pez_subkey commands.
|
||||
|
||||
mod sig_verify;
|
||||
|
||||
@@ -19,7 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
async-trait = { workspace = true }
|
||||
codec = { workspace = true, default-features = true }
|
||||
fork-tree = { workspace = true, default-features = true }
|
||||
pez-fork-tree = { workspace = true, default-features = true }
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true, default-features = true }
|
||||
parking_lot = { workspace = true, default-features = true }
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
|
||||
use codec::Codec;
|
||||
use fork_tree::ForkTree;
|
||||
use pez_fork_tree::ForkTree;
|
||||
use parking_lot::RwLock;
|
||||
use pezsp_api::ProvideRuntimeApi;
|
||||
use pezsp_blockchain::{HeaderBackend, HeaderMetadata};
|
||||
|
||||
@@ -19,7 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
async-trait = { workspace = true }
|
||||
codec = { features = ["derive"], workspace = true, default-features = true }
|
||||
fork-tree = { workspace = true, default-features = true }
|
||||
pez-fork-tree = { workspace = true, default-features = true }
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true, default-features = true }
|
||||
num-bigint = { workspace = true }
|
||||
|
||||
@@ -139,7 +139,7 @@ pub fn load_block_weight<H: Encode, B: AuxStore>(
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::migration::EpochV0;
|
||||
use fork_tree::ForkTree;
|
||||
use pez_fork_tree::ForkTree;
|
||||
use pezsc_consensus_epochs::{EpochHeader, PersistedEpoch, PersistedEpochHeader};
|
||||
use pezsc_network_test::Block as TestBlock;
|
||||
use pezsp_consensus::Error as ConsensusError;
|
||||
|
||||
@@ -354,7 +354,7 @@ pub enum Error<B: BlockT> {
|
||||
RuntimeApi(pezsp_api::ApiError),
|
||||
/// Fork tree error
|
||||
#[error(transparent)]
|
||||
ForkTree(Box<fork_tree::Error<pezsp_blockchain::Error>>),
|
||||
ForkTree(Box<pez_fork_tree::Error<pezsp_blockchain::Error>>),
|
||||
}
|
||||
|
||||
impl<B: BlockT> From<Error<B>> for String {
|
||||
|
||||
@@ -340,11 +340,11 @@ the `PublicKey`, but note that it's not the case for BEEFY. As a consequence of
|
||||
**not** convert the `AccountId` raw bytes into a BEEFY `PublicKey`.
|
||||
|
||||
The easiest way to generate or view hex-encoded or SS58-encoded BEEFY Public Key is by using the
|
||||
[Subkey](https://bizinikiwi.dev/docs/en/knowledgebase/integrate/subkey) tool. Generate a BEEFY key
|
||||
[Subkey](https://bizinikiwi.dev/docs/en/knowledgebase/integrate/pez_subkey) tool. Generate a BEEFY key
|
||||
using the following command
|
||||
|
||||
```sh
|
||||
subkey generate --scheme ecdsa
|
||||
pez_subkey generate --scheme ecdsa
|
||||
```
|
||||
|
||||
The output will look something like
|
||||
|
||||
@@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true, default-features = true }
|
||||
fork-tree = { workspace = true, default-features = true }
|
||||
pez-fork-tree = { workspace = true, default-features = true }
|
||||
pezsc-client-api = { workspace = true, default-features = true }
|
||||
pezsc-consensus = { workspace = true, default-features = true }
|
||||
pezsp-blockchain = { workspace = true, default-features = true }
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
pub mod migration;
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use fork_tree::{FilterAction, ForkTree};
|
||||
use pez_fork_tree::{FilterAction, ForkTree};
|
||||
use pezsc_client_api::utils::is_descendent_of;
|
||||
use pezsp_blockchain::{Error as ClientError, HeaderBackend, HeaderMetadata};
|
||||
use pezsp_runtime::traits::{Block as BlockT, NumberFor, One, Zero};
|
||||
@@ -195,7 +195,7 @@ where
|
||||
}
|
||||
|
||||
/// Increment the epoch, yielding an `IncrementedEpoch` to be imported
|
||||
/// into the fork-tree.
|
||||
/// into the pez-fork-tree.
|
||||
pub fn increment(&self, next_descriptor: E::NextEpochDescriptor) -> IncrementedEpoch<E> {
|
||||
let next = self.as_ref().increment(next_descriptor);
|
||||
let to_persist = match *self {
|
||||
@@ -305,7 +305,7 @@ impl<E: Epoch> PersistedEpochHeader<E> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A fresh, incremented epoch to import into the underlying fork-tree.
|
||||
/// A fresh, incremented epoch to import into the underlying pez-fork-tree.
|
||||
///
|
||||
/// Create this with `ViableEpoch::increment`.
|
||||
#[must_use = "Freshly-incremented epoch must be imported with `EpochChanges::import`"]
|
||||
@@ -401,7 +401,7 @@ where
|
||||
hash: &Hash,
|
||||
number: Number,
|
||||
slot: E::Slot,
|
||||
) -> Result<(), fork_tree::Error<D::Error>> {
|
||||
) -> Result<(), pez_fork_tree::Error<D::Error>> {
|
||||
let is_descendent_of = descendent_of_builder.build_is_descendent_of(None);
|
||||
|
||||
let predicate = |epoch: &PersistedEpochHeader<E>| match *epoch {
|
||||
@@ -518,7 +518,7 @@ where
|
||||
parent_number: Number,
|
||||
slot: E::Slot,
|
||||
make_genesis: G,
|
||||
) -> Result<Option<E>, fork_tree::Error<D::Error>>
|
||||
) -> Result<Option<E>, pez_fork_tree::Error<D::Error>>
|
||||
where
|
||||
G: FnOnce(E::Slot) -> E,
|
||||
E: Clone,
|
||||
@@ -543,13 +543,13 @@ where
|
||||
parent_hash: &Hash,
|
||||
parent_number: Number,
|
||||
slot: E::Slot,
|
||||
) -> Result<Option<ViableEpochDescriptor<Hash, Number, E>>, fork_tree::Error<D::Error>> {
|
||||
) -> Result<Option<ViableEpochDescriptor<Hash, Number, E>>, pez_fork_tree::Error<D::Error>> {
|
||||
if parent_number == Zero::zero() {
|
||||
// need to insert the genesis epoch.
|
||||
return Ok(Some(ViableEpochDescriptor::UnimportedGenesis(slot)));
|
||||
}
|
||||
|
||||
// find_node_where will give you the node in the fork-tree which is an ancestor
|
||||
// find_node_where will give you the node in the pez-fork-tree which is an ancestor
|
||||
// of the `parent_hash` by default. if the last epoch was signalled at the parent_hash,
|
||||
// then it won't be returned. we need to create a new fake chain head hash which
|
||||
// "descends" from our parent-hash.
|
||||
@@ -616,7 +616,7 @@ where
|
||||
number: Number,
|
||||
parent_hash: Hash,
|
||||
epoch: IncrementedEpoch<E>,
|
||||
) -> Result<(), fork_tree::Error<D::Error>> {
|
||||
) -> Result<(), pez_fork_tree::Error<D::Error>> {
|
||||
let is_descendent_of =
|
||||
descendent_of_builder.build_is_descendent_of(Some((hash, parent_hash)));
|
||||
let IncrementedEpoch(epoch) = epoch;
|
||||
@@ -625,7 +625,7 @@ where
|
||||
let res = self.inner.import(hash, number, header, &is_descendent_of);
|
||||
|
||||
match res {
|
||||
Ok(_) | Err(fork_tree::Error::Duplicate) => {
|
||||
Ok(_) | Err(pez_fork_tree::Error::Duplicate) => {
|
||||
self.epochs.insert((hash, number), epoch);
|
||||
Ok(())
|
||||
},
|
||||
@@ -641,14 +641,14 @@ where
|
||||
let persisted = PersistedEpoch::Regular(current);
|
||||
let header = PersistedEpochHeader::from(&persisted);
|
||||
let _res = self.inner.import(parent_hash, number - One::one(), header, &|_, _| {
|
||||
Ok(false) as Result<bool, fork_tree::Error<ClientError>>
|
||||
Ok(false) as Result<bool, pez_fork_tree::Error<ClientError>>
|
||||
});
|
||||
self.epochs.insert((parent_hash, number - One::one()), persisted);
|
||||
|
||||
let persisted = PersistedEpoch::Regular(next);
|
||||
let header = PersistedEpochHeader::from(&persisted);
|
||||
let _res = self.inner.import(hash, number, header, &|_, _| {
|
||||
Ok(true) as Result<bool, fork_tree::Error<ClientError>>
|
||||
Ok(true) as Result<bool, pez_fork_tree::Error<ClientError>>
|
||||
});
|
||||
self.epochs.insert((hash, number), persisted);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
use crate::{Epoch, EpochChanges, PersistedEpoch, PersistedEpochHeader};
|
||||
use codec::{Decode, Encode};
|
||||
use fork_tree::ForkTree;
|
||||
use pez_fork_tree::ForkTree;
|
||||
use pezsp_runtime::traits::{Block as BlockT, NumberFor};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ dyn-clone = { workspace = true }
|
||||
finality-grandpa = { features = [
|
||||
"derive-codec",
|
||||
], workspace = true, default-features = true }
|
||||
fork-tree = { workspace = true, default-features = true }
|
||||
pez-fork-tree = { workspace = true, default-features = true }
|
||||
futures = { workspace = true }
|
||||
futures-timer = { workspace = true }
|
||||
log = { workspace = true, default-features = true }
|
||||
|
||||
@@ -22,7 +22,7 @@ use std::{cmp::Ord, fmt::Debug, ops::Add};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use fork_tree::{FilterAction, ForkTree};
|
||||
use pez_fork_tree::{FilterAction, ForkTree};
|
||||
use log::debug;
|
||||
use parking_lot::MappedMutexGuard;
|
||||
use pezsc_consensus::shared_data::{SharedData, SharedDataLocked};
|
||||
@@ -48,14 +48,14 @@ pub enum Error<N, E> {
|
||||
)]
|
||||
ForcedAuthoritySetChangeDependencyUnsatisfied(N),
|
||||
#[error("Invalid operation in the pending changes tree: {0}")]
|
||||
ForkTree(fork_tree::Error<E>),
|
||||
ForkTree(pez_fork_tree::Error<E>),
|
||||
}
|
||||
|
||||
impl<N, E> From<fork_tree::Error<E>> for Error<N, E> {
|
||||
fn from(err: fork_tree::Error<E>) -> Error<N, E> {
|
||||
impl<N, E> From<pez_fork_tree::Error<E>> for Error<N, E> {
|
||||
fn from(err: pez_fork_tree::Error<E>) -> Error<N, E> {
|
||||
match err {
|
||||
fork_tree::Error::Client(err) => Error::Client(err),
|
||||
fork_tree::Error::Duplicate => Error::DuplicateAuthoritySetChange,
|
||||
pez_fork_tree::Error::Client(err) => Error::Client(err),
|
||||
pez_fork_tree::Error::Duplicate => Error::DuplicateAuthoritySetChange,
|
||||
err => Error::ForkTree(err),
|
||||
}
|
||||
}
|
||||
@@ -558,7 +558,7 @@ where
|
||||
is_descendent_of,
|
||||
|change| change.effective_number() <= finalized_number,
|
||||
)? {
|
||||
fork_tree::FinalizationResult::Changed(change) => {
|
||||
pez_fork_tree::FinalizationResult::Changed(change) => {
|
||||
status.changed = true;
|
||||
|
||||
let pending_forced_changes = std::mem::take(&mut self.pending_forced_changes);
|
||||
@@ -595,7 +595,7 @@ where
|
||||
status.new_set_block = Some((finalized_hash, finalized_number));
|
||||
}
|
||||
},
|
||||
fork_tree::FinalizationResult::Unchanged => {},
|
||||
pez_fork_tree::FinalizationResult::Unchanged => {},
|
||||
}
|
||||
|
||||
Ok(status)
|
||||
@@ -1050,7 +1050,7 @@ mod tests {
|
||||
// trying to finalize past `change_c` without finalizing `change_a` first
|
||||
assert!(matches!(
|
||||
authorities.apply_standard_changes("hash_d", 40, &is_descendent_of, false, None),
|
||||
Err(Error::ForkTree(fork_tree::Error::UnfinalizedAncestor))
|
||||
Err(Error::ForkTree(pez_fork_tree::Error::UnfinalizedAncestor))
|
||||
));
|
||||
assert_eq!(authorities.authority_set_changes, AuthoritySetChanges::empty());
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ use codec::{Decode, Encode};
|
||||
use finality_grandpa::round::State as RoundState;
|
||||
use log::{info, warn};
|
||||
|
||||
use fork_tree::ForkTree;
|
||||
use pez_fork_tree::ForkTree;
|
||||
use pezsc_client_api::backend::AuxStore;
|
||||
use pezsp_blockchain::{Error as ClientError, Result as ClientResult};
|
||||
use pezsp_consensus_grandpa::{AuthorityList, RoundNumber, SetId};
|
||||
|
||||
@@ -486,7 +486,7 @@ where
|
||||
let authority_set = AuthoritySet::new(
|
||||
authorities.clone(),
|
||||
set_id,
|
||||
fork_tree::ForkTree::new(),
|
||||
pez_fork_tree::ForkTree::new(),
|
||||
Vec::new(),
|
||||
AuthoritySetChanges::empty(),
|
||||
)
|
||||
|
||||
@@ -49,7 +49,7 @@ sysinfo = { workspace = true }
|
||||
[dev-dependencies]
|
||||
array-bytes = { workspace = true, default-features = true }
|
||||
criterion = { workspace = true, default-features = true }
|
||||
kitchensink-runtime = { workspace = true }
|
||||
pez-kitchensink-runtime = { workspace = true }
|
||||
kvdb-rocksdb = { workspace = true }
|
||||
rand = { workspace = true, default-features = true }
|
||||
pezsp-tracing = { workspace = true, default-features = true }
|
||||
@@ -60,7 +60,7 @@ tempfile = { workspace = true }
|
||||
default = []
|
||||
test-helpers = []
|
||||
runtime-benchmarks = [
|
||||
"kitchensink-runtime/runtime-benchmarks",
|
||||
"pez-kitchensink-runtime/runtime-benchmarks",
|
||||
"pezsc-client-api/runtime-benchmarks",
|
||||
"pezsp-blockchain/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
|
||||
@@ -46,7 +46,7 @@ fn insert_blocks(db: &Backend<Block>, storage: Vec<(Vec<u8>, Vec<u8>)>) -> H256
|
||||
Storage {
|
||||
top: vec![(
|
||||
pezsp_core::storage::well_known_keys::CODE.to_vec(),
|
||||
kitchensink_runtime::wasm_binary_unwrap().to_vec(),
|
||||
pez_kitchensink_runtime::wasm_binary_unwrap().to_vec(),
|
||||
)]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "mmr-gadget"
|
||||
name = "pezmmr-gadget"
|
||||
version = "29.0.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
repository.workspace = true
|
||||
description = "MMR Client gadget for bizinikiwi"
|
||||
homepage.workspace = true
|
||||
documentation = "https://docs.rs/mmr-gadget"
|
||||
documentation = "https://docs.rs/pezmmr-gadget"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "mmr-rpc"
|
||||
name = "pezmmr-rpc"
|
||||
version = "28.0.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -7,7 +7,7 @@ license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
description = "Node-specific RPC methods for interaction with Merkle Mountain Range pallet."
|
||||
documentation = "https://docs.rs/mmr-rpc"
|
||||
documentation = "https://docs.rs/pezmmr-rpc"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -26,7 +26,7 @@ use pezsp_blockchain::{Error as ClientError, Result as ClientResult};
|
||||
use pezsp_runtime::traits::{Block, NumberFor};
|
||||
|
||||
const VERSION_KEY: &[u8] = b"mmr_auxschema_version";
|
||||
const GADGET_STATE: &[u8] = b"mmr_gadget_state";
|
||||
const GADGET_STATE: &[u8] = b"pezmmr_gadget_state";
|
||||
|
||||
const CURRENT_VERSION: u32 = 1;
|
||||
pub(crate) type PersistedState<B> = NumberFor<B>;
|
||||
@@ -101,7 +101,7 @@ where
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::test_utils::{run_test_with_mmr_gadget_pre_post_using_client, MmrBlock, MockClient};
|
||||
use crate::test_utils::{run_test_with_pezmmr_gadget_pre_post_using_client, MmrBlock, MockClient};
|
||||
use parking_lot::Mutex;
|
||||
use pezsp_runtime::generic::BlockId;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
@@ -136,7 +136,7 @@ pub(crate) mod tests {
|
||||
// state not available in db -> None
|
||||
assert_eq!(load_state::<Block, Backend>(&*backend).unwrap(), None);
|
||||
// run the gadget while importing and finalizing 3 blocks
|
||||
run_test_with_mmr_gadget_pre_post_using_client(
|
||||
run_test_with_pezmmr_gadget_pre_post_using_client(
|
||||
client.clone(),
|
||||
|_| async {},
|
||||
|client| async move {
|
||||
@@ -151,7 +151,7 @@ pub(crate) mod tests {
|
||||
);
|
||||
|
||||
// verify previous progress was persisted and run the gadget again
|
||||
run_test_with_mmr_gadget_pre_post_using_client(
|
||||
run_test_with_pezmmr_gadget_pre_post_using_client(
|
||||
client.clone(),
|
||||
|client| async move {
|
||||
let backend = &*client.backend;
|
||||
@@ -183,7 +183,7 @@ pub(crate) mod tests {
|
||||
let blocks_clone = blocks.clone();
|
||||
|
||||
// run the gadget while importing and finalizing 3 blocks
|
||||
run_test_with_mmr_gadget_pre_post_using_client(
|
||||
run_test_with_pezmmr_gadget_pre_post_using_client(
|
||||
client.clone(),
|
||||
|_| async {},
|
||||
|client| async move {
|
||||
@@ -206,7 +206,7 @@ pub(crate) mod tests {
|
||||
|
||||
let blocks_clone = blocks.clone();
|
||||
// verify new gadget continues from block 4 and ignores 1, 2, 3 based on persisted state
|
||||
run_test_with_mmr_gadget_pre_post_using_client(
|
||||
run_test_with_pezmmr_gadget_pre_post_using_client(
|
||||
client.clone(),
|
||||
|client| async move {
|
||||
let blocks = blocks_clone.lock();
|
||||
|
||||
@@ -201,12 +201,12 @@ where
|
||||
},
|
||||
};
|
||||
|
||||
let mmr_gadget = MmrGadget::<B, BE, C> {
|
||||
let pezmmr_gadget = MmrGadget::<B, BE, C> {
|
||||
finality_notifications: client.finality_notification_stream(),
|
||||
|
||||
_phantom: Default::default(),
|
||||
};
|
||||
mmr_gadget
|
||||
pezmmr_gadget
|
||||
.run(OffchainMmrBuilder {
|
||||
backend,
|
||||
client,
|
||||
@@ -220,14 +220,14 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_utils::run_test_with_mmr_gadget;
|
||||
use crate::test_utils::run_test_with_pezmmr_gadget;
|
||||
use pezsp_runtime::generic::BlockId;
|
||||
use std::time::Duration;
|
||||
|
||||
#[test]
|
||||
fn mmr_first_block_is_computed_correctly() {
|
||||
// Check the case where the first block is also the first block with MMR.
|
||||
run_test_with_mmr_gadget(|client| async move {
|
||||
run_test_with_pezmmr_gadget(|client| async move {
|
||||
// G -> A1 -> A2
|
||||
// |
|
||||
// | -> first mmr block
|
||||
@@ -243,7 +243,7 @@ mod tests {
|
||||
});
|
||||
|
||||
// Check the case where the first block with MMR comes later.
|
||||
run_test_with_mmr_gadget(|client| async move {
|
||||
run_test_with_pezmmr_gadget(|client| async move {
|
||||
// G -> A1 -> A2 -> A3 -> A4 -> A5 -> A6
|
||||
// |
|
||||
// | -> first mmr block
|
||||
@@ -265,7 +265,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn does_not_panic_on_invalid_num_mmr_blocks() {
|
||||
run_test_with_mmr_gadget(|client| async move {
|
||||
run_test_with_pezmmr_gadget(|client| async move {
|
||||
// G -> A1
|
||||
// |
|
||||
// | -> first mmr block
|
||||
|
||||
@@ -279,14 +279,14 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_utils::{run_test_with_mmr_gadget, run_test_with_mmr_gadget_pre_post};
|
||||
use crate::test_utils::{run_test_with_pezmmr_gadget, run_test_with_pezmmr_gadget_pre_post};
|
||||
use parking_lot::Mutex;
|
||||
use pezsp_runtime::generic::BlockId;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
#[test]
|
||||
fn canonicalize_and_prune_works_correctly() {
|
||||
run_test_with_mmr_gadget(|client| async move {
|
||||
run_test_with_pezmmr_gadget(|client| async move {
|
||||
// -> D4 -> D5
|
||||
// G -> A1 -> A2 -> A3 -> A4
|
||||
// -> B1 -> B2 -> B3
|
||||
@@ -325,7 +325,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn canonicalize_and_prune_handles_pallet_reset() {
|
||||
run_test_with_mmr_gadget(|client| async move {
|
||||
run_test_with_pezmmr_gadget(|client| async move {
|
||||
// G -> A1 -> A2 -> A3 -> A4 -> A5
|
||||
// | |
|
||||
// | | -> pallet reset
|
||||
@@ -357,7 +357,7 @@ mod tests {
|
||||
fn canonicalize_catchup_works_correctly() {
|
||||
let mmr_blocks = Arc::new(Mutex::new(vec![]));
|
||||
let mmr_blocks_ref = mmr_blocks.clone();
|
||||
run_test_with_mmr_gadget_pre_post(
|
||||
run_test_with_pezmmr_gadget_pre_post(
|
||||
|client| async move {
|
||||
// G -> A1 -> A2
|
||||
// | |
|
||||
@@ -402,7 +402,7 @@ mod tests {
|
||||
fn canonicalize_catchup_works_correctly_with_pallet_reset() {
|
||||
let mmr_blocks = Arc::new(Mutex::new(vec![]));
|
||||
let mmr_blocks_ref = mmr_blocks.clone();
|
||||
run_test_with_mmr_gadget_pre_post(
|
||||
run_test_with_pezmmr_gadget_pre_post(
|
||||
|client| async move {
|
||||
// G -> A1 -> A2
|
||||
// | |
|
||||
|
||||
@@ -334,15 +334,15 @@ pezsp_api::mock_impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn run_test_with_mmr_gadget<F, Fut>(post_gadget: F)
|
||||
pub(crate) fn run_test_with_pezmmr_gadget<F, Fut>(post_gadget: F)
|
||||
where
|
||||
F: FnOnce(Arc<MockClient>) -> Fut + 'static,
|
||||
Fut: Future<Output = ()>,
|
||||
{
|
||||
run_test_with_mmr_gadget_pre_post(|_| async {}, post_gadget);
|
||||
run_test_with_pezmmr_gadget_pre_post(|_| async {}, post_gadget);
|
||||
}
|
||||
|
||||
pub(crate) fn run_test_with_mmr_gadget_pre_post<F, G, RetF, RetG>(pre_gadget: F, post_gadget: G)
|
||||
pub(crate) fn run_test_with_pezmmr_gadget_pre_post<F, G, RetF, RetG>(pre_gadget: F, post_gadget: G)
|
||||
where
|
||||
F: FnOnce(Arc<MockClient>) -> RetF + 'static,
|
||||
G: FnOnce(Arc<MockClient>) -> RetG + 'static,
|
||||
@@ -350,10 +350,10 @@ where
|
||||
RetG: Future<Output = ()>,
|
||||
{
|
||||
let client = Arc::new(MockClient::new());
|
||||
run_test_with_mmr_gadget_pre_post_using_client(client, pre_gadget, post_gadget)
|
||||
run_test_with_pezmmr_gadget_pre_post_using_client(client, pre_gadget, post_gadget)
|
||||
}
|
||||
|
||||
pub(crate) fn run_test_with_mmr_gadget_pre_post_using_client<F, G, RetF, RetG>(
|
||||
pub(crate) fn run_test_with_pezmmr_gadget_pre_post_using_client<F, G, RetF, RetG>(
|
||||
client: Arc<MockClient>,
|
||||
pre_gadget: F,
|
||||
post_gadget: G,
|
||||
|
||||
@@ -20,7 +20,7 @@ array-bytes = { workspace = true, default-features = true }
|
||||
async-channel = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
codec = { features = ["derive"], workspace = true, default-features = true }
|
||||
fork-tree = { workspace = true, default-features = true }
|
||||
pez-fork-tree = { workspace = true, default-features = true }
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true, default-features = true }
|
||||
mockall = { workspace = true }
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::{
|
||||
strategy::chain_sync::{PeerSync, PeerSyncState},
|
||||
LOG_TARGET,
|
||||
};
|
||||
use fork_tree::ForkTree;
|
||||
use pez_fork_tree::ForkTree;
|
||||
use log::{debug, trace, warn};
|
||||
use prometheus_endpoint::{
|
||||
prometheus::core::GenericGauge, register, GaugeVec, Opts, PrometheusError, Registry, U64,
|
||||
@@ -154,7 +154,7 @@ impl<B: BlockT> ExtraRequests<B> {
|
||||
metrics.pending.inc();
|
||||
}
|
||||
},
|
||||
Err(fork_tree::Error::Revert) => {
|
||||
Err(pez_fork_tree::Error::Revert) => {
|
||||
// we have finalized further than the given request, presumably
|
||||
// by some other part of the system (not sync). we can safely
|
||||
// ignore the `Revert` error.
|
||||
@@ -230,7 +230,7 @@ impl<B: BlockT> ExtraRequests<B> {
|
||||
best_finalized_hash: &B::Hash,
|
||||
best_finalized_number: NumberFor<B>,
|
||||
is_descendent_of: F,
|
||||
) -> Result<(), fork_tree::Error<ClientError>>
|
||||
) -> Result<(), pez_fork_tree::Error<ClientError>>
|
||||
where
|
||||
F: Fn(&B::Hash, &B::Hash) -> Result<bool, ClientError>,
|
||||
{
|
||||
@@ -247,7 +247,7 @@ impl<B: BlockT> ExtraRequests<B> {
|
||||
best_finalized_number,
|
||||
&is_descendent_of,
|
||||
) {
|
||||
Err(fork_tree::Error::Revert) => {
|
||||
Err(pez_fork_tree::Error::Revert) => {
|
||||
// we might have finalized further already in which case we
|
||||
// will get a `Revert` error which we can safely ignore.
|
||||
},
|
||||
|
||||
@@ -45,7 +45,7 @@ async fn send_future_and_ready_from_many_accounts_to_teyrchain() {
|
||||
net.wait_for_block("charlie", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create future & ready txs executors.
|
||||
let ws = net.node_rpc_uri("charlie").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("charlie").unwrap();
|
||||
let future_scenario_executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws.clone())
|
||||
.with_start_id(0)
|
||||
@@ -97,7 +97,7 @@ async fn send_future_and_ready_from_many_accounts_to_relaychain() {
|
||||
net.wait_for_block("alice", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create future & ready txs executors.
|
||||
let ws = net.node_rpc_uri("alice").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("alice").unwrap();
|
||||
let future_scenario_executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws.clone())
|
||||
.with_start_id(0)
|
||||
@@ -154,7 +154,7 @@ async fn send_future_mortal_txs() {
|
||||
net.wait_for_block("alice", BlockSubscriptionType::Finalized).await.unwrap();
|
||||
|
||||
// Create txs executors.
|
||||
let ws = net.node_rpc_uri("alice").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("alice").unwrap();
|
||||
let ready_scenario_executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws.clone())
|
||||
.with_start_id(0)
|
||||
@@ -228,7 +228,7 @@ async fn send_lower_priority_mortal_txs() {
|
||||
net.wait_for_block("alice", BlockSubscriptionType::Finalized).await.unwrap();
|
||||
|
||||
// Create txs executors.
|
||||
let ws = net.node_rpc_uri("alice").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("alice").unwrap();
|
||||
let ready_scenario_executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws.clone())
|
||||
.with_start_id(0)
|
||||
@@ -313,7 +313,7 @@ async fn send_5m_from_many_accounts_to_teyrchain() {
|
||||
net.wait_for_block("charlie", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create txs executor.
|
||||
let ws = net.node_rpc_uri("charlie").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("charlie").unwrap();
|
||||
let executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws)
|
||||
.with_start_id(0)
|
||||
@@ -343,7 +343,7 @@ async fn send_5m_from_many_accounts_to_relaychain() {
|
||||
net.wait_for_block("alice", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create txs executor.
|
||||
let ws = net.node_rpc_uri("alice").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("alice").unwrap();
|
||||
let executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws.clone())
|
||||
.with_start_id(0)
|
||||
@@ -375,7 +375,7 @@ async fn gossiping() {
|
||||
net.wait_for_block("a00", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create the txs executor.
|
||||
let ws = net.node_rpc_uri("a00").unwrap();
|
||||
let ws = net.pez_node_rpc_uri("a00").unwrap();
|
||||
let executor = default_zn_scenario_builder(&net)
|
||||
.with_rpc_uri(ws)
|
||||
.with_start_id(0)
|
||||
@@ -402,7 +402,7 @@ async fn send_batch(
|
||||
to: u32,
|
||||
prio: u32,
|
||||
) -> ScenarioExecutor {
|
||||
let ws = net.node_rpc_uri(node_name).unwrap();
|
||||
let ws = net.pez_node_rpc_uri(node_name).unwrap();
|
||||
info!(from, to, prio, "send_batch");
|
||||
default_zn_scenario_builder(net)
|
||||
.with_rpc_uri(ws)
|
||||
|
||||
@@ -209,7 +209,7 @@ impl NetworkSpawner {
|
||||
}
|
||||
|
||||
/// Get a certain node rpc uri.
|
||||
pub fn node_rpc_uri(&self, node_name: &str) -> Result<String> {
|
||||
pub fn pez_node_rpc_uri(&self, node_name: &str) -> Result<String> {
|
||||
self.network
|
||||
.get_node(node_name)
|
||||
.and_then(|node| Ok(node.ws_uri().to_string()))
|
||||
|
||||
@@ -114,7 +114,7 @@ async fn slot_based_3cores_test() -> Result<(), anyhow::Error> {
|
||||
spawner.wait_for_block("dave", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create txs executor.
|
||||
let ws = spawner.node_rpc_uri("dave").unwrap();
|
||||
let ws = spawner.pez_node_rpc_uri("dave").unwrap();
|
||||
let executor = {
|
||||
let shared_params = ScenarioBuilderSharedParams::default();
|
||||
ScenarioBuilder::new()
|
||||
|
||||
Reference in New Issue
Block a user