Skip to content
Merged
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
32 changes: 24 additions & 8 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions 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.14.0", 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 All @@ -103,8 +103,8 @@ scale-bits = { version = "0.7.0", default-features = false }
scale-decode = { version = "0.16.0", default-features = false }
scale-encode = { version = "0.10.0", default-features = false }
scale-type-resolver = { version = "0.2.0" }
scale-info-legacy = { version = "0.3.0", default-features = false }
scale-typegen = "0.11.1"
scale-info-legacy = { version = "0.3.2", default-features = false }
scale-typegen = "0.12.0"
scale-typegen-description = "0.11.0"
serde = { version = "1.0.210", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.128", default-features = false }
Expand Down
Binary file added artifacts/kusama/metadata_v10_1038.scale
Binary file not shown.
Binary file added artifacts/kusama/metadata_v11_1045.scale
Binary file not shown.
Binary file added artifacts/kusama/metadata_v12_2025.scale
Binary file not shown.
Binary file added artifacts/kusama/metadata_v13_9030.scale
Binary file not shown.
Binary file added artifacts/kusama/metadata_v14_9111.scale
Binary file not shown.
Binary file added artifacts/kusama/metadata_v9_1021.scale
Binary file not shown.
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
7 changes: 4 additions & 3 deletions historic/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod list_storage_entries_any;
mod storage_entry;
mod storage_info;
mod storage_key;
Expand Down Expand Up @@ -71,14 +72,14 @@ where
let metadata = client.metadata();

let mut pallet_name = Cow::Borrowed("");
frame_decode::helpers::list_storage_entries_any(metadata).filter_map(move |entry| {
list_storage_entries_any::list_storage_entries_any(metadata).filter_map(move |entry| {
match entry {
frame_decode::storage::Entry::In(name) => {
frame_decode::storage::StorageEntry::In(name) => {
// Set the pallet name for upcoming entries:
pallet_name = name;
None
}
frame_decode::storage::Entry::Name(entry_name) => {
frame_decode::storage::StorageEntry::Name(entry_name) => {
// Output each entry with the last seen pallet name:
Some(StorageEntriesItem {
pallet_name: pallet_name.clone(),
Expand Down
35 changes: 35 additions & 0 deletions historic/src/storage/list_storage_entries_any.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use frame_decode::storage::StorageEntryInfo;
use frame_metadata::RuntimeMetadata;

pub use frame_decode::storage::StorageEntry;

/// Returns an iterator listing the available storage entries in some metadata.
///
/// This basically calls [`StorageEntryInfo::storage_entries()`] for each metadata version,
/// returning an empty iterator where applicable (ie when passing legacy metadata and the
/// `legacy` features flag is not enabled).
pub fn list_storage_entries_any(
metadata: &RuntimeMetadata,
) -> impl Iterator<Item = StorageEntry<'_>> {
match metadata {
RuntimeMetadata::V0(_deprecated_metadata)
| RuntimeMetadata::V1(_deprecated_metadata)
| RuntimeMetadata::V2(_deprecated_metadata)
| RuntimeMetadata::V3(_deprecated_metadata)
| RuntimeMetadata::V4(_deprecated_metadata)
| RuntimeMetadata::V5(_deprecated_metadata)
| RuntimeMetadata::V6(_deprecated_metadata)
| RuntimeMetadata::V7(_deprecated_metadata) => {
Box::new(core::iter::empty()) as Box<dyn Iterator<Item = StorageEntry<'_>>>
}
RuntimeMetadata::V8(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V9(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V10(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V11(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V12(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V13(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V14(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V15(m) => Box::new(m.storage_entries()),
RuntimeMetadata::V16(m) => Box::new(m.storage_entries()),
}
}
16 changes: 15 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 All @@ -31,6 +43,8 @@ bitvec = { workspace = true, features = ["alloc"] }
criterion = { workspace = true }
scale-info = { workspace = true, features = ["bit-vec"] }
subxt-utils-stripmetadata = { workspace = true }
frame-decode = { workspace = true, features = ["legacy-types"] }
subxt-codegen = { workspace = true }

[lib]
# Without this, libtest cli opts interfere with criterion benches:
Expand Down
Loading
Loading