Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 14 additions & 26 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,41 +181,29 @@ jobs:
- name: Cargo check all targets.
run: cargo check --all-targets

# Next, check subxt features.
# Next, check each subxt feature in isolation.
# - `native` feature must always be enabled
# - `web` feature is always ignored.
# - This means, don't check --no-default-features and don't try enabling --all-features; both will fail
- name: Cargo hack; check each subxt feature
run: cargo hack -p subxt --each-feature check --exclude-no-default-features --exclude-all-features --exclude-features web --features native
run: cargo hack -p subxt --each-feature check --exclude-features web --features native

# Same with subxt-historic
- name: Cargo hack; check each subxt feature
run: cargo hack -p subxt-historic --each-feature check --exclude-no-default-features --exclude-all-features --exclude-features web --features native
run: cargo hack -p subxt-historic --each-feature check --exclude-features web --features native

# Subxt-signer has the "subxt" features enabled in the "check all targets" test. Run it on its own to
# check it without. We can't enable subxt or web features here, so no cargo hack.
- name: Cargo check subxt-signer
run: |
cargo check -p subxt-signer
cargo check -p subxt-signer --no-default-features --features sr25519
cargo check -p subxt-signer --no-default-features --features ecdsa
cargo check -p subxt-signer --no-default-features --features unstable-eth
# And with subxt-rpcs
- name: Cargo hack; check each subxt-rpcs feature
run: cargo hack -p subxt-rpcs --each-feature check --exclude-features web --features native

# Subxt-rpcs has a bunch of clients that can be exposed. Check that they all stand on their own.
- name: Cargo check subxt-rpcs
run: |
cargo check -p subxt-rpcs
cargo check -p subxt-rpcs --no-default-features --features native
cargo check -p subxt-rpcs --no-default-features --features native,subxt
cargo check -p subxt-rpcs --no-default-features --features native,jsonrpsee
cargo check -p subxt-rpcs --no-default-features --features native,reconnecting-rpc-client
cargo check -p subxt-rpcs --no-default-features --features native,mock-rpc-client
cargo check -p subxt-rpcs --no-default-features --features native,unstable-light-client

# We can't enable web features here, so no cargo hack.
# And with subxt-signer (seems to work with a more basic check here; disable web if it becomes an issue).
- name: Cargo hack; check each subxt-signer feature
run: cargo hack -p subxt-signer --each-feature check

# And for subxt-lightclient.
- name: Cargo check subxt-lightclient
run: cargo check -p subxt-lightclient
run: cargo hack -p subxt-lightclient --each-feature check --exclude-features web --features native

# Next, check each other package in isolation.
# Next, check all other crates.
- name: Cargo hack; check each feature/crate on its own
run: cargo hack --exclude subxt --exclude subxt-historic --exclude subxt-signer --exclude subxt-lightclient --exclude subxt-rpcs --exclude-all-features --each-feature check --workspace

Expand Down
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ darling = "0.20.10"
derive-where = "1.2.7"
either = { version = "1.13.0", default-features = false }
finito = { version = "0.1.0", default-features = false }
frame-decode = { version = "0.12.0", default-features = false }
frame-decode = { version = "0.12.1", default-features = false }
frame-metadata = { version = "23.0.0", default-features = false }
futures = { version = "0.3.31", default-features = false, features = ["std"] }
getrandom = { version = "0.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion core/src/blocks/extrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ mod tests {
let metadata = metadata();

// Except our metadata to contain the registered types.
let pallet = metadata.pallet_by_index(0).expect("pallet exists");
let pallet = metadata.pallet_by_call_index(0).expect("pallet exists");
let extrinsic = pallet
.call_variant_by_index(2)
.expect("metadata contains the RuntimeCall enum with this pallet");
Expand Down
4 changes: 2 additions & 2 deletions core/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl<T: Config> EventDetails<T> {

// Get metadata for the event:
let event_pallet = metadata
.pallet_by_index(pallet_index)
.pallet_by_event_index(pallet_index)
.ok_or_else(|| EventsError::CannotFindPalletWithIndex(pallet_index))?;
let event_variant = event_pallet
.event_variant_by_index(variant_index)
Expand Down Expand Up @@ -359,7 +359,7 @@ impl<T: Config> EventDetails<T> {
pub fn event_metadata(&self) -> EventMetadataDetails<'_> {
let pallet = self
.metadata
.pallet_by_index(self.pallet_index())
.pallet_by_event_index(self.pallet_index())
.expect("event pallet to be found; we did this already during decoding");
let variant = pallet
.event_variant_by_index(self.variant_index())
Expand Down
2 changes: 1 addition & 1 deletion core/src/tx/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<CallData: EncodeAsFields> Payload for DefaultPayload<CallData> {
call_name: self.call_name.to_string(),
})?;

let pallet_index = pallet.index();
let pallet_index = pallet.call_index();
let call_index = call.index;

pallet_index.encode_to(out);
Expand Down
14 changes: 13 additions & 1 deletion metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,23 @@ homepage.workspace = true
description = "Command line utilities for checking metadata compatibility between nodes."

[features]
default = ["std"]
default = ["std", "legacy"]
std = ["scale-info/std", "frame-metadata/std"]

# Enable decoding of legacy metadata, too.
# std required by frame-metadata to decode <V14.
legacy = [
"std",
"dep:scale-info-legacy",
"dep:scale-type-resolver",
"frame-decode/legacy",
"frame-metadata/legacy"
]

[dependencies]
scale-info = { workspace = true, default-features = false }
scale-info-legacy = { workspace = true, optional = true }
scale-type-resolver = { workspace = true, optional = true }
frame-decode = { workspace = true }
frame-metadata = { workspace = true, default-features = false, features = ["current", "decode"] }
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] }
Expand Down
Loading
Loading