Skip to content

Commit

Permalink
Update subxt and generate metadatav15 (#134)
Browse files Browse the repository at this point in the history
Co-authored-by: shekohex <dev+github@shadykhalifa.me>
  • Loading branch information
salman01zp and shekohex authored May 17, 2023
1 parent ce757c5 commit 7855e64
Show file tree
Hide file tree
Showing 12 changed files with 45,101 additions and 83,610 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ thiserror = "1"

[package]
name = "webb"
version = "0.5.22"
version = "0.5.23"
description = "Webb SDK"
keywords = ["webb", "sdk", "blockchain", "webb-tools"]
include = ["Cargo.toml", "contracts/", "metadata/", "src/**/*.rs", "build.rs", "README.md", "LICENSE"]
Expand All @@ -31,13 +31,13 @@ documentation = { workspace = true }
homepage = { workspace = true }

[workspace]
members = [".", "proposals", "bridge-proofs", "evm-test-utils"]
members = [".", "proposals", "bridge-proofs"]

[dependencies]
# Substrate crates.
scale = { package = "parity-scale-codec", version = "3", default-features = false, optional = true }
scale-info = { workspace = true, optional = true }
subxt = { version = "0.27", optional = true }
subxt = { git = "https://github.com/paritytech/subxt.git", branch = "master", optional = true }
async-trait = "0.1"
rand = { version = "0.8", default-features = false, features = ["getrandom"] }
thiserror = "1.0.38"
Expand All @@ -59,10 +59,10 @@ sp-keyring = "18.0.0"
serde_json = "1"
tempfile = "3.3"
ethers = { workspace = true, default-features = false, optional = true, features = ["legacy", "abigen"] }
syn = { version = "1.0.107", optional = true }
syn = { version = "2.0.15", optional = true }
scale = { package = "parity-scale-codec", version = "3", default-features = false, optional = true }
frame-metadata = { version = "15.0.0", optional = true, features = ["v14", "std"] }
subxt-codegen = { version = "0.27", optional = true }
frame-metadata = { version = "15.1.0", optional = true, features = ["v14", "std"] }
subxt-codegen = { git = "https://github.com/paritytech/subxt.git", branch = "master", optional = true }

[features]
default = ["substrate-runtime", "evm-runtime"]
Expand Down
30 changes: 9 additions & 21 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,43 +180,33 @@ mod substrate {
pub mod api {}
);
// Default type substitutes.
let substs = TypeSubstitutes::new(&CratePath::default());
let substs =
TypeSubstitutes::with_default_substitutes(&CratePath::default());
// Generate the Runtime API.
let generator = subxt_codegen::RuntimeGenerator::new(metadata);
let mut generated_type_derives =
subxt_codegen::DerivesRegistry::new(&CratePath::default());
subxt_codegen::DerivesRegistry::with_default_derives(
&CratePath::default(),
);
generated_type_derives.extend_for_all(
vec![
syn::parse_quote!(Eq),
syn::parse_quote!(PartialEq),
syn::parse_quote!(Clone),
]
.into_iter(),
],
vec![],
);
let runtime_api = generator.generate_runtime(
item_mod,
generated_type_derives,
substs,
CratePath::default(),
);
true,
)?;
std::fs::write(out, runtime_api.to_string())?;
Ok(())
}

pub fn generate_dkg_runtime() -> Result<(), Box<dyn Error>> {
parse_and_generate_runtime(
"metadata/dkg-runtime.scale",
"src/substrate/dkg_runtime.rs",
)
}

pub fn generate_protocol_substrate_runtime() -> Result<(), Box<dyn Error>> {
parse_and_generate_runtime(
"metadata/protocol-substrate-runtime.scale",
"src/substrate/protocol_substrate_runtime.rs",
)
}

pub fn generate_tangle_runtime() -> Result<(), Box<dyn Error>> {
parse_and_generate_runtime(
"metadata/tangle-runtime.scale",
Expand Down Expand Up @@ -255,8 +245,6 @@ fn main() -> Result<(), Box<dyn Error>> {
}
#[cfg(feature = "generate-substrate")]
{
substrate::generate_dkg_runtime()?;
substrate::generate_protocol_substrate_runtime()?;
substrate::generate_tangle_runtime()?;
run_cargo_fmt()?;
}
Expand Down
2 changes: 1 addition & 1 deletion evm-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ documentation = { workspace = true }
homepage = { workspace = true }

[dependencies]
anvil = { git = "https://github.com/foundry-rs/foundry.git", rev = "394f217" }
anvil = { git = "https://github.com/foundry-rs/foundry.git", rev = "6570a4c" }
futures = "0.3"
hex = { workspace = true }
webb-proposals = { path = "../proposals", default-features = false }
Expand Down
Binary file removed metadata/dkg-runtime.scale
Binary file not shown.
Binary file removed metadata/protocol-substrate-runtime.scale
Binary file not shown.
Binary file modified metadata/tangle-runtime.scale
Binary file not shown.
2 changes: 1 addition & 1 deletion proposals/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "webb-proposals"
version = "0.5.22"
version = "0.5.23"
description = "Webb Protocol Proposals Specification & Implementation (part of webb-rs SDK)"
categories = ["encoding", "no-std"]
keywords = ["webb", "proposals", "protocol", "blockchain"]
Expand Down
Loading

0 comments on commit 7855e64

Please sign in to comment.