Merge branch 'master' into tadeohepperle/subxt-metadata-no-std

This commit is contained in:
Tadeo hepperle
2024-02-02 09:13:48 +01:00
15 changed files with 3776 additions and 1052 deletions
@@ -0,0 +1,3 @@
# use-nodes
This action downloads the substrate and polkadot binaries produced from the `build-nodes` workflow and puts them into the `$PATH`.
@@ -0,0 +1,33 @@
name: Use substrate and polkadot binaries
description: Downloads and configures the substrate and polkadot binaries built with `build-nodes`
runs:
using: composite
steps:
- name: Download substrate-node binary
id: download-substrate-binary
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
with:
workflow: build-nodes.yml
name: nightly-substrate-binary
- name: Download polkadot binary
id: download-polkadot-binary
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
with:
workflow: build-nodes.yml
name: nightly-polkadot-binary
- name: Prepare binaries
shell: bash
run: |
chmod u+x ./substrate-node
chmod u+x ./polkadot
chmod u+x ./polkadot-execute-worker
chmod u+x ./polkadot-prepare-worker
./substrate-node --version
./polkadot --version
mkdir -p ~/.local/bin
cp ./substrate-node ~/.local/bin
cp ./polkadot ~/.local/bin
cp ./polkadot-execute-worker ~/.local/bin
cp ./polkadot-prepare-worker ~/.local/bin
@@ -1,3 +0,0 @@
# use-substrate
This action downloads the substrate binary produced from the `build-substrate` workflow and puts it into the `$PATH`.
@@ -1,19 +0,0 @@
name: Use substrate binary
description: Downloads and configures the substrate binary built with build-substrate
runs:
using: composite
steps:
- name: Download substrate-node binary
id: download-artifact
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
with:
workflow: build-substrate.yml
name: nightly-substrate-binary
- name: Prepare substrate-node binary
shell: bash
run: |
chmod u+x ./substrate-node
./substrate-node --version
mkdir -p ~/.local/bin
cp ./substrate-node ~/.local/bin
@@ -1,4 +1,4 @@
name: Build Substrate Binary
name: Build Substrate and Polkadot Binaries
on:
# Allow it to be manually ran to rebuild binary when needed:
@@ -9,7 +9,7 @@ on:
jobs:
tests:
name: Build Substrate
name: Build Substrate and Polkadot Binaries
runs-on: ubuntu-latest-16-cores
steps:
- name: checkout polkadot-sdk
@@ -42,3 +42,20 @@ jobs:
path: target/release/substrate-node
retention-days: 2
if-no-files-found: error
- name: build polkadot binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --manifest-path polkadot/Cargo.toml
- name: upload polkadot binary
uses: actions/upload-artifact@v3
with:
name: nightly-polkadot-binary
path: |
target/release/polkadot
target/release/polkadot-execute-worker
target/release/polkadot-prepare-worker
retention-days: 2
if-no-files-found: error
+2 -2
View File
@@ -16,8 +16,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
+18 -18
View File
@@ -56,8 +56,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -88,8 +88,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -120,8 +120,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -151,8 +151,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -240,8 +240,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -274,8 +274,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -308,8 +308,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -342,8 +342,8 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
@@ -388,8 +388,8 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Run subxt WASM tests
run: |
+2 -2
View File
@@ -21,8 +21,8 @@ jobs:
uses: actions/checkout@v4
# We run this (up-to-date) node locally to fetch metadata from it for the artifacts
- name: Use substrate-node binary
uses: ./.github/workflows/actions/use-substrate
- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -10,7 +10,7 @@ use substrate_runner::SubstrateNode;
/// Run with `cargo run --bin artifacts` from the root of the repository.
fn main() {
let mut node_builder = SubstrateNode::builder();
node_builder.binary_paths(["substrate-node", "substrate"]);
node_builder.polkadot();
// Spawn the node and retrieve a ws URL to it:
let proc = node_builder
@@ -37,13 +37,13 @@ fn main() {
// Generate a metadata file that only contains a few pallets that we need for our examples.
run_cmd(
r#"cargo run --bin subxt metadata --file artifacts/polkadot_metadata_full.scale --pallets "Balances,Staking,System,Multisig,Timestamp,ParaInherent""#,
"cargo run --bin subxt metadata --file artifacts/polkadot_metadata_full.scale --pallets Balances,Staking,System,Multisig,Timestamp,ParaInherent",
Some("artifacts/polkadot_metadata_small.scale"),
);
// Generate a metadata file that contains no pallets
run_cmd(
r#"cargo run --bin subxt metadata --file artifacts/polkadot_metadata_full.scale --pallets """#,
"cargo run --bin subxt metadata --file artifacts/polkadot_metadata_full.scale --pallets \"\"",
Some("artifacts/polkadot_metadata_tiny.scale"),
);
File diff suppressed because one or more lines are too long
+14 -2
View File
@@ -21,7 +21,7 @@ pub struct SubstrateNodeBuilder {
impl Default for SubstrateNodeBuilder {
fn default() -> Self {
Self::new()
SubstrateNodeBuilder::new()
}
}
@@ -29,11 +29,23 @@ impl SubstrateNodeBuilder {
/// Configure a new Substrate node.
pub fn new() -> Self {
SubstrateNodeBuilder {
binary_paths: vec!["substrate-node".into(), "substrate".into()],
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()];
self
}
/// Provide "polkadot" as binary path.
pub fn polkadot(&mut self) -> &mut Self {
self.binary_paths = vec!["polkadot".into()];
self
}
/// Set the path to the `substrate` binary; defaults to "substrate-node"
/// or "substrate".
pub fn binary_paths<Paths, S>(&mut self, paths: Paths) -> &mut Self