diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 47c04c6ba..6e76dec10 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -25,9 +25,14 @@ jobs: - uses: actions/checkout@v2 - name: Set-Up run: sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl protobuf-compiler + - name: Setup DVC + uses: iterative/setup-dvc@v1 + - name: Fetch Fixtures + run: ./scripts/fetch-fixtures.sh - name: Check Format run: | SKIP_WASM_BUILD=1 cargo fmt --all -- --check + SKIP_WASM_BUILD=1 cargo clippy --all-targets --workspace --exclude webb-client -- --deny warnings # Build job check-build: diff --git a/Cargo.lock b/Cargo.lock index cb8142057..66a82e398 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12736,6 +12736,7 @@ dependencies = [ "arkworks-setups", "cfg-if", "color-eyre 0.6.2", + "frame-benchmarking", "frame-support", "frame-system", "hex", @@ -12814,7 +12815,6 @@ version = "1.0.0" dependencies = [ "ark-bn254 0.3.0", "arkworks-setups", - "array-bytes", "clap 4.2.1", "frame-benchmarking", "frame-benchmarking-cli", diff --git a/circom-proving/Cargo.toml b/circom-proving/Cargo.toml index c70894b0e..ed9b98a42 100644 --- a/circom-proving/Cargo.toml +++ b/circom-proving/Cargo.toml @@ -1,31 +1,30 @@ [package] +edition = "2021" name = "circom-proving" version = "0.1.0" -edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ark-ff = { version = "0.3.0", default-features = false, features = [ "asm"] } +ark-bn254 = { version = "0.3.0" } +ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } 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, features = ["asm"] } ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } +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" } -ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } num-bigint = { version = "0.4", default-features = false, features = ["rand"] } # For ark-circom -once_cell = "1.14.0" +ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +arkworks-native-gadgets = { version = "1.2.0", default-features = false } cfg-if = "1.0" -wasmer = { version = "2.3.0", default-features = false } -num-traits = "0.2.11" -thiserror = "1.0.0" color-eyre = "0.6.1" +num-traits = "0.2.11" +once_cell = "1.14.0" serde_json = "1.0.48" -arkworks-native-gadgets = { version = "1.2.0", default-features = false } -ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } +thiserror = "1.0.0" +wasmer = { version = "2.3.0", default-features = false } [features] default = ["wasmer/sys-default"] - diff --git a/client/Cargo.toml b/client/Cargo.toml index a0c3df069..5fbb999d9 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -7,9 +7,9 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full", "bit-vec"] } -subxt = { version = "0.25.0" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } +subxt = { version = "0.25.0" } [dev-dependencies] hex = "0.4" @@ -23,30 +23,31 @@ 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-circom = { git = "https://github.com/gakonst/ark-circom", branch = "master", default-features = false, features = ["circom-2"] } 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-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", features = ["parallel"] } 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", branch = "master", default-features = false, features = ["circom-2"] } -ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", features = ["parallel"] } -rand = "0.8.4" -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } -orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", 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.39" } num-bigint = { version = "0.4", default-features = false, features = ["rand"] } +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } +rand = "0.8.4" +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } + # For ark-circom -once_cell = "1.14.0" cfg-if = "1.0" -wasmer = { version = "2.3.0", default-features = false } -num-traits = "0.2.11" -thiserror = "1.0.0" color-eyre = "0.6.1" +num-traits = "0.2.11" +once_cell = "1.14.0" serde_json = "1.0.48" - +thiserror = "1.0.0" +wasmer = { version = "2.3.0", default-features = false } # Webb deps arkworks-native-gadgets = { version = "1.2.0", default-features = false } @@ -55,7 +56,8 @@ webb-primitives = { path = "../primitives", features = ["hashing", "verifying", [features] default = ["std", "wasmer/sys-default"] std = [ - "frame-support/std", - "frame-system/std", + "frame-support/std", + "frame-system/std", + "frame-benchmarking/std", ] -wasm = ["wasmer/js", "wasmer/std"] \ No newline at end of file +wasm = ["wasmer/js", "wasmer/std"] diff --git a/pallets/anonymity-mining-claims/Cargo.toml b/pallets/anonymity-mining-claims/Cargo.toml index f2d8a76c0..935cc8bf8 100644 --- a/pallets/anonymity-mining-claims/Cargo.toml +++ b/pallets/anonymity-mining-claims/Cargo.toml @@ -45,28 +45,28 @@ frame-benchmarking = { default-features = false, git = "https://github.com/parit hex = "0.4" orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } +pallet-claims-verifier = { path = "../claims-verifier", default-features = false } pallet-hasher = { path = "../hasher", default-features = false } pallet-key-storage = { path = "../key-storage" } pallet-timestamp = { default-features = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" } pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } -pallet-claims-verifier = { path = "../claims-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.39" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } # For ark-circom -circom-proving = { path = "../../circom-proving", default-features = false } -ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } -num-bigint = { version = "0.4", default-features = false, features = ["rand"] } -once_cell = "1.14.0" +ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } cfg-if = "1.0" -wasmer = { version = "2.3.0", default-features = false } -num-traits = "0.2.11" -thiserror = "1.0.0" +circom-proving = { path = "../../circom-proving", default-features = false } color-eyre = "0.6.1" +num-bigint = { version = "0.4", default-features = false, features = ["rand"] } +num-traits = "0.2.11" +once_cell = "1.14.0" serde_json = "1.0.48" +thiserror = "1.0.0" +wasmer = { version = "2.3.0", default-features = false } [features] default = ["std", "wasmer/sys-default"] diff --git a/pallets/anonymity-mining-claims/src/lib.rs b/pallets/anonymity-mining-claims/src/lib.rs index aa5455cda..da6019af1 100644 --- a/pallets/anonymity-mining-claims/src/lib.rs +++ b/pallets/anonymity-mining-claims/src/lib.rs @@ -33,7 +33,7 @@ //! //! * `claim_ap`: Allows user to prove in zero knowledge they have a pair (spentUTXO, unspentUTXO) //! on the MASP -//! and accumulate anonimity points following `inputAmount + rate * (spentTimestamp - +//! and accumulate anonimity points following `inputAmount + rate * (spentTimestamp - //! unspentTimestamp) * amount` // Ensure we're `no_std` when compiling for Wasm. @@ -272,6 +272,7 @@ pub mod pallet { pub type ProposalNonce = u32; pub type RootIndex = u32; +#[allow(dead_code)] impl, I: 'static> Pallet { fn create( creator: Option, diff --git a/pallets/anonymity-mining-claims/src/test_utils.rs b/pallets/anonymity-mining-claims/src/test_utils.rs index 6b21f02a4..76ad6561c 100644 --- a/pallets/anonymity-mining-claims/src/test_utils.rs +++ b/pallets/anonymity-mining-claims/src/test_utils.rs @@ -1,3 +1,4 @@ +#![allow(clippy::type_complexity, clippy::ptr_arg)] use crate::mock::*; use ark_bn254::{Bn254, Fr}; use ark_circom::{read_zkey, WitnessCalculator}; diff --git a/pallets/anonymity-mining-claims/src/tests.rs b/pallets/anonymity-mining-claims/src/tests.rs index 732519322..3f7e96191 100644 --- a/pallets/anonymity-mining-claims/src/tests.rs +++ b/pallets/anonymity-mining-claims/src/tests.rs @@ -4,11 +4,8 @@ use webb_primitives::ElementTrait; use crate::Instance1; use ark_serialize::CanonicalSerialize; -use frame_support::{assert_err, assert_ok}; -// use sp_runtime::traits::Zero; - use circom_proving::{generate_proof, verify_proof}; -// use num_bigint::{BigInt, Sign}; +use frame_support::{assert_err, assert_ok}; use webb_primitives::webb_proposals::{ ResourceId, SubstrateTargetSystem, TargetSystem, TypedChainId, }; diff --git a/pallets/anonymity-mining-rewards/src/tests.rs b/pallets/anonymity-mining-rewards/src/tests.rs index 6c401676a..2f75d9f26 100644 --- a/pallets/anonymity-mining-rewards/src/tests.rs +++ b/pallets/anonymity-mining-rewards/src/tests.rs @@ -12,9 +12,6 @@ const LIQUIDITY: u128 = 20000000; const INITIAL_TOTAL_REWARDS_BALANCE: i128 = 30000000; const DURATION: u64 = 31536000; -const TEST_MAX_EDGES: u32 = 100; -const TEST_TREE_DEPTH: u8 = 32; - #[test] fn should_initialize_parameters() { new_test_ext().execute_with(|| {}); diff --git a/pallets/asset-registry/src/tests.rs b/pallets/asset-registry/src/tests.rs index 1b9d4906e..666ad61e8 100644 --- a/pallets/asset-registry/src/tests.rs +++ b/pallets/asset-registry/src/tests.rs @@ -132,7 +132,7 @@ fn create_asset() { #[test] fn location_mapping_works() { new_test_ext().execute_with(|| { - let bn = AssetRegistryPallet::to_bounded_name(b"HDX".to_vec().try_into().unwrap()).unwrap(); + let bn = AssetRegistryPallet::to_bounded_name(b"HDX".to_vec()).unwrap(); let ed = 1_000_000u128; @@ -174,7 +174,7 @@ fn location_mapping_works() { #[test] fn genesis_config_works() { ExtBuilder::default() - .with_native_asset_name(b"NATIVE".to_vec().try_into().unwrap()) + .with_native_asset_name(b"NATIVE".to_vec()) .build() .execute_with(|| { let native: BoundedVec::StringLimit> = @@ -182,7 +182,7 @@ fn genesis_config_works() { assert_eq!(AssetRegistryPallet::asset_ids(native).unwrap(), 0u32); }); ExtBuilder::default() - .with_assets(vec![(b"ONE".to_vec().try_into().unwrap(), 1_000u128)]) + .with_assets(vec![(b"ONE".to_vec(), 1_000u128)]) .build() .execute_with(|| { let native: BoundedVec::StringLimit> = diff --git a/pallets/mixer/src/mock.rs b/pallets/mixer/src/mock.rs index a932a43b7..10606de42 100644 --- a/pallets/mixer/src/mock.rs +++ b/pallets/mixer/src/mock.rs @@ -15,7 +15,6 @@ use sp_core::H256; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, ConstU32, IdentityLookup}, - BuildStorage, }; use sp_std::convert::{TryFrom, TryInto}; pub use webb_primitives::hasher::{HasherModule, InstanceHasher}; diff --git a/pallets/signature-bridge/src/lib.rs b/pallets/signature-bridge/src/lib.rs index 456b58450..d70019b11 100644 --- a/pallets/signature-bridge/src/lib.rs +++ b/pallets/signature-bridge/src/lib.rs @@ -88,7 +88,6 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use sp_runtime::traits::AtLeast32Bit; - use webb_primitives::signature_bridge::SetMaintainer; #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] diff --git a/pallets/signature-bridge/src/mock.rs b/pallets/signature-bridge/src/mock.rs index c826fc4ce..87787dc3b 100644 --- a/pallets/signature-bridge/src/mock.rs +++ b/pallets/signature-bridge/src/mock.rs @@ -101,6 +101,7 @@ impl Contains for SetResourceProposalFilter { } pub struct ExecuteAllProposalsFilter; +#[allow(clippy::collapsible_match, clippy::match_like_matches_macro)] impl Contains for ExecuteAllProposalsFilter { fn contains(c: &RuntimeCall) -> bool { match c { diff --git a/pallets/token-wrapper-handler/src/mock_signature_bridge.rs b/pallets/token-wrapper-handler/src/mock_signature_bridge.rs index 2857fe122..711e5cf2d 100644 --- a/pallets/token-wrapper-handler/src/mock_signature_bridge.rs +++ b/pallets/token-wrapper-handler/src/mock_signature_bridge.rs @@ -205,6 +205,7 @@ impl Contains for SetResourceProposalFilter { } pub struct ExecuteProposalFilter; +#[allow(clippy::collapsible_match, clippy::match_like_matches_macro)] impl Contains for ExecuteProposalFilter { fn contains(c: &RuntimeCall) -> bool { match c { diff --git a/pallets/token-wrapper-handler/src/tests_signature_bridge.rs b/pallets/token-wrapper-handler/src/tests_signature_bridge.rs index 62423de50..1d43ff95d 100644 --- a/pallets/token-wrapper-handler/src/tests_signature_bridge.rs +++ b/pallets/token-wrapper-handler/src/tests_signature_bridge.rs @@ -202,7 +202,7 @@ fn should_add_token_with_sig_succeed() { sig.0.to_vec().try_into().unwrap(), )); // Check that first_token_id is part of pool - assert_eq!(AssetRegistry::contains_asset(pool_share_id, first_token_id), true); + assert!(AssetRegistry::contains_asset(pool_share_id, first_token_id)); }) } @@ -264,7 +264,7 @@ fn should_remove_token_with_sig_succeed() { sig.0.to_vec().try_into().unwrap(), )); // Check that first_token_id is part of pool - assert_eq!(AssetRegistry::contains_asset(pool_share_id, first_token_id), true); + assert!(AssetRegistry::contains_asset(pool_share_id, first_token_id)); let nonce = webb_proposals::Nonce::from(0x0002); let header = make_proposal_header(r_id, REMOVE_TOKEN_FUNCTION_SIG, nonce); let remove_token_proposal_bytes = @@ -279,7 +279,7 @@ fn should_remove_token_with_sig_succeed() { sig.0.to_vec().try_into().unwrap(), )); - assert_eq!(AssetRegistry::contains_asset(pool_share_id, first_token_id), false); + assert!(AssetRegistry::contains_asset(pool_share_id, first_token_id)); }) } @@ -437,13 +437,13 @@ fn should_add_many_tokens_with_sig_succeed() { )); // Check that first_token_id is part of pool - assert_eq!(AssetRegistry::contains_asset(pool_share_id, first_token_id), true); + assert!(AssetRegistry::contains_asset(pool_share_id, first_token_id)); // Check that second_token_id is part of pool - assert_eq!(AssetRegistry::contains_asset(pool_share_id, second_token_id), true); + assert!(AssetRegistry::contains_asset(pool_share_id, second_token_id)); // Check that third_token_id is part of pool - assert_eq!(AssetRegistry::contains_asset(pool_share_id, third_token_id), true); + assert!(AssetRegistry::contains_asset(pool_share_id, third_token_id)); }) } @@ -500,7 +500,7 @@ fn should_fail_to_add_same_token_with_sig() { sig.0.to_vec().try_into().unwrap(), )); // Check that first_token_id is part of pool - assert_eq!(AssetRegistry::contains_asset(pool_share_id, first_token_id), true); + assert!(AssetRegistry::contains_asset(pool_share_id, first_token_id)); // Have to remake prop_data with incremented nonce let nonce = webb_proposals::Nonce::from(0x0002); diff --git a/pallets/vanchor-handler/src/mock_signature_bridge.rs b/pallets/vanchor-handler/src/mock_signature_bridge.rs index 09b77ef15..19c29b648 100644 --- a/pallets/vanchor-handler/src/mock_signature_bridge.rs +++ b/pallets/vanchor-handler/src/mock_signature_bridge.rs @@ -289,6 +289,7 @@ parameter_types! { } pub struct SetResourceProposalFilter; +#[allow(clippy::collapsible_match, clippy::match_like_matches_macro)] impl Contains for SetResourceProposalFilter { fn contains(c: &RuntimeCall) -> bool { match c { @@ -302,6 +303,7 @@ impl Contains for SetResourceProposalFilter { } pub struct ExecuteProposalFilter; +#[allow(clippy::collapsible_match, clippy::match_like_matches_macro)] impl Contains for ExecuteProposalFilter { fn contains(c: &RuntimeCall) -> bool { match c { diff --git a/pallets/vanchor-handler/src/tests_signature_bridge.rs b/pallets/vanchor-handler/src/tests_signature_bridge.rs index ec86b3193..c42b6df53 100644 --- a/pallets/vanchor-handler/src/tests_signature_bridge.rs +++ b/pallets/vanchor-handler/src/tests_signature_bridge.rs @@ -192,7 +192,7 @@ fn should_add_vanchor_edge_with_sig_succeed() { new_test_ext_initialized( src_id.chain_id(), r_id, - b"VAnchorHandler.execute_vanchor_update_proposal".to_vec().try_into().unwrap(), + b"VAnchorHandler.execute_vanchor_update_proposal".to_vec(), ) .execute_with(|| { let curve = Curve::Bn254; diff --git a/pallets/vanchor/Cargo.toml b/pallets/vanchor/Cargo.toml index 21838b00c..6f523348b 100644 --- a/pallets/vanchor/Cargo.toml +++ b/pallets/vanchor/Cargo.toml @@ -13,59 +13,63 @@ 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 } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -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.39", optional = true } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", 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-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.39", optional = true } -arkworks-native-gadgets = { version = "1.2.0", default-features = false } -ark-std = { version = "^0.3.0", default-features = false } -ark-bn254 = { version = "^0.3.0", default-features = false, features = [ "curve" ] } -ark-ff = { 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.39", optional = true } pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } pallet-hasher = { path = "../hasher", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } - -[dev-dependencies] -hex = "0.4" -rand = "0.8.4" -serde = { version = "1.0.119" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -pallet-treasury = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -pallet-key-storage = {path = "../key-storage"} -circom-proving = { path = "../../circom-proving", default-features = false } -orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } +serde = { version = "1.0.119" } +webb-primitives = { path = "../../primitives", default-features = false, features = ["verifying", "hashing", "field_ops"] } + +[dev-dependencies] +ark-bn254 = { version = "0.3.0" } +ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } -ark-ff = { version = "0.3.0", default-features = false, features = [ "asm"] } 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, features = ["asm"] } ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } +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" } -ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } +arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +circom-proving = { path = "../../circom-proving", default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } +hex = "0.4" num-bigint = { version = "0.4", default-features = false, features = ["rand"] } +orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.39", default-features = false } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } +pallet-hasher = { path = "../hasher", default-features = false } +pallet-key-storage = { path = "../key-storage" } +pallet-treasury = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } +pallet-vanchor-verifier = { path = "../vanchor-verifier", default-features = false } +webb-primitives = { path = "../../primitives", default-features = false, features = ["verifying", "hashing"] } +rand = "0.8.4" # For ark-circom -once_cell = "1.14.0" cfg-if = "1.0" -wasmer = { version = "2.3.0", default-features = false } -num-traits = "0.2.11" -thiserror = "1.0.0" color-eyre = "0.6.1" +num-traits = "0.2.11" +once_cell = "1.14.0" serde_json = "1.0.48" +thiserror = "1.0.0" +wasmer = { version = "2.3.0", default-features = false } [features] default = ["std", "wasmer/sys-default"] diff --git a/pallets/vanchor/src/test_utils.rs b/pallets/vanchor/src/test_utils.rs index 5dca2c5f5..08586529b 100644 --- a/pallets/vanchor/src/test_utils.rs +++ b/pallets/vanchor/src/test_utils.rs @@ -1,3 +1,4 @@ +#![allow(clippy::type_complexity, clippy::ptr_arg)] use crate::tests::{ BIGGER_DEFAULT_BALANCE, BIGGER_TRANSACTOR_ACCOUNT_ID, BIG_DEFAULT_BALANCE, BIG_TRANSACTOR_ACCOUNT_ID, DEFAULT_BALANCE, RELAYER_ACCOUNT_ID, SEED, TRANSACTOR_ACCOUNT_ID, @@ -124,6 +125,7 @@ pub fn setup_utxos( let curve = Curve::Bn254; let rng = &mut thread_rng(); // Input Utxos + #[allow(clippy::unnecessary_unwrap)] let indices: [Option; NUM_UTXOS] = if indices.is_some() { let ind_unw = indices.unwrap(); ind_unw.map(Some) diff --git a/pallets/vanchor/src/tests_circom.rs b/pallets/vanchor/src/tests_circom.rs index ce605437e..4eee018d4 100644 --- a/pallets/vanchor/src/tests_circom.rs +++ b/pallets/vanchor/src/tests_circom.rs @@ -186,6 +186,7 @@ fn circom_should_complete_2x2_transaction_with_withdraw() { let mut roots = Vec::new(); roots.push(BigInt::from_bytes_be(Sign::Plus, &custom_root.0)); + #[allow(clippy::needless_range_loop)] for i in 0..ANCHOR_CT - 1 { roots.push(BigInt::from_bytes_be(Sign::Plus, &neighbor_roots[i].0)); } diff --git a/pallets/vanchor/src/zerokit_utils.rs b/pallets/vanchor/src/zerokit_utils.rs index fb0a01b9e..5bf50c9e3 100644 --- a/pallets/vanchor/src/zerokit_utils.rs +++ b/pallets/vanchor/src/zerokit_utils.rs @@ -1,6 +1,6 @@ // This crate provides cross-module useful utilities (mainly type conversions) not necessarily // specific to RLN - +#![allow(clippy::all, dead_code)] use ark_bn254::Fr; use ark_ff::{BigInteger256, PrimeField}; use num_bigint::{BigInt, BigUint}; diff --git a/pallets/xanchor/Cargo.toml b/pallets/xanchor/Cargo.toml index 0350cef48..5ed178ea8 100644 --- a/pallets/xanchor/Cargo.toml +++ b/pallets/xanchor/Cargo.toml @@ -45,15 +45,15 @@ sp-runtime = { default-features = false, git = "https://github.com/paritytech/su ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-bn254 = { 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-bn254 = { 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" } diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 4b5053713..ebe03a7d3 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -30,8 +30,8 @@ ark-serialize = { version = "^0.3.0", default-features = false, features = ["der ark-std = { version = "^0.3.0", default-features = false } # ark-circom = { git = "https://github.com/gakonst/ark-circom.git", default-features = false } -byteorder = { version = "1", default-features = false } blake2 = { version = "0.9", default-features = false } +byteorder = { version = "1", default-features = false } digest = { version = "0.9", default-features = false } ark-crypto-primitives = { version = "^0.3.0", default-features = false } diff --git a/standalone/node/Cargo.toml b/standalone/node/Cargo.toml index 87bae6fb9..f9f0dd722 100644 --- a/standalone/node/Cargo.toml +++ b/standalone/node/Cargo.toml @@ -24,7 +24,6 @@ targets = ["x86_64-unknown-linux-gnu"] substrate-build-script-utils = "3.0.0" [dependencies] -array-bytes = "4.1" clap = { version = "4.0.9", features = ["derive"], optional = true } futures = "0.3.21" itertools = "0.10.0" diff --git a/standalone/node/src/cli.rs b/standalone/node/src/cli.rs index 009351d37..00cff61cf 100644 --- a/standalone/node/src/cli.rs +++ b/standalone/node/src/cli.rs @@ -1,3 +1,4 @@ +#![allow(clippy::large_enum_variant)] // This file is part of Substrate. // Copyright (C) 2018-2022 Parity Technologies (UK) Ltd. @@ -15,8 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - /// An overarching CLI command definition. + #[derive(Debug, clap::Parser)] pub struct Cli { /// Possible subcommand with parameters. diff --git a/standalone/node/src/command.rs b/standalone/node/src/command.rs index d9648d0ed..d65301446 100644 --- a/standalone/node/src/command.rs +++ b/standalone/node/src/command.rs @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - +#![allow(clippy::all)] use crate::{ benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder}, chain_spec, diff --git a/standalone/node/src/lib.rs b/standalone/node/src/lib.rs index 1c044cd00..00493cd68 100644 --- a/standalone/node/src/lib.rs +++ b/standalone/node/src/lib.rs @@ -1,5 +1,4 @@ -#![warn(unused_crate_dependencies)] - +#![allow(clippy::all)] pub mod chain_spec; pub mod rpc; pub mod service; diff --git a/standalone/node/src/service.rs b/standalone/node/src/service.rs index 473e4a959..4db5d6328 100644 --- a/standalone/node/src/service.rs +++ b/standalone/node/src/service.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . #![warn(unused_extern_crates)] -#![allow(clippy::type_complexity)] +#![allow(clippy::all)] //! Service implementation. Specialized wrapper over substrate service. diff --git a/standalone/runtime/Cargo.toml b/standalone/runtime/Cargo.toml index 1c594a3b0..05d119553 100644 --- a/standalone/runtime/Cargo.toml +++ b/standalone/runtime/Cargo.toml @@ -45,6 +45,7 @@ pallet-verifier = { path = "../../pallets/verifier", default-features = false } webb-primitives = { path = "../../primitives", default-features = false, features = ["hashing"] } # Substrate dependencies +pallet-randomness-collective-flip = { package = "pallet-insecure-randomness-collective-flip", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } @@ -60,7 +61,6 @@ sp-staking = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } -pallet-randomness-collective-flip = { package = "pallet-insecure-randomness-collective-flip", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.39", default-features = false } frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } diff --git a/standalone/runtime/src/constants.rs b/standalone/runtime/src/constants.rs index c8cb6e3e0..de79a808e 100644 --- a/standalone/runtime/src/constants.rs +++ b/standalone/runtime/src/constants.rs @@ -33,7 +33,7 @@ pub mod currency { } /// Other constants -pub mod constants { +pub mod block_constants { use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}; use sp_runtime::Perbill; /// We assume that ~5% of the block weight is consumed by `on_initialize` diff --git a/standalone/runtime/src/lib.rs b/standalone/runtime/src/lib.rs index 236d419c2..91d9d5343 100644 --- a/standalone/runtime/src/lib.rs +++ b/standalone/runtime/src/lib.rs @@ -1,4 +1,9 @@ -#![allow(clippy::from_over_into, non_snake_case)] +#![allow( + clippy::from_over_into, + non_snake_case, + clippy::collapsible_match, + clippy::match_like_matches_macro +)] #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] @@ -8,7 +13,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod constants; -use constants::{constants::*, currency::*, time::*}; +use constants::{block_constants::*, currency::*, time::*}; pub use webb_primitives::{types::runtime::Moment, *}; pub mod impls; mod voter_bags;