diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8dbed12bb..f8f16501f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,6 +11,9 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +env: + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: ci: diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 000000000..ee888fa80 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,5 @@ +exclude = ["target/*"] +[formatting] +array_auto_collapse = false +array_auto_expand = false +reorder_keys = true diff --git a/Cargo.lock b/Cargo.lock index 6e1b3ea12..8c4d4e034 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5326,6 +5326,7 @@ dependencies = [ "frame-support", "frame-system", "frame-system-benchmarking", + "getrandom 0.2.8", "orml-currencies", "orml-tokens", "orml-traits", diff --git a/Cargo.toml b/Cargo.toml index 6d7c9c1db..d0cb8ef9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,32 +1,32 @@ [profile.release] +lto = "thin" panic = "unwind" strip = "symbols" -lto = "thin" [profile.dev] -strip = "symbols" debug = 0 +strip = "symbols" [workspace] members = [ - "client", - "primitives", - "pallets/anonymity-mining-rewards", - "pallets/anonymity-mining-claims", - "pallets/asset-registry", - "pallets/hasher", - "pallets/verifier", - "pallets/mt", - "pallets/linkable-tree", - "pallets/mixer", - "pallets/signature-bridge", - "pallets/vanchor", - "pallets/vanchor-handler", - "pallets/vanchor-verifier", - # "pallets/xanchor", - "pallets/token-wrapper", - "pallets/token-wrapper-handler", - "pallets/relayer-registry", - "pallets/key-storage", - "standalone/*", -] \ No newline at end of file + "client", + "primitives", + "pallets/anonymity-mining-rewards", + "pallets/anonymity-mining-claims", + "pallets/asset-registry", + "pallets/hasher", + "pallets/verifier", + "pallets/mt", + "pallets/linkable-tree", + "pallets/mixer", + "pallets/signature-bridge", + "pallets/vanchor", + "pallets/vanchor-handler", + "pallets/vanchor-verifier", + # "pallets/xanchor", + "pallets/token-wrapper", + "pallets/token-wrapper-handler", + "pallets/relayer-registry", + "pallets/key-storage", + "standalone/*", +] diff --git a/client/Cargo.toml b/client/Cargo.toml index 8677eedbf..8f3173cbc 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -1,34 +1,34 @@ [package] +edition = "2021" name = "webb-client" version = "0.1.0" -edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -subxt = { version = "0.25.0" } codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full", "bit-vec"] } +subxt = { version = "0.25.0" } [dev-dependencies] hex = "0.4" +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-keyring = { default-features = false, version = "7.0.0" } -tokio = { version = "1.17.0", features = ["full"] } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +tokio = { version = "1.17.0", features = ["full"] } # arkworks related deps ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false} -ark-ec = { version = "^0.3.0", default-features = false} -ark-ff = { version = "^0.3.0", default-features = false} -ark-relations = { version = "^0.3.0", default-features = false} -ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"]} -ark-std = { version = "^0.3.0", default-features = false} +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +ark-ec = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } +ark-relations = { version = "^0.3.0", default-features = false } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } +ark-std = { version = "^0.3.0", default-features = false } # Webb deps -webb-primitives = { path = "../primitives", features = ["hashing", "verifying", "field_ops"] } -arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } arkworks-native-gadgets = { version = "1.2.0", default-features = false } +arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +webb-primitives = { path = "../primitives", features = ["hashing", "verifying", "field_ops"] } diff --git a/client/src/lib.rs b/client/src/lib.rs index 90c0ba0f7..b1ec15dda 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1,2 +1,3 @@ +#![allow(clippy::too_many_arguments)] #[subxt::subxt(runtime_metadata_path = "metadata/protocol_substrate_runtime.scale")] pub mod webb_runtime {} diff --git a/pallets/anonymity-mining-claims/Cargo.toml b/pallets/anonymity-mining-claims/Cargo.toml index ae65b5fb0..3b7129e65 100644 --- a/pallets/anonymity-mining-claims/Cargo.toml +++ b/pallets/anonymity-mining-claims/Cargo.toml @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -pallet-vanchor = { path = "../vanchor", default-features = false } -pallet-vanchor-handler = {path = "../../pallets/vanchor-handler", default-features = false } -pallet-signature-bridge = { path = "../../pallets/signature-bridge", default-features = false } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } pallet-asset-registry = { path = "../asset-registry", default-features = false } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-mt = { path = "../mt", default-features = false } pallet-linkable-tree = { path = "../linkable-tree", default-features = false } +pallet-mt = { path = "../mt", default-features = false } +pallet-signature-bridge = { path = "../../pallets/signature-bridge", default-features = false } pallet-token-wrapper = { path = "../token-wrapper", default-features = false } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-vanchor = { path = "../vanchor", default-features = false } +pallet-vanchor-handler = { path = "../../pallets/vanchor-handler", default-features = false } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } @@ -32,51 +32,51 @@ sp-std = { default-features = false, git = "https://github.com/paritytech/substr webb-primitives = { path = "../../primitives", default-features = false } [dev-dependencies] -hex = "0.4" -serde = { version = "1.0.119" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false } ark-ec = { version = "^0.3.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] } -ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } +ark-std = { version = "^0.3.0", default-features = false } arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +hex = "0.4" orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } pallet-hasher = { path = "../hasher", default-features = false } -pallet-key-storage = {path = "../key-storage"} +pallet-key-storage = { path = "../key-storage" } pallet-timestamp = { default-features = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +serde = { version = "1.0.119" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } [features] default = ["std"] +runtime-benchmarks = [ + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "webb-primitives/std", - "webb-primitives/hashing", - "frame-benchmarking/std", - "orml-currencies/std", - "orml-tokens/std", - "orml-traits/std", - "pallet-asset-registry/std", - "pallet-balances/std", - "pallet-vanchor/std", - "pallet-mt/std", - "pallet-vanchor-verifier/std", - "pallet-token-wrapper/std" + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "webb-primitives/std", + "webb-primitives/hashing", + "frame-benchmarking/std", + "orml-currencies/std", + "orml-tokens/std", + "orml-traits/std", + "pallet-asset-registry/std", + "pallet-balances/std", + "pallet-vanchor/std", + "pallet-mt/std", + "pallet-vanchor-verifier/std", + "pallet-token-wrapper/std", ] -runtime-benchmarks = [ - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", -] \ No newline at end of file diff --git a/pallets/anonymity-mining-rewards/Cargo.toml b/pallets/anonymity-mining-rewards/Cargo.toml index 1b6bd32ff..29aae1167 100644 --- a/pallets/anonymity-mining-rewards/Cargo.toml +++ b/pallets/anonymity-mining-rewards/Cargo.toml @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -pallet-vanchor = { path = "../vanchor", default-features = false } -pallet-vanchor-handler = {path = "../../pallets/vanchor-handler", default-features = false } -pallet-signature-bridge = { path = "../../pallets/signature-bridge", default-features = false } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } pallet-asset-registry = { path = "../asset-registry", default-features = false } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-mt = { path = "../mt", default-features = false } pallet-linkable-tree = { path = "../linkable-tree", default-features = false } +pallet-mt = { path = "../mt", default-features = false } +pallet-signature-bridge = { path = "../../pallets/signature-bridge", default-features = false } pallet-token-wrapper = { path = "../token-wrapper", default-features = false } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-vanchor = { path = "../vanchor", default-features = false } +pallet-vanchor-handler = { path = "../../pallets/vanchor-handler", default-features = false } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } @@ -32,51 +32,51 @@ sp-std = { default-features = false, git = "https://github.com/paritytech/substr webb-primitives = { path = "../../primitives", default-features = false } [dev-dependencies] -hex = "0.4" -serde = { version = "1.0.119" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false } ark-ec = { version = "^0.3.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] } -ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } +ark-std = { version = "^0.3.0", default-features = false } arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +hex = "0.4" orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } pallet-hasher = { path = "../hasher", default-features = false } -pallet-key-storage = {path = "../key-storage"} +pallet-key-storage = { path = "../key-storage" } pallet-timestamp = { default-features = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +serde = { version = "1.0.119" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } [features] default = ["std"] +runtime-benchmarks = [ + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "webb-primitives/std", - "webb-primitives/hashing", - "frame-benchmarking/std", - "orml-currencies/std", - "orml-tokens/std", - "orml-traits/std", - "pallet-asset-registry/std", - "pallet-balances/std", - "pallet-vanchor/std", - "pallet-mt/std", - "pallet-vanchor-verifier/std", - "pallet-token-wrapper/std" + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "webb-primitives/std", + "webb-primitives/hashing", + "frame-benchmarking/std", + "orml-currencies/std", + "orml-tokens/std", + "orml-traits/std", + "pallet-asset-registry/std", + "pallet-balances/std", + "pallet-vanchor/std", + "pallet-mt/std", + "pallet-vanchor-verifier/std", + "pallet-token-wrapper/std", ] -runtime-benchmarks = [ - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", -] \ No newline at end of file diff --git a/pallets/asset-registry/Cargo.toml b/pallets/asset-registry/Cargo.toml index 8d9c6ec20..40dd0c9a5 100644 --- a/pallets/asset-registry/Cargo.toml +++ b/pallets/asset-registry/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "pallet-asset-registry" -version = "0.1.0" -description = "Pallet for asset registry management" authors = ["GalacticCouncil"] +description = "Pallet for asset registry management" edition = "2018" homepage = "https://github.com/galacticcouncil/basilisk-node" license = "Apache 2.0" +name = "pallet-asset-registry" repository = "https://github.com/galacticcouncil/basilisk-node" +version = "0.1.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } codec = { default-features = false, features = ["derive", "max-encoded-len"], package = "parity-scale-codec", version = "3" } primitive-types = { default-features = false, version = "0.8.0" } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { features = ["derive"], optional = true, version = "1.0.101" } # ORML dependencies @@ -23,8 +23,8 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li # Substrate dependencies frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } @@ -40,6 +40,7 @@ webb-primitives = { path = "../../primitives", default-features = false } [features] default = ["std"] runtime-benchmarks = [ + "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", ] @@ -55,4 +56,4 @@ std = [ "sp-std/std", "sp-api/std", "sp-arithmetic/std", -] \ No newline at end of file +] diff --git a/pallets/asset-registry/src/benchmarking.rs b/pallets/asset-registry/src/benchmarking.rs index 8ba633cdb..eed5df331 100644 --- a/pallets/asset-registry/src/benchmarking.rs +++ b/pallets/asset-registry/src/benchmarking.rs @@ -33,7 +33,7 @@ benchmarks! { // In such case, one additional operation is performed to skip the id (aka worst case) assert_eq!(crate::Pallet::::next_asset_id(), T::AssetId::from(0u8)); - }: _(RawOrigin::Root, name.clone(), AssetType::Token, ed) + }: _(RawOrigin::Root, name.clone().try_into().unwrap(), AssetType::Token, ed) verify { let bname = crate::Pallet::::to_bounded_name(name).unwrap(); assert_eq!(crate::Pallet::::asset_ids(bname), Some(T::AssetId::from(1u8))); @@ -43,7 +43,7 @@ benchmarks! { let name = b"NAME".to_vec(); let ed = T::Balance::from(1_000_000u32); assert_eq!(crate::Pallet::::next_asset_id(), T::AssetId::from(0u8)); - let _ = crate::Pallet::::register(RawOrigin::Root.into(), name, AssetType::Token, ed); + let _ = crate::Pallet::::register(RawOrigin::Root.into(), name.try_into().unwrap(), AssetType::Token, ed); let new_name= vec![1; T::StringLimit::get() as usize]; @@ -51,7 +51,7 @@ benchmarks! { let new_ed = T::Balance::from(2_000_000u32); - }: _(RawOrigin::Root, asset_id, new_name.clone(), AssetType::PoolShare(vec![T::AssetId::from(10u8),T::AssetId::from(20u8)]), Some(new_ed)) + }: _(RawOrigin::Root, asset_id, new_name.clone().try_into().unwrap(), AssetType::PoolShare(vec![T::AssetId::from(10u8),T::AssetId::from(20u8)].try_into().unwrap()), Some(new_ed)) verify { let bname = crate::Pallet::::to_bounded_name(new_name).unwrap(); assert_eq!(crate::Pallet::::asset_ids(&bname), Some(T::AssetId::from(1u8))); @@ -62,7 +62,7 @@ benchmarks! { let stored = stored.unwrap(); let expected = AssetDetails{ - asset_type: AssetType::PoolShare(vec![T::AssetId::from(10u8), T::AssetId::from(20u8)]), + asset_type: AssetType::PoolShare(vec![T::AssetId::from(10u8), T::AssetId::from(20u8)].try_into().unwrap()), locked: false, existential_deposit: new_ed, name: bname,}; @@ -77,13 +77,13 @@ benchmarks! { let name = b"NAME".to_vec(); let ed = T::Balance::from(1_000_000u32); assert_eq!(crate::Pallet::::next_asset_id(), T::AssetId::from(0u8)); - let _ = crate::Pallet::::register(RawOrigin::Root.into(), name.clone(), AssetType::Token, ed); + let _ = crate::Pallet::::register(RawOrigin::Root.into(), name.clone().try_into().unwrap(), AssetType::Token, ed); let asset_id = T::AssetId::from(1u8); let max_symbol = vec![1; T::StringLimit::get() as usize]; - }: _(RawOrigin::Root, asset_id, max_symbol.clone(), 10u8) + }: _(RawOrigin::Root, asset_id, max_symbol.clone().try_into().unwrap(), 10u8) verify { let bname = crate::Pallet::::to_bounded_name(name).unwrap(); let bsymbol= crate::Pallet::::to_bounded_name(max_symbol).unwrap(); @@ -108,7 +108,7 @@ benchmarks! { let name = b"NAME".to_vec(); let ed = T::Balance::from(1_000_000u32); assert_eq!(crate::Pallet::::next_asset_id(), T::AssetId::from(0u8)); - let _ = crate::Pallet::::register(RawOrigin::Root.into(), name.clone(), AssetType::Token, ed); + let _ = crate::Pallet::::register(RawOrigin::Root.into(), name.clone().try_into().unwrap(), AssetType::Token, ed); let asset_id = T::AssetId::from(1u8); diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index 5427e3a2b..4103ba1f4 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -14,12 +14,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - +#![allow(clippy::type_complexity)] #![cfg_attr(not(feature = "std"), no_std)] -use frame_support::{ - dispatch::DispatchError, pallet_prelude::*, sp_runtime::traits::CheckedAdd, transactional, -}; +use frame_support::{dispatch::DispatchError, pallet_prelude::*, sp_runtime::traits::CheckedAdd}; use frame_system::pallet_prelude::*; use sp_arithmetic::traits::BaseArithmetic; use sp_std::{ @@ -269,7 +267,7 @@ pub mod pallet { /// Emits 'Registered` event when successful. #[pallet::weight(::WeightInfo::register())] #[pallet::call_index(0)] - #[transactional] + pub fn register( origin: OriginFor, name: BoundedVec, @@ -295,7 +293,7 @@ pub mod pallet { // TODO: No tests #[pallet::weight(::WeightInfo::update())] #[pallet::call_index(1)] - #[transactional] + pub fn update( origin: OriginFor, asset_id: T::AssetId, @@ -340,7 +338,7 @@ pub mod pallet { /// Emits `MetadataSet` event when successful. #[pallet::weight(::WeightInfo::set_metadata())] #[pallet::call_index(2)] - #[transactional] + pub fn set_metadata( origin: OriginFor, asset_id: T::AssetId, @@ -373,7 +371,7 @@ pub mod pallet { /// Emits `LocationSet` event when successful. #[pallet::weight(::WeightInfo::set_location())] #[pallet::call_index(3)] - #[transactional] + pub fn set_location( origin: OriginFor, asset_id: T::AssetId, diff --git a/pallets/asset-registry/src/traits.rs b/pallets/asset-registry/src/traits.rs index 3499c21e5..365b84dcf 100644 --- a/pallets/asset-registry/src/traits.rs +++ b/pallets/asset-registry/src/traits.rs @@ -1,3 +1,4 @@ +#![allow(clippy::ptr_arg, clippy::type_complexity)] use crate::*; use frame_support::dispatch::fmt::Debug; diff --git a/pallets/hasher/Cargo.toml b/pallets/hasher/Cargo.toml index dccc45c64..adba474ca 100644 --- a/pallets/hasher/Cargo.toml +++ b/pallets/hasher/Cargo.toml @@ -25,35 +25,36 @@ webb-primitives = { path = "../../primitives", default-features = false } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] -hex-literal = "0.2.1" +ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +ark-ec = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } +ark-relations = { version = "^0.3.0", default-features = false } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } +ark-std = { version = "^0.3.0", default-features = false } +arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } hex = "0.4" +hex-literal = "0.2.1" +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false } -ark-ec = { version = "^0.3.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } -ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] } -ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } [features] default = ["std"] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "webb-primitives/std", - "webb-primitives/hashing", + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "webb-primitives/std", + "webb-primitives/hashing", ] -runtime-benchmarks = [ - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", -] \ No newline at end of file diff --git a/pallets/hasher/src/benchmarking.rs b/pallets/hasher/src/benchmarking.rs index 489d128db..a36578fb7 100644 --- a/pallets/hasher/src/benchmarking.rs +++ b/pallets/hasher/src/benchmarking.rs @@ -50,7 +50,7 @@ benchmarks_instance_pallet! { let c in 0..MAX_PARAMETER_LENGTH; let depositor: T::AccountId = account("depositor", 0, SEED); let parameters = vec![0u8;c as usize]; - }: _(RawOrigin::Root, parameters.clone()) + }: _(RawOrigin::Root, parameters.clone().try_into().unwrap()) verify { assert_eq!(Pallet::::parameters(), parameters); } diff --git a/pallets/key-storage/Cargo.toml b/pallets/key-storage/Cargo.toml index 98ae6a8f5..01f7b285e 100644 --- a/pallets/key-storage/Cargo.toml +++ b/pallets/key-storage/Cargo.toml @@ -13,35 +13,36 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -log = { version = "0.4.14", default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +log = { version = "0.4.14", default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } webb-primitives = { path = "../../primitives", default-features = false, features = ["verifying"] } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } [features] default = ["std"] -std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "webb-primitives/std", - "frame-benchmarking/std" -] runtime-benchmarks = [ - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "webb-primitives/std", + "frame-benchmarking/std", ] diff --git a/pallets/key-storage/src/benchmarking.rs b/pallets/key-storage/src/benchmarking.rs index 692dbdea1..4b5fad6d4 100644 --- a/pallets/key-storage/src/benchmarking.rs +++ b/pallets/key-storage/src/benchmarking.rs @@ -34,9 +34,9 @@ benchmarks_instance_pallet! { let c in 0..MAX_PARAMETER_LENGTH; let owner: T::AccountId = whitelisted_caller(); let public_key = vec![0u8;c as usize]; - }: _(RawOrigin::Signed(owner.clone()), owner.clone(), public_key.clone()) + }: _(RawOrigin::Signed(owner.clone()), owner.clone(), public_key.clone().try_into().unwrap()) verify { - assert_last_event::(Event::PublicKeyRegistration{owner, public_key}.into()); + assert_last_event::(Event::PublicKeyRegistration{owner, public_key : public_key.try_into().unwrap()}.into()); } } diff --git a/pallets/key-storage/src/lib.rs b/pallets/key-storage/src/lib.rs index d911c8987..68aecfa36 100644 --- a/pallets/key-storage/src/lib.rs +++ b/pallets/key-storage/src/lib.rs @@ -20,6 +20,7 @@ //! //! `register`: Registers a public key to it's account. // Ensure we're `no_std` when compiling for Wasm. +#![allow(clippy::ptr_arg, clippy::type_complexity)] #![cfg_attr(not(feature = "std"), no_std)] mod benchmarking; #[cfg(test)] diff --git a/pallets/linkable-tree/Cargo.toml b/pallets/linkable-tree/Cargo.toml index 1df574e8b..5808a77d0 100644 --- a/pallets/linkable-tree/Cargo.toml +++ b/pallets/linkable-tree/Cargo.toml @@ -15,52 +15,52 @@ scale-info = { version = "2.1.1", default-features = false, features = ["derive" frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +pallet-mt = { path = "../mt", default-features = false } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-mt = { path = "../mt", default-features = false } webb-primitives = { path = "../../primitives", default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } - sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } serde = { version = "1.0.119", optional = true } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } pallet-hasher = { path = "../hasher", default-features = false } rand = "0.8.4" +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false} ark-ec = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ]} +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } ark-std = { version = "^0.3.0", default-features = false } ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } [features] default = ["std"] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] std = [ - "serde", - "codec/std", - "scale-info/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "sp-io/std", - "pallet-hasher/std", - "pallet-mt/std", - "webb-primitives/std", - "frame-benchmarking/std" + "serde", + "codec/std", + "scale-info/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "sp-io/std", + "pallet-hasher/std", + "pallet-mt/std", + "webb-primitives/std", + "frame-benchmarking/std", ] -runtime-benchmarks = [ - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", -] \ No newline at end of file diff --git a/pallets/linkable-tree/rpc/Cargo.toml b/pallets/linkable-tree/rpc/Cargo.toml index 58e9fb851..bb2b6ed5d 100644 --- a/pallets/linkable-tree/rpc/Cargo.toml +++ b/pallets/linkable-tree/rpc/Cargo.toml @@ -1,32 +1,32 @@ [package] -name = "pallet-linkable-tree-rpc" -version = "0.1.0" authors = ["Webb Tools"] edition = "2018" +name = "pallet-linkable-tree-rpc" +version = "0.1.0" [dependencies] jsonrpsee = { version = "0.16.2", features = ["server"] } -thiserror = "1.0" sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +thiserror = "1.0" codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-blockchain = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -webb-primitives = { path = "../../../primitives", default-features = false } pallet-linkable-tree = { path = "../", default-features = false } pallet-linkable-tree-rpc-runtime-api = { path = "./runtime-api", default-features = false } +webb-primitives = { path = "../../../primitives", default-features = false } [features] default = ["std"] std = [ - "codec/std", - "webb-primitives/std", - "pallet-linkable-tree/std", - "pallet-linkable-tree-rpc-runtime-api/std", - "sp-core/std", - "sp-runtime/std", - "sp-api/std" -] \ No newline at end of file + "codec/std", + "webb-primitives/std", + "pallet-linkable-tree/std", + "pallet-linkable-tree-rpc-runtime-api/std", + "sp-core/std", + "sp-runtime/std", + "sp-api/std", +] diff --git a/pallets/linkable-tree/rpc/runtime-api/Cargo.toml b/pallets/linkable-tree/rpc/runtime-api/Cargo.toml index ac11c5f8a..9fe862e2a 100644 --- a/pallets/linkable-tree/rpc/runtime-api/Cargo.toml +++ b/pallets/linkable-tree/rpc/runtime-api/Cargo.toml @@ -1,28 +1,28 @@ [package] -name = "pallet-linkable-tree-rpc-runtime-api" -version = "1.0.0" authors = ["Webb"] +description = "Linkable tree RPC API for linkable tree pallet" edition = "2018" license = "Apache-2.0" -description = "Linkable tree RPC API for linkable tree pallet" +name = "pallet-linkable-tree-rpc-runtime-api" readme = "README.md" +version = "1.0.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } pallet-linkable-tree = { default-features = false, path = "../../" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } webb-primitives = { path = "../../../../primitives", default-features = false } [features] default = ["std"] std = [ - "codec/std", - "sp-api/std", - "sp-std/std", - "pallet-linkable-tree/std", - "webb-primitives/std", + "codec/std", + "sp-api/std", + "sp-std/std", + "pallet-linkable-tree/std", + "webb-primitives/std", ] diff --git a/pallets/linkable-tree/src/mock.rs b/pallets/linkable-tree/src/mock.rs index 73546a3e5..008d050f6 100644 --- a/pallets/linkable-tree/src/mock.rs +++ b/pallets/linkable-tree/src/mock.rs @@ -156,9 +156,9 @@ impl ElementTrait for Element { parameter_types! { #[derive(Debug, TypeInfo)] - pub const MaxEdges: u32 = 1000; + pub const MaxEdges: u32 = 100000; #[derive(Debug, TypeInfo)] - pub const MaxDefaultHashes: u32 = 1000; + pub const MaxDefaultHashes: u32 = 100000; } impl pallet_mt::Config for Test { diff --git a/pallets/mixer/Cargo.toml b/pallets/mixer/Cargo.toml index 10b1538fb..f831f7877 100644 --- a/pallets/mixer/Cargo.toml +++ b/pallets/mixer/Cargo.toml @@ -10,47 +10,47 @@ version = "1.0.0" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = {package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"]} -scale-info = { version = "2.1.1", default-features = false, features = ["derive"]} +codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } log = "0.4" -webb-primitives = {path = "../../primitives", features = ["verifying"], default-features = false} -frame-support = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -frame-system = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -pallet-mt = {path = "../mt", default-features = false} -sp-runtime = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-std = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } - -frame-system-benchmarking = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +pallet-mt = { path = "../mt", default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +webb-primitives = { path = "../../primitives", features = ["verifying"], default-features = false } [dev-dependencies] -orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false} -ark-ec = { version = "^0.3.0", default-features = false} -ark-ff = { version = "^0.3.0", default-features = false} -ark-relations = { version = "^0.3.0", default-features = false} -ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"]} -ark-std = { version = "^0.3.0", default-features = false} +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +ark-ec = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } +ark-relations = { version = "^0.3.0", default-features = false } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } +ark-std = { version = "^0.3.0", default-features = false } +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", default-features = false } -pallet-asset-registry = { path = "../asset-registry", default-features = false } -pallet-verifier = {path = "../verifier", default-features = false} -pallet-hasher = {path = "../hasher", default-features = false} -serde = { version = "1.0.119"} hex = "0.4" +pallet-asset-registry = { path = "../asset-registry", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-hasher = { path = "../hasher", default-features = false } +pallet-verifier = { path = "../verifier", default-features = false } +serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -frame-benchmarking = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } [features] default = ["std"] runtime-benchmarks = [ + "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", ] diff --git a/pallets/mixer/src/lib.rs b/pallets/mixer/src/lib.rs index 140f2c41e..560db4c58 100644 --- a/pallets/mixer/src/lib.rs +++ b/pallets/mixer/src/lib.rs @@ -71,7 +71,7 @@ use frame_support::{ ensure, pallet_prelude::DispatchError, sp_runtime::traits::AccountIdConversion, traits::Get, PalletId, }; -use orml_traits::{currency::transactional, MultiCurrency}; +use orml_traits::MultiCurrency; use sp_std::prelude::*; use webb_primitives::{ hasher::InstanceHasher, @@ -242,7 +242,6 @@ pub mod pallet { Ok(().into()) } - #[transactional] #[pallet::weight(>::WeightInfo::deposit())] #[pallet::call_index(1)] pub fn deposit( @@ -256,7 +255,6 @@ pub mod pallet { Ok(().into()) } - #[transactional] #[pallet::weight(>::WeightInfo::withdraw())] #[pallet::call_index(2)] pub fn withdraw( diff --git a/pallets/mt/Cargo.toml b/pallets/mt/Cargo.toml index 7bb6b0179..b9169db64 100644 --- a/pallets/mt/Cargo.toml +++ b/pallets/mt/Cargo.toml @@ -10,47 +10,49 @@ version = "1.0.0" targets = ["x86_64-unknown-linux-gnu"] [dependencies] +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } +arkworks-setups = { version = "1.2.1", default-features = false } codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } - +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +pallet-hasher = { path = "../hasher", default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } webb-primitives = { path = "../../primitives", default-features = false } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } - [dev-dependencies] -hex-literal = "0.2.1" +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } +ark-std = { version = "^0.3.0", default-features = false } hex = "0.4" +hex-literal = "0.2.1" +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +pallet-hasher = { path = "../hasher", default-features = false } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-hasher = { path = "../hasher", default-features = false } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -arkworks-setups = { version = "1.2.1", default-features = false } + [features] default = ["std"] -std = [ - "codec/std", - "scale-info/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "pallet-hasher/std", - "webb-primitives/std", -] runtime-benchmarks = [ + "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", -] \ No newline at end of file +] +std = [ + "codec/std", + "scale-info/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "pallet-hasher/std", + "webb-primitives/std", + "pallet-hasher/std", +] diff --git a/pallets/mt/rpc/Cargo.toml b/pallets/mt/rpc/Cargo.toml index 4427c8226..f6f1e327a 100644 --- a/pallets/mt/rpc/Cargo.toml +++ b/pallets/mt/rpc/Cargo.toml @@ -1,30 +1,30 @@ [package] -name = "pallet-mt-rpc" -version = "0.1.0" authors = ["Webb Tools"] edition = "2018" +name = "pallet-mt-rpc" +version = "0.1.0" [dependencies] jsonrpsee = { version = "0.16.2", features = ["server"] } -thiserror = "1.0" sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +thiserror = "1.0" codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-blockchain = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -webb-primitives = { path = "../../../primitives", default-features = false } pallet-mt-rpc-runtime-api = { path = "./runtime-api", default-features = false } +webb-primitives = { path = "../../../primitives", default-features = false } [features] default = ["std"] std = [ - "codec/std", - "webb-primitives/std", - "pallet-mt-rpc-runtime-api/std", - "sp-core/std", - "sp-runtime/std", - "sp-api/std" -] \ No newline at end of file + "codec/std", + "webb-primitives/std", + "pallet-mt-rpc-runtime-api/std", + "sp-core/std", + "sp-runtime/std", + "sp-api/std", +] diff --git a/pallets/mt/rpc/runtime-api/Cargo.toml b/pallets/mt/rpc/runtime-api/Cargo.toml index deeb4e30d..9f80a333b 100644 --- a/pallets/mt/rpc/runtime-api/Cargo.toml +++ b/pallets/mt/rpc/runtime-api/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "pallet-mt-rpc-runtime-api" -version = "1.0.0" authors = ["Webb"] +description = "RPC runtime API for merkle tree pallet" edition = "2018" license = "Apache-2.0" -description = "RPC runtime API for merkle tree pallet" +name = "pallet-mt-rpc-runtime-api" readme = "README.md" +version = "1.0.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -17,6 +17,6 @@ webb-primitives = { path = "../../../../primitives", default-features = false } [features] default = ["std"] std = [ - "sp-api/std", - "webb-primitives/std", + "sp-api/std", + "webb-primitives/std", ] diff --git a/pallets/mt/src/benchmarking.rs b/pallets/mt/src/benchmarking.rs index 24eaba343..0a8383aef 100644 --- a/pallets/mt/src/benchmarking.rs +++ b/pallets/mt/src/benchmarking.rs @@ -49,7 +49,7 @@ benchmarks_instance_pallet! { create { let d in 1..>::MaxTreeDepth::get() as u32; - pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params()).unwrap(); + pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params().try_into().unwrap()).unwrap(); let caller: T::AccountId = whitelisted_caller(); <>::Currency as Currency>::make_free_balance_be(&caller, BalanceOf::::max_value()); let tree_id = Pallet::::next_tree_id(); @@ -61,7 +61,7 @@ benchmarks_instance_pallet! { insert { let caller: T::AccountId = whitelisted_caller(); - pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params()).unwrap(); + pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params().try_into().unwrap()).unwrap(); let tree_id: T::TreeId = as TreeInterface<_,_,_>>::create(Some(caller.clone()), T::MaxTreeDepth::get()).unwrap(); let leaf_index = Pallet::::next_leaf_index(tree_id); let element: T::Element = T::DefaultZeroElement::get(); @@ -76,7 +76,7 @@ benchmarks_instance_pallet! { let default_hashes = vec![>::DefaultZeroElement::get();p as usize]; - }:_(RawOrigin::Root, default_hashes) + }:_(RawOrigin::Root, default_hashes.try_into().unwrap()) verify { assert_eq!(DefaultHashes::::get().len(), p as usize) } diff --git a/pallets/mt/src/lib.rs b/pallets/mt/src/lib.rs index 1f61d75f0..0c048b9f2 100644 --- a/pallets/mt/src/lib.rs +++ b/pallets/mt/src/lib.rs @@ -44,6 +44,7 @@ //! * [`Support`](../frame_support/index.html) // Ensure we're `no_std` when compiling for Wasm. +#![allow(clippy::type_complexity)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] @@ -397,7 +398,10 @@ impl, I: 'static> TreeInterface, depth: u8) -> Result { // Setting the next tree id let tree_id = Self::next_tree_id(); - NextTreeId::::mutate(|id| *id += One::one()); + NextTreeId::::mutate(|id| { + *id = id.saturating_add(One::one()); + *id + }); // get unit of two let two: T::LeafIndex = Self::two(); // get default edge nodes @@ -465,10 +469,14 @@ impl, I: 'static> TreeInterface::mutate(|i| { - *i = i.saturating_add(One::one()) % T::RootHistorySize::get() + *i = i.saturating_add(One::one()) % T::RootHistorySize::get(); + *i }); CachedRoots::::insert(id, root_index, hash); - NextLeafIndex::::mutate(id, |i| *i += One::one()); + NextLeafIndex::::mutate(id, |i| { + *i = i.saturating_add(One::one()); + *i + }); // return the root Ok(hash) @@ -493,7 +501,7 @@ impl, I: 'static> TreeInspector, nonce: [u8; 4], encoded_call: Vec, I: 'static>(pub_key: sp_core::ecdsa::Public) -> Vec { - let maintainer_key = - libsecp256k1::PublicKey::parse_compressed(&pub_key.0).unwrap().serialize()[1..].to_vec(); + let maintainer_key: BoundedVec = + libsecp256k1::PublicKey::parse_compressed(&pub_key.0).unwrap().serialize()[1..] + .to_vec() + .try_into() + .unwrap(); Maintainer::::put(maintainer_key.clone()); - maintainer_key + maintainer_key.into_inner() } /// Return the src_chain_id in correct format @@ -82,17 +86,17 @@ benchmarks_instance_pallet! { set_maintainer { let caller: T::AccountId = whitelisted_caller(); let (old_maintainer, message, signature) = generate_maintainer_signatures::(); - }: _(RawOrigin::Signed(caller), message.clone(), signature) + }: _(RawOrigin::Signed(caller), message.clone().try_into().unwrap(), signature.try_into().unwrap()) verify { - assert_last_event::(Event::MaintainerSet{old_maintainer: old_maintainer, new_maintainer: message}.into()); + assert_last_event::(Event::MaintainerSet{old_maintainer: old_maintainer.try_into().unwrap(), new_maintainer: message.try_into().unwrap()}.into()); } force_set_maintainer { let caller: T::AccountId = whitelisted_caller(); let new_maintainer = ecdsa_generate(DUMMY, None); - }: _(RawOrigin::Root, new_maintainer.encode()) + }: _(RawOrigin::Root, new_maintainer.encode().try_into().unwrap()) verify { - assert_last_event::(Event::MaintainerSet{old_maintainer: Default::default(), new_maintainer: new_maintainer.encode()}.into()); + assert_last_event::(Event::MaintainerSet{old_maintainer: Default::default(), new_maintainer: new_maintainer.encode().try_into().unwrap()}.into()); } set_resource { @@ -135,7 +139,7 @@ benchmarks_instance_pallet! { let prop_data = make_proposal_data(r_id.encode(), nonce, call_encoded); let msg = keccak_256(&prop_data); let signature = ecdsa_sign_prehashed(DUMMY, &maintainer, &msg).unwrap(); - }: _(RawOrigin::Signed(caller), src_id.into(), prop_data, signature.encode()) + }: _(RawOrigin::Signed(caller), src_id.into(), prop_data.try_into().unwrap(), signature.encode().try_into().unwrap()) verify { assert_last_event::(Event::ProposalSucceeded{chain_id : src_id.into(), proposal_nonce : 1_u32.into()}.into()); } @@ -162,7 +166,7 @@ benchmarks_instance_pallet! { let prop_data = make_proposal_data(r_id.encode(), nonce, call_encoded); let msg = keccak_256(&prop_data); let signature = ecdsa_sign_prehashed(DUMMY, &maintainer, &msg).unwrap(); - }: _(RawOrigin::Signed(caller), src_id.into(), prop_data, signature.encode()) + }: _(RawOrigin::Signed(caller), src_id.into(), prop_data.try_into().unwrap(), signature.encode().try_into().unwrap()) verify { assert_last_event::(Event::ProposalSucceeded{chain_id : src_id.into(), proposal_nonce : 1_u32.into()}.into()); } diff --git a/pallets/token-wrapper-handler/Cargo.toml b/pallets/token-wrapper-handler/Cargo.toml index 31e0bd099..e86cc70b6 100644 --- a/pallets/token-wrapper-handler/Cargo.toml +++ b/pallets/token-wrapper-handler/Cargo.toml @@ -12,31 +12,31 @@ version = "1.0.0" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = {package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"]} -scale-info = { version = "2.1.1", default-features = false, features = ["derive"]} -asset-registry = {package = "pallet-asset-registry", path = "../asset-registry", default-features = false} -frame-support = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -frame-system = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +asset-registry = { package = "pallet-asset-registry", path = "../asset-registry", default-features = false } +codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } pallet-token-wrapper = { path = "../token-wrapper", default-features = false } -sp-arithmetic = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-std = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } #Optional dependencies -frame-benchmarking = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] -pallet-signature-bridge = { path = "../signature-bridge", default-features = false } +hex-literal = "0.3.4" orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-signature-bridge = { path = "../signature-bridge", default-features = false } pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +webb-primitives = { path = "../../primitives", default-features = false } webb-proposals = { version = "0.5.4", default-features = false, features = ["scale", "substrate"] } -webb-primitives = {path = "../../primitives", default-features = false} -hex-literal = "0.3.4" [features] default = ["std"] @@ -57,4 +57,3 @@ std = [ "sp-arithmetic/std", "pallet-token-wrapper/std", ] - diff --git a/pallets/token-wrapper/Cargo.toml b/pallets/token-wrapper/Cargo.toml index 2a0547971..83428c1cd 100644 --- a/pallets/token-wrapper/Cargo.toml +++ b/pallets/token-wrapper/Cargo.toml @@ -12,33 +12,34 @@ version = "1.0.0" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = {package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"]} -scale-info = { version = "2.1.1", default-features = false, features = ["derive"]} +codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -asset-registry = {package = "pallet-asset-registry", path = "../asset-registry", default-features = false} -frame-support = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -frame-system = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-arithmetic = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-std = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +asset-registry = { package = "pallet-asset-registry", path = "../asset-registry", default-features = false } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } #Optional dependencies -frame-benchmarking = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -webb-primitives = {path = "../../primitives", default-features = false} +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +webb-primitives = { path = "../../primitives", default-features = false } [features] default = ["std"] runtime-benchmarks = [ + "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", ] diff --git a/pallets/token-wrapper/src/benchmarking.rs b/pallets/token-wrapper/src/benchmarking.rs index 996429edb..c39f38502 100644 --- a/pallets/token-wrapper/src/benchmarking.rs +++ b/pallets/token-wrapper/src/benchmarking.rs @@ -21,11 +21,10 @@ use super::*; -use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; - use crate::traits::TokenWrapperInterface; use asset_registry::{Registry, ShareTokenRegistry}; -use frame_support::dispatch::DispatchError; +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; +use frame_support::{dispatch::DispatchError, BoundedVec}; use frame_system::RawOrigin; use orml_traits::MultiCurrency; use sp_std::vec; @@ -40,18 +39,18 @@ benchmarks! { let existential_balance: u32 = 1000; let balance: u32 = 10_000; let recipient: T::AccountId = whitelisted_caller(); - let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool, DispatchError>>::create_asset( &b"shib".to_vec(), existential_balance.into(), ) .unwrap(); - let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool, DispatchError>>::create_asset( &b"doge".to_vec(), existential_balance.into(), ) .unwrap(); - let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, DispatchError>>::create_shared_asset( + let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, ::MaxAssetIdInPool, DispatchError>>::create_shared_asset( &b"meme".to_vec(), &vec![second_token_id, first_token_id], existential_balance.into(), @@ -85,18 +84,18 @@ benchmarks! { let existential_balance: u32 = 1000; let balance: u32 = 10_000; let recipient: T::AccountId = whitelisted_caller(); - let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"shib".to_vec(), existential_balance.into(), ) .unwrap(); - let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"doge".to_vec(), existential_balance.into(), ) .unwrap(); - let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, DispatchError>>::create_shared_asset( + let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_shared_asset( &b"meme".to_vec(), &vec![second_token_id, first_token_id], existential_balance.into(), @@ -127,18 +126,18 @@ benchmarks! { let existential_balance: u32 = 1000; let balance: u32 = 10_000; let recipient: T::AccountId = whitelisted_caller(); - let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"shib".to_vec(), existential_balance.into(), ) .unwrap(); - let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"doge".to_vec(), existential_balance.into(), ) .unwrap(); - let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, DispatchError>>::create_shared_asset( + let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_shared_asset( &b"meme".to_vec(), &vec![second_token_id, first_token_id], existential_balance.into(), @@ -158,18 +157,18 @@ benchmarks! { set_fee_recipient { let existential_balance: u32 = 1000; - let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"shib".to_vec(), existential_balance.into(), ) .unwrap(); - let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"doge".to_vec(), existential_balance.into(), ) .unwrap(); - let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, DispatchError>>::create_shared_asset( + let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_shared_asset( &b"meme".to_vec(), &vec![second_token_id, first_token_id], existential_balance.into(), @@ -190,18 +189,18 @@ benchmarks! { rescue_tokens { let existential_balance: u32 = 1000; - let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let first_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_asset( &b"shib".to_vec(), existential_balance.into(), ) .unwrap(); - let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec, DispatchError>>::create_asset( + let second_token_id = <::AssetRegistry as Registry<::AssetId, Vec, ::Balance, BoundedVec,::MaxAssetIdInPool, DispatchError>>::create_asset( &b"doge".to_vec(), existential_balance.into(), ) .unwrap(); let pool_asset_name = b"meme".to_vec(); - let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, DispatchError>>::create_shared_asset( + let pool_share_id = <::AssetRegistry as ShareTokenRegistry<::AssetId, Vec, T::Balance, BoundedVec, ::MaxAssetIdInPool,DispatchError>>::create_shared_asset( &pool_asset_name, &vec![second_token_id, first_token_id], existential_balance.into(), @@ -209,7 +208,8 @@ benchmarks! { .unwrap(); let fee_recipient: T::AccountId = whitelisted_caller(); - FeeRecipient::::insert(pool_asset_name, &fee_recipient); + let bounded_name : BoundedVec = pool_asset_name.try_into().unwrap(); + FeeRecipient::::insert(bounded_name, &fee_recipient); let amount: u32 = 10_000; <::Currency as MultiCurrency>::deposit( diff --git a/pallets/token-wrapper/src/traits.rs b/pallets/token-wrapper/src/traits.rs index c288647be..00061f250 100644 --- a/pallets/token-wrapper/src/traits.rs +++ b/pallets/token-wrapper/src/traits.rs @@ -1,3 +1,4 @@ +#![allow(clippy::ptr_arg, clippy::type_complexity)] use frame_support::dispatch; use sp_std::vec::Vec; diff --git a/pallets/vanchor-handler/Cargo.toml b/pallets/vanchor-handler/Cargo.toml index 2450a3089..53987e62f 100644 --- a/pallets/vanchor-handler/Cargo.toml +++ b/pallets/vanchor-handler/Cargo.toml @@ -13,46 +13,46 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # third-party dependencies -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } +serde = { version = "1.0.101", optional = true } # frame dependencies -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-mt = { path = "../mt", default-features = false } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-asset-registry = { path = "../asset-registry", default-features = false } pallet-linkable-tree = { path = "../linkable-tree", default-features = false } +pallet-mt = { path = "../mt", default-features = false } pallet-vanchor = { path = "../vanchor", default-features = false } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } webb-primitives = { path = "../../primitives", default-features = false } -pallet-asset-registry = { path = "../asset-registry", default-features = false } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +hex-literal = "0.3.4" +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +pallet-hasher = { path = "../hasher", default-features = false } +pallet-key-storage = { path = "../key-storage" } +pallet-linkable-tree = { path = "../linkable-tree", default-features = false } +pallet-mt = { path = "../mt", default-features = false } pallet-signature-bridge = { path = "../signature-bridge", default-features = false } +pallet-token-wrapper = { path = "../token-wrapper", default-features = false } +pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-hasher = { path = "../hasher", default-features = false } -pallet-mt = { path = "../mt", default-features = false } -pallet-linkable-tree = { path = "../linkable-tree", default-features = false } -pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } -pallet-token-wrapper = { path = "../token-wrapper", default-features = false } webb-primitives = { path = "../../primitives", default-features = false } -pallet-key-storage = {path = "../key-storage"} -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -hex-literal = "0.3.4" ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } @@ -60,27 +60,27 @@ webb-proposals = { version = "0.5.4", default-features = false, features = ["sca [features] default = ["std"] -std = [ - "codec/std", - "serde", - "sp-std/std", - "sp-runtime/std", - "sp-io/std", - "sp-core/std", - "sp-arithmetic/std", - "frame-support/std", - "frame-system/std", - "pallet-mt/std", - "pallet-vanchor/std", - "pallet-vanchor-verifier/std", - "pallet-signature-bridge/std", - "pallet-token-wrapper/std", - "orml-traits/std", - "webb-primitives/std", - "pallet-asset-registry/std", -] runtime-benchmarks = [ "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", ] +std = [ + "codec/std", + "serde", + "sp-std/std", + "sp-runtime/std", + "sp-io/std", + "sp-core/std", + "sp-arithmetic/std", + "frame-support/std", + "frame-system/std", + "pallet-mt/std", + "pallet-vanchor/std", + "pallet-vanchor-verifier/std", + "pallet-signature-bridge/std", + "pallet-token-wrapper/std", + "orml-traits/std", + "webb-primitives/std", + "pallet-asset-registry/std", +] diff --git a/pallets/vanchor-verifier/Cargo.toml b/pallets/vanchor-verifier/Cargo.toml index efde40bc3..c2b8f3c73 100644 --- a/pallets/vanchor-verifier/Cargo.toml +++ b/pallets/vanchor-verifier/Cargo.toml @@ -13,37 +13,37 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -log = { version = "0.4.14", default-features = false } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +log = { version = "0.4.14", default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } webb-primitives = { path = "../../primitives", default-features = false, features = ["verifying"] } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } [features] default = ["std"] -std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "webb-primitives/std", -] runtime-benchmarks = [ "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", -] \ No newline at end of file +] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "webb-primitives/std", +] diff --git a/pallets/vanchor-verifier/src/benchmarking.rs b/pallets/vanchor-verifier/src/benchmarking.rs index 726eaeeac..5c1ca3c0a 100644 --- a/pallets/vanchor-verifier/src/benchmarking.rs +++ b/pallets/vanchor-verifier/src/benchmarking.rs @@ -45,7 +45,7 @@ benchmarks_instance_pallet! { let c in 0..MAX_VERIFIER_LENGTH; let depositor: T::AccountId = account("depositor", 0, SEED); let parameters = vec![0u8;c as usize]; - }: _(RawOrigin::Root, (1u8,1u8), parameters.clone()) + }: _(RawOrigin::Root, (1u8,1u8), parameters.clone().try_into().unwrap()) verify { assert_eq!(Pallet::::parameters((1u8,1u8)), parameters); } diff --git a/pallets/vanchor-verifier/src/lib.rs b/pallets/vanchor-verifier/src/lib.rs index 7e9c58d97..baa43a580 100644 --- a/pallets/vanchor-verifier/src/lib.rs +++ b/pallets/vanchor-verifier/src/lib.rs @@ -51,7 +51,7 @@ //! //! * [`System`](../frame_system/index.html) //! * [`Support`](../frame_support/index.html) - +#![allow(clippy::ptr_arg, clippy::type_complexity)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/pallets/vanchor/Cargo.toml b/pallets/vanchor/Cargo.toml index 68c147923..0c1e7b9be 100644 --- a/pallets/vanchor/Cargo.toml +++ b/pallets/vanchor/Cargo.toml @@ -13,66 +13,71 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-ff = { version = "^0.3.0", default-features = false } +ark-std = { version = "^0.3.0", default-features = false } +arkworks-native-gadgets = { version = "1.2.0", default-features = false } +arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-linkable-tree = { path = "../linkable-tree", default-features = false } -pallet-mt = { path = "../mt", default-features = false } -webb-primitives = { path = "../../primitives", default-features = false, features = ["hashing", "verifying", "field_ops"] } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +getrandom = { version = "0.2", features = ["js"] } +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } pallet-asset-registry = { path = "../asset-registry", default-features = false } +pallet-hasher = { path = "../hasher", default-features = false } +pallet-linkable-tree = { path = "../linkable-tree", default-features = false } +pallet-mt = { path = "../mt", default-features = false } pallet-token-wrapper = { path = "../token-wrapper", default-features = false } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -arkworks-native-gadgets = { version = "1.2.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } -ark-ff = { version = "^0.3.0", default-features = false} - -[dev-dependencies] -serde = { version = "1.0.119" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-treasury = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-key-storage = {path = "../key-storage"} -pallet-hasher = { path = "../hasher", default-features = false } -pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -rand = "0.8.4" -arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +webb-primitives = { path = "../../primitives", default-features = false, features = ["hashing", "verifying", "field_ops"] } + +[dev-dependencies] +ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false} ark-ec = { version = "^0.3.0", default-features = false } -ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ]} +ark-ff = { version = "^0.3.0", default-features = false } ark-groth16 = { version = "^0.3.0", default-features = false } +ark-relations = { version = "^0.3.0", default-features = false } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } ark-std = { version = "^0.3.0", default-features = false } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +pallet-key-storage = { path = "../key-storage" } +pallet-treasury = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +rand = "0.8.4" +serde = { version = "1.0.119" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } [features] default = ["std"] -std = [ - "codec/std", - "scale-info/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "pallet-hasher/std", - "pallet-linkable-tree/std", - "pallet-asset-registry/std", - "webb-primitives/std", - "frame-benchmarking/std", - "pallet-token-wrapper/std", - "ark-std/std" -] runtime-benchmarks = [ - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] +std = [ + "codec/std", + "scale-info/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "pallet-hasher/std", + "pallet-linkable-tree/std", + "pallet-vanchor-verifier/std", + "pallet-asset-registry/std", + "webb-primitives/std", + "frame-benchmarking/std", + "pallet-token-wrapper/std", + "ark-std/std", ] diff --git a/pallets/vanchor/src/benchmarking.rs b/pallets/vanchor/src/benchmarking.rs index 51f63655c..c37eb747c 100644 --- a/pallets/vanchor/src/benchmarking.rs +++ b/pallets/vanchor/src/benchmarking.rs @@ -56,8 +56,11 @@ where T: pallet_hasher::Config, { // Initialize hasher pallet - pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params()) - .unwrap(); + pallet_hasher::Pallet::::force_set_parameters( + RawOrigin::Root.into(), + hasher_params().try_into().unwrap(), + ) + .unwrap(); // 2. Initialize MerkleTree pallet. as OnInitialize<_>>::on_initialize(Default::default()); @@ -118,7 +121,7 @@ benchmarks_instance_pallet! { let i in 1..MAX_EDGES; let d in 1..>::MaxTreeDepth::get() as u32; - pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params()).unwrap(); + pallet_hasher::Pallet::::force_set_parameters(RawOrigin::Root.into(), hasher_params().try_into().unwrap()).unwrap(); let asset_id = <>::NativeCurrencyId as Get>>::get(); }: _(RawOrigin::Root, i, d as u8, asset_id) diff --git a/pallets/vanchor/src/benchmarking_utils.rs b/pallets/vanchor/src/benchmarking_utils.rs index b33de4dcf..9b2cbf2c3 100644 --- a/pallets/vanchor/src/benchmarking_utils.rs +++ b/pallets/vanchor/src/benchmarking_utils.rs @@ -1,6 +1,6 @@ #![cfg(feature = "runtime-benchmarks")] use ark_ff::{BigInteger, PrimeField}; -use ark_std::{collections::BTreeMap, rand::thread_rng, vec::Vec}; +use ark_std::{collections::BTreeMap, vec::Vec}; use arkworks_native_gadgets::poseidon::Poseidon; use arkworks_setups::{ common::{setup_params, setup_tree_and_create_path}, @@ -34,7 +34,7 @@ pub fn setup_utxos( indices: Option<[u64; NUM_UTXOS]>, ) -> [Utxo; NUM_UTXOS] { let curve = Curve::Bn254; - let rng = &mut thread_rng(); + let rng = &mut ark_std::test_rng(); // Input Utxos let indices: [Option; NUM_UTXOS] = if indices.is_some() { let ind_unw = indices.unwrap(); @@ -75,7 +75,7 @@ pub fn setup_zk_circuit( custom_root: Element, ) -> (Vec, Vec) { let curve = Curve::Bn254; - let rng = &mut thread_rng(); + let rng = &mut ark_std::test_rng(); let leaf0 = in_utxos[0].commitment.into_repr().to_bytes_be(); let leaf1 = in_utxos[1].commitment.into_repr().to_bytes_be(); diff --git a/pallets/vanchor/src/lib.rs b/pallets/vanchor/src/lib.rs index ca3b8b65d..d2af3ae8f 100644 --- a/pallets/vanchor/src/lib.rs +++ b/pallets/vanchor/src/lib.rs @@ -54,7 +54,6 @@ use codec::{Decode, Encode}; use frame_support::{dispatch::DispatchResult, ensure, pallet_prelude::DispatchError, traits::Get}; use orml_traits::{ arithmetic::{Signed, Zero}, - currency::transactional, MultiCurrency, MultiCurrencyExtended, }; use pallet_token_wrapper::traits::TokenWrapperInterface; @@ -315,7 +314,7 @@ pub mod pallet { T::ProposalNonce::from(ctr), ) .map_err(|_| panic!("Failed to create vanchor")); - ctr += 1; + ctr = ctr.saturating_add(1); }); } } @@ -342,7 +341,6 @@ pub mod pallet { Ok(().into()) } - #[transactional] #[pallet::weight(>::WeightInfo::transact())] #[pallet::call_index(1)] pub fn transact( @@ -356,7 +354,6 @@ pub mod pallet { Ok(().into()) } - #[transactional] #[pallet::weight(>::WeightInfo::register_and_transact())] #[pallet::call_index(2)] pub fn register_and_transact( diff --git a/pallets/verifier/Cargo.toml b/pallets/verifier/Cargo.toml index ceb181d4a..30cd76ff4 100644 --- a/pallets/verifier/Cargo.toml +++ b/pallets/verifier/Cargo.toml @@ -13,37 +13,37 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -log = { version = "0.4.14", default-features = false } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +log = { version = "0.4.14", default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } webb-primitives = { path = "../../primitives", default-features = false, features = ["verifying"] } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } [dev-dependencies] +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } serde = { version = "1.0.119" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } [features] default = ["std"] -std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-runtime/std", - "sp-std/std", - "webb-primitives/std", -] runtime-benchmarks = [ "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", -] \ No newline at end of file +] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "webb-primitives/std", +] diff --git a/pallets/verifier/src/benchmarking.rs b/pallets/verifier/src/benchmarking.rs index 4b800f15e..1137857ba 100644 --- a/pallets/verifier/src/benchmarking.rs +++ b/pallets/verifier/src/benchmarking.rs @@ -45,9 +45,9 @@ benchmarks_instance_pallet! { let c in 0..MAX_VERIFIER_LENGTH; let depositor: T::AccountId = account("depositor", 0, SEED); let parameters = vec![0u8;c as usize]; - }: _(RawOrigin::Root, parameters.clone()) + }: _(RawOrigin::Root, parameters.clone().try_into().unwrap()) verify { - assert_eq!(Pallet::::parameters(), parameters); + assert_eq!(Pallet::::parameters().into_inner(), parameters); } } diff --git a/pallets/xanchor/Cargo.toml b/pallets/xanchor/Cargo.toml index 1df3097d9..ff309bcdf 100644 --- a/pallets/xanchor/Cargo.toml +++ b/pallets/xanchor/Cargo.toml @@ -1,94 +1,94 @@ [package] +edition = "2021" name = "pallet-xanchor" version = "0.1.0" -edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", optional = true } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-asset-registry = { path = "../asset-registry", default-features = false } pallet-hasher = { path = "../hasher", default-features = false } -pallet-verifier = { path = "../verifier", default-features = false } -pallet-mt = { path = "../mt", default-features = false } pallet-linkable-tree = { path = "../linkable-tree", default-features = false } +pallet-mt = { path = "../mt", default-features = false } pallet-vanchor = { path = "../vanchor", default-features = false } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-verifier = { path = "../verifier", default-features = false } webb-primitives = { path = "../../primitives", default-features = false } -pallet-asset-registry = { path = "../asset-registry", default-features = false } webb-proposals = { version = "0.5.4", default-features = false, features = ["scale", "substrate"] } # XCM dependencies -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36", default-features = false } cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36", default-features = false } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } [dev-dependencies] -serde = { version = "1.0.119" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } pallet-democracy = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } pallet-preimage = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } pallet-scheduler = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } -orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.36", default-features = false } rand = "0.8.4" +serde = { version = "1.0.119" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "^0.3.0", default-features = false} ark-ec = { version = "^0.3.0", default-features = false } +ark-ff = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ]} +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } ark-std = { version = "^0.3.0", default-features = false } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } arkworks-native-gadgets = { version = "1.2.0", default-features = false } +arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } webb-primitives = { path = "../../primitives" } pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } -xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } +xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } +xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36", default-features = false } [features] default = ["std"] std = [ - "codec/std", - "scale-info/std", - "serde", - "cumulus-primitives-core/std", - "cumulus-pallet-xcm/std", - "sp-std/std", - "sp-runtime/std", - "frame-support/std", - "frame-system/std", - "pallet-hasher/std", - "pallet-mt/std", - "pallet-verifier/std", - "pallet-vanchor/std", - "orml-traits/std", - "webb-primitives/std", - "pallet-asset-registry/std", - "frame-benchmarking/std", - "webb-proposals/std", + "codec/std", + "scale-info/std", + "serde", + "cumulus-primitives-core/std", + "cumulus-pallet-xcm/std", + "sp-std/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-hasher/std", + "pallet-mt/std", + "pallet-verifier/std", + "pallet-vanchor/std", + "orml-traits/std", + "webb-primitives/std", + "pallet-asset-registry/std", + "frame-benchmarking/std", + "webb-proposals/std", ] runtime-benchmarks = [ - "frame-benchmarking", - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", ] diff --git a/pallets/xanchor/src/lib.rs b/pallets/xanchor/src/lib.rs index fb89d34e7..f7a880544 100644 --- a/pallets/xanchor/src/lib.rs +++ b/pallets/xanchor/src/lib.rs @@ -210,6 +210,8 @@ pub mod pallet { SendingLinkProposalFailed, /// Anchor Link is not found! AnchorLinkNotFound, + /// Invalid data for anchor update proposa + InvalidAnchorUpdateProposal } #[pallet::hooks] @@ -318,7 +320,7 @@ pub mod pallet { /// **Note**: This method requires the `origin` to be a sibling /// parachain. - #[transactional] + #[pallet::weight(0)] #[pallet::call_index(2)] pub fn save_link_proposal( @@ -507,7 +509,7 @@ pub mod pallet { // get the anchor update proposal struct from the bytes let anchor_update_proposal = - AnchorUpdateProposal::try_from(anchor_update_proposal_bytes).unwrap(); + AnchorUpdateProposal::try_from(anchor_update_proposal_bytes).ok_or(Error::InvalidAnchorUpdateProposal)?; let (src_system, src_chain_id) = utils::parse_resource_id::( anchor_update_proposal.header().resource_id().into(), diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 23f914785..6910ca7f0 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,32 +1,32 @@ [package] -name = "webb-primitives" -version = "0.1.0" authors = ["Drew Stone "] edition = "2018" +name = "webb-primitives" +version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1.0.119", optional = true, features = ["derive"] } codec = { default-features = false, features = ["derive", "max-encoded-len"], package = "parity-scale-codec", version = "3" } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +serde = { version = "1.0.119", optional = true, features = ["derive"] } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-consensus-babe = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } -sp-consensus-babe = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" } # Arkworks -ark-ff = { version = "^0.3.0", default-features = false } +ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"], optional = true } +ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"], optional = true } ark-ec = { version = "^0.3.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } -ark-relations = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] } -ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "curve" ], optional = true } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ], optional = true } +ark-ff = { version = "^0.3.0", default-features = false } ark-groth16 = { version = "^0.3.0", default-features = false } +ark-relations = { version = "^0.3.0", default-features = false } +ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } +ark-std = { version = "^0.3.0", default-features = false } # ark-circom = { git = "https://github.com/gakonst/ark-circom.git", default-features = false } blake2 = { version = "0.9", default-features = false } @@ -41,33 +41,33 @@ webb-proposals = { version = "0.5.4", default-features = false, features = ["sca [features] default = ["std", "hashing", "verifying", "field_ops"] -std = [ - "serde", - "codec/std", - "frame-support/std", - "sp-core/std", - "sp-std/std", - "sp-io/std", - "sp-runtime/std", - "sp-consensus-aura/std", - "sp-consensus-babe/std", - "ark-ff/std", - "ark-ec/std", - "ark-std/std", - "ark-relations/std", - "webb-proposals/std" -] field_ops = [ - "ark-bls12-381", - "ark-bn254", + "ark-bls12-381", + "ark-bn254", ] hashing = [ - "arkworks-native-gadgets", - "ark-bls12-381", - "ark-bn254", + "arkworks-native-gadgets", + "ark-bls12-381", + "ark-bn254", +] +std = [ + "serde", + "codec/std", + "frame-support/std", + "sp-core/std", + "sp-std/std", + "sp-io/std", + "sp-runtime/std", + "sp-consensus-aura/std", + "sp-consensus-babe/std", + "ark-ff/std", + "ark-ec/std", + "ark-std/std", + "ark-relations/std", + "webb-proposals/std", ] verifying = [ - "arkworks-native-gadgets", - "ark-bls12-381", - "ark-bn254", + "arkworks-native-gadgets", + "ark-bls12-381", + "ark-bn254", ] diff --git a/primitives/src/types/mod.rs b/primitives/src/types/mod.rs index 33e5e72cf..20129f833 100644 --- a/primitives/src/types/mod.rs +++ b/primitives/src/types/mod.rs @@ -87,6 +87,7 @@ pub trait ElementTrait: } } +#[allow(clippy::wrong_self_convention)] pub trait IntoAbiToken { fn into_abi(&self) -> Token; fn encode_abi(&self) -> Vec { diff --git a/primitives/src/types/vanchor.rs b/primitives/src/types/vanchor.rs index 593bf76a6..6a4281f5d 100644 --- a/primitives/src/types/vanchor.rs +++ b/primitives/src/types/vanchor.rs @@ -1,7 +1,7 @@ use super::{ElementTrait, IntoAbiToken, Token}; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; -use sp_std::vec::Vec; +use sp_std::{vec, vec::Vec}; #[derive(Clone, Encode, Decode, TypeInfo, MaxEncodedLen)] pub struct VAnchorMetadata { @@ -82,15 +82,16 @@ impl IntoAbiToken for ExtData; type RemoveItemsLimit = ConstU32<1000>; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); } impl pallet_sudo::Config for Runtime { @@ -1153,7 +1151,6 @@ impl pallet_mt::Config for Runtime { type Two = Two; type WeightInfo = pallet_mt::weights::WebbWeight; } - parameter_types! { pub const MaxParameterLength : u32 = 1000; } @@ -1166,7 +1163,7 @@ impl pallet_verifier::Config for Runtime { type WeightInfo = pallet_verifier::weights::WebbWeight; } -impl pallet_vanchor_verifier::Config for Runtime { +impl pallet_vanchor_verifier::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ForceOrigin = frame_system::EnsureRoot; type Verifier = ArkworksVerifierBn254; @@ -1472,7 +1469,7 @@ construct_runtime!( MixerVerifierBn254: pallet_verifier::::{Pallet, Call, Storage, Event, Config}, // VAnchor Verifier - VAnchorVerifier: pallet_vanchor_verifier::{Pallet, Call, Storage, Event, Config}, + VAnchorVerifier: pallet_vanchor_verifier::::{Pallet, Call, Storage, Event, Config}, // Merkle Tree MerkleTreeBn254: pallet_mt::::{Pallet, Call, Storage, Event, Config}, @@ -1769,11 +1766,9 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_mt, MerkleTreeBn254); list_benchmark!(list, extra, pallet_linkable_tree, LinkableTreeBn254); list_benchmark!(list, extra, pallet_vanchor, VAnchorBn254); - list_benchmark!(list, extra, pallet_vanchor_handler, VAnchorHandlerBn254); list_benchmark!(list, extra, pallet_mixer, MixerBn254); list_benchmark!(list, extra, pallet_verifier, MixerVerifierBn254); list_benchmark!(list, extra, pallet_token_wrapper, TokenWrapper); - list_benchmark!(list, extra, pallet_token_wrapper_handler, TokenWrapperHandler); list_benchmark!(list, extra, pallet_signature_bridge, SignatureBridge); list_benchmark!(list, extra, pallet_relayer_registry, RelayerRegistry); list_benchmark!(list, extra, pallet_key_storage, KeyStorage); @@ -1810,11 +1805,9 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_mt, MerkleTreeBn254); add_benchmark!(params, batches, pallet_linkable_tree, LinkableTreeBn254); add_benchmark!(params, batches, pallet_vanchor, VAnchorBn254); - add_benchmark!(params, batches, pallet_vanchor_handler, VAnchorHandlerBn254); add_benchmark!(params, batches, pallet_mixer, MixerBn254); add_benchmark!(params, batches, pallet_verifier, MixerVerifierBn254); add_benchmark!(params, batches, pallet_token_wrapper, TokenWrapper); - add_benchmark!(params, batches, pallet_token_wrapper_handler, TokenWrapperHandler); add_benchmark!(params, batches, pallet_signature_bridge, SignatureBridge); add_benchmark!(params, batches, pallet_relayer_registry, RelayerRegistry); add_benchmark!(params, batches, pallet_key_storage, KeyStorage);