mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user