mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
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
This commit is contained in:
@@ -10,7 +10,7 @@ license.workspace = true
|
||||
repository.workspace = true
|
||||
documentation.workspace = true
|
||||
homepage.workspace = true
|
||||
description = "Subxt integration tests that rely on the Substrate binary"
|
||||
description = "Subxt integration tests that rely on the Bizinikiwi binary"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
@@ -42,7 +42,7 @@ regex = { workspace = true }
|
||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||
scale-value = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
substrate-runner = { workspace = true }
|
||||
bizinikiwi-runner = { workspace = true }
|
||||
subxt-test-macro = { path = "subxt-test-macro" }
|
||||
syn = { workspace = true }
|
||||
test-runtime = { workspace = true }
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::utils::node_runtime;
|
||||
#[cfg(fullclient)]
|
||||
use pezkuwi_subxt::{
|
||||
config::{
|
||||
DefaultExtrinsicParamsBuilder, SubstrateConfig,
|
||||
DefaultExtrinsicParamsBuilder, BizinikiwConfig,
|
||||
transaction_extensions::{ChargeAssetTxPayment, CheckMortality, CheckNonce},
|
||||
},
|
||||
utils::Era,
|
||||
@@ -268,9 +268,9 @@ async fn fetch_block_and_decode_extrinsic_details() {
|
||||
/// A helper function to submit a transaction with some params and then get it back in a block,
|
||||
/// so that we can test the decoding of it.
|
||||
async fn submit_extrinsic_and_get_it_back(
|
||||
api: &pezkuwi_subxt::OnlineClient<SubstrateConfig>,
|
||||
params: pezkuwi_subxt::config::DefaultExtrinsicParamsBuilder<SubstrateConfig>,
|
||||
) -> pezkuwi_subxt::blocks::ExtrinsicDetails<SubstrateConfig, pezkuwi_subxt::OnlineClient<SubstrateConfig>> {
|
||||
api: &pezkuwi_subxt::OnlineClient<BizinikiwConfig>,
|
||||
params: pezkuwi_subxt::config::DefaultExtrinsicParamsBuilder<BizinikiwConfig>,
|
||||
) -> pezkuwi_subxt::blocks::ExtrinsicDetails<BizinikiwConfig, pezkuwi_subxt::OnlineClient<BizinikiwConfig>> {
|
||||
let alice = dev::alice();
|
||||
let bob = dev::bob();
|
||||
|
||||
@@ -313,7 +313,7 @@ async fn decode_transaction_extensions_from_blocks() {
|
||||
let nonce1_static = extensions1.find::<CheckNonce>().unwrap().unwrap();
|
||||
let tip1 = extensions1.tip().unwrap();
|
||||
let tip1_static: u128 = extensions1
|
||||
.find::<ChargeAssetTxPayment<SubstrateConfig>>()
|
||||
.find::<ChargeAssetTxPayment<BizinikiwConfig>>()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.tip();
|
||||
@@ -326,7 +326,7 @@ async fn decode_transaction_extensions_from_blocks() {
|
||||
let nonce2_static = extensions2.find::<CheckNonce>().unwrap().unwrap();
|
||||
let tip2 = extensions2.tip().unwrap();
|
||||
let tip2_static: u128 = extensions2
|
||||
.find::<ChargeAssetTxPayment<SubstrateConfig>>()
|
||||
.find::<ChargeAssetTxPayment<BizinikiwConfig>>()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.tip();
|
||||
@@ -393,7 +393,7 @@ async fn decode_block_mortality() {
|
||||
let mortality = tx
|
||||
.transaction_extensions()
|
||||
.unwrap()
|
||||
.find::<CheckMortality<SubstrateConfig>>()
|
||||
.find::<CheckMortality<BizinikiwConfig>>()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
@@ -411,7 +411,7 @@ async fn decode_block_mortality() {
|
||||
let mortality = tx
|
||||
.transaction_extensions()
|
||||
.unwrap()
|
||||
.find::<CheckMortality<SubstrateConfig>>()
|
||||
.find::<CheckMortality<BizinikiwConfig>>()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
@@ -429,7 +429,7 @@ async fn decode_block_mortality() {
|
||||
let mortality = tx
|
||||
.transaction_extensions()
|
||||
.unwrap()
|
||||
.find::<CheckMortality<SubstrateConfig>>()
|
||||
.find::<CheckMortality<BizinikiwConfig>>()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ async fn external_signing() {
|
||||
|
||||
#[cfg(fullclient)]
|
||||
// TODO: Investigate and fix this test failure when using the ChainHeadBackend.
|
||||
// (https://github.com/paritytech/subxt/issues/1308)
|
||||
// (https://github.com/pezkuwichain/subxt/issues/1308)
|
||||
#[cfg(legacy_backend)]
|
||||
#[subxt_test]
|
||||
async fn submit_large_extrinsic() {
|
||||
@@ -267,7 +267,7 @@ async fn decode_a_module_error() {
|
||||
}
|
||||
|
||||
#[subxt_test]
|
||||
async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
|
||||
async fn unsigned_extrinsic_is_same_shape_as_pezkuwijs() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
|
||||
@@ -280,8 +280,8 @@ async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
|
||||
let actual_tx_bytes = actual_tx.encoded();
|
||||
|
||||
// How these were obtained:
|
||||
// - start local substrate node.
|
||||
// - open polkadot.js UI in browser and point at local node.
|
||||
// - start local bizinikiwi node.
|
||||
// - open pezkuwi.js UI in browser and point at local node.
|
||||
// - open dev console (may need to refresh page now) and find the WS connection.
|
||||
// - create a balances.transferAllowDeath to ALICE (doesn't matter who from) with 12345 and "submit unsigned".
|
||||
// - find the submitAndWatchExtrinsic call in the WS connection to get these bytes:
|
||||
@@ -290,7 +290,7 @@ async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Make sure our encoding is the same as the encoding polkadot UI created.
|
||||
// Make sure our encoding is the same as the encoding pezkuwi UI created.
|
||||
assert_eq!(actual_tx_bytes, expected_tx_bytes);
|
||||
}
|
||||
|
||||
@@ -393,8 +393,8 @@ async fn partial_fee_estimate_correct() {
|
||||
|
||||
// This test runs OK locally but fails sporadically in CI eg:
|
||||
//
|
||||
// https://github.com/paritytech/subxt/actions/runs/13374953009/job/37353887719?pr=1910#step:7:178
|
||||
// https://github.com/paritytech/subxt/actions/runs/13385878645/job/37382498200#step:6:163
|
||||
// https://github.com/pezkuwichain/subxt/actions/runs/13374953009/job/37353887719?pr=1910#step:7:178
|
||||
// https://github.com/pezkuwichain/subxt/actions/runs/13385878645/job/37382498200#step:6:163
|
||||
//
|
||||
// While those errors were timeouts, I also saw errors like "intersections size is 1".
|
||||
/*
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
/// Generate by running this at the root of the repository:
|
||||
///
|
||||
/// ```text
|
||||
/// cargo run --bin subxt -- codegen --file artifacts/polkadot_metadata_full.scale | rustfmt > testing/integration-tests/src/full_client/codegen/polkadot.rs
|
||||
/// cargo run --bin subxt -- codegen --file artifacts/pezkuwi_metadata_full.scale | rustfmt > testing/integration-tests/src/full_client/codegen/pezkuwi.rs
|
||||
/// ```
|
||||
#[rustfmt::skip]
|
||||
#[allow(clippy::all)]
|
||||
mod polkadot;
|
||||
mod pezkuwi;
|
||||
|
||||
mod documentation;
|
||||
|
||||
+830
-830
File diff suppressed because one or more lines are too long
@@ -17,9 +17,9 @@ use scale_info::{
|
||||
build::{Fields, Variants},
|
||||
meta_type,
|
||||
};
|
||||
use pezkuwi_subxt::{Metadata, OfflineClient, OnlineClient, SubstrateConfig};
|
||||
use pezkuwi_subxt::{Metadata, OfflineClient, OnlineClient, BizinikiwConfig};
|
||||
|
||||
async fn fetch_v15_metadata(client: &OnlineClient<SubstrateConfig>) -> RuntimeMetadataV15 {
|
||||
async fn fetch_v15_metadata(client: &OnlineClient<BizinikiwConfig>) -> RuntimeMetadataV15 {
|
||||
let payload = node_runtime::apis().metadata().metadata_at_version(15);
|
||||
let runtime_metadata_bytes = client
|
||||
.runtime_api()
|
||||
@@ -40,7 +40,7 @@ async fn fetch_v15_metadata(client: &OnlineClient<SubstrateConfig>) -> RuntimeMe
|
||||
v15_metadata
|
||||
}
|
||||
|
||||
async fn metadata_to_api(metadata: Metadata, ctx: &TestContext) -> OfflineClient<SubstrateConfig> {
|
||||
async fn metadata_to_api(metadata: Metadata, ctx: &TestContext) -> OfflineClient<BizinikiwConfig> {
|
||||
OfflineClient::new(
|
||||
ctx.client().genesis_hash(),
|
||||
ctx.client().runtime_version(),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
// TODO: Re-enable these once V16 is stable in Substrate nightlies,
|
||||
// TODO: Re-enable these once V16 is stable in Bizinikiwi nightlies,
|
||||
// and test-runtime is updated to pull in V16 metadata by default.
|
||||
/*
|
||||
use crate::{subxt_test, test_context};
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{subxt_test, test_context};
|
||||
use frame_decode::extrinsics::ExtrinsicType;
|
||||
use pezkuwi_subxt_signer::sr25519::dev;
|
||||
|
||||
// TODO: When VerifySignature exists on the substrate kitchensink runtime,
|
||||
// TODO: When VerifySignature exists on the bizinikiwi kitchensink runtime,
|
||||
// let's try actuallty submitting v4 and v5 signed extrinsics to verify that
|
||||
// they are actually accepted by the node.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
//! using `OnceCell`. However, during the initialization, tokio::spawn is used
|
||||
//! to multiplex between subxt requests and node responses. The #[tokio::test]
|
||||
//! macro internally creates a new Runtime for each individual test. This means
|
||||
//! that only the first test, which spawns the substrate binary and synchronizes
|
||||
//! that only the first test, which spawns the bizinikiwi binary and synchronizes
|
||||
//! the light client, would have access to the background task. The cleanup process
|
||||
//! would destroy the spawned background task, preventing subsequent tests from
|
||||
//! accessing it.
|
||||
@@ -33,13 +33,13 @@ use std::sync::Arc;
|
||||
use pezkuwi_subxt::backend::chain_head::ChainHeadBackend;
|
||||
use pezkuwi_subxt::backend::rpc::RpcClient;
|
||||
use pezkuwi_subxt::dynamic::Value;
|
||||
use pezkuwi_subxt::{client::OnlineClient, config::PolkadotConfig, lightclient::LightClient};
|
||||
use pezkuwi_subxt::{client::OnlineClient, config::PezkuwiConfig, lightclient::LightClient};
|
||||
use pezkuwi_subxt_metadata::Metadata;
|
||||
|
||||
type Client = OnlineClient<PolkadotConfig>;
|
||||
type Client = OnlineClient<PezkuwiConfig>;
|
||||
|
||||
/// The Polkadot chainspec.
|
||||
const POLKADOT_SPEC: &str = include_str!("../../../../artifacts/demo_chain_specs/polkadot.json");
|
||||
/// The Pezkuwi chainspec.
|
||||
const POLKADOT_SPEC: &str = include_str!("../../../../artifacts/demo_chain_specs/pezkuwi.json");
|
||||
|
||||
// Check that we can subscribe to non-finalized blocks.
|
||||
async fn non_finalized_headers_subscription(api: &Client) -> Result<(), pezkuwi_subxt::Error> {
|
||||
@@ -165,11 +165,11 @@ async fn dynamic_events(api: &Client) -> Result<(), pezkuwi_subxt::Error> {
|
||||
}
|
||||
|
||||
async fn run_test(backend: BackendType) -> Result<(), pezkuwi_subxt::Error> {
|
||||
// Note: This code fetches the chainspec from the Polkadot public RPC node.
|
||||
// Note: This code fetches the chainspec from the Pezkuwi public RPC node.
|
||||
// This is not recommended for production use, as it may be slow and unreliable.
|
||||
// However, this can come in handy for testing purposes.
|
||||
//
|
||||
// let chainspec = pezkuwi_subxt::utils::fetch_chainspec_from_rpc_node("wss://rpc.polkadot.io:443")
|
||||
// let chainspec = pezkuwi_subxt::utils::fetch_chainspec_from_rpc_node("wss://rpc.pezkuwi.io:443")
|
||||
// .await
|
||||
// .unwrap();
|
||||
// let chain_config = chainspec.get();
|
||||
@@ -182,7 +182,7 @@ async fn run_test(backend: BackendType) -> Result<(), pezkuwi_subxt::Error> {
|
||||
BackendType::Unstable => {
|
||||
let backend =
|
||||
ChainHeadBackend::builder().build_with_background_driver(RpcClient::new(rpc));
|
||||
let api: OnlineClient<PolkadotConfig> =
|
||||
let api: OnlineClient<PezkuwiConfig> =
|
||||
OnlineClient::from_backend(Arc::new(backend)).await?;
|
||||
api
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
pub(crate) use crate::{node_runtime, utils::TestNodeProcess};
|
||||
|
||||
use pezkuwi_subxt::SubstrateConfig;
|
||||
use pezkuwi_subxt::BizinikiwConfig;
|
||||
use pezkuwi_subxt::client::OnlineClient;
|
||||
|
||||
use super::node_proc::RpcClientKind;
|
||||
|
||||
/// `substrate-node` should be installed on the $PATH. We fall back
|
||||
/// to also checking for an older `substrate` binary.
|
||||
const SUBSTRATE_NODE_PATHS: &str = "substrate-node,substrate";
|
||||
/// `bizinikiwi-node` should be installed on the $PATH. We fall back
|
||||
/// to also checking for an older `bizinikiwi` binary.
|
||||
const SUBSTRATE_NODE_PATHS: &str = "bizinikiwi-node,bizinikiwi";
|
||||
|
||||
pub async fn test_context_with(authority: String, rpc_client_kind: RpcClientKind) -> TestContext {
|
||||
let paths =
|
||||
@@ -21,14 +21,14 @@ pub async fn test_context_with(authority: String, rpc_client_kind: RpcClientKind
|
||||
let mut proc = TestContext::build(&paths);
|
||||
proc.with_authority(authority);
|
||||
proc.with_rpc_client_kind(rpc_client_kind);
|
||||
proc.spawn::<SubstrateConfig>().await.unwrap()
|
||||
proc.spawn::<BizinikiwConfig>().await.unwrap()
|
||||
}
|
||||
|
||||
pub type TestConfig = SubstrateConfig;
|
||||
pub type TestConfig = BizinikiwConfig;
|
||||
|
||||
pub type TestContext = TestNodeProcess<SubstrateConfig>;
|
||||
pub type TestContext = TestNodeProcess<BizinikiwConfig>;
|
||||
|
||||
pub type TestClient = OnlineClient<SubstrateConfig>;
|
||||
pub type TestClient = OnlineClient<BizinikiwConfig>;
|
||||
|
||||
pub async fn test_context() -> TestContext {
|
||||
test_context_with("alice".to_string(), RpcClientKind::Legacy).await
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::cell::RefCell;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use substrate_runner::SubstrateNode;
|
||||
use bizinikiwi_runner::BizinikiwiNode;
|
||||
use pezkuwi_subxt::backend::rpc::reconnecting_rpc_client::{ExponentialBackoff, RpcClientBuilder};
|
||||
use pezkuwi_subxt::{
|
||||
Config, OnlineClient,
|
||||
@@ -35,10 +35,10 @@ fn get_url(port: Option<u16>) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Spawn a local substrate node for testing subxt.
|
||||
/// Spawn a local bizinikiwi node for testing subxt.
|
||||
pub struct TestNodeProcess<R: Config> {
|
||||
// Keep a handle to the node; once it's dropped the node is killed.
|
||||
proc: Option<SubstrateNode>,
|
||||
proc: Option<BizinikiwiNode>,
|
||||
|
||||
// Lazily construct these when asked for.
|
||||
chainhead_backend: RefCell<Option<OnlineClient<R>>>,
|
||||
@@ -165,14 +165,14 @@ impl TestNodeProcessBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Spawn the substrate node at the given path, and wait for rpc to be initialized.
|
||||
/// Spawn the bizinikiwi node at the given path, and wait for rpc to be initialized.
|
||||
pub async fn spawn<R>(self) -> Result<TestNodeProcess<R>, String>
|
||||
where
|
||||
R: Config,
|
||||
{
|
||||
// Only spawn a process if a URL to target wasn't provided as an env var.
|
||||
let proc = if !is_url_provided() {
|
||||
let mut node_builder = SubstrateNode::builder();
|
||||
let mut node_builder = BizinikiwiNode::builder();
|
||||
node_builder.binary_paths(&self.node_paths);
|
||||
|
||||
if let Some(authority) = &self.authority {
|
||||
@@ -267,14 +267,14 @@ async fn build_chainhead_backend<T: Config>(
|
||||
|
||||
#[cfg(lightclient)]
|
||||
async fn build_light_client<T: Config>(
|
||||
maybe_proc: &Option<SubstrateNode>,
|
||||
maybe_proc: &Option<BizinikiwiNode>,
|
||||
) -> Result<OnlineClient<T>, String> {
|
||||
use pezkuwi_subxt::lightclient::{ChainConfig, LightClient};
|
||||
|
||||
let proc = if let Some(proc) = maybe_proc {
|
||||
proc
|
||||
} else {
|
||||
return Err("Cannot build light client: no substrate node is running (you can't start a light client when pointing to an external node)".into());
|
||||
return Err("Cannot build light client: no bizinikiwi node is running (you can't start a light client when pointing to an external node)".into());
|
||||
};
|
||||
|
||||
// RPC endpoint. Only localhost works.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use pezkuwi_subxt::{
|
||||
Config, OnlineClient, SubstrateConfig, backend::StreamOf, blocks::Block, client::OnlineClientT,
|
||||
Config, OnlineClient, BizinikiwConfig, backend::StreamOf, blocks::Block, client::OnlineClientT,
|
||||
error::BackendError,
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ pub async fn wait_for_number_of_blocks<C: Config>(
|
||||
/// and one relies on something to included in finalized block in ner future.
|
||||
pub async fn consume_initial_blocks(
|
||||
blocks: &mut StreamOf<
|
||||
Result<Block<SubstrateConfig, OnlineClient<SubstrateConfig>>, BackendError>,
|
||||
Result<Block<BizinikiwConfig, OnlineClient<BizinikiwConfig>>, BackendError>,
|
||||
>,
|
||||
) {
|
||||
use tokio::time::{Duration, Instant, interval_at};
|
||||
|
||||
@@ -37,7 +37,7 @@ fn compile_test() {
|
||||
let bytes: alloc::vec::Vec<u8> = alloc::vec![0, 1, 2, 3, 4];
|
||||
pezkuwi_subxt_metadata::Metadata::decode(&mut &bytes[..]).expect_err("invalid byte sequence");
|
||||
|
||||
const METADATA: &[u8] = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
|
||||
const METADATA: &[u8] = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
|
||||
pezkuwi_subxt_metadata::Metadata::decode(&mut &METADATA[..]).expect("should be valid metadata");
|
||||
|
||||
// Subxt signer compiles (though nothing much works on this particular nostd target...):
|
||||
@@ -68,7 +68,7 @@ fn compile_test() {
|
||||
}
|
||||
|
||||
#[pezkuwi_subxt_macro::subxt(
|
||||
runtime_metadata_path = "../../artifacts/polkadot_metadata_full.scale",
|
||||
runtime_metadata_path = "../../artifacts/pezkuwi_metadata_full.scale",
|
||||
crate = "::pezkuwi_subxt_core"
|
||||
)]
|
||||
pub mod polkadot {}
|
||||
pub mod pezkuwi {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "substrate-runner"
|
||||
name = "bizinikiwi-runner"
|
||||
version.workspace = true
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# substrate-runner
|
||||
# bizinikiwi-runner
|
||||
|
||||
A small crate whose sole purpose is starting up a substrate node on some free port and handing back a handle to it with the port that it started on.
|
||||
A small crate whose sole purpose is starting up a bizinikiwi node on some free port and handing back a handle to it with the port that it started on.
|
||||
@@ -16,15 +16,15 @@ impl std::fmt::Display for Error {
|
||||
Error::Io(err) => write!(f, "IO error: {err}"),
|
||||
Error::CouldNotExtractPort(log) => write!(
|
||||
f,
|
||||
"could not extract port from running substrate node's stdout: {log}"
|
||||
"could not extract port from running bizinikiwi node's stdout: {log}"
|
||||
),
|
||||
Error::CouldNotExtractP2pAddress(log) => write!(
|
||||
f,
|
||||
"could not extract p2p address from running substrate node's stdout: {log}"
|
||||
"could not extract p2p address from running bizinikiwi node's stdout: {log}"
|
||||
),
|
||||
Error::CouldNotExtractP2pPort(log) => write!(
|
||||
f,
|
||||
"could not extract p2p port from running substrate node's stdout: {log}"
|
||||
"could not extract p2p port from running bizinikiwi node's stdout: {log}"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,40 +14,40 @@ pub use error::Error;
|
||||
|
||||
type CowStr = Cow<'static, str>;
|
||||
|
||||
pub struct SubstrateNodeBuilder {
|
||||
pub struct BizinikiwiNodeBuilder {
|
||||
binary_paths: Vec<OsString>,
|
||||
custom_flags: HashMap<CowStr, Option<CowStr>>,
|
||||
}
|
||||
|
||||
impl Default for SubstrateNodeBuilder {
|
||||
impl Default for BizinikiwiNodeBuilder {
|
||||
fn default() -> Self {
|
||||
SubstrateNodeBuilder::new()
|
||||
BizinikiwiNodeBuilder::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl SubstrateNodeBuilder {
|
||||
/// Configure a new Substrate node.
|
||||
impl BizinikiwiNodeBuilder {
|
||||
/// Configure a new Bizinikiwi node.
|
||||
pub fn new() -> Self {
|
||||
SubstrateNodeBuilder {
|
||||
BizinikiwiNodeBuilder {
|
||||
binary_paths: vec![],
|
||||
custom_flags: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Provide "substrate-node" and "substrate" as binary paths
|
||||
pub fn substrate(&mut self) -> &mut Self {
|
||||
self.binary_paths = vec!["substrate-node".into(), "substrate".into()];
|
||||
/// Provide "bizinikiwi-node" and "bizinikiwi" as binary paths
|
||||
pub fn bizinikiwi(&mut self) -> &mut Self {
|
||||
self.binary_paths = vec!["bizinikiwi-node".into(), "bizinikiwi".into()];
|
||||
self
|
||||
}
|
||||
|
||||
/// Provide "polkadot" as binary path.
|
||||
pub fn polkadot(&mut self) -> &mut Self {
|
||||
self.binary_paths = vec!["polkadot".into()];
|
||||
/// Provide "pezkuwi" as binary path.
|
||||
pub fn pezkuwi(&mut self) -> &mut Self {
|
||||
self.binary_paths = vec!["pezkuwi".into()];
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the path to the `substrate` binary; defaults to "substrate-node"
|
||||
/// or "substrate".
|
||||
/// Set the path to the `bizinikiwi` binary; defaults to "bizinikiwi-node"
|
||||
/// or "bizinikiwi".
|
||||
pub fn binary_paths<Paths, S>(&mut self, paths: Paths) -> &mut Self
|
||||
where
|
||||
Paths: IntoIterator<Item = S>,
|
||||
@@ -70,7 +70,7 @@ impl SubstrateNodeBuilder {
|
||||
}
|
||||
|
||||
/// Spawn the node, handing back an object which, when dropped, will stop it.
|
||||
pub fn spawn(mut self) -> Result<SubstrateNode, Error> {
|
||||
pub fn spawn(mut self) -> Result<BizinikiwiNode, Error> {
|
||||
// Try to spawn the binary at each path, returning the
|
||||
// first "ok" or last error that we encountered.
|
||||
let mut res = Err(io::Error::other("No binary path provided"));
|
||||
@@ -85,7 +85,7 @@ impl SubstrateNodeBuilder {
|
||||
self.custom_flags
|
||||
.insert("base-path".into(), Some(path.clone().into()));
|
||||
|
||||
res = SubstrateNodeBuilder::try_spawn(binary_path, &self.custom_flags);
|
||||
res = BizinikiwiNodeBuilder::try_spawn(binary_path, &self.custom_flags);
|
||||
if res.is_ok() {
|
||||
bin_path.clone_from(binary_path);
|
||||
break;
|
||||
@@ -99,13 +99,13 @@ impl SubstrateNodeBuilder {
|
||||
|
||||
// Wait for RPC port to be logged (it's logged to stderr).
|
||||
let stderr = proc.stderr.take().unwrap();
|
||||
let running_node = try_find_substrate_port_from_output(stderr);
|
||||
let running_node = try_find_bizinikiwi_port_from_output(stderr);
|
||||
|
||||
let ws_port = running_node.ws_port()?;
|
||||
let p2p_address = running_node.p2p_address()?;
|
||||
let p2p_port = running_node.p2p_port()?;
|
||||
|
||||
Ok(SubstrateNode {
|
||||
Ok(BizinikiwiNode {
|
||||
binary_path: bin_path,
|
||||
custom_flags: self.custom_flags,
|
||||
proc,
|
||||
@@ -144,7 +144,7 @@ impl SubstrateNodeBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SubstrateNode {
|
||||
pub struct BizinikiwiNode {
|
||||
binary_path: OsString,
|
||||
custom_flags: HashMap<CowStr, Option<CowStr>>,
|
||||
proc: process::Child,
|
||||
@@ -154,10 +154,10 @@ pub struct SubstrateNode {
|
||||
base_path: String,
|
||||
}
|
||||
|
||||
impl SubstrateNode {
|
||||
/// Configure and spawn a new [`SubstrateNode`].
|
||||
pub fn builder() -> SubstrateNodeBuilder {
|
||||
SubstrateNodeBuilder::new()
|
||||
impl BizinikiwiNode {
|
||||
/// Configure and spawn a new [`BizinikiwiNode`].
|
||||
pub fn builder() -> BizinikiwiNodeBuilder {
|
||||
BizinikiwiNodeBuilder::new()
|
||||
}
|
||||
|
||||
/// Return the ID of the running process.
|
||||
@@ -235,16 +235,16 @@ impl SubstrateNode {
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for SubstrateNode {
|
||||
impl Drop for BizinikiwiNode {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.kill();
|
||||
self.cleanup()
|
||||
}
|
||||
}
|
||||
|
||||
// Consume a stderr reader from a spawned substrate command and
|
||||
// Consume a stderr reader from a spawned bizinikiwi command and
|
||||
// locate the port number that is logged out to it.
|
||||
fn try_find_substrate_port_from_output(r: impl Read + Send + 'static) -> SubstrateNodeInfo {
|
||||
fn try_find_bizinikiwi_port_from_output(r: impl Read + Send + 'static) -> BizinikiwiNodeInfo {
|
||||
let mut port = None;
|
||||
let mut p2p_address = None;
|
||||
let mut p2p_port = None;
|
||||
@@ -321,7 +321,7 @@ fn try_find_substrate_port_from_output(r: impl Read + Send + 'static) -> Substra
|
||||
}
|
||||
}
|
||||
|
||||
SubstrateNodeInfo {
|
||||
BizinikiwiNodeInfo {
|
||||
ws_port: port,
|
||||
p2p_address,
|
||||
p2p_port,
|
||||
@@ -331,14 +331,14 @@ fn try_find_substrate_port_from_output(r: impl Read + Send + 'static) -> Substra
|
||||
|
||||
/// Data extracted from the running node's stdout.
|
||||
#[derive(Debug)]
|
||||
pub struct SubstrateNodeInfo {
|
||||
pub struct BizinikiwiNodeInfo {
|
||||
ws_port: Option<u16>,
|
||||
p2p_address: Option<String>,
|
||||
p2p_port: Option<u32>,
|
||||
log: String,
|
||||
}
|
||||
|
||||
impl SubstrateNodeInfo {
|
||||
impl BizinikiwiNodeInfo {
|
||||
pub fn ws_port(&self) -> Result<u16, Error> {
|
||||
self.ws_port
|
||||
.ok_or_else(|| Error::CouldNotExtractPort(self.log.clone()))
|
||||
|
||||
@@ -16,7 +16,7 @@ jsonrpsee = { workspace = true, features = [
|
||||
"client-ws-transport-tls",
|
||||
] }
|
||||
serde = { workspace = true }
|
||||
substrate-runner = { workspace = true }
|
||||
bizinikiwi-runner = { workspace = true }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
||||
tokio-util = { workspace = true, features = ["compat"] }
|
||||
which = { workspace = true }
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
The logic for this crate exists mainly in the `build.rs` file.
|
||||
|
||||
At compile time, this crate will:
|
||||
- Spin up a local `substrate` binary (set the `SUBSTRATE_NODE_PATH` env var to point to a custom binary, otherwise it'll look for `substrate` on your PATH).
|
||||
- Spin up a local `bizinikiwi` binary (set the `SUBSTRATE_NODE_PATH` env var to point to a custom binary, otherwise it'll look for `bizinikiwi` on your PATH).
|
||||
- Obtain metadata from this node.
|
||||
- Export the metadata and a `node_runtime` module which has been annotated using the `subxt` proc macro and is based off the above metadata.
|
||||
|
||||
The reason for doing this is that our integration tests (which also spin up a Substrate node) can then use the generated `subxt` types from the exact node being tested against, so that we don't have to worry about metadata getting out of sync with the binary under test.
|
||||
The reason for doing this is that our integration tests (which also spin up a Bizinikiwi node) can then use the generated `subxt` types from the exact node being tested against, so that we don't have to worry about metadata getting out of sync with the binary under test.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use std::{env, fs, path::Path};
|
||||
use substrate_runner::{Error as SubstrateNodeError, SubstrateNode};
|
||||
use bizinikiwi_runner::{Error as BizinikiwiNodeError, BizinikiwiNode};
|
||||
|
||||
// This variable accepts a single binary name or comma separated list.
|
||||
static SUBSTRATE_BIN_ENV_VAR: &str = "SUBSTRATE_NODE_PATH";
|
||||
@@ -17,24 +17,24 @@ async fn main() {
|
||||
}
|
||||
|
||||
async fn run() {
|
||||
// Select substrate binary to run based on env var.
|
||||
let substrate_bins: String =
|
||||
env::var(SUBSTRATE_BIN_ENV_VAR).unwrap_or_else(|_| "substrate-node,substrate".to_owned());
|
||||
let substrate_bins_vec: Vec<&str> = substrate_bins.split(',').map(|s| s.trim()).collect();
|
||||
// Select bizinikiwi binary to run based on env var.
|
||||
let bizinikiwi_bins: String =
|
||||
env::var(SUBSTRATE_BIN_ENV_VAR).unwrap_or_else(|_| "bizinikiwi-node,bizinikiwi".to_owned());
|
||||
let bizinikiwi_bins_vec: Vec<&str> = bizinikiwi_bins.split(',').map(|s| s.trim()).collect();
|
||||
|
||||
let mut node_builder = SubstrateNode::builder();
|
||||
node_builder.binary_paths(substrate_bins_vec.iter());
|
||||
let mut node_builder = BizinikiwiNode::builder();
|
||||
node_builder.binary_paths(bizinikiwi_bins_vec.iter());
|
||||
|
||||
let node = match node_builder.spawn() {
|
||||
Ok(node) => node,
|
||||
Err(SubstrateNodeError::Io(e)) if e.kind() == std::io::ErrorKind::NotFound => {
|
||||
Err(BizinikiwiNodeError::Io(e)) if e.kind() == std::io::ErrorKind::NotFound => {
|
||||
panic!(
|
||||
"A substrate binary should be installed on your path for testing purposes. \
|
||||
See https://github.com/paritytech/subxt/tree/master#integration-testing"
|
||||
"A bizinikiwi binary should be installed on your path for testing purposes. \
|
||||
See https://github.com/pezkuwichain/subxt/tree/master#integration-testing"
|
||||
)
|
||||
}
|
||||
Err(e) => {
|
||||
panic!("Cannot spawn substrate command from any of {substrate_bins_vec:?}: {e}")
|
||||
panic!("Cannot spawn bizinikiwi command from any of {bizinikiwi_bins_vec:?}: {e}")
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ async fn run() {
|
||||
// and so we need to spit it out here and include it verbatim instead.
|
||||
let runtime_api_contents = format!(
|
||||
r#"
|
||||
/// Generated types for the locally running Substrate node using V15 metadata.
|
||||
/// Generated types for the locally running Bizinikiwi node using V15 metadata.
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "{stable_metadata_path}",
|
||||
derive_for_all_types = "Eq, PartialEq",
|
||||
@@ -63,16 +63,16 @@ async fn run() {
|
||||
let runtime_path = Path::new(&out_dir).join("runtime.rs");
|
||||
fs::write(runtime_path, runtime_api_contents).expect("Couldn't write runtime rust output");
|
||||
|
||||
for substrate_node_path in substrate_bins_vec {
|
||||
let Ok(full_path) = which::which(substrate_node_path) else {
|
||||
for bizinikiwi_node_path in bizinikiwi_bins_vec {
|
||||
let Ok(full_path) = which::which(bizinikiwi_node_path) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
// Re-build if the substrate binary we're pointed to changes (mtime):
|
||||
// Re-build if the bizinikiwi binary we're pointed to changes (mtime):
|
||||
println!("cargo:rerun-if-changed={}", full_path.to_string_lossy());
|
||||
}
|
||||
|
||||
// Re-build if we point to a different substrate binary:
|
||||
// Re-build if we point to a different bizinikiwi binary:
|
||||
println!("cargo:rerun-if-env-changed={SUBSTRATE_BIN_ENV_VAR}");
|
||||
// Re-build if this file changes:
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
/// The SCALE encoded metadata obtained from a local run of a substrate node.
|
||||
/// The SCALE encoded metadata obtained from a local run of a bizinikiwi node.
|
||||
pub static METADATA: &[u8] = include_bytes!(concat!(
|
||||
env!("OUT_DIR"),
|
||||
"/test_node_runtime_metadata_v15.scale"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use codec::{Decode};
|
||||
use pezkuwi_subxt::{config::substrate::H256, OfflineClient, PolkadotConfig};
|
||||
use pezkuwi_subxt::{config::bizinikiwi::H256, OfflineClient, PezkuwiConfig};
|
||||
use pezkuwi_subxt_metadata::Metadata;
|
||||
|
||||
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../../../../artifacts/metadata_with_custom_values.scale", derive_for_all_types = "Eq, PartialEq")]
|
||||
@@ -29,7 +29,7 @@ fn main() {
|
||||
assert_eq!(vec![0,1,2,3], custom_bytes);
|
||||
}
|
||||
|
||||
fn construct_offline_client() -> OfflineClient<PolkadotConfig> {
|
||||
fn construct_offline_client() -> OfflineClient<PezkuwiConfig> {
|
||||
let genesis_hash = {
|
||||
let h = "91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3";
|
||||
let bytes = hex::decode(h).unwrap();
|
||||
@@ -44,5 +44,5 @@ fn construct_offline_client() -> OfflineClient<PolkadotConfig> {
|
||||
let bytes = std::fs::read("../../../../artifacts/metadata_with_custom_values.scale").unwrap();
|
||||
Metadata::decode(&mut &*bytes).unwrap()
|
||||
};
|
||||
OfflineClient::<PolkadotConfig>::new(genesis_hash, runtime_version, metadata)
|
||||
OfflineClient::<PezkuwiConfig>::new(genesis_hash, runtime_version, metadata)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ pub struct Second<T, U>(T, U);
|
||||
pub struct DoesntImplEncodeDecodeAsType(u16);
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// Discarding both params:
|
||||
@@ -30,7 +30,7 @@ pub struct DoesntImplEncodeDecodeAsType(u16);
|
||||
pub mod node_runtime {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// Discarding second param:
|
||||
@@ -40,7 +40,7 @@ pub mod node_runtime {}
|
||||
pub mod node_runtime2 {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// Discarding first param:
|
||||
@@ -50,7 +50,7 @@ pub mod node_runtime2 {}
|
||||
pub mod node_runtime3 {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// Swapping params:
|
||||
@@ -60,7 +60,7 @@ pub mod node_runtime3 {}
|
||||
pub mod node_runtime4 {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress",
|
||||
// Ignore input params and just use concrete types on output:
|
||||
@@ -70,7 +70,7 @@ pub mod node_runtime4 {}
|
||||
pub mod node_runtime5 {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// We can put a static type in, too:
|
||||
@@ -80,7 +80,7 @@ pub mod node_runtime5 {}
|
||||
pub mod node_runtime6 {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// Check that things can be wrapped in our Static type:
|
||||
@@ -90,7 +90,7 @@ pub mod node_runtime6 {}
|
||||
pub mod node_runtime7 {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
// Recursive type param substitution should work too (swapping out nested A and B):
|
||||
@@ -100,7 +100,7 @@ pub mod node_runtime7 {}
|
||||
pub mod node_runtime8 {}
|
||||
|
||||
fn main() {
|
||||
// We assume Polkadot's config of MultiAddress<AccountId32, ()> here
|
||||
// We assume Pezkuwi's config of MultiAddress<AccountId32, ()> here
|
||||
let _ = node_runtime::tx()
|
||||
.balances()
|
||||
.transfer_allow_death(CustomAddress(1337), 123);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../../../../artifacts/polkadot_metadata_tiny.scale")]
|
||||
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_tiny.scale")]
|
||||
pub mod node_runtime {
|
||||
pub struct SomeStruct;
|
||||
pub enum SomeEnum {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#[pezkuwi_subxt::subxt(runtime_path = "../../../../artifacts/westend_runtime.wasm")]
|
||||
#[pezkuwi_subxt::subxt(runtime_path = "../../../../artifacts/zagros_runtime.wasm")]
|
||||
mod runtime {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(runtime_path = "../../../../artifacts/westend_runtime.compact.compressed.wasm")]
|
||||
#[pezkuwi_subxt::subxt(runtime_path = "../../../../artifacts/zagros_runtime.compact.compressed.wasm")]
|
||||
mod runtime_compressed {}
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::Event",
|
||||
with = "crate::MyEvent"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "frame_support::dispatch::DispatchInfo",
|
||||
with = "my_mod::DispatchInfo"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_tiny.scale",
|
||||
runtime_metadata_insecure_url = "wss://rpc.polkadot.io:443"
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_tiny.scale",
|
||||
runtime_metadata_insecure_url = "wss://rpc.pezkuwi.io:443"
|
||||
)]
|
||||
pub mod node_runtime {}
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_tiny.scale",
|
||||
runtime_metadata_insecure_url = "wss://rpc.polkadot.io:443",
|
||||
runtime_path = "../../../../artifacts/westend_runtime.wasm"
|
||||
runtime_metadata_path = "../../../../artifacts/pezkuwi_metadata_tiny.scale",
|
||||
runtime_metadata_insecure_url = "wss://rpc.pezkuwi.io:443",
|
||||
runtime_path = "../../../../artifacts/zagros_runtime.wasm"
|
||||
)]
|
||||
pub mod node_runtime2 {}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use frame_metadata::{
|
||||
use crate::utils::generate_metadata_from_runtime_apis;
|
||||
|
||||
/// Generate metadata which contains a `Map` storage entry with no hashers/values.
|
||||
/// This is a bit of an odd case, but it was raised in https://github.com/paritytech/subxt/issues/552,
|
||||
/// This is a bit of an odd case, but it was raised in https://github.com/pezkuwichain/subxt/issues/552,
|
||||
/// and this test will fail before the fix and should pass once the fix is applied.
|
||||
pub fn metadata_runtime_api_underscore_method_name() -> RuntimeMetadataPrefixed {
|
||||
generate_metadata_from_runtime_apis(vec![RuntimeApiMetadata {
|
||||
|
||||
@@ -11,7 +11,7 @@ use scale_info::meta_type;
|
||||
use crate::utils::generate_metadata_from_storage_entries;
|
||||
|
||||
/// Generate metadata which contains a `Map` storage entry with no hashers/values.
|
||||
/// This is a bit of an odd case, but it was raised in https://github.com/paritytech/subxt/issues/552,
|
||||
/// This is a bit of an odd case, but it was raised in https://github.com/pezkuwichain/subxt/issues/552,
|
||||
/// and this test will fail before the fix and should pass once the fix is applied.
|
||||
pub fn metadata_storage_map_no_keys() -> RuntimeMetadataPrefixed {
|
||||
generate_metadata_from_storage_entries(vec![StorageEntryMetadata {
|
||||
|
||||
@@ -7,7 +7,7 @@ use frame_metadata::RuntimeMetadataPrefixed;
|
||||
use std::io::Read;
|
||||
|
||||
static TEST_DIR_PREFIX: &str = "subxt_generated_ui_tests_";
|
||||
static METADATA_FILE: &str = "../../artifacts/polkadot_metadata_full.scale";
|
||||
static METADATA_FILE: &str = "../../artifacts/pezkuwi_metadata_full.scale";
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MetadataTestRunner {
|
||||
@@ -144,7 +144,7 @@ impl MetadataTestRunnerCaseBuilder {
|
||||
use std::io::Read;
|
||||
|
||||
#[pezkuwi_subxt::subxt(runtime_metadata_path = "{tmp_macro_metadata_path}")]
|
||||
pub mod polkadot {{}}
|
||||
pub mod pezkuwi {{}}
|
||||
|
||||
fn main() {{
|
||||
// load validation metadata:
|
||||
@@ -159,7 +159,7 @@ impl MetadataTestRunnerCaseBuilder {
|
||||
.expect("Cannot decode metadata bytes");
|
||||
|
||||
// validate it:
|
||||
let is_valid = polkadot::is_codegen_valid_for(&metadata);
|
||||
let is_valid = pezkuwi::is_codegen_valid_for(&metadata);
|
||||
assert_eq!(is_valid, {should_be_valid_str}, "expected validity to line up");
|
||||
}}
|
||||
"#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![cfg(target_arch = "wasm32")]
|
||||
|
||||
use futures_util::StreamExt;
|
||||
use pezkuwi_subxt::{client::OnlineClient, config::PolkadotConfig, lightclient::LightClient};
|
||||
use pezkuwi_subxt::{client::OnlineClient, config::PezkuwiConfig, lightclient::LightClient};
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
||||
@@ -46,16 +46,16 @@ async fn light_client_works() {
|
||||
/// We connect to an RPC node because the light client can struggle to sync in
|
||||
/// time to a new local node for some reason. Because this can be brittle (eg RPC nodes can
|
||||
/// go down or have network issues), we try a few RPC nodes until we find one that works.
|
||||
async fn connect_to_rpc_node() -> OnlineClient<PolkadotConfig> {
|
||||
async fn connect_to_rpc_node() -> OnlineClient<PezkuwiConfig> {
|
||||
let rpc_node_urls = [
|
||||
"wss://rpc.polkadot.io",
|
||||
"wss://rpc.pezkuwi.io",
|
||||
"wss://1rpc.io/dot",
|
||||
"wss://polkadot-public-rpc.blockops.network/ws",
|
||||
"wss://pezkuwi-public-rpc.blockops.network/ws",
|
||||
];
|
||||
|
||||
async fn do_connect(
|
||||
url: &str,
|
||||
) -> Result<OnlineClient<PolkadotConfig>, Box<dyn std::error::Error + Send + Sync + 'static>>
|
||||
) -> Result<OnlineClient<PezkuwiConfig>, Box<dyn std::error::Error + Send + Sync + 'static>>
|
||||
{
|
||||
let chainspec = pezkuwi_subxt::utils::fetch_chainspec_from_rpc_node(url).await?;
|
||||
let (_lc, rpc) = LightClient::relay_chain(chainspec.get())?;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![cfg(target_arch = "wasm32")]
|
||||
|
||||
use pezkuwi_subxt::config::SubstrateConfig;
|
||||
use pezkuwi_subxt::config::BizinikiwConfig;
|
||||
use pezkuwi_subxt::backend::rpc::reconnecting_rpc_client::RpcClient as ReconnectingRpcClient;
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
@@ -12,10 +12,10 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
||||
// wasm-pack test --firefox --headless`
|
||||
// ```
|
||||
//
|
||||
// You'll need to have a substrate node running:
|
||||
// You'll need to have a bizinikiwi node running:
|
||||
//
|
||||
// ```bash
|
||||
// ./substrate-node --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws
|
||||
// ./bizinikiwi-node --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws
|
||||
// ```
|
||||
//
|
||||
// Use the following to enable logs:
|
||||
@@ -28,7 +28,7 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
||||
async fn wasm_ws_transport_works() {
|
||||
console_error_panic_hook::set_once();
|
||||
tracing_wasm::set_as_global_default();
|
||||
let client = pezkuwi_subxt::client::OnlineClient::<SubstrateConfig>::from_url("ws://127.0.0.1:9944")
|
||||
let client = pezkuwi_subxt::client::OnlineClient::<BizinikiwConfig>::from_url("ws://127.0.0.1:9944")
|
||||
.await
|
||||
.unwrap();
|
||||
let hasher = client.hasher();
|
||||
@@ -41,7 +41,7 @@ async fn wasm_ws_transport_works() {
|
||||
async fn wasm_ws_chainhead_works() {
|
||||
let rpc = pezkuwi_subxt::backend::rpc::RpcClient::from_url("ws://127.0.0.1:9944").await.unwrap();
|
||||
let backend = pezkuwi_subxt::backend::chain_head::ChainHeadBackendBuilder::new().build_with_background_driver(rpc);
|
||||
let client = pezkuwi_subxt::client::OnlineClient::<SubstrateConfig>::from_backend(std::sync::Arc::new(backend)).await.unwrap();
|
||||
let client = pezkuwi_subxt::client::OnlineClient::<BizinikiwConfig>::from_backend(std::sync::Arc::new(backend)).await.unwrap();
|
||||
let hasher = client.hasher();
|
||||
|
||||
let mut stream = client.backend().stream_best_block_headers(hasher).await.unwrap();
|
||||
@@ -51,7 +51,7 @@ async fn wasm_ws_chainhead_works() {
|
||||
#[wasm_bindgen_test]
|
||||
async fn reconnecting_rpc_client_ws_transport_works() {
|
||||
let rpc = ReconnectingRpcClient::builder().build("ws://127.0.0.1:9944".to_string()).await.unwrap();
|
||||
let client = pezkuwi_subxt::client::OnlineClient::<SubstrateConfig>::from_rpc_client(rpc.clone()).await.unwrap();
|
||||
let client = pezkuwi_subxt::client::OnlineClient::<BizinikiwConfig>::from_rpc_client(rpc.clone()).await.unwrap();
|
||||
let hasher = client.hasher();
|
||||
|
||||
let mut stream = client.backend().stream_best_block_headers(hasher).await.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user