mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-23 07:18:00 +00:00
De-dup types early in CLI/macro so that derives/substitutes work for de-duped types (#2015)
* De-dup types early to enable derives for them * ensure_unique_type_paths in CLI codegen, too * Update UI test outpuot --------- Co-authored-by: José Duarte <duarte.gmj@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user