From a4efa99b2e5ed00f1ca88cb34583009f7cb97869 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 21 Sep 2023 18:26:15 +0600 Subject: [PATCH 01/29] Add `clippy` component to the toolchain file --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9bcb924a2..bcf909e27 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "nightly-2022-10-09" -components = [ "rustfmt" ] +components = [ "clippy", "rustfmt" ] targets = [ "wasm32-unknown-unknown" ] From 625913c4b2578bad2969908b43c9430bb374d70a Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Mon, 23 Oct 2023 16:57:58 +0600 Subject: [PATCH 02/29] Add clippy config --- .cargo/config.toml | 31 +++++++++++++++++++++++++++++++ .gitignore | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..fc82ca587 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,31 @@ +# An auto defined `clippy` feature was introduced, +# but it was found to clash with user defined features, +# so was renamed to `cargo-clippy`. +# +# If you want standard clippy run: +# RUSTFLAGS= cargo clippy +[target.'cfg(feature = "cargo-clippy")'] +rustflags = [ + "-Aclippy::all", + "-Dclippy::correctness", + "-Aclippy::if-same-then-else", + "-Aclippy::clone-double-ref", + "-Dclippy::complexity", + "-Aclippy::zero-prefixed-literal", # 00_1000_000 + "-Aclippy::type_complexity", # raison d'etre + "-Aclippy::nonminimal-bool", # maybe + "-Aclippy::borrowed-box", # Reasonable to fix this one + "-Aclippy::too-many-arguments", # (Turning this on would lead to) + "-Aclippy::unnecessary_cast", # Types may change + "-Aclippy::identity-op", # One case where we do 0 + + "-Aclippy::useless_conversion", # Types may change + "-Aclippy::unit_arg", # styalistic. + "-Aclippy::option-map-unit-fn", # styalistic + "-Aclippy::bind_instead_of_map", # styalistic + "-Aclippy::erasing_op", # E.g. 0 * DOLLARS + "-Aclippy::eq_op", # In tests we test equality. + "-Aclippy::while_immutable_condition", # false positives + "-Aclippy::needless_option_as_deref", # false positives + "-Aclippy::derivable_impls", # false positives + "-Aclippy::stable_sort_primitive", # prefer stable sort +] diff --git a/.gitignore b/.gitignore index 90db35e94..6dd97a7f6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ .DS_Store # The cache for docker container dependency -.cargo +.cargo/** +!/.cargo/config.toml # The cache for chain data in container .local From 8c3d4dbc4116ac4a10d7f8acaf0b14d0eb0b9d09 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Mon, 23 Oct 2023 12:30:18 +0600 Subject: [PATCH 03/29] Disable clippy linter in legacy pallets --- pallets/chainbridge/src/lib.rs | 1 + pallets/ddc-metrics-offchain-worker/src/lib.rs | 2 +- pallets/ddc/src/lib.rs | 1 + pallets/erc20/src/lib.rs | 1 + pallets/erc721/src/lib.rs | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pallets/chainbridge/src/lib.rs b/pallets/chainbridge/src/lib.rs index 1e48b4a7d..562b54566 100644 --- a/pallets/chainbridge/src/lib.rs +++ b/pallets/chainbridge/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/pallets/ddc-metrics-offchain-worker/src/lib.rs b/pallets/ddc-metrics-offchain-worker/src/lib.rs index 991fdabb2..7f68798ab 100644 --- a/pallets/ddc-metrics-offchain-worker/src/lib.rs +++ b/pallets/ddc-metrics-offchain-worker/src/lib.rs @@ -1,7 +1,7 @@ // Offchain worker for DDC metrics. // // Inspired from https://github.com/paritytech/substrate/tree/master/frame/example-offchain-worker - +#![allow(clippy::all)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] diff --git a/pallets/ddc/src/lib.rs b/pallets/ddc/src/lib.rs index e1d572af6..8308b880c 100644 --- a/pallets/ddc/src/lib.rs +++ b/pallets/ddc/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] #![cfg_attr(not(feature = "std"), no_std)] use frame_support::{ diff --git a/pallets/erc20/src/lib.rs b/pallets/erc20/src/lib.rs index a9474ae2f..e025c5177 100644 --- a/pallets/erc20/src/lib.rs +++ b/pallets/erc20/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/pallets/erc721/src/lib.rs b/pallets/erc721/src/lib.rs index c5b7244d7..7d93c96f9 100644 --- a/pallets/erc721/src/lib.rs +++ b/pallets/erc721/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] From 66520f979eaa3904aaf21ae2460874c3eb803d6d Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Mon, 23 Oct 2023 15:52:40 +0600 Subject: [PATCH 04/29] Suppress `clippy::needless_lifetimes` in ddc-nodes --- pallets/ddc-nodes/src/cdn_node.rs | 2 ++ pallets/ddc-nodes/src/node.rs | 2 ++ pallets/ddc-nodes/src/storage_node.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pallets/ddc-nodes/src/cdn_node.rs b/pallets/ddc-nodes/src/cdn_node.rs index 2bf763e44..fe499717b 100644 --- a/pallets/ddc-nodes/src/cdn_node.rs +++ b/pallets/ddc-nodes/src/cdn_node.rs @@ -1,3 +1,5 @@ +#![allow(clippy::needless_lifetimes)] // ToDo + use crate::node::{ Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait, NodeType, }; diff --git a/pallets/ddc-nodes/src/node.rs b/pallets/ddc-nodes/src/node.rs index e571cfe85..4b48d4054 100644 --- a/pallets/ddc-nodes/src/node.rs +++ b/pallets/ddc-nodes/src/node.rs @@ -1,3 +1,5 @@ +#![allow(clippy::needless_lifetimes)] // ToDo + use crate::{ cdn_node::{CDNNode, CDNNodeParams, CDNNodeProps}, pallet::Error, diff --git a/pallets/ddc-nodes/src/storage_node.rs b/pallets/ddc-nodes/src/storage_node.rs index 92b867391..d9cd253d1 100644 --- a/pallets/ddc-nodes/src/storage_node.rs +++ b/pallets/ddc-nodes/src/storage_node.rs @@ -1,3 +1,5 @@ +#![allow(clippy::needless_lifetimes)] // ToDo + use crate::node::{ Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait, NodeType, }; From d5d671d1f3edc5bae3d513bf42d1ffda92f2af70 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 21 Sep 2023 18:35:21 +0600 Subject: [PATCH 05/29] Apply `cargo clippy --fix --all` --- cli/src/command.rs | 10 +- node/service/src/lib.rs | 10 +- pallets/chainbridge/src/lib.rs | 20 +-- pallets/chainbridge/src/mock.rs | 2 +- pallets/chainbridge/src/tests.rs | 76 +++++------ pallets/ddc-accounts/src/lib.rs | 4 +- pallets/ddc-clusters/src/lib.rs | 24 ++-- .../ddc-metrics-offchain-worker/src/lib.rs | 20 +-- .../src/tests/mod.rs | 8 +- pallets/ddc-nodes/src/lib.rs | 14 +- pallets/ddc-staking/src/lib.rs | 20 +-- pallets/ddc-staking/src/mock.rs | 2 +- pallets/ddc-staking/src/testing_utils.rs | 2 +- pallets/ddc-staking/src/weights.rs | 120 +++++++++--------- pallets/ddc-validator/src/dac.rs | 26 ++-- pallets/ddc-validator/src/lib.rs | 45 +++---- pallets/ddc-validator/src/shm.rs | 8 +- pallets/ddc-validator/src/tests.rs | 6 +- pallets/ddc-validator/src/utils.rs | 4 +- pallets/ddc/src/lib.rs | 6 +- pallets/erc20/src/lib.rs | 6 +- pallets/erc721/src/lib.rs | 10 +- pallets/erc721/src/tests.rs | 16 +-- runtime/cere-dev/src/impls.rs | 16 +-- runtime/cere-dev/src/lib.rs | 28 ++-- runtime/cere/src/impls.rs | 16 +-- runtime/cere/src/lib.rs | 28 ++-- 27 files changed, 269 insertions(+), 278 deletions(-) diff --git a/cli/src/command.rs b/cli/src/command.rs index 9865ccf85..665ba9d31 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -67,7 +67,7 @@ impl SubstrateCli for Cli { #[cfg(feature = "cere-native")] { - return &cere_service::cere_runtime::VERSION + &cere_service::cere_runtime::VERSION } #[cfg(not(feature = "cere-native"))] @@ -161,17 +161,17 @@ pub fn run() -> sc_cli::Result<()> { #[cfg(feature = "cere-dev-native")] if chain_spec.is_cere_dev() { - return Ok(runner.sync_run(|config| { + return runner.sync_run(|config| { cmd.run::(config) - })?) + }) } // else we assume it is Cere #[cfg(feature = "cere-native")] { - return Ok(runner.sync_run(|config| { + runner.sync_run(|config| { cmd.run::(config) - })?) + }) } #[cfg(not(feature = "cere-native"))] diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 6988b5641..68e5386a6 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -88,7 +88,7 @@ where let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( - &config, + config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, )?; @@ -287,7 +287,7 @@ pub fn build_full( #[cfg(feature = "cere-native")] { - return new_full::( + new_full::( config, disable_hardware_benchmarks, enable_ddc_validation, @@ -347,7 +347,7 @@ where { let hwbench = if !disable_hardware_benchmarks { config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) }) } else { @@ -461,7 +461,7 @@ where let proposer = sc_basic_authorship::ProposerFactory::new( task_manager.spawn_handle(), client.clone(), - transaction_pool.clone(), + transaction_pool, prometheus_registry.as_ref(), telemetry.as_ref().map(|x| x.handle()), ); @@ -646,7 +646,7 @@ pub fn new_chain_ops( #[cfg(feature = "cere-native")] { - return chain_ops!(config; cere_runtime, CereExecutorDispatch, Cere) + chain_ops!(config; cere_runtime, CereExecutorDispatch, Cere) } #[cfg(not(feature = "cere-native"))] diff --git a/pallets/chainbridge/src/lib.rs b/pallets/chainbridge/src/lib.rs index 562b54566..9972be688 100644 --- a/pallets/chainbridge/src/lib.rs +++ b/pallets/chainbridge/src/lib.rs @@ -37,7 +37,7 @@ pub fn derive_resource_id(chain: u8, id: &[u8]) -> ResourceId { for i in 0..range { r_id[30 - i] = id[range - 1 - i]; // Ensure left padding for eth compatibility } - return r_id + r_id } #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] @@ -77,7 +77,7 @@ impl ProposalVotes { /// Returns true if `who` has voted for or against the proposal fn has_voted(&self, who: &A) -> bool { - self.votes_for.contains(&who) || self.votes_against.contains(&who) + self.votes_for.contains(who) || self.votes_against.contains(who) } /// Return true if the expiry time has been reached @@ -295,7 +295,7 @@ decl_module! { /// # /// - weight of proposed call, regardless of whether execution is performed /// # - #[weight = (call.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), call.get_dispatch_info().class, Pays::Yes)] + #[weight = (call.get_dispatch_info().weight + Weight::from_ref_time(195_000_000_u64), call.get_dispatch_info().class, Pays::Yes)] pub fn acknowledge_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); @@ -328,7 +328,7 @@ decl_module! { /// # /// - weight of proposed call, regardless of whether execution is performed /// # - #[weight = (prop.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), prop.get_dispatch_info().class, Pays::Yes)] + #[weight = (prop.get_dispatch_info().weight + Weight::from_ref_time(195_000_000_u64), prop.get_dispatch_info().class, Pays::Yes)] pub fn eval_vote_state(origin, nonce: DepositNonce, src_id: ChainId, prop: Box<::Proposal>) -> DispatchResult { ensure_signed(origin)?; @@ -358,12 +358,12 @@ impl Module { /// Asserts if a resource is registered pub fn resource_exists(id: ResourceId) -> bool { - return Self::resources(id) != None + Self::resources(id).is_some() } /// Checks if a chain exists as a whitelisted destination pub fn chain_whitelisted(id: ChainId) -> bool { - return Self::chains(id) != None + Self::chains(id).is_some() } /// Increments the deposit nonce for the specified chain ID @@ -401,7 +401,7 @@ impl Module { ensure!(id != T::ChainId::get(), Error::::InvalidChainId); // Cannot whitelist with an existing entry ensure!(!Self::chain_whitelisted(id), Error::::ChainAlreadyWhitelisted); - ::insert(&id, 0); + ::insert(id, 0); Self::deposit_event(RawEvent::ChainWhitelisted(id)); Ok(()) } @@ -452,13 +452,13 @@ impl Module { if in_favour { votes.votes_for.push(who.clone()); - Self::deposit_event(RawEvent::VoteFor(src_id, nonce, who.clone())); + Self::deposit_event(RawEvent::VoteFor(src_id, nonce, who)); } else { votes.votes_against.push(who.clone()); - Self::deposit_event(RawEvent::VoteAgainst(src_id, nonce, who.clone())); + Self::deposit_event(RawEvent::VoteAgainst(src_id, nonce, who)); } - >::insert(src_id, (nonce, prop.clone()), votes.clone()); + >::insert(src_id, (nonce, prop), votes.clone()); Ok(()) } diff --git a/pallets/chainbridge/src/mock.rs b/pallets/chainbridge/src/mock.rs index 5e22f6e92..2a3fd20b5 100644 --- a/pallets/chainbridge/src/mock.rs +++ b/pallets/chainbridge/src/mock.rs @@ -152,6 +152,6 @@ pub fn assert_events(mut expected: Vec) { for evt in expected { let next = actual.pop().expect("event expected"); - assert_eq!(next, evt.into(), "Events don't match (actual,expected)"); + assert_eq!(next, evt, "Events don't match (actual,expected)"); } } diff --git a/pallets/chainbridge/src/tests.rs b/pallets/chainbridge/src/tests.rs index bd0ae5a03..ce0e308c0 100644 --- a/pallets/chainbridge/src/tests.rs +++ b/pallets/chainbridge/src/tests.rs @@ -137,50 +137,50 @@ fn asset_transfer_success() { let token_id = vec![1, 2, 3, 4]; let method = "Erc20.transfer".as_bytes().to_vec(); - assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), resource_id, method.clone())); + assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), resource_id, method)); assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id.clone())); + assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id)); assert_ok!(Bridge::transfer_fungible( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, to.clone(), amount.into() )); assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(dest_id.clone())), + RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(dest_id)), RuntimeEvent::Bridge(RawEvent::FungibleTransfer( - dest_id.clone(), + dest_id, 1, - resource_id.clone(), + resource_id, amount.into(), to.clone(), )), ]); assert_ok!(Bridge::transfer_nonfungible( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, token_id.clone(), to.clone(), metadata.clone() )); assert_events(vec![RuntimeEvent::Bridge(RawEvent::NonFungibleTransfer( - dest_id.clone(), + dest_id, 2, - resource_id.clone(), + resource_id, token_id, - to.clone(), + to, metadata.clone(), ))]); assert_ok!(Bridge::transfer_generic( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, metadata.clone() )); assert_events(vec![RuntimeEvent::Bridge(RawEvent::GenericTransfer( - dest_id.clone(), + dest_id, 3, resource_id, metadata, @@ -197,13 +197,13 @@ fn asset_transfer_invalid_resource_id() { let amount = 100; assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id.clone())); + assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id)); assert_noop!( Bridge::transfer_fungible( - dest_id.clone(), - resource_id.clone(), - to.clone(), + dest_id, + resource_id, + to, amount.into() ), Error::::ResourceDoesNotExist @@ -211,8 +211,8 @@ fn asset_transfer_invalid_resource_id() { assert_noop!( Bridge::transfer_nonfungible( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, vec![], vec![], vec![] @@ -221,7 +221,7 @@ fn asset_transfer_invalid_resource_id() { ); assert_noop!( - Bridge::transfer_generic(dest_id.clone(), resource_id.clone(), vec![]), + Bridge::transfer_generic(dest_id, resource_id, vec![]), Error::::ResourceDoesNotExist ); }) @@ -234,21 +234,21 @@ fn asset_transfer_invalid_chain() { let bad_dest_id = 3; let resource_id = [4; 32]; - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), chain_id.clone())); - assert_events(vec![RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(chain_id.clone()))]); + assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), chain_id)); + assert_events(vec![RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(chain_id))]); assert_noop!( - Bridge::transfer_fungible(bad_dest_id, resource_id.clone(), vec![], U256::zero()), + Bridge::transfer_fungible(bad_dest_id, resource_id, vec![], U256::zero()), Error::::ChainNotWhitelisted ); assert_noop!( - Bridge::transfer_nonfungible(bad_dest_id, resource_id.clone(), vec![], vec![], vec![]), + Bridge::transfer_nonfungible(bad_dest_id, resource_id, vec![], vec![], vec![]), Error::::ChainNotWhitelisted ); assert_noop!( - Bridge::transfer_generic(bad_dest_id, resource_id.clone(), vec![]), + Bridge::transfer_generic(bad_dest_id, resource_id, vec![]), Error::::ChainNotWhitelisted ); }) @@ -310,7 +310,7 @@ fn create_sucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -327,7 +327,7 @@ fn create_sucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![RELAYER_B], @@ -344,7 +344,7 @@ fn create_sucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A, RELAYER_C], votes_against: vec![RELAYER_B], @@ -380,7 +380,7 @@ fn create_unsucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -397,7 +397,7 @@ fn create_unsucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![RELAYER_B], @@ -414,7 +414,7 @@ fn create_unsucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![RELAYER_B, RELAYER_C], @@ -452,7 +452,7 @@ fn execute_after_threshold_change() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -472,7 +472,7 @@ fn execute_after_threshold_change() { Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -510,7 +510,7 @@ fn proposal_expires() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -535,7 +535,7 @@ fn proposal_expires() { ); // Proposal state should remain unchanged - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -554,7 +554,7 @@ fn proposal_expires() { ), Error::::ProposalExpired ); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], diff --git a/pallets/ddc-accounts/src/lib.rs b/pallets/ddc-accounts/src/lib.rs index e988cdd0f..4968204f3 100644 --- a/pallets/ddc-accounts/src/lib.rs +++ b/pallets/ddc-accounts/src/lib.rs @@ -314,7 +314,7 @@ pub mod pallet { unlocking: Default::default(), }; Self::update_ledger_and_deposit(&stash, &controller, &item)?; - Self::deposit_event(Event::::Deposited(stash.clone(), value)); + Self::deposit_event(Event::::Deposited(stash, value)); Ok(()) } @@ -346,7 +346,7 @@ pub mod pallet { Self::update_ledger_and_deposit(&stash, &controller, &ledger)?; - Self::deposit_event(Event::::Deposited(stash.clone(), extra)); + Self::deposit_event(Event::::Deposited(stash, extra)); Ok(()) } diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index e4131c0fe..7d3499d4a 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -104,10 +104,10 @@ pub mod pallet { cluster_params: ClusterParams, ) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let cluster = Cluster::new(cluster_id.clone(), caller_id, cluster_params) - .map_err(|e: ClusterError| Into::>::into(ClusterError::from(e)))?; - ensure!(!Clusters::::contains_key(&cluster_id), Error::::ClusterAlreadyExists); - Clusters::::insert(cluster_id.clone(), cluster); + let cluster = Cluster::new(cluster_id, caller_id, cluster_params) + .map_err(Into::>::into)?; + ensure!(!Clusters::::contains_key(cluster_id), Error::::ClusterAlreadyExists); + Clusters::::insert(cluster_id, cluster); Self::deposit_event(Event::::ClusterCreated { cluster_id }); Ok(()) } @@ -120,7 +120,7 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); let mut node = T::NodeRepository::get(node_pub_key.clone()) .map_err(|_| Error::::AttemptToAddNonExistentNode)?; @@ -152,9 +152,9 @@ pub mod pallet { .is_some_and(|staking_cluster| staking_cluster == cluster_id); ensure!(has_stake, Error::::NoStake); - node.set_cluster_id(Some(cluster_id.clone())); + node.set_cluster_id(Some(cluster_id)); T::NodeRepository::update(node).map_err(|_| Error::::AttemptToAddNonExistentNode)?; - ClustersNodes::::insert(cluster_id.clone(), node_pub_key.clone(), true); + ClustersNodes::::insert(cluster_id, node_pub_key.clone(), true); Self::deposit_event(Event::::ClusterNodeAdded { cluster_id, node_pub_key }); Ok(()) @@ -168,7 +168,7 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); let mut node = T::NodeRepository::get(node_pub_key.clone()) .map_err(|_| Error::::AttemptToRemoveNonExistentNode)?; @@ -176,7 +176,7 @@ pub mod pallet { node.set_cluster_id(None); T::NodeRepository::update(node) .map_err(|_| Error::::AttemptToRemoveNonExistentNode)?; - ClustersNodes::::remove(cluster_id.clone(), node_pub_key.clone()); + ClustersNodes::::remove(cluster_id, node_pub_key.clone()); Self::deposit_event(Event::::ClusterNodeRemoved { cluster_id, node_pub_key }); Ok(()) @@ -191,12 +191,12 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let mut cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); cluster .set_params(cluster_params) - .map_err(|e: ClusterError| Into::>::into(ClusterError::from(e)))?; - Clusters::::insert(cluster_id.clone(), cluster); + .map_err(Into::>::into)?; + Clusters::::insert(cluster_id, cluster); Self::deposit_event(Event::::ClusterParamsSet { cluster_id }); Ok(()) diff --git a/pallets/ddc-metrics-offchain-worker/src/lib.rs b/pallets/ddc-metrics-offchain-worker/src/lib.rs index 7f68798ab..228def0f0 100644 --- a/pallets/ddc-metrics-offchain-worker/src/lib.rs +++ b/pallets/ddc-metrics-offchain-worker/src/lib.rs @@ -19,7 +19,7 @@ use frame_system::offchain::{ }; use hex_literal::hex; -use pallet_contracts; + use sp_core::crypto::{KeyTypeId, UncheckedFrom}; use sp_runtime::{ offchain::{http, storage::StorageValueRef, Duration}, @@ -194,7 +194,7 @@ where }; let should_proceed = Self::check_if_should_proceed(block_number); - if should_proceed == false { + if !should_proceed { return Ok(()) } @@ -246,7 +246,7 @@ where let block_timestamp = sp_io::offchain::timestamp().unix_millis(); if day_end_ms < block_timestamp { - Self::finalize_metric_period(contract_address.clone(), &signer, day_start_ms).map_err( + Self::finalize_metric_period(contract_address, &signer, day_start_ms).map_err( |err| { error!("[OCW] Contract error occurred: {:?}", err); "could not call finalize_metric_period TX" @@ -327,8 +327,8 @@ where fn get_start_of_day_ms() -> u64 { let now = sp_io::offchain::timestamp(); - let day_start_ms = (now.unix_millis() / MS_PER_DAY) * MS_PER_DAY; - day_start_ms + + (now.unix_millis() / MS_PER_DAY) * MS_PER_DAY } fn get_signer() -> ResultStr> { @@ -520,7 +520,7 @@ where account.id, p2p_id, is_online, ); - let call_data = Self::encode_report_ddn_status(&p2p_id, is_online); + let call_data = Self::encode_report_ddn_status(p2p_id, is_online); let contract_id_unl = <::Lookup as StaticLookup>::unlookup( contract_id.clone(), @@ -641,12 +641,12 @@ where "HTTP GET error" })?; - let parsed = serde_json::from_slice(&body).map_err(|err| { + + + serde_json::from_slice(&body).map_err(|err| { warn!("[OCW] Error while parsing JSON from {}: {:?}", url, err); "HTTP JSON parse error" - }); - - parsed + }) } fn http_get_request(http_url: &str) -> Result, http::Error> { diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs b/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs index a261b10c8..7480f8ea3 100644 --- a/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs +++ b/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs @@ -295,7 +295,7 @@ fn should_run_contract() { .unwrap(); let contract_exec_result = pallet_contracts::Pallet::::bare_call( - alice.clone(), + alice, contract_id, 0, Weight::from_ref_time(100_000_000_000), @@ -317,7 +317,7 @@ pub const CTOR_SELECTOR: [u8; 4] = hex!("9bae9d5e"); fn encode_constructor() -> Vec { let mut call_data = CTOR_SELECTOR.to_vec(); - let x = 0 as u128; + let x = 0_u128; for _ in 0..9 { x.encode_to(&mut call_data); } @@ -344,13 +344,13 @@ fn deploy_contract() -> AccountId { GAS_LIMIT, None, wasm.to_vec(), - contract_args.clone(), + contract_args, vec![], ) .unwrap(); // Configure worker with the contract address. - let contract_id = Contracts::contract_address(&alice, &wasm_hash, &vec![]); + let contract_id = Contracts::contract_address(&alice, &wasm_hash, &[]); pub const ADD_DDC_NODE_SELECTOR: [u8; 4] = hex!("11a9e1b9"); diff --git a/pallets/ddc-nodes/src/lib.rs b/pallets/ddc-nodes/src/lib.rs index a6ff1b3d4..2871f1e29 100644 --- a/pallets/ddc-nodes/src/lib.rs +++ b/pallets/ddc-nodes/src/lib.rs @@ -83,8 +83,8 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let node = Node::::new(node_pub_key.clone(), caller_id, node_params) - .map_err(|e| Into::>::into(NodeError::from(e)))?; - Self::create(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; + Self::create(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeCreated { node_pub_key }); Ok(()) } @@ -93,11 +93,11 @@ pub mod pallet { pub fn delete_node(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { let caller_id = ensure_signed(origin)?; let node = Self::get(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); ensure!(node.get_cluster_id().is_none(), Error::::NodeIsAssignedToCluster); Self::delete(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; Self::deposit_event(Event::::NodeDeleted { node_pub_key }); Ok(()) } @@ -110,11 +110,11 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let mut node = Self::get(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); node.set_params(node_params) - .map_err(|e| Into::>::into(NodeError::from(e)))?; - Self::update(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; + Self::update(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeParamsChanged { node_pub_key }); Ok(()) } diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index c349b3271..ec96bfe27 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -382,7 +382,7 @@ pub mod pallet { // Add initial CDN participants for &(ref stash, ref controller, ref node, balance, cluster) in &self.edges { assert!( - T::Currency::free_balance(&stash) >= balance, + T::Currency::free_balance(stash) >= balance, "Stash do not have enough balance to participate in CDN." ); assert_ok!(Pallet::::bond( @@ -400,7 +400,7 @@ pub mod pallet { // Add initial storage network participants for &(ref stash, ref controller, ref node, balance, cluster) in &self.storages { assert!( - T::Currency::free_balance(&stash) >= balance, + T::Currency::free_balance(stash) >= balance, "Stash do not have enough balance to participate in storage network." ); assert_ok!(Pallet::::bond( @@ -691,10 +691,10 @@ pub mod pallet { let stash = &ledger.stash; // Can't participate in CDN if already participating in storage network. - ensure!(!Storages::::contains_key(&stash), Error::::AlreadyInRole); + ensure!(!Storages::::contains_key(stash), Error::::AlreadyInRole); // Is it an attempt to cancel a previous "chill"? - if let Some(current_cluster) = Self::edges(&stash) { + if let Some(current_cluster) = Self::edges(stash) { // Switching the cluster is prohibited. The user should chill first. ensure!(current_cluster == cluster, Error::::AlreadyInRole); // Cancel previous "chill" attempts @@ -725,10 +725,10 @@ pub mod pallet { let stash = &ledger.stash; // Can't participate in storage network if already participating in CDN. - ensure!(!Edges::::contains_key(&stash), Error::::AlreadyInRole); + ensure!(!Edges::::contains_key(stash), Error::::AlreadyInRole); // Is it an attempt to cancel a previous "chill"? - if let Some(current_cluster) = Self::storages(&stash) { + if let Some(current_cluster) = Self::storages(stash) { // Switching the cluster is prohibited. The user should chill first. ensure!(current_cluster == cluster, Error::::AlreadyInRole); // Cancel previous "chill" attempts @@ -949,7 +949,7 @@ pub mod pallet { // ToDo: check that validation is finalised for era let era_reward_points: EraRewardPoints = - >::get(&era); + >::get(era); let price_per_byte: u128 = match Self::pricing() { Some(pricing) => pricing, @@ -991,7 +991,7 @@ pub mod pallet { } Self::deposit_event(Event::::PayoutNodes( era, - era_reward_points.clone(), + era_reward_points, price_per_byte, )); log::debug!("Payout event executed"); @@ -1036,7 +1036,7 @@ pub mod pallet { cluster: ClusterId, can_chill_from: EraIndex, ) { - Ledger::::mutate(&controller, |maybe_ledger| { + Ledger::::mutate(controller, |maybe_ledger| { if let Some(ref mut ledger) = maybe_ledger { ledger.chilling = Some(can_chill_from) } @@ -1099,7 +1099,7 @@ pub mod pallet { /// Reset the chilling era for a controller. pub fn reset_chilling(controller: &T::AccountId) { - Ledger::::mutate(&controller, |maybe_ledger| { + Ledger::::mutate(controller, |maybe_ledger| { if let Some(ref mut ledger) = maybe_ledger { ledger.chilling = None } diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs index 48d046fb6..2278b0148 100644 --- a/pallets/ddc-staking/src/mock.rs +++ b/pallets/ddc-staking/src/mock.rs @@ -239,7 +239,7 @@ impl ExtBuilder { TestExternalities::new(storage) } - pub fn build_and_execute(self, test: impl FnOnce() -> ()) { + pub fn build_and_execute(self, test: impl FnOnce()) { sp_tracing::try_init_simple(); let mut ext = self.build(); ext.execute_with(test); diff --git a/pallets/ddc-staking/src/testing_utils.rs b/pallets/ddc-staking/src/testing_utils.rs index 74e61221c..d2111f297 100644 --- a/pallets/ddc-staking/src/testing_utils.rs +++ b/pallets/ddc-staking/src/testing_utils.rs @@ -60,7 +60,7 @@ pub fn create_stash_controller_node( node.clone(), amount, )?; - return Ok((stash, controller, node)) + Ok((stash, controller, node)) } /// Create a stash and controller pair with fixed balance. diff --git a/pallets/ddc-staking/src/weights.rs b/pallets/ddc-staking/src/weights.rs index 3b69615ab..67f428730 100644 --- a/pallets/ddc-staking/src/weights.rs +++ b/pallets/ddc-staking/src/weights.rs @@ -48,9 +48,9 @@ impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Nodes (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(55_007_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + Weight::from_ref_time(55_007_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking Edges (r:1 w:0) @@ -59,36 +59,36 @@ impl WeightInfo for SubstrateWeight { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(47_727_000_u64) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(69_750_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Edges (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(26_112_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking Edges (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(19_892_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) @@ -96,34 +96,34 @@ impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + Weight::from_ref_time(77_450_000_u64) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(38_521_000_u64) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Nodes (r:1 w:1) fn set_node() -> Weight { - Weight::from_ref_time(21_779_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(21_779_000_u64) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking ClusterManagers (r:1 w:1) fn allow_cluster_manager() -> Weight { - Weight::from_ref_time(11_727_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(11_727_000_u64) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking ClusterManagers (r:1 w:1) fn disallow_cluster_manager() -> Weight { - Weight::from_ref_time(18_006_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(18_006_000_u64) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -134,9 +134,9 @@ impl WeightInfo for () { // Storage: DdcStaking Nodes (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(55_007_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(4 as u64)) + Weight::from_ref_time(55_007_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking Edges (r:1 w:0) @@ -145,36 +145,36 @@ impl WeightInfo for () { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(RocksDbWeight::get().reads(6 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(47_727_000_u64) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(69_750_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Edges (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(26_112_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking Edges (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(19_892_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) @@ -182,33 +182,33 @@ impl WeightInfo for () { // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(RocksDbWeight::get().reads(5 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + Weight::from_ref_time(77_450_000_u64) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(38_521_000_u64) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Nodes (r:1 w:1) fn set_node() -> Weight { - Weight::from_ref_time(21_779_000 as u64) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(21_779_000_u64) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking ClusterManagers (r:1 w:1) fn allow_cluster_manager() -> Weight { - Weight::from_ref_time(11_727_000 as u64) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(11_727_000_u64) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking ClusterManagers (r:1 w:1) fn disallow_cluster_manager() -> Weight { - Weight::from_ref_time(18_006_000 as u64) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(18_006_000_u64) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/pallets/ddc-validator/src/dac.rs b/pallets/ddc-validator/src/dac.rs index c23b98588..a2b593182 100644 --- a/pallets/ddc-validator/src/dac.rs +++ b/pallets/ddc-validator/src/dac.rs @@ -260,12 +260,12 @@ pub fn get_served_bytes_sum(file_requests: &Requests) -> (u64, u64) { fn get_proved_delivered_bytes(chunk: &Chunk, ack_timestamps: &Vec) -> u64 { let log_timestamp = chunk.log.timestamp; - let neighbors = get_closer_neighbors(log_timestamp, &ack_timestamps); + let neighbors = get_closer_neighbors(log_timestamp, ack_timestamps); let is_proved = is_lies_within_threshold(log_timestamp, neighbors, FAILED_CONTENT_CONSUMER_THRESHOLD); if is_proved { - return chunk.log.bytes_sent + chunk.log.bytes_sent } else { 0 } @@ -305,7 +305,7 @@ fn is_lies_within_threshold( pub(crate) fn fetch_cdn_node_aggregates_request(url: &String) -> Vec { log::debug!("fetch_file_request | url: {:?}", url); - let response: FileRequestWrapper = http_get_json(&url).unwrap(); + let response: FileRequestWrapper = http_get_json(url).unwrap(); log::debug!("response.json: {:?}", response.json); let map: Vec = serde_json::from_str(response.json.as_str()).unwrap(); // log::debug!("response.json: {:?}", response.json); @@ -315,7 +315,7 @@ pub(crate) fn fetch_cdn_node_aggregates_request(url: &String) -> Vec FileRequest { log::debug!("fetch_file_request | url: {:?}", url); - let response: FileRequestWrapper = http_get_json(&url).unwrap(); + let response: FileRequestWrapper = http_get_json(url).unwrap(); log::debug!("response.json: {:?}", response.json); let map: FileRequest = serde_json::from_str(response.json.as_str()).unwrap(); @@ -329,12 +329,12 @@ pub(crate) fn http_get_json(url: &str) -> crate::ResultSt "HTTP GET error" })?; - let parsed = serde_json::from_slice(&body).map_err(|err| { + + + serde_json::from_slice(&body).map_err(|err| { log::warn!("[DAC Validator] Error while parsing JSON from {}: {:?}", url, err); "HTTP JSON parse error" - }); - - parsed + }) } fn http_get_request(http_url: &str) -> Result, http::Error> { @@ -365,7 +365,9 @@ pub(crate) fn get_final_decision(decisions: Vec) -> Validati let serialized_decisions = serde_json::to_string(&common_decisions).unwrap(); - let final_decision = ValidationDecision { + + + ValidationDecision { edge: decision_example.edge.clone(), result: decision_example.result, payload: utils::hash(&serialized_decisions), @@ -375,9 +377,7 @@ pub(crate) fn get_final_decision(decisions: Vec) -> Validati failed_by_client: 0, failure_rate: 0, }, - }; - - final_decision + } } fn find_largest_group(decisions: Vec) -> Option> { @@ -404,7 +404,7 @@ fn find_largest_group(decisions: Vec) -> Option half { Some(largest_group) diff --git a/pallets/ddc-validator/src/lib.rs b/pallets/ddc-validator/src/lib.rs index ac0bfe531..175ab0b88 100644 --- a/pallets/ddc-validator/src/lib.rs +++ b/pallets/ddc-validator/src/lib.rs @@ -360,7 +360,7 @@ pub mod pallet { // Skip if DDC validation is not enabled. match StorageValueRef::persistent(ENABLE_DDC_VALIDATION_KEY).get::() { - Ok(Some(enabled)) if enabled == true => (), + Ok(Some(enabled)) if enabled => (), _ => return, } @@ -634,13 +634,7 @@ pub mod pallet { let percentage_difference = 1f32 - (bytes_received as f32 / bytes_sent as f32); - return if percentage_difference >= 0.0 && - (T::ValidationThreshold::get() as f32 - percentage_difference) > 0.0 - { - true - } else { - false - } + percentage_difference >= 0.0 && (T::ValidationThreshold::get() as f32 - percentage_difference) > 0.0 } /// Shuffle the `list` swapping it's random elements `list.len()` times. @@ -678,7 +672,7 @@ pub mod pallet { let validators: Vec = DDCValidatorToStashKeys::::iter_keys().collect(); log::debug!("Current validators: {:?}.", validators); - if validators.len() == 0 { + if validators.is_empty() { return Err(AssignmentError::NoValidators) } @@ -692,7 +686,7 @@ pub mod pallet { let edges: Vec = >::iter_keys().collect(); log::debug!("Current edges: {:?}.", edges); - if edges.len() == 0 { + if edges.is_empty() { return Ok(()) } @@ -725,7 +719,7 @@ pub mod pallet { }); } - return Ok(()) + Ok(()) } /// Randomly choose a number in range `[0, total)`. @@ -764,7 +758,7 @@ pub mod pallet { } fn find_validators_from_quorum(validator_id: &T::AccountId, era: &EraIndex) -> Vec { - let validator_edges = Self::assignments(era, &validator_id).unwrap(); + let validator_edges = Self::assignments(era, validator_id).unwrap(); let mut quorum_members: Vec = Vec::new(); >::iter_prefix(era).for_each(|(candidate_id, edges)| { @@ -778,10 +772,7 @@ pub mod pallet { } fn get_public_key() -> Option { - match sr25519_public_keys(KEY_TYPE).first() { - Some(pubkey) => Some(T::AccountId::decode(&mut &pubkey.encode()[..]).unwrap()), - None => None, - } + sr25519_public_keys(KEY_TYPE).first().map(|pubkey| T::AccountId::decode(&mut &pubkey.encode()[..]).unwrap()) } fn validate_edges() -> Result<(), &'static str> { @@ -832,7 +823,7 @@ pub mod pallet { log::debug!("node aggregates: {:?}", node_aggregates); // No data for node - if node_aggregates.len() == 0 { + if node_aggregates.is_empty() { continue } @@ -848,8 +839,8 @@ pub mod pallet { let file_request = dac::fetch_file_request(&request_id_url); requests.insert(file_request.file_request_id.clone(), file_request.clone()); } - dac::get_acknowledged_bytes_bucket(&requests, payments_per_bucket); - let (bytes_sent, bytes_received) = dac::get_served_bytes_sum(&requests); + dac::get_acknowledged_bytes_bucket(requests, payments_per_bucket); + let (bytes_sent, bytes_received) = dac::get_served_bytes_sum(requests); let is_valid = Self::is_valid(bytes_sent, bytes_received); log::debug!("bytes_sent, bytes_received: {:?}, {:?}", bytes_sent, bytes_received); @@ -916,18 +907,18 @@ pub mod pallet { u128, BucketsDetails>, > = BTreeMap::new(); - for bucket in payments_per_bucket.into_iter() { + for bucket in payments_per_bucket.iter_mut() { let cere_payment = bucket.1 as u32; - if payments.contains_key(&bucket.0) { - payments.entry(bucket.0).and_modify(|bucket_info| { - bucket_info.amount += cere_payment.into() - }); - } else { + if let std::collections::btree_map::Entry::Vacant(e) = payments.entry(bucket.0) { let bucket_info = BucketsDetails { bucket_id: bucket.0, amount: cere_payment.into(), }; - payments.insert(bucket.0, bucket_info); + e.insert(bucket_info); + } else { + payments.entry(bucket.0).and_modify(|bucket_info| { + bucket_info.amount += cere_payment.into() + }); } } let mut final_payments = vec![]; @@ -993,7 +984,7 @@ pub mod pallet { let signer = Self::get_signer().unwrap(); // ToDo: replace local call by a call from `ddc-staking` pallet - if cdn_nodes_reward_points.len() > 0 { + if !cdn_nodes_reward_points.is_empty() { let tx_res = signer.send_signed_transaction(|_account| Call::set_era_reward_points { era: current_ddc_era - 1, diff --git a/pallets/ddc-validator/src/shm.rs b/pallets/ddc-validator/src/shm.rs index 6989e148f..066be9bd5 100644 --- a/pallets/ddc-validator/src/shm.rs +++ b/pallets/ddc-validator/src/shm.rs @@ -43,7 +43,7 @@ pub fn base64_decode(input: &String) -> Result, ()> { let mut buf = Vec::with_capacity(1000); // ToDo: calculate capacity buf.resize(1000, 0); BASE64_STANDARD.decode_slice(input, &mut buf).map_err(|_| ())?; - Ok(buf.iter().map(|&char| char as u8).collect()) + Ok(buf.to_vec()) } /// Encodes a vector of bytes into a vector of characters using base64 encoding. @@ -121,9 +121,9 @@ pub(crate) fn get_intermediate_decisions( }; let quorum_decisions = find_quorum_decisions(decisions_for_edge, quorum); - let decoded_decisions = decode_intermediate_decisions(quorum_decisions); + - decoded_decisions + decode_intermediate_decisions(quorum_decisions) } pub(crate) fn decode_intermediate_decisions( @@ -139,7 +139,7 @@ pub(crate) fn decode_intermediate_decisions( log::debug!("data_str: {:?}", data_trimmed); - let decoded_decision: ValidationDecision = serde_json::from_str(&data_trimmed).unwrap(); + let decoded_decision: ValidationDecision = serde_json::from_str(data_trimmed).unwrap(); decoded_decisions.push(decoded_decision); } diff --git a/pallets/ddc-validator/src/tests.rs b/pallets/ddc-validator/src/tests.rs index fc537b88a..4bd841fe8 100644 --- a/pallets/ddc-validator/src/tests.rs +++ b/pallets/ddc-validator/src/tests.rs @@ -20,7 +20,7 @@ const OCW_SEED: &str = "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; fn last_event() -> RuntimeEvent { - System::events().pop().expect("Event expected").event.into() + System::events().pop().expect("Event expected").event } #[test] @@ -137,7 +137,7 @@ fn it_sets_validation_decision_with_one_validator_in_quorum() { } t.execute_with(|| { - let era_block_number = 20 as u32 * era_to_validate; + let era_block_number = 20_u32 * era_to_validate; System::set_block_number(era_block_number); // required for randomness assert_ok!(DdcValidator::set_validator_key( // register validator 1 @@ -470,7 +470,7 @@ fn charge_payments_content_owners_works_as_expected() { ValidatorError::::DDCEraNotSet ); - let era_block_number = 20 as u32 * era_to_validate; + let era_block_number = 20_u32 * era_to_validate; System::set_block_number(era_block_number); Timestamp::set_timestamp( (DDC_ERA_START_MS + DDC_ERA_DURATION_MS * (era_to_validate as u128 - 1)) as u64, diff --git a/pallets/ddc-validator/src/utils.rs b/pallets/ddc-validator/src/utils.rs index 5c5459b24..a43ee2aa1 100644 --- a/pallets/ddc-validator/src/utils.rs +++ b/pallets/ddc-validator/src/utils.rs @@ -6,9 +6,9 @@ pub use sp_std::prelude::*; pub fn account_to_string(account: T::AccountId) -> String { let to32 = T::AccountId::encode(&account); - let pub_key_str = array_bytes::bytes2hex("", to32); + - pub_key_str + array_bytes::bytes2hex("", to32) } pub fn string_to_account(pub_key_str: String) -> T::AccountId { diff --git a/pallets/ddc/src/lib.rs b/pallets/ddc/src/lib.rs index 8308b880c..c7bdc1d73 100644 --- a/pallets/ddc/src/lib.rs +++ b/pallets/ddc/src/lib.rs @@ -97,10 +97,10 @@ decl_module! { ensure!(data.len() >= T::MinLength::get(), Error::::TooShort); ensure!(data.len() <= T::MaxLength::get(), Error::::TooLong); - if let Some(_) = >::get(&sender) { - Self::deposit_event(RawEvent::DataStringChanged(sender.clone())); + if >::get(&sender).is_some() { + Self::deposit_event(RawEvent::DataStringChanged(sender)); } else { - Self::deposit_event(RawEvent::DataStringSet(sender.clone())); + Self::deposit_event(RawEvent::DataStringSet(sender)); }; >::insert(send_to, data); diff --git a/pallets/erc20/src/lib.rs b/pallets/erc20/src/lib.rs index e025c5177..8e7967ed6 100644 --- a/pallets/erc20/src/lib.rs +++ b/pallets/erc20/src/lib.rs @@ -82,7 +82,7 @@ decl_module! { let source = ensure_signed(origin)?; ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); let bridge_id = >::account_id(); - T::Currency::transfer(&source, &bridge_id, amount.into(), AllowDeath)?; + T::Currency::transfer(&source, &bridge_id, amount, AllowDeath)?; let resource_id = T::NativeTokenId::get(); let number_amount: u128 = amount.saturated_into(); @@ -96,7 +96,7 @@ decl_module! { pub fn transfer_erc721(origin, recipient: Vec, token_id: U256, dest_id: bridge::ChainId) -> DispatchResult { let source = ensure_signed(origin)?; ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); - match >::tokens(&token_id) { + match >::tokens(token_id) { Some(token) => { >::burn_token(source, token_id)?; let resource_id = T::Erc721Id::get(); @@ -116,7 +116,7 @@ decl_module! { #[weight = 195_000_000] pub fn transfer(origin, to: T::AccountId, amount: BalanceOf) -> DispatchResult { let source = T::BridgeOrigin::ensure_origin(origin)?; - ::Currency::transfer(&source, &to, amount.into(), AllowDeath)?; + ::Currency::transfer(&source, &to, amount, AllowDeath)?; Ok(()) } diff --git a/pallets/erc721/src/lib.rs b/pallets/erc721/src/lib.rs index 7d93c96f9..638dc864a 100644 --- a/pallets/erc721/src/lib.rs +++ b/pallets/erc721/src/lib.rs @@ -114,8 +114,8 @@ impl Module { let new_token = Erc721Token { id, metadata }; - ::insert(&id, new_token); - >::insert(&id, owner.clone()); + ::insert(id, new_token); + >::insert(id, owner.clone()); let new_total = ::get().saturating_add(U256::one()); ::put(new_total); @@ -130,7 +130,7 @@ impl Module { let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; ensure!(owner == from, Error::::NotOwner); // Update owner - >::insert(&id, to.clone()); + >::insert(id, to.clone()); Self::deposit_event(RawEvent::Transferred(from, to, id)); @@ -142,8 +142,8 @@ impl Module { let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; ensure!(owner == from, Error::::NotOwner); - ::remove(&id); - >::remove(&id); + ::remove(id); + >::remove(id); let new_total = ::get().saturating_sub(U256::one()); ::put(new_total); diff --git a/pallets/erc721/src/tests.rs b/pallets/erc721/src/tests.rs index f273f83a3..9fa6cde1b 100644 --- a/pallets/erc721/src/tests.rs +++ b/pallets/erc721/src/tests.rs @@ -22,7 +22,7 @@ fn mint_burn_tokens() { ); assert_eq!(Erc721::token_count(), 1.into()); assert_noop!( - Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone()), + Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a), Error::::TokenAlreadyExists ); @@ -33,19 +33,19 @@ fn mint_burn_tokens() { ); assert_eq!(Erc721::token_count(), 2.into()); assert_noop!( - Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone()), + Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b), Error::::TokenAlreadyExists ); assert_ok!(Erc721::burn(RuntimeOrigin::root(), id_a)); assert_eq!(Erc721::token_count(), 1.into()); - assert!(!::contains_key(&id_a)); - assert!(!>::contains_key(&id_a)); + assert!(!::contains_key(id_a)); + assert!(!>::contains_key(id_a)); assert_ok!(Erc721::burn(RuntimeOrigin::root(), id_b)); assert_eq!(Erc721::token_count(), 0.into()); - assert!(!::contains_key(&id_b)); - assert!(!>::contains_key(&id_b)); + assert!(!::contains_key(id_b)); + assert!(!>::contains_key(id_b)); }) } @@ -57,8 +57,8 @@ fn transfer_tokens() { let metadata_a: Vec = vec![1, 2, 3]; let metadata_b: Vec = vec![4, 5, 6]; - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone())); - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone())); + assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a)); + assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b)); assert_ok!(Erc721::transfer(RuntimeOrigin::signed(USER_A), USER_B, id_a)); assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_B); diff --git a/runtime/cere-dev/src/impls.rs b/runtime/cere-dev/src/impls.rs index c576e8d31..3e725dca7 100644 --- a/runtime/cere-dev/src/impls.rs +++ b/runtime/cere-dev/src/impls.rs @@ -98,7 +98,7 @@ mod multiplier_tests { fn run_with_system_weight(w: Weight, assertions: F) where - F: Fn() -> (), + F: Fn(), { let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() .build_storage::() @@ -114,12 +114,12 @@ mod multiplier_tests { fn truth_value_update_poc_works() { let fm = Multiplier::saturating_from_rational(1, 2); let test_set = vec![ - (0, fm.clone()), - (100, fm.clone()), - (1000, fm.clone()), - (target().ref_time(), fm.clone()), - (max_normal().ref_time() / 2, fm.clone()), - (max_normal().ref_time(), fm.clone()), + (0, fm), + (100, fm), + (1000, fm), + (target().ref_time(), fm), + (max_normal().ref_time() / 2, fm), + (max_normal().ref_time(), fm), ]; test_set.into_iter().for_each(|(w, fm)| { run_with_system_weight(Weight::from_ref_time(w), || { @@ -325,7 +325,7 @@ mod multiplier_tests { #[test] fn weight_to_fee_should_not_overflow_on_large_weights() { - let kb = 1024 as u64; + let kb = 1024_u64; let mb = kb * kb; let max_fm = Multiplier::saturating_from_integer(i128::MAX); diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index d71e17e5c..0bcc2c34a 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -406,7 +406,7 @@ impl pallet_indices::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; + pub const ExistentialDeposit: Balance = DOLLARS; // For weight estimation, we assume that the most locks on an individual account will be 50. // This number may need to be adjusted in the future if this assumption no longer holds true. pub const MaxLocks: u32 = 50; @@ -566,9 +566,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = 1 * DOLLARS; - pub const SignedDepositBase: Balance = 1 * DOLLARS; - pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -723,11 +723,11 @@ impl pallet_bags_list::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const LaunchPeriod: BlockNumber = 24 * 60 * MINUTES; + pub const VotingPeriod: BlockNumber = 24 * 60 * MINUTES; pub const FastTrackVotingPeriod: BlockNumber = 3 * 60 * MINUTES; pub const MinimumDeposit: Balance = 5_000_000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const EnactmentPeriod: BlockNumber = 24 * 60 * MINUTES; pub const CooloffPeriod: BlockNumber = 7 * 24 * 60 * MINUTES; pub const MaxProposals: u32 = 100; } @@ -805,7 +805,7 @@ parameter_types! { pub const CandidacyBond: Balance = 500_000_000 * DOLLARS; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); - pub const VotingBondFactor: Balance = 1 * DOLLARS; + pub const VotingBondFactor: Balance = DOLLARS; pub const TermDuration: BlockNumber = 182 * DAYS; pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 20; @@ -877,12 +877,12 @@ impl pallet_membership::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 5_000_000 * DOLLARS; - pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(0); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 5_000_000 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * DOLLARS; + pub const DataDepositPerByte: Balance = DOLLARS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 16384; pub const MaxApprovals: u32 = 100; @@ -918,7 +918,7 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const BountyDepositBase: Balance = 5_000_000 * DOLLARS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = 1 * DOLLARS; + pub const CuratorDepositMin: Balance = DOLLARS; pub const CuratorDepositMax: Balance = 100 * DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; @@ -940,7 +940,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyValueMinimum: Balance = DOLLARS; } impl pallet_child_bounties::Config for Runtime { @@ -1193,7 +1193,7 @@ impl pallet_society::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; } impl pallet_vesting::Config for Runtime { diff --git a/runtime/cere/src/impls.rs b/runtime/cere/src/impls.rs index 6895f794e..f1763dea1 100644 --- a/runtime/cere/src/impls.rs +++ b/runtime/cere/src/impls.rs @@ -98,7 +98,7 @@ mod multiplier_tests { fn run_with_system_weight(w: Weight, assertions: F) where - F: Fn() -> (), + F: Fn(), { let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() .build_storage::() @@ -114,12 +114,12 @@ mod multiplier_tests { fn truth_value_update_poc_works() { let fm = Multiplier::saturating_from_rational(1, 2); let test_set = vec![ - (0, fm.clone()), - (100, fm.clone()), - (1000, fm.clone()), - (target().ref_time(), fm.clone()), - (max_normal().ref_time() / 2, fm.clone()), - (max_normal().ref_time(), fm.clone()), + (0, fm), + (100, fm), + (1000, fm), + (target().ref_time(), fm), + (max_normal().ref_time() / 2, fm), + (max_normal().ref_time(), fm), ]; test_set.into_iter().for_each(|(w, fm)| { run_with_system_weight(Weight::from_ref_time(w), || { @@ -325,7 +325,7 @@ mod multiplier_tests { #[test] fn weight_to_fee_should_not_overflow_on_large_weights() { - let kb = 1024 as u64; + let kb = 1024_u64; let mb = kb * kb; let max_fm = Multiplier::saturating_from_integer(i128::MAX); diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index c27c8e8e6..c7745b7eb 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -401,7 +401,7 @@ impl pallet_indices::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; + pub const ExistentialDeposit: Balance = DOLLARS; // For weight estimation, we assume that the most locks on an individual account will be 50. // This number may need to be adjusted in the future if this assumption no longer holds true. pub const MaxLocks: u32 = 50; @@ -562,9 +562,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = 1 * DOLLARS; - pub const SignedDepositBase: Balance = 1 * DOLLARS; - pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -719,11 +719,11 @@ impl pallet_bags_list::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const LaunchPeriod: BlockNumber = 24 * 60 * MINUTES; + pub const VotingPeriod: BlockNumber = 24 * 60 * MINUTES; pub const FastTrackVotingPeriod: BlockNumber = 3 * 60 * MINUTES; pub const MinimumDeposit: Balance = 5_000_000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const EnactmentPeriod: BlockNumber = 24 * 60 * MINUTES; pub const CooloffPeriod: BlockNumber = 7 * 24 * 60 * MINUTES; pub const MaxProposals: u32 = 100; } @@ -801,7 +801,7 @@ parameter_types! { pub const CandidacyBond: Balance = 500_000_000 * DOLLARS; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); - pub const VotingBondFactor: Balance = 1 * DOLLARS; + pub const VotingBondFactor: Balance = DOLLARS; pub const TermDuration: BlockNumber = 182 * DAYS; pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 20; @@ -873,12 +873,12 @@ impl pallet_membership::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 5_000_000 * DOLLARS; - pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(0); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 5_000_000 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * DOLLARS; + pub const DataDepositPerByte: Balance = DOLLARS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 16384; pub const MaxApprovals: u32 = 100; @@ -914,7 +914,7 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const BountyDepositBase: Balance = 5_000_000 * DOLLARS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = 1 * DOLLARS; + pub const CuratorDepositMin: Balance = DOLLARS; pub const CuratorDepositMax: Balance = 100 * DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; @@ -936,7 +936,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyValueMinimum: Balance = DOLLARS; } impl pallet_child_bounties::Config for Runtime { @@ -1189,7 +1189,7 @@ impl pallet_society::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; } impl pallet_vesting::Config for Runtime { From ebe97f8cc517a539982dc2d6b4b1a92dcbc18ad3 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 21 Sep 2023 18:41:46 +0600 Subject: [PATCH 06/29] Use `sp_std` as a BTreeMap type source --- pallets/ddc-validator/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pallets/ddc-validator/src/lib.rs b/pallets/ddc-validator/src/lib.rs index 175ab0b88..0dade22e5 100644 --- a/pallets/ddc-validator/src/lib.rs +++ b/pallets/ddc-validator/src/lib.rs @@ -59,7 +59,10 @@ pub use sp_runtime::offchain::{ http, storage::StorageValueRef, storage_lock, storage_lock::StorageLock, Duration, Timestamp, }; pub use sp_staking::EraIndex; -pub use sp_std::{collections::btree_map::BTreeMap, prelude::*}; +pub use sp_std::{ + collections::{btree_map, btree_map::BTreeMap}, + prelude::*, +}; extern crate alloc; @@ -909,7 +912,7 @@ pub mod pallet { > = BTreeMap::new(); for bucket in payments_per_bucket.iter_mut() { let cere_payment = bucket.1 as u32; - if let std::collections::btree_map::Entry::Vacant(e) = payments.entry(bucket.0) { + if let btree_map::Entry::Vacant(e) = payments.entry(bucket.0) { let bucket_info = BucketsDetails { bucket_id: bucket.0, amount: cere_payment.into(), From 17efbf4d97d6279496c16dd53b54146beca4dea2 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Mon, 23 Oct 2023 18:22:49 +0600 Subject: [PATCH 07/29] Disable rustfmt for legacy pallets --- rustfmt.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rustfmt.toml b/rustfmt.toml index 441913f61..f58198d98 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -21,3 +21,11 @@ match_block_trailing_comma = true trailing_comma = "Vertical" trailing_semicolon = false use_field_init_shorthand = true + +ignore = [ + "pallets/chainbridge", + "pallets/ddc-metrics-offchain-worker", + "pallets/ddc", + "pallets/erc20", + "pallets/erc721", +] From 3b367ba9aa22bf3cc9a4c01757b90cd70328cc7f Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 21 Sep 2023 18:51:50 +0600 Subject: [PATCH 08/29] Apply rustfmt --- pallets/ddc-clusters/src/lib.rs | 4 +--- pallets/ddc-nodes/src/lib.rs | 12 ++++-------- pallets/ddc-staking/src/lib.rs | 6 +----- pallets/ddc-validator/src/dac.rs | 4 ---- pallets/ddc-validator/src/lib.rs | 7 +++++-- pallets/ddc-validator/src/shm.rs | 1 - pallets/ddc-validator/src/utils.rs | 1 - 7 files changed, 11 insertions(+), 24 deletions(-) diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index 7d3499d4a..7569b2760 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -193,9 +193,7 @@ pub mod pallet { let mut cluster = Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); - cluster - .set_params(cluster_params) - .map_err(Into::>::into)?; + cluster.set_params(cluster_params).map_err(Into::>::into)?; Clusters::::insert(cluster_id, cluster); Self::deposit_event(Event::::ClusterParamsSet { cluster_id }); diff --git a/pallets/ddc-nodes/src/lib.rs b/pallets/ddc-nodes/src/lib.rs index 2871f1e29..75d89e260 100644 --- a/pallets/ddc-nodes/src/lib.rs +++ b/pallets/ddc-nodes/src/lib.rs @@ -92,12 +92,10 @@ pub mod pallet { #[pallet::weight(10_000)] pub fn delete_node(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let node = Self::get(node_pub_key.clone()) - .map_err(Into::>::into)?; + let node = Self::get(node_pub_key.clone()).map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); ensure!(node.get_cluster_id().is_none(), Error::::NodeIsAssignedToCluster); - Self::delete(node_pub_key.clone()) - .map_err(Into::>::into)?; + Self::delete(node_pub_key.clone()).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeDeleted { node_pub_key }); Ok(()) } @@ -109,11 +107,9 @@ pub mod pallet { node_params: NodeParams, ) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let mut node = Self::get(node_pub_key.clone()) - .map_err(Into::>::into)?; + let mut node = Self::get(node_pub_key.clone()).map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); - node.set_params(node_params) - .map_err(Into::>::into)?; + node.set_params(node_params).map_err(Into::>::into)?; Self::update(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeParamsChanged { node_pub_key }); Ok(()) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index ec96bfe27..3c8464dc8 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -989,11 +989,7 @@ pub mod pallet { current_rewards.push(rewards); }); } - Self::deposit_event(Event::::PayoutNodes( - era, - era_reward_points, - price_per_byte, - )); + Self::deposit_event(Event::::PayoutNodes(era, era_reward_points, price_per_byte)); log::debug!("Payout event executed"); log::debug!( diff --git a/pallets/ddc-validator/src/dac.rs b/pallets/ddc-validator/src/dac.rs index a2b593182..205abba4e 100644 --- a/pallets/ddc-validator/src/dac.rs +++ b/pallets/ddc-validator/src/dac.rs @@ -329,8 +329,6 @@ pub(crate) fn http_get_json(url: &str) -> crate::ResultSt "HTTP GET error" })?; - - serde_json::from_slice(&body).map_err(|err| { log::warn!("[DAC Validator] Error while parsing JSON from {}: {:?}", url, err); "HTTP JSON parse error" @@ -365,8 +363,6 @@ pub(crate) fn get_final_decision(decisions: Vec) -> Validati let serialized_decisions = serde_json::to_string(&common_decisions).unwrap(); - - ValidationDecision { edge: decision_example.edge.clone(), result: decision_example.result, diff --git a/pallets/ddc-validator/src/lib.rs b/pallets/ddc-validator/src/lib.rs index 0dade22e5..f08727d4b 100644 --- a/pallets/ddc-validator/src/lib.rs +++ b/pallets/ddc-validator/src/lib.rs @@ -637,7 +637,8 @@ pub mod pallet { let percentage_difference = 1f32 - (bytes_received as f32 / bytes_sent as f32); - percentage_difference >= 0.0 && (T::ValidationThreshold::get() as f32 - percentage_difference) > 0.0 + percentage_difference >= 0.0 && + (T::ValidationThreshold::get() as f32 - percentage_difference) > 0.0 } /// Shuffle the `list` swapping it's random elements `list.len()` times. @@ -775,7 +776,9 @@ pub mod pallet { } fn get_public_key() -> Option { - sr25519_public_keys(KEY_TYPE).first().map(|pubkey| T::AccountId::decode(&mut &pubkey.encode()[..]).unwrap()) + sr25519_public_keys(KEY_TYPE) + .first() + .map(|pubkey| T::AccountId::decode(&mut &pubkey.encode()[..]).unwrap()) } fn validate_edges() -> Result<(), &'static str> { diff --git a/pallets/ddc-validator/src/shm.rs b/pallets/ddc-validator/src/shm.rs index 066be9bd5..47619425c 100644 --- a/pallets/ddc-validator/src/shm.rs +++ b/pallets/ddc-validator/src/shm.rs @@ -121,7 +121,6 @@ pub(crate) fn get_intermediate_decisions( }; let quorum_decisions = find_quorum_decisions(decisions_for_edge, quorum); - decode_intermediate_decisions(quorum_decisions) } diff --git a/pallets/ddc-validator/src/utils.rs b/pallets/ddc-validator/src/utils.rs index a43ee2aa1..2ba8379e9 100644 --- a/pallets/ddc-validator/src/utils.rs +++ b/pallets/ddc-validator/src/utils.rs @@ -6,7 +6,6 @@ pub use sp_std::prelude::*; pub fn account_to_string(account: T::AccountId) -> String { let to32 = T::AccountId::encode(&account); - array_bytes::bytes2hex("", to32) } From 1fce540127954ef632a65bb9a2568ac0d31334df Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Fri, 22 Sep 2023 12:57:41 +0600 Subject: [PATCH 09/29] Apply clippy suggestions which it can't fix itself --- .gitignore | 2 -- pallets/ddc-metrics-offchain-worker/src/lib.rs | 17 ++++++++--------- .../src/tests/test_data/ddc.wasm | 0 .../src/tests/test_data/metadata.json | 0 4 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm create mode 100644 pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json diff --git a/.gitignore b/.gitignore index 6dd97a7f6..ac9d585fc 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,3 @@ # ddc-metrics-offchain-worker mock files pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.contract -pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm -pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json diff --git a/pallets/ddc-metrics-offchain-worker/src/lib.rs b/pallets/ddc-metrics-offchain-worker/src/lib.rs index 228def0f0..ffa2dfbb1 100644 --- a/pallets/ddc-metrics-offchain-worker/src/lib.rs +++ b/pallets/ddc-metrics-offchain-worker/src/lib.rs @@ -304,11 +304,10 @@ where ); Err("Skipping") } else { - let block_interval_configured = Self::get_block_interval(); let mut block_interval = T::BlockInterval::get(); - if block_interval_configured.is_some() { + if let Some(block_interval_configured) = Self::get_block_interval() { block_interval = ::BlockNumber::from( - block_interval_configured.unwrap(), + block_interval_configured, ); } @@ -753,7 +752,12 @@ impl MetricsAggregator { let existing_pubkey_index = self.0.iter().position(|one_result_obj| metric.app_id == one_result_obj.app_id); - if existing_pubkey_index.is_none() { + if let Some(existing_pubkey_index) = existing_pubkey_index { + // Add to metrics of an existing app. + self.0[existing_pubkey_index].storage_bytes += metric.storage_bytes; + self.0[existing_pubkey_index].wcu_used += metric.wcu_used; + self.0[existing_pubkey_index].rcu_used += metric.rcu_used; + } else { // New app. let new_metric_obj = Metric { app_id: metric.app_id.clone(), @@ -762,11 +766,6 @@ impl MetricsAggregator { rcu_used: metric.rcu_used, }; self.0.push(new_metric_obj); - } else { - // Add to metrics of an existing app. - self.0[existing_pubkey_index.unwrap()].storage_bytes += metric.storage_bytes; - self.0[existing_pubkey_index.unwrap()].wcu_used += metric.wcu_used; - self.0[existing_pubkey_index.unwrap()].rcu_used += metric.rcu_used; } } diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm b/pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm new file mode 100644 index 000000000..e69de29bb diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json b/pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json new file mode 100644 index 000000000..e69de29bb From e6a45d6f4d5a9d79132be253518d1247c6570904 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Fri, 22 Sep 2023 13:20:50 +0600 Subject: [PATCH 10/29] Pre-push script invoking Clippy linter --- scripts/pre-push.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 scripts/pre-push.sh diff --git a/scripts/pre-push.sh b/scripts/pre-push.sh new file mode 100755 index 000000000..9c6679c02 --- /dev/null +++ b/scripts/pre-push.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# Check code with clippy before publishing +cargo clippy --all --all-targets -- -D warnings +if [ $? -ne 0 ]; then + echo "Run \`cargo clippy --fix --all --allow-staged --allow-dirty\` to apply clippy's suggestions." + exit 1 +fi From 2ec2d82ccc8f9564dc52c4c4c8c766162499bb28 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Fri, 22 Sep 2023 13:21:41 +0600 Subject: [PATCH 11/29] Add pre-push script setup to init script --- scripts/init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/init.sh b/scripts/init.sh index beca622b2..1472424dc 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -9,3 +9,4 @@ rustup install nightly-2022-10-09 rustup target add wasm32-unknown-unknown --toolchain nightly-2022-10-09 ln -sf $PWD/scripts/pre-commit.sh $PWD/.git/hooks/pre-commit || true +ln -sf $PWD/scripts/pre-push.sh $PWD/.git/hooks/pre-push || true From 585f1d86ccece2510882a2741fc543723eae969f Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Fri, 22 Sep 2023 13:23:33 +0600 Subject: [PATCH 12/29] Add Clippy to the `check` CI workflow --- .github/workflows/check.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index db63d8d96..27070bd99 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -35,6 +35,10 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2 + - name: Check with Clippy + run: | + cargo clippy --all --all-targets -- -D warnings + - name: Check Build run: | SKIP_WASM_BUILD=1 cargo check --release From d30f4de6b2821c4e7aef5beb437af6b64b3ed579 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Thu, 9 Nov 2023 21:20:23 +0100 Subject: [PATCH 13/29] feat: checking node cluster_id while node provider chilling --- Cargo.lock | 1 + pallets/ddc-nodes/Cargo.toml | 1 + pallets/ddc-nodes/src/lib.rs | 11 +++++++++ pallets/ddc-staking/src/lib.rs | 45 ++++++++++++++++++++++++++++------ runtime/cere-dev/src/lib.rs | 1 + traits/src/lib.rs | 1 + traits/src/node.rs | 10 ++++++++ 7 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 traits/src/node.rs diff --git a/Cargo.lock b/Cargo.lock index 6059b927b..149864ce3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4983,6 +4983,7 @@ name = "pallet-ddc-nodes" version = "4.8.1" dependencies = [ "ddc-primitives", + "ddc-traits", "frame-benchmarking", "frame-support", "frame-system", diff --git a/pallets/ddc-nodes/Cargo.toml b/pallets/ddc-nodes/Cargo.toml index 607ab47fa..65f5d098b 100644 --- a/pallets/ddc-nodes/Cargo.toml +++ b/pallets/ddc-nodes/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } +ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/pallets/ddc-nodes/src/lib.rs b/pallets/ddc-nodes/src/lib.rs index f0e881f7f..6da1c7076 100644 --- a/pallets/ddc-nodes/src/lib.rs +++ b/pallets/ddc-nodes/src/lib.rs @@ -15,6 +15,7 @@ #![recursion_limit = "256"] use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey, StorageNodePubKey}; +use ddc_traits::node::{NodeVisitor, NodeVisitorError}; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; use sp_std::prelude::*; @@ -209,4 +210,14 @@ pub mod pallet { } } } + + impl NodeVisitor for Pallet { + fn get_cluster_id( + node_pub_key: &NodePubKey, + ) -> Result, NodeVisitorError> { + let node = + Self::get(node_pub_key.clone()).map_err(|_| NodeVisitorError::NodeDoesNotExist)?; + Ok(*node.get_cluster_id()) + } + } } diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index fbc82d69b..3c00316c0 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -32,6 +32,7 @@ use codec::{Decode, Encode, HasCompact}; pub use ddc_primitives::{ClusterId, NodePubKey, NodeType}; use ddc_traits::{ cluster::{ClusterVisitor, ClusterVisitorError}, + node::NodeVisitor, staking::{StakingVisitor, StakingVisitorError}, }; @@ -157,6 +158,8 @@ pub mod pallet { type WeightInfo: WeightInfo; type ClusterVisitor: ClusterVisitor; + + type NodeVisitor: NodeVisitor; } /// Map from all locked "stash" accounts to the controller account. @@ -187,6 +190,11 @@ pub mod pallet { #[pallet::getter(fn nodes)] pub type Nodes = StorageMap<_, Twox64Concat, NodePubKey, T::AccountId>; + /// Map from operator stash account to DDC node ID. + #[pallet::storage] + #[pallet::getter(fn providers)] + pub type Providers = StorageMap<_, Twox64Concat, T::AccountId, NodePubKey>; + #[pallet::genesis_config] pub struct GenesisConfig { pub cdns: Vec<(T::AccountId, T::AccountId, NodePubKey, BalanceOf, ClusterId)>, @@ -330,13 +338,14 @@ pub mod pallet { } // Reject a bond with a known DDC node. - if Nodes::::contains_key(&node) { + if Nodes::::contains_key(&node) || Providers::::contains_key(&stash) { Err(Error::::AlreadyPaired)? } frame_system::Pallet::::inc_consumers(&stash).map_err(|_| Error::::BadState)?; Nodes::::insert(&node, &stash); + Providers::::insert(&stash, &node); // You're auto-bonded forever, here. We might improve this by only bonding when // you actually store/serve and remove once you unbond __everything__. @@ -423,7 +432,27 @@ pub mod pallet { T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::Storage) .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))? } else { - T::BlockNumber::from(100_00u32) + let node_pub_key = + >::get(&ledger.stash).ok_or(Error::::BadState)?; + + match T::NodeVisitor::get_cluster_id(&node_pub_key) { + // If node is chilling within some cluster, the unbonding period should be + // set according to the cluster's settings + Ok(Some(cluster_id)) => match node_pub_key { + NodePubKey::CDNPubKey(_) => + T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) + .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?, + NodePubKey::StoragePubKey(_) => T::ClusterVisitor::get_unbonding_delay( + &cluster_id, + NodeType::Storage, + ) + .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?, + }, + // If node is not a member of any cluster, allow immediate unbonding. + // It is possible if node provider hasn't called 'store/serve' yet, or after + // the 'fast_chill' and subsequent 'chill' calls. + _ => T::BlockNumber::from(0u32), + } }; let block = >::block_number() + unbonding_delay_in_blocks; @@ -679,7 +708,8 @@ pub mod pallet { ensure!(!>::contains_key(&stash), Error::::AlreadyInRole); ensure!(!>::contains_key(&stash), Error::::AlreadyInRole); - >::insert(new_node, stash); + >::insert(new_node.clone(), stash.clone()); + >::insert(stash, new_node); Ok(()) } @@ -688,10 +718,11 @@ pub mod pallet { /// /// The dispatch origin for this call must be _Signed_ by the controller. #[pallet::weight(10_000)] - pub fn fast_chill(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { + pub fn fast_chill(origin: OriginFor) -> DispatchResult { let controller = ensure_signed(origin)?; let stash = >::get(&controller).ok_or(Error::::NotController)?.stash; + let node_pub_key = >::get(&stash).ok_or(Error::::BadState)?; let node_stash = >::get(&node_pub_key).ok_or(Error::::BadState)?; ensure!(stash == node_stash, Error::::NotNodeController); @@ -764,9 +795,9 @@ pub mod pallet { >::remove(stash); >::remove(&controller); - if let Some((node, _)) = >::iter().find(|(_, v)| v == stash) { - >::remove(node); - } + if let Some(node_pub_key) = >::take(stash) { + >::remove(node_pub_key); + }; Self::do_remove_storage(stash); Self::do_remove_cdn(stash); diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 810c26d37..83331e687 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -1320,6 +1320,7 @@ impl pallet_ddc_staking::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; type ClusterVisitor = pallet_ddc_clusters::Pallet; + type NodeVisitor = pallet_ddc_nodes::Pallet; } parameter_types! { diff --git a/traits/src/lib.rs b/traits/src/lib.rs index f6eb2b0a4..35d286602 100644 --- a/traits/src/lib.rs +++ b/traits/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] pub mod cluster; +pub mod node; pub mod staking; diff --git a/traits/src/node.rs b/traits/src/node.rs new file mode 100644 index 000000000..af22b5a8b --- /dev/null +++ b/traits/src/node.rs @@ -0,0 +1,10 @@ +use ddc_primitives::{ClusterId, NodePubKey}; +use frame_system::Config; + +pub trait NodeVisitor { + fn get_cluster_id(node_pub_key: &NodePubKey) -> Result, NodeVisitorError>; +} + +pub enum NodeVisitorError { + NodeDoesNotExist, +} From 4553d156c9e5cf2c516d33b44e911d6062f8e923 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Thu, 9 Nov 2023 21:24:25 +0100 Subject: [PATCH 14/29] chore: version bump --- runtime/cere-dev/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 83331e687..7e8be086a 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -129,7 +129,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 48012, + spec_version: 48013, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 5, From ce406bf6e6fdf7850c705b13d32d2d0a690487f6 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Thu, 9 Nov 2023 22:36:21 +0100 Subject: [PATCH 15/29] fix: test compilation error is fixed --- pallets/ddc-staking/src/mock.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs index 041a719a3..c76b90dcb 100644 --- a/pallets/ddc-staking/src/mock.rs +++ b/pallets/ddc-staking/src/mock.rs @@ -4,7 +4,11 @@ use crate::{self as pallet_ddc_staking, *}; use ddc_primitives::{CDNNodePubKey, StorageNodePubKey}; -use ddc_traits::cluster::{ClusterVisitor, ClusterVisitorError}; +use ddc_traits::{ + cluster::{ClusterVisitor, ClusterVisitorError}, + node::{NodeVisitor, NodeVisitorError}, +}; + use frame_support::{ construct_runtime, traits::{ConstU32, ConstU64, Everything, GenesisBuild}, @@ -96,6 +100,7 @@ impl crate::pallet::Config for Test { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); type ClusterVisitor = TestClusterVisitor; + type NodeVisitor = TestNodeVisitor; } pub(crate) type DdcStakingCall = crate::Call; @@ -127,6 +132,14 @@ impl ClusterVisitor for TestClusterVisitor { Ok(T::BlockNumber::from(10u32)) } } + +pub struct TestNodeVisitor; +impl NodeVisitor for TestNodeVisitor { + fn get_cluster_id(_node_pub_key: &NodePubKey) -> Result, NodeVisitorError> { + Ok(None) + } +} + pub struct ExtBuilder { has_cdns: bool, has_storages: bool, From 7e0fa8aee958c000f846a1d4041ec6b600f1ae46 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 12:40:08 +0300 Subject: [PATCH 16/29] Rerun cargo clippy fix --- .github/workflows/check.yaml | 2 +- pallets/ddc-clusters/src/lib.rs | 50 +++++++--------- pallets/ddc-customers/src/lib.rs | 4 +- pallets/ddc-nodes/src/lib.rs | 18 +++--- pallets/ddc-staking/src/lib.rs | 47 +++++++-------- pallets/ddc-staking/src/tests.rs | 10 ++-- pallets/ddc-staking/src/weights.rs | 96 +++++++++++++++--------------- runtime/cere-dev/src/lib.rs | 28 ++++----- runtime/cere/src/lib.rs | 28 ++++----- 9 files changed, 134 insertions(+), 149 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 27070bd99..1ecb04c4b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -37,7 +37,7 @@ jobs: - name: Check with Clippy run: | - cargo clippy --all --all-targets -- -D warnings + cargo clippy --no-deps --all-targets --features runtime-benchmarks --workspace -- --deny warnings - name: Check Build run: | diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index cb4aafb7b..55d668f69 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -16,7 +16,7 @@ #![feature(is_some_and)] // ToDo: delete at rustc > 1.70 use crate::{ - cluster::{Cluster, ClusterError, ClusterGovParams, ClusterParams}, + cluster::{Cluster, ClusterGovParams, ClusterParams}, node_provider_auth::{NodeProviderAuthContract, NodeProviderAuthContractError}, }; use ddc_primitives::{ClusterId, NodePubKey, NodeType}; @@ -124,17 +124,13 @@ pub mod pallet { cluster_gov_params: ClusterGovParams, T::BlockNumber>, ) -> DispatchResult { ensure_root(origin)?; // requires Governance approval - let cluster = Cluster::new( - cluster_id.clone(), - cluster_manager_id, - cluster_reserve_id, - cluster_params, - ) - .map_err(|e: ClusterError| Into::>::into(ClusterError::from(e)))?; - ensure!(!Clusters::::contains_key(&cluster_id), Error::::ClusterAlreadyExists); - - Clusters::::insert(cluster_id.clone(), cluster); - ClustersGovParams::::insert(cluster_id.clone(), cluster_gov_params); + let cluster = + Cluster::new(cluster_id, cluster_manager_id, cluster_reserve_id, cluster_params) + .map_err(Into::>::into)?; + ensure!(!Clusters::::contains_key(cluster_id), Error::::ClusterAlreadyExists); + + Clusters::::insert(cluster_id, cluster); + ClustersGovParams::::insert(cluster_id, cluster_gov_params); Self::deposit_event(Event::::ClusterCreated { cluster_id }); Ok(()) @@ -148,7 +144,7 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); // Node with this node with this public key exists. @@ -158,12 +154,12 @@ pub mod pallet { // Sufficient funds are locked at the DDC Staking module. let has_stake = T::StakingVisitor::node_has_stake(&node_pub_key, &cluster_id) - .map_err(|e| Into::>::into(StakingVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!(has_stake, Error::::NodeHasNoStake); // Candidate is not planning to pause operations any time soon. let is_chilling = T::StakingVisitor::node_is_chilling(&node_pub_key) - .map_err(|e| Into::>::into(StakingVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!(!is_chilling, Error::::NodeChillingIsProhibited); // Cluster extension smart contract allows joining. @@ -177,13 +173,13 @@ pub mod pallet { node.get_pub_key().to_owned(), node.get_type(), ) - .map_err(|e| Into::>::into(NodeProviderAuthContractError::from(e)))?; + .map_err(Into::>::into)?; ensure!(is_authorized, Error::::NodeIsNotAuthorized); // Add node to the cluster. - node.set_cluster_id(Some(cluster_id.clone())); + node.set_cluster_id(Some(cluster_id)); T::NodeRepository::update(node).map_err(|_| Error::::AttemptToAddNonExistentNode)?; - ClustersNodes::::insert(cluster_id.clone(), node_pub_key.clone(), true); + ClustersNodes::::insert(cluster_id, node_pub_key.clone(), true); Self::deposit_event(Event::::ClusterNodeAdded { cluster_id, node_pub_key }); Ok(()) @@ -197,7 +193,7 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); let mut node = T::NodeRepository::get(node_pub_key.clone()) .map_err(|_| Error::::AttemptToRemoveNonExistentNode)?; @@ -205,7 +201,7 @@ pub mod pallet { node.set_cluster_id(None); T::NodeRepository::update(node) .map_err(|_| Error::::AttemptToRemoveNonExistentNode)?; - ClustersNodes::::remove(cluster_id.clone(), node_pub_key.clone()); + ClustersNodes::::remove(cluster_id, node_pub_key.clone()); Self::deposit_event(Event::::ClusterNodeRemoved { cluster_id, node_pub_key }); Ok(()) @@ -220,12 +216,10 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let mut cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); - cluster - .set_params(cluster_params) - .map_err(|e: ClusterError| Into::>::into(ClusterError::from(e)))?; - Clusters::::insert(cluster_id.clone(), cluster); + cluster.set_params(cluster_params).map_err(Into::>::into)?; + Clusters::::insert(cluster_id, cluster); Self::deposit_event(Event::::ClusterParamsSet { cluster_id }); Ok(()) @@ -240,8 +234,8 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; // requires Governance approval let _cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; - ClustersGovParams::::insert(cluster_id.clone(), cluster_gov_params); + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + ClustersGovParams::::insert(cluster_id, cluster_gov_params); Self::deposit_event(Event::::ClusterGovParamsSet { cluster_id }); Ok(()) @@ -254,7 +248,7 @@ pub mod pallet { } fn ensure_cluster(cluster_id: &ClusterId) -> Result<(), ClusterVisitorError> { - Clusters::::get(&cluster_id) + Clusters::::get(cluster_id) .map(|_| ()) .ok_or(ClusterVisitorError::ClusterDoesNotExist) } diff --git a/pallets/ddc-customers/src/lib.rs b/pallets/ddc-customers/src/lib.rs index d544ced22..f807f0985 100644 --- a/pallets/ddc-customers/src/lib.rs +++ b/pallets/ddc-customers/src/lib.rs @@ -333,7 +333,7 @@ pub mod pallet { Self::update_ledger_and_deposit(&owner, &ledger)?; - Self::deposit_event(Event::::Deposited(owner.clone(), extra)); + Self::deposit_event(Event::::Deposited(owner, extra)); Ok(()) } @@ -500,7 +500,7 @@ pub mod pallet { /// This is called: /// - after a `withdraw_unlocked_deposit()` call that frees all of a owner's locked balance. fn kill_owner(owner: &T::AccountId) -> DispatchResult { - >::remove(&owner); + >::remove(owner); frame_system::Pallet::::dec_consumers(owner); diff --git a/pallets/ddc-nodes/src/lib.rs b/pallets/ddc-nodes/src/lib.rs index f0e881f7f..433aa114f 100644 --- a/pallets/ddc-nodes/src/lib.rs +++ b/pallets/ddc-nodes/src/lib.rs @@ -83,8 +83,8 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let node = Node::::new(node_pub_key.clone(), caller_id, node_params) - .map_err(|e| Into::>::into(NodeError::from(e)))?; - Self::create(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; + Self::create(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeCreated { node_pub_key }); Ok(()) } @@ -92,12 +92,10 @@ pub mod pallet { #[pallet::weight(10_000)] pub fn delete_node(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let node = Self::get(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + let node = Self::get(node_pub_key.clone()).map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); ensure!(node.get_cluster_id().is_none(), Error::::NodeIsAssignedToCluster); - Self::delete(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + Self::delete(node_pub_key.clone()).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeDeleted { node_pub_key }); Ok(()) } @@ -109,12 +107,10 @@ pub mod pallet { node_params: NodeParams, ) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let mut node = Self::get(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + let mut node = Self::get(node_pub_key.clone()).map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); - node.set_params(node_params) - .map_err(|e| Into::>::into(NodeError::from(e)))?; - Self::update(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + node.set_params(node_params).map_err(Into::>::into)?; + Self::update(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeParamsChanged { node_pub_key }); Ok(()) } diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index fbc82d69b..1eb4176a8 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -206,7 +206,7 @@ pub mod pallet { // Add initial CDN participants for &(ref stash, ref controller, ref node, balance, cluster) in &self.cdns { assert!( - T::Currency::free_balance(&stash) >= balance, + T::Currency::free_balance(stash) >= balance, "Stash do not have enough balance to participate in CDN." ); assert_ok!(Pallet::::bond( @@ -224,7 +224,7 @@ pub mod pallet { // Add initial storage network participants for &(ref stash, ref controller, ref node, balance, cluster) in &self.storages { assert!( - T::Currency::free_balance(&stash) >= balance, + T::Currency::free_balance(stash) >= balance, "Stash do not have enough balance to participate in storage network." ); assert_ok!(Pallet::::bond( @@ -400,12 +400,12 @@ pub mod pallet { let min_active_bond = if let Some(cluster_id) = Self::cdns(&ledger.stash) { let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; bond_size.saturated_into::>() } else if let Some(cluster_id) = Self::storages(&ledger.stash) { let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; bond_size.saturated_into::>() } else { Zero::zero() @@ -418,12 +418,12 @@ pub mod pallet { let unbonding_delay_in_blocks = if let Some(cluster_id) = Self::cdns(&ledger.stash) { T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))? + .map_err(Into::>::into)? } else if let Some(cluster_id) = Self::storages(&ledger.stash) { T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))? + .map_err(Into::>::into)? } else { - T::BlockNumber::from(100_00u32) + T::BlockNumber::from(10_000_u32) }; let block = >::block_number() + unbonding_delay_in_blocks; @@ -500,13 +500,12 @@ pub mod pallet { pub fn serve(origin: OriginFor, cluster_id: ClusterId) -> DispatchResult { let controller = ensure_signed(origin)?; - T::ClusterVisitor::ensure_cluster(&cluster_id) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + T::ClusterVisitor::ensure_cluster(&cluster_id).map_err(Into::>::into)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; // Retrieve the respective bond size from Cluster Visitor let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!( ledger.active >= bond_size.saturated_into::>(), @@ -515,10 +514,10 @@ pub mod pallet { let stash = &ledger.stash; // Can't participate in CDN if already participating in storage network. - ensure!(!Storages::::contains_key(&stash), Error::::AlreadyInRole); + ensure!(!Storages::::contains_key(stash), Error::::AlreadyInRole); // Is it an attempt to cancel a previous "chill"? - if let Some(current_cluster) = Self::cdns(&stash) { + if let Some(current_cluster) = Self::cdns(stash) { // Switching the cluster is prohibited. The user should chill first. ensure!(current_cluster == cluster_id, Error::::AlreadyInRole); // Cancel previous "chill" attempts @@ -541,13 +540,12 @@ pub mod pallet { pub fn store(origin: OriginFor, cluster_id: ClusterId) -> DispatchResult { let controller = ensure_signed(origin)?; - T::ClusterVisitor::ensure_cluster(&cluster_id) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + T::ClusterVisitor::ensure_cluster(&cluster_id).map_err(Into::>::into)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; // Retrieve the respective bond size from Cluster Visitor let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!( ledger.active >= bond_size.saturated_into::>(), Error::::InsufficientBond @@ -555,10 +553,10 @@ pub mod pallet { let stash = &ledger.stash; // Can't participate in storage network if already participating in CDN. - ensure!(!CDNs::::contains_key(&stash), Error::::AlreadyInRole); + ensure!(!CDNs::::contains_key(stash), Error::::AlreadyInRole); // Is it an attempt to cancel a previous "chill"? - if let Some(current_cluster) = Self::storages(&stash) { + if let Some(current_cluster) = Self::storages(stash) { // Switching the cluster is prohibited. The user should chill first. ensure!(current_cluster == cluster_id, Error::::AlreadyInRole); // Cancel previous "chill" attempts @@ -596,12 +594,11 @@ pub mod pallet { // Extract delay from the cluster settings. let (cluster, delay) = if let Some(cluster) = Self::cdns(&ledger.stash) { let chill_delay = T::ClusterVisitor::get_chill_delay(&cluster, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; (cluster, chill_delay) } else if let Some(cluster) = Self::storages(&ledger.stash) { - let chill_delay = - T::ClusterVisitor::get_chill_delay(&cluster, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + let chill_delay = T::ClusterVisitor::get_chill_delay(&cluster, NodeType::Storage) + .map_err(Into::>::into)?; (cluster, chill_delay) } else { return Ok(()) // already chilled @@ -743,7 +740,7 @@ pub mod pallet { cluster: ClusterId, can_chill_from: T::BlockNumber, ) { - Ledger::::mutate(&controller, |maybe_ledger| { + Ledger::::mutate(controller, |maybe_ledger| { if let Some(ref mut ledger) = maybe_ledger { ledger.chilling = Some(can_chill_from) } @@ -806,7 +803,7 @@ pub mod pallet { /// Reset the chilling block for a controller. pub fn reset_chilling(controller: &T::AccountId) { - Ledger::::mutate(&controller, |maybe_ledger| { + Ledger::::mutate(controller, |maybe_ledger| { if let Some(ref mut ledger) = maybe_ledger { ledger.chilling = None } @@ -820,7 +817,7 @@ pub mod pallet { cluster_id: &ClusterId, ) -> Result { let stash = - >::get(&node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; + >::get(node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; let maybe_cdn_in_cluster = CDNs::::get(&stash); let maybe_storage_in_cluster = Storages::::get(&stash); @@ -833,7 +830,7 @@ pub mod pallet { fn node_is_chilling(node_pub_key: &NodePubKey) -> Result { let stash = - >::get(&node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; + >::get(node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; let controller = >::get(&stash).ok_or(StakingVisitorError::NodeStakeIsInBadState)?; diff --git a/pallets/ddc-staking/src/tests.rs b/pallets/ddc-staking/src/tests.rs index 10f325b46..37d971bca 100644 --- a/pallets/ddc-staking/src/tests.rs +++ b/pallets/ddc-staking/src/tests.rs @@ -1,11 +1,9 @@ //! Tests for the module. use super::{mock::*, *}; -use ddc_primitives::{CDNNodePubKey, NodeType}; -use ddc_traits::cluster::{ClusterVisitor, ClusterVisitorError}; -use frame_support::{ - assert_noop, assert_ok, assert_storage_noop, error::BadOrigin, traits::ReservableCurrency, -}; +use ddc_primitives::CDNNodePubKey; + +use frame_support::{assert_noop, assert_ok, traits::ReservableCurrency}; use pallet_balances::Error as BalancesError; pub const BLOCK_TIME: u64 = 1000; @@ -113,7 +111,7 @@ fn staking_should_work() { assert_ok!(DdcStaking::chill(RuntimeOrigin::signed(4))); // Removal is scheduled, stashed value of 4 is still lock. - let chilling = System::block_number() + BlockNumber::from(10u64); + let chilling = System::block_number() + 10u64; // TestClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN) // .unwrap_or(10_u64); assert_eq!( diff --git a/pallets/ddc-staking/src/weights.rs b/pallets/ddc-staking/src/weights.rs index 969385330..efca88632 100644 --- a/pallets/ddc-staking/src/weights.rs +++ b/pallets/ddc-staking/src/weights.rs @@ -46,9 +46,9 @@ impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Nodes (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(55_007_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + Weight::from_ref_time(55_007_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CDNs (r:1 w:0) @@ -57,36 +57,36 @@ impl WeightInfo for SubstrateWeight { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(47_727_000_u64) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(69_750_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(26_112_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(19_892_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) @@ -94,22 +94,22 @@ impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + Weight::from_ref_time(77_450_000_u64) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(38_521_000_u64) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Nodes (r:1 w:1) fn set_node() -> Weight { - Weight::from_ref_time(21_779_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(21_779_000_u64) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -120,9 +120,9 @@ impl WeightInfo for () { // Storage: DdcStaking Nodes (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(55_007_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(4 as u64)) + Weight::from_ref_time(55_007_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CDNs (r:1 w:0) @@ -131,36 +131,36 @@ impl WeightInfo for () { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(RocksDbWeight::get().reads(6 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(47_727_000_u64) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(69_750_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(26_112_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(19_892_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) @@ -168,21 +168,21 @@ impl WeightInfo for () { // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(RocksDbWeight::get().reads(5 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + Weight::from_ref_time(77_450_000_u64) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(38_521_000_u64) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Nodes (r:1 w:1) fn set_node() -> Weight { - Weight::from_ref_time(21_779_000 as u64) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(21_779_000_u64) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 810c26d37..d81288bfa 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -405,7 +405,7 @@ impl pallet_indices::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; + pub const ExistentialDeposit: Balance = DOLLARS; // For weight estimation, we assume that the most locks on an individual account will be 50. // This number may need to be adjusted in the future if this assumption no longer holds true. pub const MaxLocks: u32 = 50; @@ -565,9 +565,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = 1 * DOLLARS; - pub const SignedDepositBase: Balance = 1 * DOLLARS; - pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -722,11 +722,11 @@ impl pallet_bags_list::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const LaunchPeriod: BlockNumber = 24 * 60 * MINUTES; + pub const VotingPeriod: BlockNumber = 24 * 60 * MINUTES; pub const FastTrackVotingPeriod: BlockNumber = 3 * 60 * MINUTES; pub const MinimumDeposit: Balance = 50_000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const EnactmentPeriod: BlockNumber = 24 * 60 * MINUTES; pub const CooloffPeriod: BlockNumber = 7 * 24 * 60 * MINUTES; pub const MaxProposals: u32 = 100; } @@ -804,7 +804,7 @@ parameter_types! { pub const CandidacyBond: Balance = 5_000_000 * DOLLARS; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); - pub const VotingBondFactor: Balance = 1 * DOLLARS; + pub const VotingBondFactor: Balance = DOLLARS; pub const TermDuration: BlockNumber = 182 * DAYS; pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 20; @@ -876,12 +876,12 @@ impl pallet_membership::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 50_000 * DOLLARS; - pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(0); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 50_000 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * DOLLARS; + pub const DataDepositPerByte: Balance = DOLLARS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 16384; pub const MaxApprovals: u32 = 100; @@ -917,7 +917,7 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const BountyDepositBase: Balance = 50_000 * DOLLARS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = 1 * DOLLARS; + pub const CuratorDepositMin: Balance = DOLLARS; pub const CuratorDepositMax: Balance = 100 * DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; @@ -939,7 +939,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyValueMinimum: Balance = DOLLARS; } impl pallet_child_bounties::Config for Runtime { @@ -1192,7 +1192,7 @@ impl pallet_society::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; } impl pallet_vesting::Config for Runtime { diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index be5ab085d..984ffb7bc 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -401,7 +401,7 @@ impl pallet_indices::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; + pub const ExistentialDeposit: Balance = DOLLARS; // For weight estimation, we assume that the most locks on an individual account will be 50. // This number may need to be adjusted in the future if this assumption no longer holds true. pub const MaxLocks: u32 = 50; @@ -562,9 +562,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = 1 * DOLLARS; - pub const SignedDepositBase: Balance = 1 * DOLLARS; - pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -719,11 +719,11 @@ impl pallet_bags_list::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const LaunchPeriod: BlockNumber = 24 * 60 * MINUTES; + pub const VotingPeriod: BlockNumber = 24 * 60 * MINUTES; pub const FastTrackVotingPeriod: BlockNumber = 3 * 60 * MINUTES; pub const MinimumDeposit: Balance = 50_000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const EnactmentPeriod: BlockNumber = 24 * 60 * MINUTES; pub const CooloffPeriod: BlockNumber = 7 * 24 * 60 * MINUTES; pub const MaxProposals: u32 = 100; } @@ -801,7 +801,7 @@ parameter_types! { pub const CandidacyBond: Balance = 5_000_000 * DOLLARS; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); - pub const VotingBondFactor: Balance = 1 * DOLLARS; + pub const VotingBondFactor: Balance = DOLLARS; pub const TermDuration: BlockNumber = 182 * DAYS; pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 20; @@ -873,12 +873,12 @@ impl pallet_membership::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 50_000 * DOLLARS; - pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(0); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 50_000 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * DOLLARS; + pub const DataDepositPerByte: Balance = DOLLARS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 16384; pub const MaxApprovals: u32 = 100; @@ -914,7 +914,7 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const BountyDepositBase: Balance = 50_000 * DOLLARS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = 1 * DOLLARS; + pub const CuratorDepositMin: Balance = DOLLARS; pub const CuratorDepositMax: Balance = 100 * DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; @@ -936,7 +936,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyValueMinimum: Balance = DOLLARS; } impl pallet_child_bounties::Config for Runtime { @@ -1189,7 +1189,7 @@ impl pallet_society::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; } impl pallet_vesting::Config for Runtime { From 6b4b4ff2ed42f978ab5c8bcafe962c8bd5622b5a Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Fri, 10 Nov 2023 11:58:27 +0100 Subject: [PATCH 17/29] chore: using if/else instead of match --- pallets/ddc-staking/src/lib.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 3c00316c0..786962dd8 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -435,10 +435,8 @@ pub mod pallet { let node_pub_key = >::get(&ledger.stash).ok_or(Error::::BadState)?; - match T::NodeVisitor::get_cluster_id(&node_pub_key) { - // If node is chilling within some cluster, the unbonding period should be - // set according to the cluster's settings - Ok(Some(cluster_id)) => match node_pub_key { + if let Ok(Some(cluster_id)) = T::NodeVisitor::get_cluster_id(&node_pub_key) { + match node_pub_key { NodePubKey::CDNPubKey(_) => T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?, @@ -447,11 +445,10 @@ pub mod pallet { NodeType::Storage, ) .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?, - }, + } + } else { // If node is not a member of any cluster, allow immediate unbonding. - // It is possible if node provider hasn't called 'store/serve' yet, or after - // the 'fast_chill' and subsequent 'chill' calls. - _ => T::BlockNumber::from(0u32), + T::BlockNumber::from(0u32) } }; From 9391237bc64467120a0ecb37c6e78df0e3730c7a Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 14:10:50 +0300 Subject: [PATCH 18/29] Refactor new method and remove lifetimes --- pallets/ddc-clusters/src/lib.rs | 2 +- pallets/ddc-nodes/src/cdn_node.rs | 65 ++++++++++++++------------- pallets/ddc-nodes/src/node.rs | 60 +++++++++---------------- pallets/ddc-nodes/src/storage_node.rs | 65 ++++++++++++++------------- primitives/src/lib.rs | 6 +-- 5 files changed, 93 insertions(+), 105 deletions(-) diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index 55d668f69..4c52afd96 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -170,7 +170,7 @@ pub mod pallet { let is_authorized = auth_contract .is_authorized( node.get_provider_id().to_owned(), - node.get_pub_key().to_owned(), + node.get_pub_key(), node.get_type(), ) .map_err(Into::>::into)?; diff --git a/pallets/ddc-nodes/src/cdn_node.rs b/pallets/ddc-nodes/src/cdn_node.rs index 5b3954953..1c8f19de1 100644 --- a/pallets/ddc-nodes/src/cdn_node.rs +++ b/pallets/ddc-nodes/src/cdn_node.rs @@ -1,4 +1,4 @@ -use crate::node::{Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait}; +use crate::node::{NodeError, NodeParams, NodeProps, NodePropsRef, NodeTrait}; use codec::{Decode, Encode}; use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey, NodeType}; use frame_support::{parameter_types, BoundedVec}; @@ -36,15 +36,44 @@ pub struct CDNNodeParams { pub p2p_port: u16, } +impl CDNNode { + pub fn new( + node_pub_key: NodePubKey, + provider_id: T::AccountId, + node_params: NodeParams, + ) -> Result { + match node_pub_key { + NodePubKey::CDNPubKey(pub_key) => match node_params { + NodeParams::CDNParams(node_params) => Ok(CDNNode:: { + provider_id, + pub_key, + cluster_id: None, + props: CDNNodeProps { + host: match node_params.host.try_into() { + Ok(vec) => vec, + Err(_) => return Err(NodeError::CDNHostLenExceedsLimit), + }, + http_port: node_params.http_port, + grpc_port: node_params.grpc_port, + p2p_port: node_params.p2p_port, + }, + }), + _ => Err(NodeError::InvalidCDNNodeParams), + }, + _ => Err(NodeError::InvalidCDNNodePubKey), + } + } +} + impl NodeTrait for CDNNode { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { - NodePubKeyRef::CDNPubKeyRef(&self.pub_key) + fn get_pub_key(&self) -> NodePubKey { + NodePubKey::CDNPubKey(self.pub_key.clone()) } fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } - fn get_props<'a>(&'a self) -> NodePropsRef<'a> { - NodePropsRef::CDNPropsRef(&self.props) + fn get_props(&self) -> NodePropsRef { + NodePropsRef::CDNPropsRef(self.props.clone()) } fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError> { self.props = match props { @@ -77,30 +106,4 @@ impl NodeTrait for CDNNode { fn get_type(&self) -> NodeType { NodeType::CDN } - fn new( - node_pub_key: NodePubKey, - provider_id: T::AccountId, - node_params: NodeParams, - ) -> Result, NodeError> { - match node_pub_key { - NodePubKey::CDNPubKey(pub_key) => match node_params { - NodeParams::CDNParams(node_params) => Ok(Node::CDN(CDNNode:: { - provider_id, - pub_key, - cluster_id: None, - props: CDNNodeProps { - host: match node_params.host.try_into() { - Ok(vec) => vec, - Err(_) => return Err(NodeError::CDNHostLenExceedsLimit), - }, - http_port: node_params.http_port, - grpc_port: node_params.grpc_port, - p2p_port: node_params.p2p_port, - }, - })), - _ => Err(NodeError::InvalidCDNNodeParams), - }, - _ => Err(NodeError::InvalidCDNNodePubKey), - } - } } diff --git a/pallets/ddc-nodes/src/node.rs b/pallets/ddc-nodes/src/node.rs index 3ea06bcf7..fbf962d1f 100644 --- a/pallets/ddc-nodes/src/node.rs +++ b/pallets/ddc-nodes/src/node.rs @@ -7,7 +7,7 @@ use crate::{ ClusterId, }; use codec::{Decode, Encode}; -use ddc_primitives::{CDNNodePubKey, NodePubKey, NodeType, StorageNodePubKey}; +use ddc_primitives::{NodePubKey, NodeType}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; @@ -32,46 +32,39 @@ pub enum NodeProps { } #[derive(Clone, RuntimeDebug, PartialEq)] -pub enum NodePubKeyRef<'a> { - StoragePubKeyRef(&'a StorageNodePubKey), - CDNPubKeyRef(&'a CDNNodePubKey), -} - -impl<'a> NodePubKeyRef<'a> { - pub fn to_owned(&self) -> NodePubKey { - match &self { - NodePubKeyRef::StoragePubKeyRef(pub_key_ref) => - NodePubKey::StoragePubKey((**pub_key_ref).clone()), - NodePubKeyRef::CDNPubKeyRef(pub_key_ref) => - NodePubKey::CDNPubKey((**pub_key_ref).clone()), - } - } -} - -#[derive(Clone, RuntimeDebug, PartialEq)] -pub enum NodePropsRef<'a> { - StoragePropsRef(&'a StorageNodeProps), - CDNPropsRef(&'a CDNNodeProps), +pub enum NodePropsRef { + StoragePropsRef(StorageNodeProps), + CDNPropsRef(CDNNodeProps), } pub trait NodeTrait { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a>; + fn get_pub_key(&self) -> NodePubKey; fn get_provider_id(&self) -> &T::AccountId; - fn get_props<'a>(&'a self) -> NodePropsRef<'a>; + fn get_props(&self) -> NodePropsRef; fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError>; fn set_params(&mut self, props: NodeParams) -> Result<(), NodeError>; fn get_cluster_id(&self) -> &Option; fn set_cluster_id(&mut self, cluster_id: Option); fn get_type(&self) -> NodeType; - fn new( +} + +impl Node { + pub fn new( node_pub_key: NodePubKey, provider_id: T::AccountId, - params: NodeParams, - ) -> Result, NodeError>; + node_params: NodeParams, + ) -> Result { + match node_pub_key { + NodePubKey::StoragePubKey(_) => + StorageNode::new(node_pub_key, provider_id, node_params).map(|n| Node::Storage(n)), + NodePubKey::CDNPubKey(_) => + CDNNode::new(node_pub_key, provider_id, node_params).map(|n| Node::CDN(n)), + } + } } impl NodeTrait for Node { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { + fn get_pub_key(&self) -> NodePubKey { match &self { Node::Storage(node) => node.get_pub_key(), Node::CDN(node) => node.get_pub_key(), @@ -83,7 +76,7 @@ impl NodeTrait for Node { Node::CDN(node) => node.get_provider_id(), } } - fn get_props<'a>(&'a self) -> NodePropsRef<'a> { + fn get_props(&self) -> NodePropsRef { match &self { Node::Storage(node) => node.get_props(), Node::CDN(node) => node.get_props(), @@ -119,17 +112,6 @@ impl NodeTrait for Node { Node::CDN(node) => node.get_type(), } } - fn new( - node_pub_key: NodePubKey, - provider_id: T::AccountId, - node_params: NodeParams, - ) -> Result, NodeError> { - match node_pub_key { - NodePubKey::StoragePubKey(_) => - StorageNode::new(node_pub_key, provider_id, node_params), - NodePubKey::CDNPubKey(_) => CDNNode::new(node_pub_key, provider_id, node_params), - } - } } pub enum NodeError { diff --git a/pallets/ddc-nodes/src/storage_node.rs b/pallets/ddc-nodes/src/storage_node.rs index 578afeb09..83fd2b11f 100644 --- a/pallets/ddc-nodes/src/storage_node.rs +++ b/pallets/ddc-nodes/src/storage_node.rs @@ -1,4 +1,4 @@ -use crate::node::{Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait}; +use crate::node::{NodeError, NodeParams, NodeProps, NodePropsRef, NodeTrait}; use codec::{Decode, Encode}; use ddc_primitives::{ClusterId, NodePubKey, NodeType, StorageNodePubKey}; use frame_support::{parameter_types, BoundedVec}; @@ -36,15 +36,44 @@ pub struct StorageNodeParams { pub p2p_port: u16, } +impl StorageNode { + pub fn new( + node_pub_key: NodePubKey, + provider_id: T::AccountId, + node_params: NodeParams, + ) -> Result { + match node_pub_key { + NodePubKey::StoragePubKey(pub_key) => match node_params { + NodeParams::StorageParams(node_params) => Ok(StorageNode:: { + provider_id, + pub_key, + cluster_id: None, + props: StorageNodeProps { + host: match node_params.host.try_into() { + Ok(vec) => vec, + Err(_) => return Err(NodeError::StorageHostLenExceedsLimit), + }, + http_port: node_params.http_port, + grpc_port: node_params.grpc_port, + p2p_port: node_params.p2p_port, + }, + }), + _ => Err(NodeError::InvalidStorageNodeParams), + }, + _ => Err(NodeError::InvalidStorageNodePubKey), + } + } +} + impl NodeTrait for StorageNode { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { - NodePubKeyRef::StoragePubKeyRef(&self.pub_key) + fn get_pub_key(&self) -> NodePubKey { + NodePubKey::StoragePubKey(self.pub_key.clone()) } fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } - fn get_props<'a>(&'a self) -> NodePropsRef<'a> { - NodePropsRef::StoragePropsRef(&self.props) + fn get_props(&self) -> NodePropsRef { + NodePropsRef::StoragePropsRef(self.props.clone()) } fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError> { self.props = match props { @@ -77,30 +106,4 @@ impl NodeTrait for StorageNode { fn get_type(&self) -> NodeType { NodeType::Storage } - fn new( - node_pub_key: NodePubKey, - provider_id: T::AccountId, - node_params: NodeParams, - ) -> Result, NodeError> { - match node_pub_key { - NodePubKey::StoragePubKey(pub_key) => match node_params { - NodeParams::StorageParams(node_params) => Ok(Node::Storage(StorageNode:: { - provider_id, - pub_key, - cluster_id: None, - props: StorageNodeProps { - host: match node_params.host.try_into() { - Ok(vec) => vec, - Err(_) => return Err(NodeError::StorageHostLenExceedsLimit), - }, - http_port: node_params.http_port, - grpc_port: node_params.grpc_port, - p2p_port: node_params.p2p_port, - }, - })), - _ => Err(NodeError::InvalidStorageNodeParams), - }, - _ => Err(NodeError::InvalidStorageNodePubKey), - } - } } diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index a3abee7c4..0564f3c16 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -11,6 +11,9 @@ use sp_runtime::{AccountId32, RuntimeDebug}; pub type ClusterId = H160; pub type BucketId = u64; +pub type StorageNodePubKey = AccountId32; +pub type CDNNodePubKey = AccountId32; + #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] pub enum NodePubKey { @@ -18,9 +21,6 @@ pub enum NodePubKey { CDNPubKey(CDNNodePubKey), } -pub type StorageNodePubKey = AccountId32; -pub type CDNNodePubKey = AccountId32; - #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] pub enum NodeType { Storage = 1, From 1f6a317b5e97ec105dc6817205dc8a1f0b991d77 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 14:11:02 +0300 Subject: [PATCH 19/29] Resolve clippy warnings --- node/service/src/lib.rs | 2 ++ pallets/ddc-staking/src/benchmarking.rs | 4 ++-- pallets/ddc-staking/src/lib.rs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 68e5386a6..ee62d08d1 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -103,6 +103,7 @@ where Ok(Basics { task_manager, client, backend, keystore_container, telemetry }) } +#[allow(clippy::type_complexity)] fn new_partial( config: &Configuration, Basics { task_manager, backend, client, keystore_container, telemetry }: Basics< @@ -628,6 +629,7 @@ macro_rules! chain_ops { }}; } +#[allow(clippy::type_complexity)] pub fn new_chain_ops( config: &Configuration, ) -> Result< diff --git a/pallets/ddc-staking/src/benchmarking.rs b/pallets/ddc-staking/src/benchmarking.rs index d682ec9c0..6353e4a5d 100644 --- a/pallets/ddc-staking/src/benchmarking.rs +++ b/pallets/ddc-staking/src/benchmarking.rs @@ -5,7 +5,7 @@ use crate::Pallet as DdcStaking; use ddc_primitives::{CDNNodePubKey, NodeType}; use testing_utils::*; -use frame_support::traits::{Currency, Get}; +use frame_support::traits::Currency; use sp_runtime::traits::StaticLookup; use sp_std::prelude::*; @@ -91,7 +91,7 @@ benchmarks! { assert!(CDNs::::contains_key(&cdn_stash)); frame_system::Pallet::::set_block_number(T::BlockNumber::from(1u32)); DdcStaking::::chill(RawOrigin::Signed(cdn_controller.clone()).into())?; - frame_system::Pallet::::set_block_number(T::BlockNumber::from(1u32) + T::ClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN).unwrap_or(T::BlockNumber::from(10u32))); + frame_system::Pallet::::set_block_number(T::BlockNumber::from(1u32) + T::ClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN).unwrap_or_else(|_| T::BlockNumber::from(10u32))); whitelist_account!(cdn_controller); }: _(RawOrigin::Signed(cdn_controller)) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 1eb4176a8..9c270570c 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -189,7 +189,9 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { + #[allow(clippy::type_complexity)] pub cdns: Vec<(T::AccountId, T::AccountId, NodePubKey, BalanceOf, ClusterId)>, + #[allow(clippy::type_complexity)] pub storages: Vec<(T::AccountId, T::AccountId, NodePubKey, BalanceOf, ClusterId)>, } @@ -693,7 +695,7 @@ pub mod pallet { ensure!(stash == node_stash, Error::::NotNodeController); let cluster_id = >::get(&stash) - .or(>::get(&stash)) + .or_else(|| >::get(&stash)) .ok_or(Error::::NodeHasNoStake)?; let is_cluster_node = T::ClusterVisitor::cluster_has_node(&cluster_id, &node_pub_key); From 8107abc1125ed2965426e6059f5c59ee3cfdeac9 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 14:44:49 +0300 Subject: [PATCH 20/29] Check for unused dependencies --- .github/workflows/check.yaml | 3 + Cargo.lock | 73 ------------------- Cargo.toml | 1 - node/client/Cargo.toml | 3 - node/service/Cargo.toml | 8 +- pallets/chainbridge/Cargo.toml | 8 -- pallets/ddc-clusters/Cargo.toml | 9 --- pallets/ddc-customers/Cargo.toml | 4 - .../ddc-metrics-offchain-worker/Cargo.toml | 4 - pallets/ddc-nodes/Cargo.toml | 9 --- pallets/ddc-staking/Cargo.toml | 3 - pallets/ddc/Cargo.toml | 3 + pallets/erc20/Cargo.toml | 9 +-- pallets/erc721/Cargo.toml | 6 -- runtime/cere-dev/Cargo.toml | 2 - runtime/cere-dev/constants/Cargo.toml | 3 +- runtime/cere/Cargo.toml | 3 +- runtime/cere/constants/Cargo.toml | 3 +- traits/Cargo.toml | 4 - 19 files changed, 13 insertions(+), 145 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 1ecb04c4b..9bdc50136 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -32,6 +32,9 @@ jobs: run: | cargo fmt -- --check + - name: Unused dependencies + uses: bnjbvr/cargo-machete@main + - name: Rust Cache uses: Swatinem/rust-cache@v2 diff --git a/Cargo.lock b/Cargo.lock index 6059b927b..861333611 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -759,7 +759,6 @@ version = "4.8.1" dependencies = [ "cere-cli", "sc-cli", - "ss58-registry", "substrate-build-script-utils", ] @@ -785,7 +784,6 @@ dependencies = [ "cere-dev-runtime", "cere-runtime", "frame-benchmarking", - "frame-benchmarking-cli", "frame-system", "frame-system-rpc-runtime-api", "node-primitives", @@ -801,10 +799,8 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-core", "sp-finality-grandpa", "sp-inherents", - "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", @@ -880,7 +876,6 @@ dependencies = [ "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "pallet-transaction-storage", "pallet-treasury", "pallet-utility", "pallet-vesting", @@ -909,7 +904,6 @@ name = "cere-dev-runtime-constants" version = "4.8.1" dependencies = [ "node-primitives", - "sp-runtime", ] [[package]] @@ -1005,7 +999,6 @@ dependencies = [ "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "pallet-transaction-storage", "pallet-treasury", "pallet-utility", "pallet-vesting", @@ -1044,7 +1037,6 @@ name = "cere-runtime-constants" version = "4.8.1" dependencies = [ "node-primitives", - "sp-runtime", ] [[package]] @@ -1056,17 +1048,14 @@ dependencies = [ "cere-dev-runtime-constants", "cere-rpc", "cere-runtime", - "cere-runtime-constants", "futures", "jsonrpsee", "node-primitives", "pallet-im-online", - "parity-scale-codec", "rand 0.8.5", "sc-authority-discovery", "sc-basic-authorship", "sc-chain-spec", - "sc-cli", "sc-client-api", "sc-consensus", "sc-consensus-babe", @@ -1087,7 +1076,6 @@ dependencies = [ "sp-authority-discovery", "sp-authorship", "sp-blockchain", - "sp-consensus", "sp-consensus-babe", "sp-core", "sp-finality-grandpa", @@ -1651,11 +1639,7 @@ name = "ddc-traits" version = "0.1.0" dependencies = [ "ddc-primitives", - "frame-support", "frame-system", - "sp-core", - "sp-staking", - "sp-std", ] [[package]] @@ -4045,24 +4029,6 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" -[[package]] -name = "lite-json" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0e787ffe1153141a0f6f6d759fdf1cc34b1226e088444523812fd412a5cca2" -dependencies = [ - "lite-parser", -] - -[[package]] -name = "lite-parser" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d5f9dc37c52d889a21fd701983d02bb6a84f852c5140a6c80ef4557f7dc29e" -dependencies = [ - "paste", -] - [[package]] name = "lock_api" version = "0.4.11" @@ -4778,16 +4744,13 @@ dependencies = [ name = "pallet-chainbridge" version = "4.8.1" dependencies = [ - "frame-benchmarking", "frame-support", "frame-system", - "lite-json", "pallet-balances", "parity-scale-codec", "scale-info", "sp-core", "sp-io", - "sp-keystore", "sp-runtime", "sp-std", ] @@ -4917,18 +4880,14 @@ version = "4.8.1" dependencies = [ "ddc-primitives", "ddc-traits", - "frame-benchmarking", "frame-support", "frame-system", - "log", "pallet-contracts", "pallet-ddc-nodes", "parity-scale-codec", "scale-info", "sp-core", - "sp-io", "sp-runtime", - "sp-staking", "sp-std", "sp-tracing", "substrate-test-utils", @@ -4945,9 +4904,7 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "sp-io", "sp-runtime", - "sp-staking", "sp-std", "substrate-test-utils", ] @@ -4961,7 +4918,6 @@ dependencies = [ "frame-system", "hex", "hex-literal", - "lite-json", "pallet-balances", "pallet-contracts", "pallet-randomness-collective-flip", @@ -4969,7 +4925,6 @@ dependencies = [ "parity-scale-codec", "pretty_assertions", "scale-info", - "serde", "serde_json 1.0.44", "sp-core", "sp-io", @@ -4983,16 +4938,12 @@ name = "pallet-ddc-nodes" version = "4.8.1" dependencies = [ "ddc-primitives", - "frame-benchmarking", "frame-support", "frame-system", - "log", "parity-scale-codec", "scale-info", "sp-core", - "sp-io", "sp-runtime", - "sp-staking", "sp-std", "sp-tracing", "substrate-test-utils", @@ -5007,7 +4958,6 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "log", "pallet-balances", "pallet-timestamp", "parity-scale-codec", @@ -5015,7 +4965,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-staking", "sp-std", "sp-tracing", "substrate-test-utils", @@ -5096,7 +5045,6 @@ dependencies = [ name = "pallet-erc20" version = "4.8.1" dependencies = [ - "frame-benchmarking", "frame-support", "frame-system", "pallet-balances", @@ -5104,7 +5052,6 @@ dependencies = [ "pallet-erc721", "parity-scale-codec", "scale-info", - "serde", "sp-arithmetic", "sp-core", "sp-io", @@ -5116,14 +5063,12 @@ dependencies = [ name = "pallet-erc721" version = "4.8.1" dependencies = [ - "frame-benchmarking", "frame-support", "frame-system", "pallet-balances", "pallet-chainbridge", "parity-scale-codec", "scale-info", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5584,24 +5529,6 @@ dependencies = [ "sp-runtime", ] -[[package]] -name = "pallet-transaction-storage" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "frame-support", - "frame-system", - "log", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-transaction-storage-proof", -] - [[package]] name = "pallet-treasury" version = "4.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index 3d7599231..27cff6711 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ build = "build.rs" [dependencies] cere-cli = { path = "cli", features = [ "cere-dev-native" ] } sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -ss58-registry = { version = "1.38.0", default-features = false } [build-dependencies] substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/node/client/Cargo.toml b/node/client/Cargo.toml index dbafa5fa8..d83bb5b03 100644 --- a/node/client/Cargo.toml +++ b/node/client/Cargo.toml @@ -8,7 +8,6 @@ sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/subs sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -29,8 +28,6 @@ sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/su sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } # Local cere-runtime = { path = "../../runtime/cere", optional = true } diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index d444e3244..c6c8abdfb 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -4,13 +4,10 @@ version = "4.8.1" edition = "2021" [dependencies] -codec = { package = "parity-scale-codec", version = "3.1.5" } serde = { version = "1.0.136", features = ["derive"] } rand = "0.8" futures = "0.3.21" jsonrpsee = { version = "0.15.1", features = ["server"] } - -sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } @@ -18,7 +15,6 @@ sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/sub sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -47,8 +43,6 @@ sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/su # Local cere-client = { path = "../client", default-features = false, optional = true } cere-rpc = { path = "../../rpc" } - -cere-runtime-constants = { path = "../../runtime/cere/constants", optional = true } cere-dev-runtime-constants = { path = "../../runtime/cere-dev/constants", optional = true } cere-runtime = { path = "../../runtime/cere", optional = true } @@ -57,7 +51,7 @@ cere-dev-runtime = { path = "../../runtime/cere-dev", optional = true } [features] default = ["cere-native"] -cere-native = [ "cere-runtime", "cere-runtime-constants", "cere-client/cere" ] +cere-native = [ "cere-runtime", "cere-client/cere" ] cere-dev-native = [ "cere-dev-runtime", "cere-dev-runtime-constants", "cere-client/cere-dev" ] runtime-benchmarks = [ diff --git a/pallets/chainbridge/Cargo.toml b/pallets/chainbridge/Cargo.toml index de714f861..455a0aa8a 100644 --- a/pallets/chainbridge/Cargo.toml +++ b/pallets/chainbridge/Cargo.toml @@ -20,26 +20,18 @@ sp-core = { version = "6.0.0", default-features = false, git = "https://github.c sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -lite-json = { version = "0.2.0", default-features = false } -sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } - [features] default = ["std"] std = [ "codec/std", "sp-runtime/std", - "frame-benchmarking/std", "frame-support/std", "frame-system/std", "pallet-balances/std", "sp-io/std", "sp-std/std", "sp-core/std", - "lite-json/std", - "sp-keystore", ] -runtime-benchmarks = ["frame-benchmarking"] diff --git a/pallets/ddc-clusters/Cargo.toml b/pallets/ddc-clusters/Cargo.toml index 62f59dd67..0ef556a69 100644 --- a/pallets/ddc-clusters/Cargo.toml +++ b/pallets/ddc-clusters/Cargo.toml @@ -7,16 +7,11 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } @@ -32,14 +27,10 @@ std = [ "ddc-primitives/std", "frame-support/std", "frame-system/std", - "frame-benchmarking/std", "pallet-contracts/std", "pallet-ddc-nodes/std", "scale-info/std", "sp-core/std", - "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", ] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ddc-customers/Cargo.toml b/pallets/ddc-customers/Cargo.toml index 48cdf287f..8d60ba44f 100644 --- a/pallets/ddc-customers/Cargo.toml +++ b/pallets/ddc-customers/Cargo.toml @@ -10,9 +10,7 @@ ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } log = { version = "0.4.17", default-features = false } @@ -27,8 +25,6 @@ std = [ "frame-support/std", "frame-system/std", "scale-info/std", - "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", ] diff --git a/pallets/ddc-metrics-offchain-worker/Cargo.toml b/pallets/ddc-metrics-offchain-worker/Cargo.toml index 74747a397..3ab61de26 100644 --- a/pallets/ddc-metrics-offchain-worker/Cargo.toml +++ b/pallets/ddc-metrics-offchain-worker/Cargo.toml @@ -16,14 +16,12 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["full"] } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -serde = { version = "1.0.136", optional = true } sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -lite-json = { version = "0.2.0", default-features = false } alt_serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } # pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -38,8 +36,6 @@ std = [ "sp-keystore", "frame-support/std", "frame-system/std", - "serde", - "lite-json/std", "sp-core/std", "sp-io/std", "sp-runtime/std", diff --git a/pallets/ddc-nodes/Cargo.toml b/pallets/ddc-nodes/Cargo.toml index 607ab47fa..54bc35070 100644 --- a/pallets/ddc-nodes/Cargo.toml +++ b/pallets/ddc-nodes/Cargo.toml @@ -6,16 +6,11 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } [dev-dependencies] sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -29,12 +24,8 @@ std = [ "ddc-primitives/std", "frame-support/std", "frame-system/std", - "frame-benchmarking/std", "scale-info/std", - "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", "sp-core/std", ] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ddc-staking/Cargo.toml b/pallets/ddc-staking/Cargo.toml index 9fbcc154e..0f9c57433 100644 --- a/pallets/ddc-staking/Cargo.toml +++ b/pallets/ddc-staking/Cargo.toml @@ -10,11 +10,9 @@ ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [dev-dependencies] @@ -35,7 +33,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", ] runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ddc/Cargo.toml b/pallets/ddc/Cargo.toml index 9c89014d1..867c36f52 100644 --- a/pallets/ddc/Cargo.toml +++ b/pallets/ddc/Cargo.toml @@ -35,3 +35,6 @@ std = [ 'frame-support/std', 'frame-system/std', ] + +[package.metadata.cargo-machete] +ignored = ["scale-info", "codec"] diff --git a/pallets/erc20/Cargo.toml b/pallets/erc20/Cargo.toml index 6cce2c8d4..3bf27fea6 100644 --- a/pallets/erc20/Cargo.toml +++ b/pallets/erc20/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -27,15 +26,11 @@ pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../c pallet-erc721 = { version = "4.2.0", default-features = false, path = "../erc721" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } - [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", - "frame-benchmarking/std", "frame-support/std", "frame-system/std", "pallet-balances/std", @@ -46,4 +41,6 @@ std = [ "pallet-chainbridge/std", "pallet-erc721/std" ] -runtime-benchmarks = ["frame-benchmarking"] + +[package.metadata.cargo-machete] +ignored = ["scale-info"] diff --git a/pallets/erc721/Cargo.toml b/pallets/erc721/Cargo.toml index 3f586f103..e6e12c37f 100644 --- a/pallets/erc721/Cargo.toml +++ b/pallets/erc721/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -25,15 +24,11 @@ sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.gi pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } - [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", - "frame-benchmarking/std", "frame-support/std", "frame-system/std", "pallet-balances/std", @@ -42,4 +37,3 @@ std = [ "sp-core/std", "pallet-chainbridge/std" ] -runtime-benchmarks = ["frame-benchmarking"] diff --git a/runtime/cere-dev/Cargo.toml b/runtime/cere-dev/Cargo.toml index f5ba45aba..e78c7dd17 100644 --- a/runtime/cere-dev/Cargo.toml +++ b/runtime/cere-dev/Cargo.toml @@ -92,7 +92,6 @@ pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "http pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } cere-runtime-common = { path = "../common", default-features = false } cere-dev-runtime-constants = { path = "./constants", default-features = false } @@ -197,7 +196,6 @@ runtime-benchmarks = [ "pallet-bags-list/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-bounties/runtime-benchmarks", - "pallet-chainbridge/runtime-benchmarks", "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-contracts/runtime-benchmarks", diff --git a/runtime/cere-dev/constants/Cargo.toml b/runtime/cere-dev/constants/Cargo.toml index 5fdb89737..201630962 100644 --- a/runtime/cere-dev/constants/Cargo.toml +++ b/runtime/cere-dev/constants/Cargo.toml @@ -6,10 +6,9 @@ edition = "2021" [dependencies] node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "sp-runtime/std" + "node-primitives/std" ] diff --git a/runtime/cere/Cargo.toml b/runtime/cere/Cargo.toml index 59a2668cd..698fa079b 100644 --- a/runtime/cere/Cargo.toml +++ b/runtime/cere/Cargo.toml @@ -92,7 +92,6 @@ pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "http pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } cere-runtime-common = { path = "../common", default-features = false } cere-runtime-constants = { path = "./constants", default-features = false } @@ -189,7 +188,6 @@ runtime-benchmarks = [ "pallet-bags-list/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-bounties/runtime-benchmarks", - "pallet-chainbridge/runtime-benchmarks", "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-contracts/runtime-benchmarks", @@ -260,3 +258,4 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", ] + diff --git a/runtime/cere/constants/Cargo.toml b/runtime/cere/constants/Cargo.toml index 2188486ef..629d01bcb 100644 --- a/runtime/cere/constants/Cargo.toml +++ b/runtime/cere/constants/Cargo.toml @@ -6,10 +6,9 @@ edition = "2021" [dependencies] node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "sp-runtime/std" + "node-primitives/std" ] diff --git a/traits/Cargo.toml b/traits/Cargo.toml index b224e2d28..202996ef0 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -4,9 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } ddc-primitives = { version = "0.1.0", default-features = false, path = "../primitives" } From 6e9da2e5533c420689dbfbe4486328d52c487a3a Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 14:56:10 +0300 Subject: [PATCH 21/29] Cargo machete does not support --locked install yet --- .github/workflows/check.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 9bdc50136..1ecb04c4b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -32,9 +32,6 @@ jobs: run: | cargo fmt -- --check - - name: Unused dependencies - uses: bnjbvr/cargo-machete@main - - name: Rust Cache uses: Swatinem/rust-cache@v2 From 051fe25e5c565586e6465ef054feabf278094e40 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 15:01:20 +0300 Subject: [PATCH 22/29] Fix clippy warning --- pallets/ddc-staking/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 93a23f324..587f2d6c5 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -441,12 +441,12 @@ pub mod pallet { match node_pub_key { NodePubKey::CDNPubKey(_) => T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?, + .map_err(|e| Into::>::into(e))?, NodePubKey::StoragePubKey(_) => T::ClusterVisitor::get_unbonding_delay( &cluster_id, NodeType::Storage, ) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?, + .map_err(|e| Into::>::into(e))?, } } else { // If node is not a member of any cluster, allow immediate unbonding. From bbb08680a0116242fd0652f058b4019e30caf633 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 15:10:51 +0300 Subject: [PATCH 23/29] Resolve redundancy --- pallets/ddc-staking/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 587f2d6c5..9c8469785 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -441,12 +441,12 @@ pub mod pallet { match node_pub_key { NodePubKey::CDNPubKey(_) => T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(e))?, + .map_err(Into::>::into)?, NodePubKey::StoragePubKey(_) => T::ClusterVisitor::get_unbonding_delay( &cluster_id, NodeType::Storage, ) - .map_err(|e| Into::>::into(e))?, + .map_err(Into::>::into)?, } } else { // If node is not a member of any cluster, allow immediate unbonding. From a52c241ea4812d291792c2767c50a8409ceb8255 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 16:01:12 +0300 Subject: [PATCH 24/29] Increase call_size for tests --- runtime/cere/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index 984ffb7bc..6e68d7106 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -1844,7 +1844,7 @@ mod tests { fn call_size() { let size = core::mem::size_of::(); assert!( - size <= 208, + size <= 256, "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the size of RuntimeCall. If the limit is too strong, maybe consider increase the limit to 300.", From d5d6a89539a939aff8607e32a33e4959984743a2 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Fri, 10 Nov 2023 15:03:23 +0100 Subject: [PATCH 25/29] chore: unused node related type removed --- pallets/ddc-nodes/src/cdn_node.rs | 6 +++--- pallets/ddc-nodes/src/node.rs | 10 ++-------- pallets/ddc-nodes/src/storage_node.rs | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/pallets/ddc-nodes/src/cdn_node.rs b/pallets/ddc-nodes/src/cdn_node.rs index 1c8f19de1..eafe6cd27 100644 --- a/pallets/ddc-nodes/src/cdn_node.rs +++ b/pallets/ddc-nodes/src/cdn_node.rs @@ -1,4 +1,4 @@ -use crate::node::{NodeError, NodeParams, NodeProps, NodePropsRef, NodeTrait}; +use crate::node::{NodeError, NodeParams, NodeProps, NodeTrait}; use codec::{Decode, Encode}; use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey, NodeType}; use frame_support::{parameter_types, BoundedVec}; @@ -72,8 +72,8 @@ impl NodeTrait for CDNNode { fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } - fn get_props(&self) -> NodePropsRef { - NodePropsRef::CDNPropsRef(self.props.clone()) + fn get_props(&self) -> NodeProps { + NodeProps::CDNProps(self.props.clone()) } fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError> { self.props = match props { diff --git a/pallets/ddc-nodes/src/node.rs b/pallets/ddc-nodes/src/node.rs index fbf962d1f..042d13be3 100644 --- a/pallets/ddc-nodes/src/node.rs +++ b/pallets/ddc-nodes/src/node.rs @@ -31,16 +31,10 @@ pub enum NodeProps { CDNProps(CDNNodeProps), } -#[derive(Clone, RuntimeDebug, PartialEq)] -pub enum NodePropsRef { - StoragePropsRef(StorageNodeProps), - CDNPropsRef(CDNNodeProps), -} - pub trait NodeTrait { fn get_pub_key(&self) -> NodePubKey; fn get_provider_id(&self) -> &T::AccountId; - fn get_props(&self) -> NodePropsRef; + fn get_props(&self) -> NodeProps; fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError>; fn set_params(&mut self, props: NodeParams) -> Result<(), NodeError>; fn get_cluster_id(&self) -> &Option; @@ -76,7 +70,7 @@ impl NodeTrait for Node { Node::CDN(node) => node.get_provider_id(), } } - fn get_props(&self) -> NodePropsRef { + fn get_props(&self) -> NodeProps { match &self { Node::Storage(node) => node.get_props(), Node::CDN(node) => node.get_props(), diff --git a/pallets/ddc-nodes/src/storage_node.rs b/pallets/ddc-nodes/src/storage_node.rs index 83fd2b11f..902739771 100644 --- a/pallets/ddc-nodes/src/storage_node.rs +++ b/pallets/ddc-nodes/src/storage_node.rs @@ -1,4 +1,4 @@ -use crate::node::{NodeError, NodeParams, NodeProps, NodePropsRef, NodeTrait}; +use crate::node::{NodeError, NodeParams, NodeProps, NodeTrait}; use codec::{Decode, Encode}; use ddc_primitives::{ClusterId, NodePubKey, NodeType, StorageNodePubKey}; use frame_support::{parameter_types, BoundedVec}; @@ -72,8 +72,8 @@ impl NodeTrait for StorageNode { fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } - fn get_props(&self) -> NodePropsRef { - NodePropsRef::StoragePropsRef(self.props.clone()) + fn get_props(&self) -> NodeProps { + NodeProps::StorageProps(self.props.clone()) } fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError> { self.props = match props { From 918474e2e27399fa5d75dbb7fed760474148be36 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Fri, 10 Nov 2023 17:56:34 +0300 Subject: [PATCH 26/29] Update both runtimes --- runtime/cere-dev/src/lib.rs | 4 ++-- runtime/cere/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 518b398dc..fb260b4ed 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -1898,8 +1898,8 @@ mod tests { fn call_size() { let size = core::mem::size_of::(); assert!( - size <= 208, - "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the + size <= 256, + "size of RuntimeCall {} is more than 256 bytes: some calls have too big arguments, use Box to reduce the size of RuntimeCall. If the limit is too strong, maybe consider increase the limit to 300.", size, diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index 6e68d7106..f7eef4df6 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -1845,7 +1845,7 @@ mod tests { let size = core::mem::size_of::(); assert!( size <= 256, - "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the + "size of RuntimeCall {} is more than 256 bytes: some calls have too big arguments, use Box to reduce the size of RuntimeCall. If the limit is too strong, maybe consider increase the limit to 300.", size, From 90e163ea070815983d4d0983accf715c2d5fa4a9 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Sun, 12 Nov 2023 14:05:09 +0300 Subject: [PATCH 27/29] dprint fmt --- .cargo/config.toml | 32 +- Cargo.toml | 38 +- cli/Cargo.toml | 18 +- dprint.json | 11 + node/client/Cargo.toml | 28 +- node/service/Cargo.toml | 69 ++-- pallets/chainbridge/Cargo.toml | 24 +- pallets/ddc-clusters/Cargo.toml | 4 +- pallets/ddc-customers/Cargo.toml | 2 +- .../ddc-metrics-offchain-worker/Cargo.toml | 42 +- pallets/ddc/Cargo.toml | 28 +- pallets/erc20/Cargo.toml | 36 +- pallets/erc721/Cargo.toml | 30 +- primitives/Cargo.toml | 12 +- rpc/Cargo.toml | 28 +- runtime/cere-dev/Cargo.toml | 374 +++++++++--------- runtime/cere-dev/constants/Cargo.toml | 2 +- runtime/cere/Cargo.toml | 357 +++++++++-------- runtime/cere/constants/Cargo.toml | 2 +- runtime/common/Cargo.toml | 4 +- rust-toolchain.toml | 4 +- rustfmt.toml | 10 +- traits/Cargo.toml | 2 +- .../0000-block-building/block-building.toml | 8 +- .../0001-ddc-validation/ddc-validation.toml | 26 +- 25 files changed, 596 insertions(+), 595 deletions(-) create mode 100644 dprint.json diff --git a/.cargo/config.toml b/.cargo/config.toml index fc82ca587..b283a2801 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -11,21 +11,21 @@ rustflags = [ "-Aclippy::if-same-then-else", "-Aclippy::clone-double-ref", "-Dclippy::complexity", - "-Aclippy::zero-prefixed-literal", # 00_1000_000 - "-Aclippy::type_complexity", # raison d'etre - "-Aclippy::nonminimal-bool", # maybe - "-Aclippy::borrowed-box", # Reasonable to fix this one - "-Aclippy::too-many-arguments", # (Turning this on would lead to) - "-Aclippy::unnecessary_cast", # Types may change - "-Aclippy::identity-op", # One case where we do 0 + - "-Aclippy::useless_conversion", # Types may change - "-Aclippy::unit_arg", # styalistic. - "-Aclippy::option-map-unit-fn", # styalistic - "-Aclippy::bind_instead_of_map", # styalistic - "-Aclippy::erasing_op", # E.g. 0 * DOLLARS - "-Aclippy::eq_op", # In tests we test equality. + "-Aclippy::zero-prefixed-literal", # 00_1000_000 + "-Aclippy::type_complexity", # raison d'etre + "-Aclippy::nonminimal-bool", # maybe + "-Aclippy::borrowed-box", # Reasonable to fix this one + "-Aclippy::too-many-arguments", # (Turning this on would lead to) + "-Aclippy::unnecessary_cast", # Types may change + "-Aclippy::identity-op", # One case where we do 0 + + "-Aclippy::useless_conversion", # Types may change + "-Aclippy::unit_arg", # styalistic. + "-Aclippy::option-map-unit-fn", # styalistic + "-Aclippy::bind_instead_of_map", # styalistic + "-Aclippy::erasing_op", # E.g. 0 * DOLLARS + "-Aclippy::eq_op", # In tests we test equality. "-Aclippy::while_immutable_condition", # false positives - "-Aclippy::needless_option_as_deref", # false positives - "-Aclippy::derivable_impls", # false positives - "-Aclippy::stable_sort_primitive", # prefer stable sort + "-Aclippy::needless_option_as_deref", # false positives + "-Aclippy::derivable_impls", # false positives + "-Aclippy::stable_sort_primitive", # prefer stable sort ] diff --git a/Cargo.toml b/Cargo.toml index 27cff6711..a9da35ba1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,13 +4,13 @@ path = "src/main.rs" [package] name = "cere" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" version = "4.8.1" -edition = "2021" build = "build.rs" +edition = "2021" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -cere-cli = { path = "cli", features = [ "cere-dev-native" ] } +cere-cli = { path = "cli", features = ["cere-dev-native"] } sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [build-dependencies] @@ -18,22 +18,22 @@ substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/pa [workspace] members = [ - "cli", - "node/client", - "node/service", - "rpc", - "runtime/cere", - "runtime/cere-dev", - "pallets/chainbridge", - "pallets/ddc", - "pallets/ddc-staking", - "pallets/erc721", - "pallets/erc20", - "pallets/ddc-metrics-offchain-worker", - "pallets/ddc-customers", - "pallets/ddc-nodes", - "pallets/ddc-clusters", - "primitives", + "cli", + "node/client", + "node/service", + "rpc", + "runtime/cere", + "runtime/cere-dev", + "pallets/chainbridge", + "pallets/ddc", + "pallets/ddc-staking", + "pallets/erc721", + "pallets/erc20", + "pallets/ddc-metrics-offchain-worker", + "pallets/ddc-customers", + "pallets/ddc-nodes", + "pallets/ddc-clusters", + "primitives", ] [profile.release] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 77f4d290d..648c6e2fa 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -13,15 +13,15 @@ crate-type = ["cdylib", "rlib"] [dependencies] clap = { version = "3.1", features = ["derive"], optional = true } +frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -try-runtime-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.30" } +try-runtime-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } url = "2.4.1" # Local -cere-service = { path = "../node/service", default-features = false, optional = true } cere-client = { path = "../node/client", optional = true } +cere-service = { path = "../node/service", default-features = false, optional = true } [build-dependencies] substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -29,12 +29,12 @@ substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/pa [features] default = ["cli", "cere-native"] cli = [ - "clap", - "sc-cli", - "sc-service", - "frame-benchmarking-cli", - "try-runtime-cli", - "cere-client", + "clap", + "sc-cli", + "sc-service", + "frame-benchmarking-cli", + "try-runtime-cli", + "cere-client", ] runtime-benchmarks = ["cere-service/runtime-benchmarks"] try-runtime = ["cere-service/try-runtime"] diff --git a/dprint.json b/dprint.json new file mode 100644 index 000000000..82c59d3ee --- /dev/null +++ b/dprint.json @@ -0,0 +1,11 @@ +{ + "includes": [ + "**/*.{toml}" + ], + "excludes": [ + "**/target" + ], + "plugins": [ + "https://plugins.dprint.dev/toml-0.5.3.wasm" + ] + } \ No newline at end of file diff --git a/node/client/Cargo.toml b/node/client/Cargo.toml index d83bb5b03..e310ce7d1 100644 --- a/node/client/Cargo.toml +++ b/node/client/Cargo.toml @@ -4,34 +4,34 @@ version = "4.8.1" edition = "2021" [dependencies] -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-offchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-offchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } # Local -cere-runtime = { path = "../../runtime/cere", optional = true } cere-dev-runtime = { path = "../../runtime/cere-dev", optional = true } +cere-runtime = { path = "../../runtime/cere", optional = true } [features] default = ["cere"] diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index c6c8abdfb..dbde60843 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -4,63 +4,62 @@ version = "4.8.1" edition = "2021" [dependencies] -serde = { version = "1.0.136", features = ["derive"] } -rand = "0.8" futures = "0.3.21" jsonrpsee = { version = "0.15.1", features = ["server"] } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +rand = "0.8" +sc-authority-discovery = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-consensus-uncles = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-authority-discovery = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } +sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-network = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authorship = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } +sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +serde = { version = "1.0.136", features = ["derive"] } sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-trie = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-authorship = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-trie = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } # Local cere-client = { path = "../client", default-features = false, optional = true } -cere-rpc = { path = "../../rpc" } cere-dev-runtime-constants = { path = "../../runtime/cere-dev/constants", optional = true } +cere-rpc = { path = "../../rpc" } -cere-runtime = { path = "../../runtime/cere", optional = true } cere-dev-runtime = { path = "../../runtime/cere-dev", optional = true } - +cere-runtime = { path = "../../runtime/cere", optional = true } [features] default = ["cere-native"] -cere-native = [ "cere-runtime", "cere-client/cere" ] -cere-dev-native = [ "cere-dev-runtime", "cere-dev-runtime-constants", "cere-client/cere-dev" ] +cere-native = ["cere-runtime", "cere-client/cere"] +cere-dev-native = ["cere-dev-runtime", "cere-dev-runtime-constants", "cere-client/cere-dev"] runtime-benchmarks = [ - "cere-runtime/runtime-benchmarks", - "cere-dev-runtime/runtime-benchmarks", - "sc-service/runtime-benchmarks", + "cere-runtime/runtime-benchmarks", + "cere-dev-runtime/runtime-benchmarks", + "sc-service/runtime-benchmarks", ] try-runtime = [ - "cere-runtime/try-runtime", - "cere-dev-runtime/try-runtime", + "cere-runtime/try-runtime", + "cere-dev-runtime/try-runtime", ] diff --git a/pallets/chainbridge/Cargo.toml b/pallets/chainbridge/Cargo.toml index 455a0aa8a..617e76b9b 100644 --- a/pallets/chainbridge/Cargo.toml +++ b/pallets/chainbridge/Cargo.toml @@ -3,11 +3,11 @@ name = "pallet-chainbridge" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.io" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -16,22 +16,22 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } [features] default = ["std"] std = [ - "codec/std", - "sp-runtime/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "sp-io/std", + "sp-std/std", + "sp-core/std", ] diff --git a/pallets/ddc-clusters/Cargo.toml b/pallets/ddc-clusters/Cargo.toml index 0ef556a69..7bd5018b4 100644 --- a/pallets/ddc-clusters/Cargo.toml +++ b/pallets/ddc-clusters/Cargo.toml @@ -9,11 +9,11 @@ ddc-primitives = { version = "0.1.0", default-features = false, path = "../../pr ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } [dev-dependencies] sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/pallets/ddc-customers/Cargo.toml b/pallets/ddc-customers/Cargo.toml index 8d60ba44f..89faf08a5 100644 --- a/pallets/ddc-customers/Cargo.toml +++ b/pallets/ddc-customers/Cargo.toml @@ -9,10 +9,10 @@ ddc-primitives = { version = "0.1.0", default-features = false, path = "../../pr ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } [dev-dependencies] substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/pallets/ddc-metrics-offchain-worker/Cargo.toml b/pallets/ddc-metrics-offchain-worker/Cargo.toml index 3ab61de26..d56726763 100644 --- a/pallets/ddc-metrics-offchain-worker/Cargo.toml +++ b/pallets/ddc-metrics-offchain-worker/Cargo.toml @@ -3,49 +3,49 @@ name = "pallet-ddc-metrics-offchain-worker" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.dev" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "FRAME example pallet for offchain worker" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] +alt_serde = { version = "1", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["full"] } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +hex = { version = "0.4", default-features = false } +# pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +hex-literal = "^0.3.1" +pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -alt_serde = { version = "1", default-features = false, features = ["derive"] } -serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } -# pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -hex-literal = "^0.3.1" -hex = { version = "0.4", default-features = false } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } [features] default = ["std"] std = [ - "codec/std", - "sp-keystore", - "frame-support/std", - "frame-system/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", - "sp-std/std", - "pallet-contracts/std", - # "pallet-contracts-rpc-runtime-api/std", + "codec/std", + "sp-keystore", + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", + "pallet-contracts/std", + # "pallet-contracts-rpc-runtime-api/std", ] [dev-dependencies] pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-randomness-collective-flip = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pretty_assertions = "0.6.1" diff --git a/pallets/ddc/Cargo.toml b/pallets/ddc/Cargo.toml index 867c36f52..f25de5056 100644 --- a/pallets/ddc/Cargo.toml +++ b/pallets/ddc/Cargo.toml @@ -1,13 +1,13 @@ [package] +name = 'pallet-cere-ddc' +version = '4.8.1' authors = ['Substrate DevHub '] -description = 'FRAME pallet template for defining custom runtime logic.' edition = '2021' homepage = 'https://www.cere.network/' license = 'Unlicense' -name = 'pallet-cere-ddc' -repository = 'https://github.com/Cerebellum-Network/ddc-pallet' -version = '4.8.1' readme = 'README.md' +repository = 'https://github.com/Cerebellum-Network/ddc-pallet' +description = 'FRAME pallet template for defining custom runtime logic.' [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -16,24 +16,24 @@ targets = ['x86_64-unknown-linux-gnu'] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [dev-dependencies] -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } serde = { version = "1.0.101" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [features] default = ['std'] std = [ - 'codec/std', - 'sp-io/std', - 'sp-std/std', - 'sp-runtime/std', - 'frame-support/std', - 'frame-system/std', + 'codec/std', + 'sp-io/std', + 'sp-std/std', + 'sp-runtime/std', + 'frame-support/std', + 'frame-system/std', ] [package.metadata.cargo-machete] diff --git a/pallets/erc20/Cargo.toml b/pallets/erc20/Cargo.toml index 3bf27fea6..580ba103f 100644 --- a/pallets/erc20/Cargo.toml +++ b/pallets/erc20/Cargo.toml @@ -3,11 +3,11 @@ name = "pallet-erc20" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.dev" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "FRAME example pallet" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -17,29 +17,29 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -sp-arithmetic = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } pallet-erc721 = { version = "4.2.0", default-features = false, path = "../erc721" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +sp-arithmetic = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "codec/std", - "sp-runtime/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "sp-arithmetic/std", - "pallet-chainbridge/std", - "pallet-erc721/std" + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "sp-io/std", + "sp-std/std", + "sp-core/std", + "sp-arithmetic/std", + "pallet-chainbridge/std", + "pallet-erc721/std", ] [package.metadata.cargo-machete] diff --git a/pallets/erc721/Cargo.toml b/pallets/erc721/Cargo.toml index e6e12c37f..08e9b531a 100644 --- a/pallets/erc721/Cargo.toml +++ b/pallets/erc721/Cargo.toml @@ -3,11 +3,11 @@ name = "pallet-erc721" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.dev" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "FRAME example pallet" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -17,23 +17,23 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false,git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "codec/std", - "sp-runtime/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "pallet-chainbridge/std" + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "sp-io/std", + "sp-std/std", + "sp-core/std", + "pallet-chainbridge/std", ] diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 178800a4b..607c87512 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", default-features = false, features = [ "derive" ], optional = true } +serde = { version = "1.0.136", default-features = false, features = ["derive"], optional = true } sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -14,10 +14,10 @@ sp-runtime = { version = "6.0.0", default-features = false, git = "https://githu [features] default = ["std"] std = [ - "codec/std", - "scale-info/std", - "serde", - "sp-core/std", - "sp-runtime/std", + "codec/std", + "scale-info/std", + "serde", + "sp-core/std", + "sp-runtime/std", ] runtime-benchmarks = [] diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index e037f35f4..92f3e9a6f 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -5,26 +5,26 @@ edition = "2021" [dependencies] jsonrpsee = { version = "0.15.1", features = ["server"] } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus-babe-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus-epochs = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-finality-grandpa-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } substrate-state-trie-migration-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/runtime/cere-dev/Cargo.toml b/runtime/cere-dev/Cargo.toml index e78c7dd17..9d47b5f64 100644 --- a/runtime/cere-dev/Cargo.toml +++ b/runtime/cere-dev/Cargo.toml @@ -2,51 +2,49 @@ name = "cere-dev-runtime" version = "4.8.1" authors = ["Parity Technologies "] -edition = "2021" build = "build.rs" -license = "Apache-2.0" +edition = "2021" homepage = "https://substrate.io" +license = "Apache-2.0" repository = "https://github.com/paritytech/substrate/" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] - # third-party dependencies -codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = [ - "derive", - "max-encoded-len", -] } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -static_assertions = "1.1.0" +codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.16", default-features = false } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +static_assertions = "1.1.0" # primitives +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, version = "4.0.0-dev" } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } # frame dependencies -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +cere-dev-runtime-constants = { path = "./constants", default-features = false } +cere-runtime-common = { path = "../common", default-features = false } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -55,55 +53,53 @@ pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https:// pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } +pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-ddc-clusters = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-clusters" } +pallet-ddc-customers = { version = "0.1.0", default-features = false, path = "../../pallets/ddc-customers" } +pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } +pallet-ddc-nodes = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-nodes" } +pallet-ddc-staking = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-staking" } pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } +pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } +pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } +pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-session = { version = "4.0.0-dev", features = ["historical"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } +pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -cere-runtime-common = { path = "../common", default-features = false } -cere-dev-runtime-constants = { path = "./constants", default-features = false } -pallet-ddc-staking = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-staking" } -pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } -pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } -pallet-ddc-customers = { version = "0.1.0", default-features = false, path = "../../pallets/ddc-customers" } -pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } -pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } -pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } -pallet-ddc-nodes = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-nodes" } -pallet-ddc-clusters = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-clusters" } [build-dependencies] substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -112,158 +108,158 @@ substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/pari default = ["std"] with-tracing = ["frame-executive/with-tracing"] std = [ - "sp-authority-discovery/std", - "pallet-authority-discovery/std", - "pallet-authorship/std", - "sp-consensus-babe/std", - "pallet-babe/std", - "pallet-bags-list/std", - "pallet-balances/std", - "pallet-bounties/std", - "sp-block-builder/std", - "codec/std", - "scale-info/std", - "pallet-collective/std", - "pallet-contracts/std", - "pallet-contracts-primitives/std", - "pallet-contracts-rpc-runtime-api/std", - "pallet-democracy/std", - "pallet-fast-unstake/std", - "pallet-elections-phragmen/std", - "frame-executive/std", - "pallet-cere-ddc/std", - "pallet-chainbridge/std", - "pallet-erc721/std", - "pallet-erc20/std", - "pallet-grandpa/std", - "pallet-im-online/std", - "pallet-indices/std", - "sp-inherents/std", - "pallet-membership/std", - "pallet-multisig/std", - "pallet-nomination-pools/std", - "pallet-nomination-pools-runtime-api/std", - "pallet-identity/std", - "pallet-scheduler/std", - "node-primitives/std", - "sp-offchain/std", - "pallet-offences/std", - "pallet-proxy/std", - "sp-core/std", - "pallet-randomness-collective-flip/std", - "sp-std/std", - "pallet-session/std", - "sp-api/std", - "sp-runtime/std", - "sp-staking/std", - "pallet-staking/std", - "sp-session/std", - "pallet-sudo/std", - "frame-support/std", - "frame-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "pallet-election-provider-multi-phase/std", - "pallet-timestamp/std", - "pallet-tips/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-treasury/std", - "sp-transaction-pool/std", - "pallet-utility/std", - "sp-version/std", - "pallet-society/std", - "pallet-recovery/std", - "pallet-vesting/std", - "log/std", - "frame-try-runtime/std", - "sp-io/std", - "pallet-child-bounties/std", - "pallet-ddc-metrics-offchain-worker/std", - "pallet-ddc-staking/std", - "cere-runtime-common/std", - "cere-dev-runtime-constants/std", - "pallet-ddc-customers/std", - "pallet-ddc-nodes/std", - "pallet-ddc-clusters/std", + "sp-authority-discovery/std", + "pallet-authority-discovery/std", + "pallet-authorship/std", + "sp-consensus-babe/std", + "pallet-babe/std", + "pallet-bags-list/std", + "pallet-balances/std", + "pallet-bounties/std", + "sp-block-builder/std", + "codec/std", + "scale-info/std", + "pallet-collective/std", + "pallet-contracts/std", + "pallet-contracts-primitives/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-democracy/std", + "pallet-fast-unstake/std", + "pallet-elections-phragmen/std", + "frame-executive/std", + "pallet-cere-ddc/std", + "pallet-chainbridge/std", + "pallet-erc721/std", + "pallet-erc20/std", + "pallet-grandpa/std", + "pallet-im-online/std", + "pallet-indices/std", + "sp-inherents/std", + "pallet-membership/std", + "pallet-multisig/std", + "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", + "pallet-identity/std", + "pallet-scheduler/std", + "node-primitives/std", + "sp-offchain/std", + "pallet-offences/std", + "pallet-proxy/std", + "sp-core/std", + "pallet-randomness-collective-flip/std", + "sp-std/std", + "pallet-session/std", + "sp-api/std", + "sp-runtime/std", + "sp-staking/std", + "pallet-staking/std", + "sp-session/std", + "pallet-sudo/std", + "frame-support/std", + "frame-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "pallet-election-provider-multi-phase/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "sp-transaction-pool/std", + "pallet-utility/std", + "sp-version/std", + "pallet-society/std", + "pallet-recovery/std", + "pallet-vesting/std", + "log/std", + "frame-try-runtime/std", + "sp-io/std", + "pallet-child-bounties/std", + "pallet-ddc-metrics-offchain-worker/std", + "pallet-ddc-staking/std", + "cere-runtime-common/std", + "cere-dev-runtime-constants/std", + "pallet-ddc-customers/std", + "pallet-ddc-nodes/std", + "pallet-ddc-clusters/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-babe/runtime-benchmarks", - "pallet-bags-list/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", - "pallet-child-bounties/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", - "pallet-fast-unstake/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", - "pallet-im-online/runtime-benchmarks", - "pallet-indices/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nomination-pools/runtime-benchmarks", - "pallet-nomination-pools-benchmarking/runtime-benchmarks", - "pallet-offences-benchmarking/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", - "pallet-society/runtime-benchmarks", - "pallet-staking/runtime-benchmarks", - "pallet-ddc-staking/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "hex-literal", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-babe/runtime-benchmarks", + "pallet-bags-list/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-election-provider-multi-phase/runtime-benchmarks", + "pallet-election-provider-support-benchmarking/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-fast-unstake/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nomination-pools/runtime-benchmarks", + "pallet-nomination-pools-benchmarking/runtime-benchmarks", + "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", + "pallet-society/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "pallet-ddc-staking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "hex-literal", ] try-runtime = [ - "frame-executive/try-runtime", - "frame-try-runtime", - "frame-system/try-runtime", - "pallet-authority-discovery/try-runtime", - "pallet-authorship/try-runtime", - "pallet-babe/try-runtime", - "pallet-bags-list/try-runtime", - "pallet-balances/try-runtime", - "pallet-bounties/try-runtime", - "pallet-child-bounties/try-runtime", - "pallet-collective/try-runtime", - "pallet-contracts/try-runtime", - "pallet-democracy/try-runtime", - "pallet-election-provider-multi-phase/try-runtime", - "pallet-elections-phragmen/try-runtime", - "pallet-fast-unstake/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", - "pallet-im-online/try-runtime", - "pallet-indices/try-runtime", - "pallet-membership/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nomination-pools/try-runtime", - "pallet-offences/try-runtime", - "pallet-proxy/try-runtime", - "pallet-randomness-collective-flip/try-runtime", - "pallet-recovery/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-society/try-runtime", - "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-vesting/try-runtime", + "frame-executive/try-runtime", + "frame-try-runtime", + "frame-system/try-runtime", + "pallet-authority-discovery/try-runtime", + "pallet-authorship/try-runtime", + "pallet-babe/try-runtime", + "pallet-bags-list/try-runtime", + "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", + "pallet-collective/try-runtime", + "pallet-contracts/try-runtime", + "pallet-democracy/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-fast-unstake/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", + "pallet-indices/try-runtime", + "pallet-membership/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nomination-pools/try-runtime", + "pallet-offences/try-runtime", + "pallet-proxy/try-runtime", + "pallet-randomness-collective-flip/try-runtime", + "pallet-recovery/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-society/try-runtime", + "pallet-staking/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", ] diff --git a/runtime/cere-dev/constants/Cargo.toml b/runtime/cere-dev/constants/Cargo.toml index 201630962..d42c6c5b2 100644 --- a/runtime/cere-dev/constants/Cargo.toml +++ b/runtime/cere-dev/constants/Cargo.toml @@ -10,5 +10,5 @@ node-primitives = { version = "2.0.0", default-features = false, git = "https:// [features] default = ["std"] std = [ - "node-primitives/std" + "node-primitives/std", ] diff --git a/runtime/cere/Cargo.toml b/runtime/cere/Cargo.toml index 698fa079b..95cfa8a4b 100644 --- a/runtime/cere/Cargo.toml +++ b/runtime/cere/Cargo.toml @@ -2,51 +2,49 @@ name = "cere-runtime" version = "4.8.1" authors = ["Parity Technologies "] -edition = "2021" build = "build.rs" -license = "Apache-2.0" +edition = "2021" homepage = "https://substrate.io" +license = "Apache-2.0" repository = "https://github.com/paritytech/substrate/" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] - # third-party dependencies -codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = [ - "derive", - "max-encoded-len", -] } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -static_assertions = "1.1.0" +codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.16", default-features = false } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +static_assertions = "1.1.0" # primitives +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, version = "4.0.0-dev" } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } # frame dependencies -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +cere-runtime-common = { path = "../common", default-features = false } +cere-runtime-constants = { path = "./constants", default-features = false } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -55,51 +53,49 @@ pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https:// pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } +pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } +pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } +pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } +pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-session = { version = "4.0.0-dev", features = ["historical"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } +pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -cere-runtime-common = { path = "../common", default-features = false } -cere-runtime-constants = { path = "./constants", default-features = false } -pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } -pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } -pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } -pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } -pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } [build-dependencies] substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -108,154 +104,153 @@ substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/pari default = ["std"] with-tracing = ["frame-executive/with-tracing"] std = [ - "sp-authority-discovery/std", - "pallet-authority-discovery/std", - "pallet-authorship/std", - "sp-consensus-babe/std", - "pallet-babe/std", - "pallet-bags-list/std", - "pallet-balances/std", - "pallet-bounties/std", - "sp-block-builder/std", - "codec/std", - "scale-info/std", - "pallet-collective/std", - "pallet-contracts/std", - "pallet-contracts-primitives/std", - "pallet-contracts-rpc-runtime-api/std", - "pallet-democracy/std", - "pallet-fast-unstake/std", - "pallet-elections-phragmen/std", - "frame-executive/std", - "pallet-cere-ddc/std", - "pallet-chainbridge/std", - "pallet-erc721/std", - "pallet-erc20/std", - "pallet-grandpa/std", - "pallet-im-online/std", - "pallet-indices/std", - "sp-inherents/std", - "pallet-membership/std", - "pallet-multisig/std", - "pallet-nomination-pools/std", - "pallet-nomination-pools-runtime-api/std", - "pallet-identity/std", - "pallet-scheduler/std", - "node-primitives/std", - "sp-offchain/std", - "pallet-offences/std", - "pallet-proxy/std", - "sp-core/std", - "pallet-randomness-collective-flip/std", - "sp-std/std", - "pallet-session/std", - "sp-api/std", - "sp-runtime/std", - "sp-staking/std", - "pallet-staking/std", - "sp-session/std", - "pallet-sudo/std", - "frame-support/std", - "frame-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "pallet-election-provider-multi-phase/std", - "pallet-timestamp/std", - "pallet-tips/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-treasury/std", - "sp-transaction-pool/std", - "pallet-utility/std", - "sp-version/std", - "pallet-society/std", - "pallet-recovery/std", - "pallet-vesting/std", - "log/std", - "frame-try-runtime/std", - "sp-io/std", - "pallet-child-bounties/std", - "pallet-ddc-metrics-offchain-worker/std", - "cere-runtime-common/std", - "cere-runtime-constants/std" + "sp-authority-discovery/std", + "pallet-authority-discovery/std", + "pallet-authorship/std", + "sp-consensus-babe/std", + "pallet-babe/std", + "pallet-bags-list/std", + "pallet-balances/std", + "pallet-bounties/std", + "sp-block-builder/std", + "codec/std", + "scale-info/std", + "pallet-collective/std", + "pallet-contracts/std", + "pallet-contracts-primitives/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-democracy/std", + "pallet-fast-unstake/std", + "pallet-elections-phragmen/std", + "frame-executive/std", + "pallet-cere-ddc/std", + "pallet-chainbridge/std", + "pallet-erc721/std", + "pallet-erc20/std", + "pallet-grandpa/std", + "pallet-im-online/std", + "pallet-indices/std", + "sp-inherents/std", + "pallet-membership/std", + "pallet-multisig/std", + "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", + "pallet-identity/std", + "pallet-scheduler/std", + "node-primitives/std", + "sp-offchain/std", + "pallet-offences/std", + "pallet-proxy/std", + "sp-core/std", + "pallet-randomness-collective-flip/std", + "sp-std/std", + "pallet-session/std", + "sp-api/std", + "sp-runtime/std", + "sp-staking/std", + "pallet-staking/std", + "sp-session/std", + "pallet-sudo/std", + "frame-support/std", + "frame-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "pallet-election-provider-multi-phase/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "sp-transaction-pool/std", + "pallet-utility/std", + "sp-version/std", + "pallet-society/std", + "pallet-recovery/std", + "pallet-vesting/std", + "log/std", + "frame-try-runtime/std", + "sp-io/std", + "pallet-child-bounties/std", + "pallet-ddc-metrics-offchain-worker/std", + "cere-runtime-common/std", + "cere-runtime-constants/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-babe/runtime-benchmarks", - "pallet-bags-list/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", - "pallet-child-bounties/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", - "pallet-fast-unstake/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", - "pallet-im-online/runtime-benchmarks", - "pallet-indices/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nomination-pools/runtime-benchmarks", - "pallet-nomination-pools-benchmarking/runtime-benchmarks", - "pallet-offences-benchmarking/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", - "pallet-society/runtime-benchmarks", - "pallet-staking/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "hex-literal", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-babe/runtime-benchmarks", + "pallet-bags-list/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-election-provider-multi-phase/runtime-benchmarks", + "pallet-election-provider-support-benchmarking/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-fast-unstake/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nomination-pools/runtime-benchmarks", + "pallet-nomination-pools-benchmarking/runtime-benchmarks", + "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", + "pallet-society/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "hex-literal", ] try-runtime = [ - "frame-executive/try-runtime", - "frame-try-runtime", - "frame-system/try-runtime", - "pallet-authority-discovery/try-runtime", - "pallet-authorship/try-runtime", - "pallet-babe/try-runtime", - "pallet-bags-list/try-runtime", - "pallet-balances/try-runtime", - "pallet-bounties/try-runtime", - "pallet-child-bounties/try-runtime", - "pallet-collective/try-runtime", - "pallet-contracts/try-runtime", - "pallet-democracy/try-runtime", - "pallet-election-provider-multi-phase/try-runtime", - "pallet-elections-phragmen/try-runtime", - "pallet-fast-unstake/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", - "pallet-im-online/try-runtime", - "pallet-indices/try-runtime", - "pallet-membership/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nomination-pools/try-runtime", - "pallet-offences/try-runtime", - "pallet-proxy/try-runtime", - "pallet-randomness-collective-flip/try-runtime", - "pallet-recovery/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-society/try-runtime", - "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-vesting/try-runtime", + "frame-executive/try-runtime", + "frame-try-runtime", + "frame-system/try-runtime", + "pallet-authority-discovery/try-runtime", + "pallet-authorship/try-runtime", + "pallet-babe/try-runtime", + "pallet-bags-list/try-runtime", + "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", + "pallet-collective/try-runtime", + "pallet-contracts/try-runtime", + "pallet-democracy/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-fast-unstake/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", + "pallet-indices/try-runtime", + "pallet-membership/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nomination-pools/try-runtime", + "pallet-offences/try-runtime", + "pallet-proxy/try-runtime", + "pallet-randomness-collective-flip/try-runtime", + "pallet-recovery/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-society/try-runtime", + "pallet-staking/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", ] - diff --git a/runtime/cere/constants/Cargo.toml b/runtime/cere/constants/Cargo.toml index 629d01bcb..592358dfa 100644 --- a/runtime/cere/constants/Cargo.toml +++ b/runtime/cere/constants/Cargo.toml @@ -10,5 +10,5 @@ node-primitives = { version = "2.0.0", default-features = false, git = "https:// [features] default = ["std"] std = [ - "node-primitives/std" + "node-primitives/std", ] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 15c08df07..5aff0c986 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -10,7 +10,7 @@ no_std = [] std = [] [dependencies] -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } frame-support = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } node-primitives = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index bcf909e27..7e60322a9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "nightly-2022-10-09" -components = [ "clippy", "rustfmt" ] -targets = [ "wasm32-unknown-unknown" ] +components = ["clippy", "rustfmt"] +targets = ["wasm32-unknown-unknown"] diff --git a/rustfmt.toml b/rustfmt.toml index f58198d98..2797c252b 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -23,9 +23,9 @@ trailing_semicolon = false use_field_init_shorthand = true ignore = [ - "pallets/chainbridge", - "pallets/ddc-metrics-offchain-worker", - "pallets/ddc", - "pallets/erc20", - "pallets/erc721", + "pallets/chainbridge", + "pallets/ddc-metrics-offchain-worker", + "pallets/ddc", + "pallets/erc20", + "pallets/erc721", ] diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 202996ef0..63f8cbd4e 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -4,5 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } ddc-primitives = { version = "0.1.0", default-features = false, path = "../primitives" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/zombienet/0000-block-building/block-building.toml b/zombienet/0000-block-building/block-building.toml index b9d662117..10b9955de 100644 --- a/zombienet/0000-block-building/block-building.toml +++ b/zombienet/0000-block-building/block-building.toml @@ -2,8 +2,8 @@ default_command = "./target/release/cere" chain = "local" - [[relaychain.nodes]] - name = "alice" +[[relaychain.nodes]] +name = "alice" - [[relaychain.nodes]] - name = "bob" +[[relaychain.nodes]] +name = "bob" diff --git a/zombienet/0001-ddc-validation/ddc-validation.toml b/zombienet/0001-ddc-validation/ddc-validation.toml index 64b4111ed..e5d7ae40a 100644 --- a/zombienet/0001-ddc-validation/ddc-validation.toml +++ b/zombienet/0001-ddc-validation/ddc-validation.toml @@ -3,21 +3,21 @@ default_command = "./target/release/cere" default_args = ["--enable-ddc-validation --dac-url {{DAC_URL}}"] chain = "local" - [[relaychain.nodes]] - name = "alice" +[[relaychain.nodes]] +name = "alice" - [[relaychain.nodes]] - name = "bob" +[[relaychain.nodes]] +name = "bob" - [[relaychain.nodes]] - name = "charlie" +[[relaychain.nodes]] +name = "charlie" - [[relaychain.nodes]] - name = "dave" +[[relaychain.nodes]] +name = "dave" - [[relaychain.nodes]] - name = "eve" +[[relaychain.nodes]] +name = "eve" - [[relaychain.nodes]] - name = "ferdie" - validator = false +[[relaychain.nodes]] +name = "ferdie" +validator = false From 9f783c0d6a5464b0b9ef390f45d44479faf12846 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Sun, 12 Nov 2023 14:07:05 +0300 Subject: [PATCH 28/29] Add github action --- .github/workflows/check.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 1ecb04c4b..04af2420e 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -28,6 +28,9 @@ jobs: rustup update stable --no-self-update rustup target add wasm32-unknown-unknown + - name: Check TOML + uses: dprint/check@v2.2 + - name: Check Format run: | cargo fmt -- --check From 1f259aa96e7034f66e4bd81fa133662a96161b54 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Mon, 13 Nov 2023 14:29:11 +0300 Subject: [PATCH 29/29] Add auto-assign to github PRs --- .github/auto_assign.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/auto_assign.yml diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 000000000..ab48497b9 --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1,12 @@ +addReviewers: true +addAssignees: author +reviewers: + - rakanalh + - MRamanenkau + - Raid5594 + - aie0 + - yahortsaryk + - khssnv +skipKeywords: + - wip +numberOfReviewers: 2