Files
pezkuwi-subxt/historic/src/config/pezkuwi.rs
T
pezkuwichain 7af0bcd262 Complete rebrand: Polkadot→Pezkuwi, Substrate→Bizinikiwi
- Replace PolkadotConfig with PezkuwiConfig
- Replace SubstrateConfig with BizinikiwConfig
- Rename config module files (polkadot.rs→pezkuwi.rs, substrate.rs→bizinikiwi.rs)
- Update all documentation and examples
- All 165 files updated, cargo check passes
2025-12-21 21:42:34 +03:00

89 lines
2.8 KiB
Rust

use super::Config;
use super::BizinikiwConfig;
use scale_info_legacy::{ChainTypeRegistry, TypeRegistrySet};
use std::sync::Arc;
/// Configuration that's suitable for the Pezkuwi Relay Chain
pub struct PezkuwiConfig(BizinikiwConfig);
impl PezkuwiConfig {
/// Create a new PezkuwiConfig.
pub fn new() -> Self {
let config = BizinikiwConfig::new()
.set_legacy_types(frame_decode::legacy_types::pezkuwi::relay_chain());
// TODO: Set spec versions as well with known spec version changes, to speed
// up accessing historic blocks within the known ranges. For now, we just let
// the online client look these up on chain.
Self(config)
}
/// Set the metadata to be used for decoding blocks at the given spec versions.
pub fn set_metadata_for_spec_versions(
mut self,
ranges: impl Iterator<Item = (u32, frame_metadata::RuntimeMetadata)>,
) -> Self {
self = Self(self.0.set_metadata_for_spec_versions(ranges));
self
}
/// Given an iterator of block ranges to spec version of the form `(start, end, spec_version)`, add them
/// to this configuration.
pub fn set_spec_version_for_block_ranges(
mut self,
ranges: impl Iterator<Item = (u64, u64, u32)>,
) -> Self {
self = Self(self.0.set_spec_version_for_block_ranges(ranges));
self
}
}
/// This hands back the legacy types for the Pezkuwi Relay Chain, which is what [`PezkuwiConfig`] uses internally.
pub fn legacy_types() -> ChainTypeRegistry {
frame_decode::legacy_types::pezkuwi::relay_chain()
}
impl Default for PezkuwiConfig {
fn default() -> Self {
Self::new()
}
}
impl Config for PezkuwiConfig {
type Hash = <BizinikiwConfig as Config>::Hash;
fn legacy_types_for_spec_version(&'_ self, spec_version: u32) -> TypeRegistrySet<'_> {
self.0.legacy_types_for_spec_version(spec_version)
}
fn spec_version_for_block_number(&self, block_number: u64) -> Option<u32> {
self.0.spec_version_for_block_number(block_number)
}
fn metadata_for_spec_version(
&self,
spec_version: u32,
) -> Option<Arc<frame_metadata::RuntimeMetadata>> {
self.0.metadata_for_spec_version(spec_version)
}
fn set_metadata_for_spec_version(
&self,
spec_version: u32,
metadata: Arc<frame_metadata::RuntimeMetadata>,
) {
self.0.set_metadata_for_spec_version(spec_version, metadata)
}
fn hash(s: &[u8]) -> <Self as Config>::Hash {
BizinikiwConfig::hash(s)
}
}
impl pezkuwi_subxt_rpcs::RpcConfig for PezkuwiConfig {
type Hash = <BizinikiwConfig as pezkuwi_subxt_rpcs::RpcConfig>::Hash;
type Header = <BizinikiwConfig as pezkuwi_subxt_rpcs::RpcConfig>::Header;
type AccountId = <BizinikiwConfig as pezkuwi_subxt_rpcs::RpcConfig>::AccountId;
}