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:
2025-12-16 09:57:23 +03:00
parent eea003e14d
commit 3139ffa25e
3022 changed files with 42157 additions and 23579 deletions
+36
View File
@@ -0,0 +1,36 @@
[package]
name = "teyrchains-relay"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
repository.workspace = true
publish = false
description = "Pezkuwi SDK component: teyrchains relay"
documentation = "https://docs.rs/teyrchains-relay"
homepage = { workspace = true }
[lints]
workspace = true
[dependencies]
async-std = { workspace = true }
async-trait = { workspace = true }
futures = { workspace = true }
relay-utils = { workspace = true }
tracing = { workspace = true }
# Bridge dependencies
bp-pezkuwi-core = { workspace = true, default-features = true }
relay-bizinikiwi-client = { workspace = true }
[dev-dependencies]
relay-bizinikiwi-client = { features = ["test-helpers"], workspace = true }
pezsp-core = { workspace = true, default-features = true }
[features]
runtime-benchmarks = [
"bp-pezkuwi-core/runtime-benchmarks",
"relay-bizinikiwi-client/runtime-benchmarks",
"relay-utils/runtime-benchmarks",
]
+50
View File
@@ -0,0 +1,50 @@
# Teyrchains Finality Relay
The teyrchains finality relay works with two chains - source relay chain and target chain (which may be standalone
chain, relay chain or a teyrchain). The source chain must have the
[`paras` pezpallet](https://github.com/paritytech/polkadot/tree/master/runtime/parachains/src/paras) deployed at its
runtime. The target chain must have the [bridge teyrchains pezpallet](../../modules/teyrchains/) deployed at its runtime.
The relay is configured to submit heads of one or several teyrchains. It pokes source chain periodically and compares
teyrchain heads that are known to the source relay chain to heads at the target chain. If there are new heads,
the relay submits them to the target chain.
More: [Teyrchains Finality Relay Sequence Diagram](../../docs/teyrchains-pez-finality-relay.html).
## How to Use the Teyrchains Finality Relay
There are only two traits that need to be implemented. The [`SourceChain`](./src/teyrchains_loop.rs) implementation
is supposed to connect to the source chain node. It must be able to read teyrchain heads from the `Heads` map of
the [`paras` pezpallet](https://github.com/paritytech/polkadot/tree/master/runtime/parachains/src/paras).
It also must create storage proofs of `Heads` map entries, when required.
The [`TargetChain`](./src/teyrchains_loop.rs) implementation connects to the target chain node. It must be able
to return the best known head of given teyrchain. When required, it must be able to craft and submit teyrchains
finality delivery transaction to the target node.
The main entrypoint for the crate is the [`run` function](./src/teyrchains_loop.rs), which takes source and target
clients and [`TeyrchainSyncParams`](./src/teyrchains_loop.rs) parameters. The most important parameter is the
`teyrchains` - it is the set of teyrchains, which relay tracks and updates. The other important parameter that
may affect the relay operational costs is the `strategy`. If it is set to `Any`, then the finality delivery
transaction is submitted if at least one of tracked teyrchain heads is updated. The other option is `All`. Then
the relay waits until all tracked teyrchain heads are updated and submits them all in a single finality delivery
transaction.
## Teyrchain Finality Relay Metrics
Every teyrchain in PezkuwiChain is identified by the 32-bit number. All metrics, exposed by the teyrchains finality
relay have the `teyrchain` label, which is set to the teyrchain id. And the metrics are prefixed with the prefix,
that depends on the name of the source relay and target chains. The list below shows metrics names for
pezkuwichain (source relay chain) to BridgeHubzagros (target chain) teyrchains finality relay. For other chains, simply
change chain names. So the metrics are:
- `pezkuwichain_to_BridgeHubzagros_Teyrchains_best_teyrchain_block_number_at_source` - returns best known teyrchain block
number, registered in the `paras` pezpallet at the source relay chain (pezkuwichain in our example);
- `pezkuwichain_to_BridgeHubzagros_Teyrchains_best_teyrchain_block_number_at_target` - returns best known teyrchain block
number, registered in the bridge teyrchains pezpallet at the target chain (BridgeHubzagros in our example).
If relay operates properly, you should see that
the `pezkuwichain_to_BridgeHubzagros_Teyrchains_best_teyrchain_block_number_at_target` tries to reach
the `pezkuwichain_to_BridgeHubzagros_Teyrchains_best_teyrchain_block_number_at_source`.
And the latter one always increases.
+32
View File
@@ -0,0 +1,32 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use std::fmt::Debug;
use relay_bizinikiwi_client::{Chain, Teyrchain};
pub mod teyrchains_loop;
pub mod teyrchains_loop_metrics;
/// Finality proofs synchronization pipeline.
pub trait TeyrchainsPipeline: 'static + Clone + Debug + Send + Sync {
/// Relay chain which is storing teyrchain heads in its `paras` module.
type SourceRelayChain: Chain;
/// Teyrchain which headers we are syncing here.
type SourceTeyrchain: Teyrchain;
/// Target chain (either relay or para) which wants to know about new teyrchain heads.
type TargetChain: Chain;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,86 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use bp_pezkuwi_core::teyrchains::ParaId;
use relay_utils::{
metrics::{metric_name, register, Gauge, Metric, PrometheusError, Registry, U64},
UniqueSaturatedInto,
};
/// Teyrchains sync metrics.
#[derive(Clone)]
pub struct TeyrchainsLoopMetrics {
/// Best teyrchains header numbers at the source.
best_source_block_numbers: Gauge<U64>,
/// Best teyrchains header numbers at the target.
best_target_block_numbers: Gauge<U64>,
}
impl TeyrchainsLoopMetrics {
/// Create and register teyrchains loop metrics.
pub fn new(prefix: Option<&str>) -> Result<Self, PrometheusError> {
Ok(TeyrchainsLoopMetrics {
best_source_block_numbers: Gauge::new(
metric_name(prefix, "best_teyrchain_block_number_at_source"),
"Best teyrchain block numbers at the source relay chain".to_string(),
)?,
best_target_block_numbers: Gauge::new(
metric_name(prefix, "best_teyrchain_block_number_at_target"),
"Best teyrchain block numbers at the target chain".to_string(),
)?,
})
}
/// Update best block number at source.
pub fn update_best_teyrchain_block_at_source<Number: UniqueSaturatedInto<u64>>(
&self,
teyrchain: ParaId,
block_number: Number,
) {
let block_number = block_number.unique_saturated_into();
tracing::trace!(
target: "bridge-metrics",
?teyrchain,
?block_number,
"Updated value of metric 'best_teyrchain_block_number_at_source"
);
self.best_source_block_numbers.set(block_number);
}
/// Update best block number at target.
pub fn update_best_teyrchain_block_at_target<Number: UniqueSaturatedInto<u64>>(
&self,
teyrchain: ParaId,
block_number: Number,
) {
let block_number = block_number.unique_saturated_into();
tracing::trace!(
target: "bridge-metrics",
?teyrchain,
?block_number,
"Updated value of metric 'best_teyrchain_block_number_at_target"
);
self.best_target_block_numbers.set(block_number);
}
}
impl Metric for TeyrchainsLoopMetrics {
fn register(&self, registry: &Registry) -> Result<(), PrometheusError> {
register(self.best_source_block_numbers.clone(), registry)?;
register(self.best_target_block_numbers.clone(), registry)?;
Ok(())
}
}