This commit is contained in:
James Wilson
2025-06-03 12:07:46 +01:00
parent b34e449adf
commit fb20b01af6
4 changed files with 26 additions and 3 deletions
+1
View File
@@ -27,6 +27,7 @@ chain-spec-pruning = ["smoldot"]
[dependencies]
subxt-codegen = { workspace = true }
scale-typegen = { workspace = true }
subxt-utils-fetchmetadata = { workspace = true, features = ["url"] }
subxt-metadata = { workspace = true }
subxt = { workspace = true, features = ["default"] }
+12 -2
View File
@@ -210,8 +210,18 @@ fn codegen(
codegen.no_docs()
}
let metadata = subxt_metadata::Metadata::decode(&mut &*metadata_bytes)
.map_err(|e| eyre!("Cannot decode the provided metadata: {e}"))?;
let metadata = {
let mut metadata = subxt_metadata::Metadata::decode(&mut &*metadata_bytes)
.map_err(|e| eyre!("Cannot decode the provided metadata: {e}"))?;
// Run this first to ensure type paths are unique (which may result in 1,2,3 suffixes being added
// to type paths), so that when we validate derives/substitutions below, they are allowed for such
// types. See <https://github.com/paritytech/subxt/issues/2011>.
scale_typegen::utils::ensure_unique_type_paths(metadata.types_mut())
.expect("ensure_unique_type_paths should not fail; please report an issue.");
metadata
};
// Configure derives:
let global_derives = raw_derives