diff --git a/Cargo.toml b/Cargo.toml index 179b8a18..b4ae26d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,76 @@ members = [ 'vouches', ] +[workspace.dependencies] +# local pin +encointer-ceremonies-assignment = { path = "ceremonies/assignment", default-features = false, version = "3.0.2" } +encointer-meetup-validation = { path = "ceremonies/meetup-validation", default-features = false, version = "3.0.2" } +encointer-primitives = { path = "primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } +encointer-rpc = { path = "rpc", version = "3.0.2" } +ep-core = { path = "primitives/core", default-features = false, version = "3.0.2" } +pallet-encointer-balances = { path = "balances", default-features = false, version = "3.0.2" } +pallet-encointer-ceremonies = { path = "ceremonies", default-features = false, version = "3.0.2" } +pallet-encointer-communities = { path = "communities", default-features = false, version = "3.0.3" } +pallet-encointer-reputation-commitments = { path = "reputation-commitments", default-features = false, version = "3.0.2" } +pallet-encointer-scheduler = { path = "scheduler", default-features = false, version = "3.0.3" } +test-utils = { path = "test-utils" } +# rpc apis +encointer-balances-tx-payment-rpc-runtime-api = { path = "balances-tx-payment/rpc/runtime-api", version = "3.0.2" } +pallet-encointer-bazaar-rpc-runtime-api = { path = "bazaar/rpc/runtime-api", version = "3.0.2" } +pallet-encointer-ceremonies-rpc-runtime-api = { path = "ceremonies/rpc/runtime-api", version = "3.0.2" } +pallet-encointer-communities-rpc-runtime-api = { path = "communities/rpc/runtime-api", version = "3.0.2" } + +# various +array-bytes = "6.1.0" +bs58 = { version = "0.4.0", default-features = false, features = ["alloc"] } +crc = "2.1.0" +fixed = { package = "substrate-fixed", default-features = false, version = "0.5.9" } +geohash = { package = "substrate-geohash", version = "0.13.0" } +impl-serde = { version = "0.4.0", default-features = false } +impl-trait-for-tuples = { version = "0.2.2", default-features = false } +log = { version = "0.4.20", default-features = false } +parity-scale-codec = { version = "3.6.4", default-features = false, features = ["derive", "max-encoded-len"] } +parking_lot = "0.12.0" +scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.188", default-features = false, features = ["derive", "alloc"] } +thiserror = "1.0.31" + +# polkadot-sdk [no_std] +frame-benchmarking = { default-features = false, version = "25.0.0" } +frame-support = { default-features = false, version = "25.0.0" } +frame-system = { default-features = false, version = "25.0.0" } +pallet-asset-tx-payment = { default-features = false, version = "25.0.0" } +pallet-balances = { default-features = false, version = "25.0.0" } +pallet-timestamp = { default-features = false, version = "24.0.0" } +pallet-transaction-payment = { default-features = false, version = "25.0.0" } +pallet-treasury = { default-features = false, version = "24.0.0" } +sp-api = { default-features = false, version = "23.0.0" } +sp-application-crypto = { default-features = false, version = "27.0.0" } +sp-arithmetic = { default-features = false, version = "20.0.0" } +sp-core = { default-features = false, version = "25.0.0" } +sp-io = { default-features = false, version = "27.0.0" } +sp-runtime = { default-features = false, version = "28.0.0" } +sp-std = { default-features = false, version = "12.0.0" } + +# rpc stuff [std] +jsonrpsee = { version = "0.16.3", features = ["client-core", "server", "macros"] } +jsonrpsee-core = { version = "0.16.3" } +jsonrpsee-types = { version = "0.16.3" } +pallet-transaction-payment-rpc = { version = "27.0.0" } +sc-rpc = "26.0.0" +sc-rpc-api = "0.30.0" +sp-blockchain = "25.0.0" +sp-rpc = "23.0.0" + +# dev deps +approx = "0.5.1" +itertools = "0.10.3" +rstest = "0.12.0" +serde_json = "1.0.105" +sp-inherents = "23.0.0" +sp-keyring = "28.0.0" +sp-keystore = "0.31.0" + #[patch."https://github.com/encointer/substrate-fixed"] #substrate-fixed = { path = "../substrate-fixed"} # diff --git a/balances-tx-payment/Cargo.toml b/balances-tx-payment/Cargo.toml index 75189518..bd4dbc97 100644 --- a/balances-tx-payment/Cargo.toml +++ b/balances-tx-payment/Cargo.toml @@ -9,38 +9,34 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -log = { version = "0.4.20", default-features = false } +log = { workspace = true } -encointer-primitives = { path = "../primitives", default-features = false, version = "3.0.2" } -pallet-encointer-balances = { path = "../balances", default-features = false, version = "3.0.2" } -pallet-encointer-ceremonies = { path = "../ceremonies", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } +pallet-encointer-balances = { workspace = true } +pallet-encointer-ceremonies = { workspace = true } # substrate dependencies -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-asset-tx-payment = { default-features = false, version = "25.0.0" } -pallet-transaction-payment = { default-features = false, version = "25.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-asset-tx-payment = { workspace = true } +pallet-transaction-payment = { workspace = true } +sp-runtime = { workspace = true } [dev-dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -rstest = "0.12.0" -scale-info = { version = "2.10.0", default-features = false } -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +parity-scale-codec = { workspace = true } +rstest = { workspace = true } +scale-info = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ "encointer-primitives/std", - # substrate deps "frame-support/std", "frame-system/std", "log/std", "pallet-asset-tx-payment/std", - # encointer deps "pallet-encointer-balances/std", "pallet-encointer-ceremonies/std", "pallet-transaction-payment/std", diff --git a/balances-tx-payment/rpc/Cargo.toml b/balances-tx-payment/rpc/Cargo.toml index d7c8b95d..fe83fdc1 100644 --- a/balances-tx-payment/rpc/Cargo.toml +++ b/balances-tx-payment/rpc/Cargo.toml @@ -9,28 +9,24 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false } -jsonrpsee = { version = "0.16.3", features = [ - "client-core", - "server", - "macros", -] } -log = "0.4.20" -parking_lot = "0.12.0" -thiserror = "1.0.31" +jsonrpsee = { workspace = true } +log = { workspace = true, features = ["std"] } +parity-scale-codec = { workspace = true } +parking_lot = { workspace = true } +thiserror = { workspace = true } # local deps -encointer-balances-tx-payment-rpc-runtime-api = { package = "encointer-balances-tx-payment-rpc-runtime-api", path = "runtime-api", version = "3.0.2" } -encointer-primitives = { path = "../../primitives", version = "3.0.2" } -encointer-rpc = { path = "../../rpc", version = "3.0.2" } +encointer-balances-tx-payment-rpc-runtime-api = { workspace = true } +encointer-primitives = { workspace = true } +encointer-rpc = { workspace = true } # substrate deps -pallet-transaction-payment = { version = "25.0.0" } -pallet-transaction-payment-rpc = { version = "27.0.0" } -sc-rpc = "26.0.0" -sc-rpc-api = "0.30.0" -sp-api = "23.0.0" -sp-blockchain = "25.0.0" -sp-core = "25.0.0" -sp-rpc = "23.0.0" -sp-runtime = "28.0.0" +pallet-transaction-payment = { workspace = true, features = ["std"] } +pallet-transaction-payment-rpc = { workspace = true } +sc-rpc = { workspace = true } +sc-rpc-api = { workspace = true } +sp-api = { workspace = true, features = ["std"] } +sp-blockchain = { workspace = true } +sp-core = { workspace = true, features = ["std"] } +sp-rpc = { workspace = true } +sp-runtime = { workspace = true, features = ["std"] } diff --git a/balances-tx-payment/rpc/runtime-api/Cargo.toml b/balances-tx-payment/rpc/runtime-api/Cargo.toml index 40607ba9..b3ec4754 100644 --- a/balances-tx-payment/rpc/runtime-api/Cargo.toml +++ b/balances-tx-payment/rpc/runtime-api/Cargo.toml @@ -10,23 +10,21 @@ license = "GPL-3.0-or-later" [dependencies] # local deps -encointer-primitives = { path = "../../../primitives", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -frame-support = { default-features = false, version = "25.0.0" } -scale-info = { version = "2.10.0", default-features = false } -sp-api = { default-features = false, version = "23.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-support = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } +sp-api = { workspace = true } +sp-std = { workspace = true } [features] default = ["std"] std = [ - "codec/std", "encointer-primitives/std", "frame-support/std", + "parity-scale-codec/std", "scale-info/std", "sp-api/std", "sp-std/std", diff --git a/balances-tx-payment/rpc/src/lib.rs b/balances-tx-payment/rpc/src/lib.rs index f17f198c..6d93f3aa 100644 --- a/balances-tx-payment/rpc/src/lib.rs +++ b/balances-tx-payment/rpc/src/lib.rs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Encointer. If not, see . -use codec::Codec; use core::fmt::Display; use encointer_balances_tx_payment_rpc_runtime_api::{ BalancesTxPaymentApi as BalancesTxPaymentApiRuntimeApi, Error, @@ -27,6 +26,7 @@ use jsonrpsee::{ pub use pallet_transaction_payment::RuntimeDispatchInfo; use pallet_transaction_payment::{FeeDetails, InclusionFee}; use pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi; +use parity_scale_codec::Codec; use sp_api::{Decode, Encode, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::Bytes; diff --git a/balances/Cargo.toml b/balances/Cargo.toml index 39d70cd6..a8235516 100644 --- a/balances/Cargo.toml +++ b/balances/Cargo.toml @@ -9,42 +9,38 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -approx = { version = "0.5.1", optional = true } -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +approx = { workspace = true, optional = true } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-asset-tx-payment = { default-features = false, version = "25.0.0" } -pallet-transaction-payment = { default-features = false, version = "25.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-asset-tx-payment = { workspace = true } +pallet-transaction-payment = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -approx = "0.5.1" -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true, features = ["std"] } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ - "codec/std", - # local deps "encointer-primitives/std", - # substrate deps "frame-support/std", "frame-system/std", "log/std", "pallet-asset-tx-payment/std", "pallet-transaction-payment/std", + "parity-scale-codec/std", "scale-info/std", "sp-runtime/std", "sp-std/std", diff --git a/balances/src/mock.rs b/balances/src/mock.rs index bff9043e..0a3d7217 100644 --- a/balances/src/mock.rs +++ b/balances/src/mock.rs @@ -35,7 +35,7 @@ frame_support::construct_runtime!( System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, EncointerBalances: dut::{Pallet, Call, Storage, Event, Config}, } ); diff --git a/bazaar/Cargo.toml b/bazaar/Cargo.toml index a5eefcba..e20e377c 100644 --- a/bazaar/Cargo.toml +++ b/bazaar/Cargo.toml @@ -9,51 +9,47 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-communities = { package = "pallet-encointer-communities", path = "../communities", default-features = false, version = "3.0.3" } -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } +encointer-primitives = { workspace = true } +pallet-encointer-communities = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ - "codec/std", - # local deps - "encointer-communities/std", "encointer-primitives/std", - # substrate deps "frame-support/std", "frame-system/std", "log/std", + "pallet-encointer-communities/std", + "parity-scale-codec/std", "scale-info/std", "sp-core/std", "sp-std/std", ] runtime-benchmarks = [ - "encointer-communities/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", ] try-runtime = [ - "encointer-communities/try-runtime", "frame-system/try-runtime", + "pallet-encointer-communities/try-runtime", ] diff --git a/bazaar/rpc/Cargo.toml b/bazaar/rpc/Cargo.toml index dab4a9f9..ca50ca98 100644 --- a/bazaar/rpc/Cargo.toml +++ b/bazaar/rpc/Cargo.toml @@ -9,23 +9,19 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -jsonrpsee = { version = "0.16.3", features = [ - "client-core", - "server", - "macros", -] } -log = "0.4.20" -parking_lot = "0.12.0" -thiserror = "1.0.31" +jsonrpsee = { workspace = true } +log = { workspace = true, features = ["std"] } +parking_lot = { workspace = true } +thiserror = { workspace = true } # local deps -encointer-bazaar-rpc-runtime-api = { package = "pallet-encointer-bazaar-rpc-runtime-api", path = "runtime-api", version = "3.0.2" } -encointer-primitives = { path = "../../primitives", version = "3.0.2" } -encointer-rpc = { path = "../../rpc", version = "3.0.2" } +encointer-primitives = { workspace = true } +encointer-rpc = { workspace = true } +pallet-encointer-bazaar-rpc-runtime-api = { workspace = true } # substrate deps -sc-rpc = "26.0.0" -sc-rpc-api = "0.30.0" -sp-api = "23.0.0" -sp-blockchain = "25.0.0" -sp-runtime = "28.0.0" +sc-rpc = { workspace = true } +sc-rpc-api = { workspace = true } +sp-api = { workspace = true, features = ["std"] } +sp-blockchain = { workspace = true } +sp-runtime = { workspace = true, features = ["std"] } diff --git a/bazaar/rpc/runtime-api/Cargo.toml b/bazaar/rpc/runtime-api/Cargo.toml index dac818d0..c3088881 100644 --- a/bazaar/rpc/runtime-api/Cargo.toml +++ b/bazaar/rpc/runtime-api/Cargo.toml @@ -10,12 +10,12 @@ license = "GPL-3.0-or-later" [dependencies] # local deps -encointer-primitives = { path = "../../../primitives", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -frame-support = { default-features = false, version = "25.0.0" } -sp-api = { default-features = false, version = "23.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-support = { workspace = true } +sp-api = { workspace = true } +sp-std = { workspace = true } [features] default = ["std"] diff --git a/bazaar/rpc/src/lib.rs b/bazaar/rpc/src/lib.rs index 5e94e275..d1179369 100644 --- a/bazaar/rpc/src/lib.rs +++ b/bazaar/rpc/src/lib.rs @@ -21,11 +21,11 @@ use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; -use encointer_bazaar_rpc_runtime_api::BazaarApi as BazaarRuntimeApi; use encointer_primitives::{ bazaar::{Business, BusinessIdentifier, OfferingData}, communities::CommunityIdentifier, }; +use pallet_encointer_bazaar_rpc_runtime_api::BazaarApi as BazaarRuntimeApi; #[rpc(client, server)] pub trait BazaarApi diff --git a/bazaar/src/benchmarking.rs b/bazaar/src/benchmarking.rs index 5c749ffa..fcac52b7 100644 --- a/bazaar/src/benchmarking.rs +++ b/bazaar/src/benchmarking.rs @@ -24,10 +24,11 @@ fn create_community() -> CommunityIdentifier { let bs = vec![alice.clone(), bob.clone(), charlie.clone()]; let community_meta: CommunityMetadata = CommunityMetadata::default(); - encointer_communities::Pallet::::set_min_solar_trip_time_s(RawOrigin::Root.into(), 1).ok(); - encointer_communities::Pallet::::set_max_speed_mps(RawOrigin::Root.into(), 83).ok(); + pallet_encointer_communities::Pallet::::set_min_solar_trip_time_s(RawOrigin::Root.into(), 1) + .ok(); + pallet_encointer_communities::Pallet::::set_max_speed_mps(RawOrigin::Root.into(), 83).ok(); - encointer_communities::Pallet::::new_community( + pallet_encointer_communities::Pallet::::new_community( RawOrigin::Root.into(), location, bs.clone(), diff --git a/bazaar/src/lib.rs b/bazaar/src/lib.rs index 485df408..34591df8 100644 --- a/bazaar/src/lib.rs +++ b/bazaar/src/lib.rs @@ -43,7 +43,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; #[pallet::config] - pub trait Config: frame_system::Config + encointer_communities::Config { + pub trait Config: frame_system::Config + pallet_encointer_communities::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; type WeightInfo: WeightInfo; } @@ -65,7 +65,7 @@ pub mod pallet { let sender = ensure_signed(origin)?; // Check that the supplied community is actually registered ensure!( - >::community_identifiers().contains(&cid), + >::community_identifiers().contains(&cid), Error::::NonexistentCommunity ); diff --git a/bazaar/src/mock.rs b/bazaar/src/mock.rs index 69123e6a..60764e72 100644 --- a/bazaar/src/mock.rs +++ b/bazaar/src/mock.rs @@ -25,9 +25,9 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, - EncointerCommunities: encointer_communities::{Pallet, Call, Storage, Event}, - EncointerBalances: encointer_balances::{Pallet, Call, Storage, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerCommunities: pallet_encointer_communities::{Pallet, Call, Storage, Event}, + EncointerBalances: pallet_encointer_balances::{Pallet, Call, Storage, Event}, EncointerBazaar: dut::{Pallet, Call, Storage, Event}, } ); @@ -48,7 +48,7 @@ impl_encointer_scheduler!(TestRuntime); pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - encointer_communities::GenesisConfig:: { + pallet_encointer_communities::GenesisConfig:: { min_solar_trip_time_s: 1, max_speed_mps: 83, ..Default::default() diff --git a/ceremonies/Cargo.toml b/ceremonies/Cargo.toml index 4d505218..c017bd77 100644 --- a/ceremonies/Cargo.toml +++ b/ceremonies/Cargo.toml @@ -9,56 +9,54 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-balances = { package = "pallet-encointer-balances", path = "../balances", default-features = false, version = "3.0.2" } -encointer-ceremonies-assignment = { path = "assignment", default-features = false, version = "3.0.2" } -encointer-communities = { package = "pallet-encointer-communities", path = "../communities", default-features = false, version = "3.0.3" } -encointer-meetup-validation = { path = "meetup-validation", default-features = false, version = "3.0.2" } -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } -encointer-scheduler = { package = "pallet-encointer-scheduler", path = "../scheduler", default-features = false, version = "3.0.3" } +encointer-ceremonies-assignment = { workspace = true } +encointer-meetup-validation = { workspace = true } +encointer-primitives = { workspace = true } +pallet-encointer-balances = { workspace = true } +pallet-encointer-communities = { workspace = true } +pallet-encointer-scheduler = { workspace = true } # substrate deps -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-timestamp = { default-features = false, version = "24.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-io = { default-features = false, version = "27.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-timestamp = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } # benchmarking -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -sp-application-crypto = { default-features = false, optional = true, version = "27.0.0" } +frame-benchmarking = { workspace = true, optional = true } +sp-application-crypto = { workspace = true, optional = true } [dev-dependencies] -approx = "0.5.1" -itertools = "0.10.3" -rstest = "0.12.0" -sp-io = "27.0.0" -sp-keystore = "0.31.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +itertools = { workspace = true } +rstest = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +sp-keystore = { workspace = true } +test-utils = { workspace = true } [features] default = ["std"] std = [ - "codec/std", - "encointer-balances/std", "encointer-ceremonies-assignment/std", - "encointer-communities/std", "encointer-meetup-validation/std", "encointer-primitives/std", - "encointer-scheduler/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std", "log/std", + "pallet-encointer-balances/std", + "pallet-encointer-communities/std", + "pallet-encointer-scheduler/std", "pallet-timestamp/std", + "parity-scale-codec/std", "scale-info/std", "sp-core/std", "sp-io/std", @@ -67,19 +65,19 @@ std = [ ] runtime-benchmarks = [ - "encointer-balances/runtime-benchmarks", - "encointer-communities/runtime-benchmarks", - "encointer-scheduler/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", "sp-application-crypto", ] try-runtime = [ - "encointer-balances/try-runtime", - "encointer-communities/try-runtime", - "encointer-scheduler/try-runtime", + "pallet-encointer-balances/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-scheduler/try-runtime", "frame-system/try-runtime", ] diff --git a/ceremonies/assignment/Cargo.toml b/ceremonies/assignment/Cargo.toml index 3a1f9beb..5b0f3af2 100644 --- a/ceremonies/assignment/Cargo.toml +++ b/ceremonies/assignment/Cargo.toml @@ -10,14 +10,14 @@ license = "GPL-3.0-or-later" [dependencies] # local deps -encointer-primitives = { path = "../../primitives", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -sp-core = "25.0.0" +sp-core = { workspace = true, features = ["std"] } [features] default = ["std"] diff --git a/ceremonies/meetup-validation/Cargo.toml b/ceremonies/meetup-validation/Cargo.toml index 922d2910..e35e52d7 100644 --- a/ceremonies/meetup-validation/Cargo.toml +++ b/ceremonies/meetup-validation/Cargo.toml @@ -9,31 +9,26 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -scale-info = { version = "2.10.0", default-features = false } -serde = { version = "1.0.188", default-features = false, features = [ - "derive", - "alloc", -] } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } +serde = { workspace = true } # local deps -encointer-primitives = { path = "../../primitives", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -rstest = "0.12.0" -sp-core = "25.0.0" +rstest = { workspace = true } +sp-core = { workspace = true, features = ["std"] } [features] default = ["std"] std = [ - "codec/std", "encointer-primitives/std", + "parity-scale-codec/std", "scale-info/std", "serde/std", "sp-runtime/std", diff --git a/ceremonies/meetup-validation/src/lib.rs b/ceremonies/meetup-validation/src/lib.rs index 9437770f..f0ad51f0 100644 --- a/ceremonies/meetup-validation/src/lib.rs +++ b/ceremonies/meetup-validation/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; use sp_std::{vec, vec::Vec}; diff --git a/ceremonies/rpc/Cargo.toml b/ceremonies/rpc/Cargo.toml index 5778c0e5..ded6023e 100644 --- a/ceremonies/rpc/Cargo.toml +++ b/ceremonies/rpc/Cargo.toml @@ -9,23 +9,19 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -jsonrpsee = { version = "0.16.3", features = [ - "client-core", - "server", - "macros", -] } -log = "0.4.20" -parking_lot = "0.12.0" -thiserror = "1.0.31" +jsonrpsee = { workspace = true } +log = { workspace = true, features = ["std"] } +parking_lot = { workspace = true } +thiserror = { workspace = true } # local deps -encointer-ceremonies-rpc-runtime-api = { package = "pallet-encointer-ceremonies-rpc-runtime-api", path = "runtime-api", version = "3.0.2" } -encointer-primitives = { path = "../../primitives", version = "3.0.2" } -encointer-rpc = { path = "../../rpc", version = "3.0.2" } +encointer-primitives = { workspace = true } +encointer-rpc = { workspace = true } +pallet-encointer-ceremonies-rpc-runtime-api = { workspace = true } # substrate deps -sc-rpc = "26.0.0" -sc-rpc-api = "0.30.0" -sp-api = "23.0.0" -sp-blockchain = "25.0.0" -sp-runtime = "28.0.0" +sc-rpc = { workspace = true } +sc-rpc-api = { workspace = true } +sp-api = { workspace = true, features = ["std"] } +sp-blockchain = { workspace = true } +sp-runtime = { workspace = true, features = ["std"] } diff --git a/ceremonies/rpc/runtime-api/Cargo.toml b/ceremonies/rpc/runtime-api/Cargo.toml index 19a368c0..de169c13 100644 --- a/ceremonies/rpc/runtime-api/Cargo.toml +++ b/ceremonies/rpc/runtime-api/Cargo.toml @@ -10,12 +10,12 @@ license = "GPL-3.0-or-later" [dependencies] # local deps -encointer-primitives = { path = "../../../primitives", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -frame-support = { default-features = false, version = "25.0.0" } -sp-api = { default-features = false, version = "23.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-support = { workspace = true } +sp-api = { workspace = true } +sp-std = { workspace = true } [features] default = ["std"] diff --git a/ceremonies/rpc/src/lib.rs b/ceremonies/rpc/src/lib.rs index 7b69d1f0..ef1743ad 100644 --- a/ceremonies/rpc/src/lib.rs +++ b/ceremonies/rpc/src/lib.rs @@ -25,7 +25,6 @@ use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; -use encointer_ceremonies_rpc_runtime_api::CeremoniesApi as CeremoniesRuntimeApi; use encointer_primitives::{ ceremonies::{ reputation_cache_dirty_key, reputation_cache_key, AggregatedAccountData, CeremonyInfo, @@ -34,6 +33,7 @@ use encointer_primitives::{ communities::CommunityIdentifier, scheduler::CeremonyIndexType, }; +use pallet_encointer_ceremonies_rpc_runtime_api::CeremoniesApi as CeremoniesRuntimeApi; #[rpc(client, server)] pub trait CeremoniesApi diff --git a/ceremonies/src/benchmarking.rs b/ceremonies/src/benchmarking.rs index 5f2c2aa6..de197ca5 100644 --- a/ceremonies/src/benchmarking.rs +++ b/ceremonies/src/benchmarking.rs @@ -45,19 +45,19 @@ fn test_location() -> Location { fn create_community() -> CommunityIdentifier { let location = test_location(); let bs = bootstrappers::(); - encointer_scheduler::Pallet::::set_phase_duration( + pallet_encointer_scheduler::Pallet::::set_phase_duration( RawOrigin::Root.into(), CeremonyPhaseType::Assigning, 10u32.into(), ) .ok(); - encointer_scheduler::Pallet::::set_phase_duration( + pallet_encointer_scheduler::Pallet::::set_phase_duration( RawOrigin::Root.into(), CeremonyPhaseType::Attesting, 10u32.into(), ) .ok(); - encointer_scheduler::Pallet::::set_phase_duration( + pallet_encointer_scheduler::Pallet::::set_phase_duration( RawOrigin::Root.into(), CeremonyPhaseType::Registering, 10u32.into(), @@ -73,9 +73,10 @@ fn create_community() -> CommunityIdentifier { Pallet::::set_location_tolerance(RawOrigin::Root.into(), 1000).ok(); Pallet::::set_time_tolerance(RawOrigin::Root.into(), 1_000_000u32.into()).ok(); - encointer_communities::Pallet::::set_min_solar_trip_time_s(RawOrigin::Root.into(), 1).ok(); - encointer_communities::Pallet::::set_max_speed_mps(RawOrigin::Root.into(), 83).ok(); - encointer_communities::Pallet::::new_community( + pallet_encointer_communities::Pallet::::set_min_solar_trip_time_s(RawOrigin::Root.into(), 1) + .ok(); + pallet_encointer_communities::Pallet::::set_max_speed_mps(RawOrigin::Root.into(), 83).ok(); + pallet_encointer_communities::Pallet::::new_community( RawOrigin::Root.into(), location, bs.clone(), @@ -113,7 +114,7 @@ where /// We purposely don't use `run_to_next_phase` because in the actual node aura complained /// when the timestamps were manipulated. fn next_phase() { - encointer_scheduler::Pallet::::next_phase(RawOrigin::Root.into()).unwrap(); + pallet_encointer_scheduler::Pallet::::next_phase(RawOrigin::Root.into()).unwrap(); } pub fn account_id(account: &TestPublic) -> T::AccountId @@ -131,10 +132,10 @@ where ::AccountId: ByteArray, ::Signature: From, { - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); let prover_account: T::AccountId = account_id::(prover); - assert_ok!(encointer_balances::Pallet::::issue( + assert_ok!(pallet_encointer_balances::Pallet::::issue( cid, &prover_account, NominalIncome::from_num(1) @@ -145,7 +146,7 @@ where Reputation::VerifiedUnlinked ); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); IssuedRewards::::insert((cid, cindex - 1), 0, MeetupResult::Ok); let proof = create_proof_of_attendance::(prover_account, cid, cindex - 1, prover); proof @@ -212,7 +213,7 @@ benchmarks! { let zoran = generate_pair(); let zoran_account= account_id::(&zoran); let proof = fake_last_attendance_and_get_proof::(&zoran, cid); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); assert_eq!(ReputableCount::::get((cid, cindex)), 0); }: _(RawOrigin::Signed(zoran_account.clone()), cid, Some(proof)) @@ -230,7 +231,7 @@ benchmarks! { let zoran = generate_pair(); let zoran_account= account_id::(&zoran); let proof = fake_last_attendance_and_get_proof::(&zoran, cid); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); assert_ok!(Pallet::::register_participant( RawOrigin::Signed(zoran_account.clone()).into(), @@ -255,7 +256,7 @@ benchmarks! { let zoran = generate_pair(); let zoran_account= account_id::(&zoran); let proof = fake_last_attendance_and_get_proof::(&zoran, cid); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); assert_ok!(Pallet::::register_participant( RawOrigin::Signed(zoran_account.clone()).into(), @@ -294,7 +295,7 @@ benchmarks! { next_phase::(); next_phase::(); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); let mindex = 1; }: _(RawOrigin::Signed(attestor_account.clone()), cid, 3, attestees) @@ -306,14 +307,14 @@ benchmarks! { endorse_newcomer { let cid = create_community::(); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); // we let the newbie be endorsed by a reputable as this is the worst case scenario let zoran = account_id::(&generate_pair()); Pallet::::fake_reputation((cid, cindex - 1), &zoran, Reputation::VerifiedUnlinked); // issue some income such that newbies are allowed to register - assert_ok!(encointer_balances::Pallet::::issue( + assert_ok!(pallet_encointer_balances::Pallet::::issue( cid, &zoran, NominalIncome::from_num(1) @@ -340,7 +341,7 @@ benchmarks! { next_phase::(); next_phase::(); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); let loc = test_location(); let time = crate::Pallet::::get_meetup_time(loc).expect("Could not get meetup time"); let mindex = 1; @@ -408,7 +409,7 @@ benchmarks! { purge_community_ceremony { let cid = create_community::(); - let cindex = encointer_scheduler::Pallet::::current_ceremony_index(); + let cindex = pallet_encointer_scheduler::Pallet::::current_ceremony_index(); let user = generate_pair(); assert_ok!(Pallet::::register_participant(RawOrigin::Signed(account_id::(&user.clone())).into(), cid, Some(fake_last_attendance_and_get_proof::(&user.clone(), cid)))); assert_eq!(ReputableCount::::get((cid, cindex)), 1); diff --git a/ceremonies/src/lib.rs b/ceremonies/src/lib.rs index c4bbf945..59341f36 100644 --- a/ceremonies/src/lib.rs +++ b/ceremonies/src/lib.rs @@ -25,7 +25,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode}; use encointer_ceremonies_assignment::{ assignment_fn_inverse, generate_assignment_function_params, get_meetup_location_index, math::{checked_ceil_division, find_prime_below, find_random_coprime_below}, @@ -39,7 +38,6 @@ use encointer_primitives::{ scheduler::{CeremonyIndexType, CeremonyPhaseType}, RandomNumberGenerator, }; -use encointer_scheduler::OnCeremonyPhaseChange; use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo, Pays}, ensure, @@ -48,6 +46,8 @@ use frame_support::{ }; use frame_system::ensure_signed; use log::{debug, error, info, trace, warn}; +use pallet_encointer_scheduler::OnCeremonyPhaseChange; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_core::bounded::BoundedSlice; use sp_runtime::traits::{IdentifyAccount, Member, Verify}; @@ -80,9 +80,9 @@ pub mod pallet { pub trait Config: frame_system::Config + pallet_timestamp::Config - + encointer_communities::Config - + encointer_balances::Config - + encointer_scheduler::Config + + pallet_encointer_communities::Config + + pallet_encointer_balances::Config + + pallet_encointer_scheduler::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -117,18 +117,18 @@ pub mod pallet { proof: Option>, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; - let current_phase = >::current_phase(); + let current_phase = >::current_phase(); ensure!( CeremonyPhaseType::is_registering_or_attesting(¤t_phase), Error::::RegisteringOrAttestationPhaseRequired ); ensure!( - >::community_identifiers().contains(&cid), + >::community_identifiers().contains(&cid), Error::::InexistentCommunity ); - let mut cindex = >::current_ceremony_index(); + let mut cindex = >::current_ceremony_index(); if current_phase == CeremonyPhaseType::Attesting { cindex += 1 @@ -190,9 +190,9 @@ pub mod pallet { proof: ProofOfAttendance, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin.clone())?; - let current_phase = >::current_phase(); + let current_phase = >::current_phase(); ensure!( - >::community_identifiers().contains(&cid), + >::community_identifiers().contains(&cid), Error::::InexistentCommunity ); @@ -201,7 +201,7 @@ pub mod pallet { Error::::RegisteringOrAttestationPhaseRequired ); - let mut cindex = >::current_ceremony_index(); + let mut cindex = >::current_ceremony_index(); if current_phase == CeremonyPhaseType::Attesting { cindex += 1 @@ -226,18 +226,18 @@ pub mod pallet { maybe_reputation_community_ceremony: Option, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; - let current_phase = >::current_phase(); + let current_phase = >::current_phase(); ensure!( CeremonyPhaseType::is_registering_or_attesting(¤t_phase), Error::::RegisteringOrAttestationPhaseRequired ); ensure!( - >::community_identifiers().contains(&cid), + >::community_identifiers().contains(&cid), Error::::InexistentCommunity ); - let mut cindex = >::current_ceremony_index(); + let mut cindex = >::current_ceremony_index(); if current_phase == CeremonyPhaseType::Attesting { cindex += 1 @@ -279,11 +279,12 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; ensure!( - >::current_phase() == CeremonyPhaseType::Attesting, + >::current_phase() + == CeremonyPhaseType::Attesting, Error::::AttestationPhaseRequired ); ensure!( - >::community_identifiers().contains(&cid), + >::community_identifiers().contains(&cid), Error::::InexistentCommunity ); @@ -330,12 +331,14 @@ pub mod pallet { let sender = ensure_signed(origin)?; ensure!( - >::community_identifiers().contains(&cid), + >::community_identifiers().contains(&cid), Error::::InexistentCommunity ); - let mut cindex = >::current_ceremony_index(); - if >::current_phase() != CeremonyPhaseType::Registering { + let mut cindex = >::current_ceremony_index(); + if >::current_phase() + != CeremonyPhaseType::Registering + { cindex += 1; //safe; cindex comes from within, will not overflow at +1/d } @@ -372,8 +375,8 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let participant = &ensure_signed(origin)?; - let current_phase = >::current_phase(); - let mut cindex = >::current_ceremony_index(); + let current_phase = >::current_phase(); + let mut cindex = >::current_ceremony_index(); match current_phase { CeremonyPhaseType::Registering => cindex -= 1, CeremonyPhaseType::Attesting => (), @@ -573,7 +576,9 @@ pub mod pallet { meetup_time_offset: MeetupTimeOffsetType, ) -> DispatchResultWithPostInfo { ::CeremonyMaster::ensure_origin(origin)?; - if >::current_phase() != CeremonyPhaseType::Registering { + if >::current_phase() + != CeremonyPhaseType::Registering + { return Err(>::WrongPhaseForChangingMeetupTimeOffset.into()); } @@ -1103,9 +1108,9 @@ impl Pallet { cid: CommunityIdentifier, account: &T::AccountId, ) -> AggregatedAccountData { - let cindex = >::current_ceremony_index(); + let cindex = >::current_ceremony_index(); let aggregated_account_data_global = AggregatedAccountDataGlobal { - ceremony_phase: >::current_phase(), + ceremony_phase: >::current_phase(), ceremony_index: cindex, }; @@ -1123,7 +1128,7 @@ impl Pallet { // check if the participant is already assigned to a meetup if let Some(participant_meetup_index) = Self::get_meetup_index((cid, cindex), account) { meetup_index = Some(participant_meetup_index); - let locations = >::get_locations(&cid); + let locations = >::get_locations(&cid); let location_assignment_params = Self::assignments((cid, cindex)).locations; meetup_location_index = get_meetup_location_index( @@ -1160,8 +1165,8 @@ impl Pallet { pub fn get_ceremony_info() -> CeremonyInfo { CeremonyInfo { - ceremony_phase: >::current_phase(), - ceremony_index: >::current_ceremony_index(), + ceremony_phase: >::current_phase(), + ceremony_index: >::current_ceremony_index(), } } @@ -1172,7 +1177,7 @@ impl Pallet { is_reputable: bool, ) -> Result> { let participant_type = - if >::bootstrappers(cid).contains(sender) { + if >::bootstrappers(cid).contains(sender) { let participant_index = >::get((cid, cindex)) .checked_add(1) .ok_or(Error::::RegistryOverflow)?; @@ -1180,7 +1185,7 @@ impl Pallet { >::insert((cid, cindex), sender, participant_index); >::insert((cid, cindex), participant_index); ParticipantType::Bootstrapper - } else if >::total_issuance(cid) <= 0 { + } else if >::total_issuance(cid) <= 0 { return Err(Error::::OnlyBootstrappers); } else if is_reputable { let participant_index = >::get((cid, cindex)) @@ -1217,7 +1222,9 @@ impl Pallet { cindex: CeremonyIndexType, participant: &T::AccountId, ) -> Result<(), Error> { - if >::current_phase() != CeremonyPhaseType::Registering { + if >::current_phase() + != CeremonyPhaseType::Registering + { return Err(>::WrongPhaseForUnregistering); } @@ -1290,7 +1297,7 @@ impl Pallet { return Ok(()); } - if >::bootstrappers(cid).contains(sender) + if >::bootstrappers(cid).contains(sender) && >::get(cid, sender) < Self::endorsement_tickets_per_bootstrapper() { @@ -1349,7 +1356,7 @@ impl Pallet { } fn purge_registry(cindex: CeremonyIndexType) { - let cids = >::community_identifiers(); + let cids = >::community_identifiers(); for cid in cids.into_iter() { Self::purge_community_ceremony_internal((cid, cindex)); } @@ -1417,7 +1424,8 @@ impl Pallet { random_source: &mut RandomNumberGenerator, ) -> AssignmentParams { let num_locations = - >::get_locations(&community_ceremony.0).len() as u64; + >::get_locations(&community_ceremony.0).len() + as u64; AssignmentParams { m: num_locations, @@ -1431,7 +1439,8 @@ impl Pallet { meetup_multiplier: u64, ) -> Result> { let num_locations = - >::get_locations(&community_ceremony.0).len() as u64; + >::get_locations(&community_ceremony.0).len() + as u64; debug!( target: LOG, "Number of locations for cid {:?} is {:?}", community_ceremony.0, num_locations @@ -1513,7 +1522,7 @@ impl Pallet { } fn purge_community(cid: CommunityIdentifier) { - let current = >::current_ceremony_index(); + let current = >::current_ceremony_index(); let reputation_lifetime = Self::reputation_lifetime(); for cindex in current.saturating_sub(reputation_lifetime)..=current { @@ -1525,12 +1534,12 @@ impl Pallet { #[allow(deprecated)] >::remove_prefix(cid, None); - >::remove_community(cid); + >::remove_community(cid); } fn generate_all_meetup_assignment_params() { - let cids = >::community_identifiers(); - let cindex = >::current_ceremony_index(); + let cids = >::community_identifiers(); + let cindex = >::current_ceremony_index(); // we don't need to pass a subject here, as this is only called once in a block. let mut random_source = @@ -1724,7 +1733,7 @@ impl Pallet { cc: CommunityCeremony, meetup_idx: MeetupIndexType, ) -> Option { - let locations = >::get_locations(&cc.0); + let locations = >::get_locations(&cc.0); let assignment_params = Self::assignments(cc).locations; meetup_location(meetup_idx, locations, assignment_params) @@ -1732,13 +1741,15 @@ impl Pallet { // this function only works during ATTESTING, so we're keeping it for private use pub(crate) fn get_meetup_time(location: Location) -> Option { - if !(>::current_phase() == CeremonyPhaseType::Attesting) { + if !(>::current_phase() + == CeremonyPhaseType::Attesting) + { return None; } let duration = - >::phase_durations(CeremonyPhaseType::Attesting); - let next = >::next_phase_timestamp(); + >::phase_durations(CeremonyPhaseType::Attesting); + let next = >::next_phase_timestamp(); let start = next - duration; Some(meetup_time::( @@ -1752,7 +1763,7 @@ impl Pallet { /// Returns the community-specific nominal income if it is set. Otherwise returns the /// the ceremony reward defined in the genesis config. pub fn nominal_income(cid: &CommunityIdentifier) -> NominalIncome { - encointer_communities::NominalIncome::::try_get(cid) + pallet_encointer_communities::NominalIncome::::try_get(cid) .unwrap_or_else(|_| Self::ceremony_reward()) } @@ -1771,7 +1782,7 @@ impl Pallet { .ok_or(Error::::MeetupValidationIndexOutOfBounds)?; trace!(target: LOG, "participant merits reward: {:?}", participant); - if >::issue(cid, participant, reward).is_ok() { + if >::issue(cid, participant, reward).is_ok() { >::insert( (&cid, cindex), participant, @@ -1828,7 +1839,7 @@ impl Pallet { cid: &CommunityIdentifier, participant: &T::AccountId, ) -> Result, Error> { - let cindex = >::current_ceremony_index(); + let cindex = >::current_ceremony_index(); let meetup_index = Self::get_meetup_index((*cid, cindex), participant) .ok_or(Error::::ParticipantIsNotRegistered)?; @@ -1901,7 +1912,7 @@ impl Pallet { fn has_reputation(participant: &T::AccountId, cid: &CommunityIdentifier) -> bool { let reputation_lifetime = Self::reputation_lifetime(); - let cindex = >::current_ceremony_index(); + let cindex = >::current_ceremony_index(); for i in 0..=reputation_lifetime { if Self::participant_reputation((*cid, cindex.saturating_sub(i)), participant) .is_verified() @@ -1931,7 +1942,7 @@ impl Pallet { cid: &CommunityIdentifier, cindex: CeremonyIndexType, ) -> bool { - let current_cindex = >::current_ceremony_index(); + let current_cindex = >::current_ceremony_index(); if cindex < current_cindex.saturating_sub(Self::reputation_lifetime()) { return false; } @@ -1952,9 +1963,10 @@ impl OnCeremonyPhaseChange for Pallet { match new_phase { CeremonyPhaseType::Assigning => { let inactives = Self::update_inactivity_counters( - >::current_ceremony_index().saturating_sub(1), + >::current_ceremony_index() + .saturating_sub(1), Self::inactivity_timeout(), - >::community_identifiers().to_vec(), + >::community_identifiers().to_vec(), ); for inactive in inactives { Self::purge_community(inactive); @@ -1964,7 +1976,7 @@ impl OnCeremonyPhaseChange for Pallet { }, CeremonyPhaseType::Attesting => {}, CeremonyPhaseType::Registering => { - let cindex = >::current_ceremony_index(); + let cindex = >::current_ceremony_index(); // Clean up with a time delay, such that participants can claim their UBI in the following cycle. if cindex > Self::reputation_lifetime() { Self::purge_registry( diff --git a/ceremonies/src/mock.rs b/ceremonies/src/mock.rs index 780053df..ce3e365f 100644 --- a/ceremonies/src/mock.rs +++ b/ceremonies/src/mock.rs @@ -36,10 +36,10 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, EncointerCeremonies: dut::{Pallet, Call, Storage, Config, Event}, - EncointerCommunities: encointer_communities::{Pallet, Call, Storage, Event}, - EncointerBalances: encointer_balances::{Pallet, Call, Storage, Event}, + EncointerCommunities: pallet_encointer_communities::{Pallet, Call, Storage, Event}, + EncointerBalances: pallet_encointer_balances::{Pallet, Call, Storage, Event}, } ); @@ -77,7 +77,7 @@ impl_encointer_balances!(TestRuntime); // genesis values pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - encointer_scheduler::GenesisConfig:: { + pallet_encointer_scheduler::GenesisConfig:: { current_phase: CeremonyPhaseType::Registering, current_ceremony_index: 1, phase_durations: vec![ @@ -103,7 +103,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_communities::GenesisConfig:: { + pallet_encointer_communities::GenesisConfig:: { min_solar_trip_time_s: 1, max_speed_mps: 83, ..Default::default() diff --git a/ceremonies/src/storage_helper.rs b/ceremonies/src/storage_helper.rs index 46a91685..c6975b71 100644 --- a/ceremonies/src/storage_helper.rs +++ b/ceremonies/src/storage_helper.rs @@ -1,9 +1,9 @@ -use codec::{Decode, EncodeLike}; use encointer_primitives::{ ceremonies::{CommunityCeremony, ParticipantIndexType}, communities::CommunityIdentifier, scheduler::CeremonyIndexType, }; +use parity_scale_codec::{Decode, EncodeLike}; pub fn remove_participant_from_registry( cid: CommunityIdentifier, cindex: CeremonyIndexType, diff --git a/ceremonies/src/tests.rs b/ceremonies/src/tests.rs index 620fdf33..4634c5ef 100644 --- a/ceremonies/src/tests.rs +++ b/ceremonies/src/tests.rs @@ -16,7 +16,6 @@ use super::*; use approx::assert_abs_diff_eq; -use encointer_balances::Event as BalancesEvent; use encointer_primitives::{ communities::{CommunityIdentifier, Degree, Location, LossyInto}, scheduler::{CeremonyIndexType, CeremonyPhaseType}, @@ -30,6 +29,7 @@ use mock::{ master, new_test_ext, EncointerBalances, EncointerCeremonies, EncointerCommunities, EncointerScheduler, RuntimeOrigin, System, TestProofOfAttendance, TestRuntime, Timestamp, }; +use pallet_encointer_balances::Event as BalancesEvent; use rstest::*; use sp_core::{bounded_vec, sr25519, Pair, H256}; use sp_runtime::{traits::BlakeTwo256, DispatchError}; @@ -2014,9 +2014,8 @@ fn purge_inactive_communities_works() { System::set_block_number(System::block_number() + 1); // this is needed to assert events let cid = perform_bootstrapping_ceremony(None, 1); - assert!( - >::community_identifiers().contains(&cid) - ); + assert!(>::community_identifiers() + .contains(&cid)); // inactivity counter is 1, beacuse of a full ceremony cycle in the bootstrapping ceremony // without any rewards being claimed @@ -2029,9 +2028,8 @@ fn purge_inactive_communities_works() { Some(Event::InactivityCounterUpdated(cid, 2).into()) ); - assert!( - >::community_identifiers().contains(&cid) - ); + assert!(>::community_identifiers() + .contains(&cid)); assert_eq!(EncointerCeremonies::inactivity_counters(cid).unwrap(), 2); // issued rewards will cause inactivity counter to go to 0 in the next cycle @@ -2049,35 +2047,31 @@ fn purge_inactive_communities_works() { Some(Event::InactivityCounterUpdated(cid, 0).into()) ); - assert!( - >::community_identifiers().contains(&cid) - ); + assert!(>::community_identifiers() + .contains(&cid)); assert_eq!(EncointerCeremonies::inactivity_counters(cid).unwrap(), 0); run_to_next_phase(); run_to_next_phase(); run_to_next_phase(); - assert!( - >::community_identifiers().contains(&cid) - ); + assert!(>::community_identifiers() + .contains(&cid)); assert_eq!(EncointerCeremonies::inactivity_counters(cid).unwrap(), 1); run_to_next_phase(); run_to_next_phase(); run_to_next_phase(); - assert!( - >::community_identifiers().contains(&cid) - ); + assert!(>::community_identifiers() + .contains(&cid)); assert_eq!(EncointerCeremonies::inactivity_counters(cid).unwrap(), 2); run_to_next_phase(); run_to_next_phase(); run_to_next_phase(); - assert!( - >::community_identifiers().contains(&cid) - ); + assert!(>::community_identifiers() + .contains(&cid)); // now the inactivity counter is 3 == inactivity_timeout, so in the next cycle the community will be purged assert_eq!(EncointerCeremonies::inactivity_counters(cid).unwrap(), 3); @@ -2086,9 +2080,8 @@ fn purge_inactive_communities_works() { run_to_next_phase(); // here community gets purged - assert!( - !>::community_identifiers().contains(&cid) - ); + assert!(!>::community_identifiers() + .contains(&cid)); }); } diff --git a/communities/Cargo.toml b/communities/Cargo.toml index 7a4399dd..17ce4557 100644 --- a/communities/Cargo.toml +++ b/communities/Cargo.toml @@ -9,58 +9,52 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-balances = { package = "pallet-encointer-balances", path = "../balances", default-features = false, version = "3.0.2" } -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } -encointer-scheduler = { package = "pallet-encointer-scheduler", path = "../scheduler", default-features = false, version = "3.0.3" } +encointer-primitives = { workspace = true } +pallet-encointer-balances = { workspace = true } +pallet-encointer-scheduler = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -sp-io = { default-features = false, version = "27.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -approx = "0.5.1" -sp-core = "25.0.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +sp-core = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ - "codec/std", - "encointer-balances/std", - # local deps "encointer-primitives/std", - "encointer-scheduler/std", - # substrate deps "frame-support/std", "frame-system/std", "log/std", + "pallet-encointer-balances/std", + "pallet-encointer-scheduler/std", + "parity-scale-codec/std", "scale-info/std", "sp-io/std", "sp-runtime/std", "sp-std/std", ] runtime-benchmarks = [ - "encointer-balances/runtime-benchmarks", - "encointer-scheduler/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", - ] try-runtime = [ - "encointer-balances/try-runtime", - "encointer-scheduler/try-runtime", "frame-system/try-runtime", - + "pallet-encointer-balances/try-runtime", + "pallet-encointer-scheduler/try-runtime", ] diff --git a/communities/rpc/Cargo.toml b/communities/rpc/Cargo.toml index c4933817..2332c5f6 100644 --- a/communities/rpc/Cargo.toml +++ b/communities/rpc/Cargo.toml @@ -9,26 +9,22 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -jsonrpsee = { version = "0.16.3", features = [ - "client-core", - "server", - "macros", -] } -log = "0.4.20" -parking_lot = "0.12.0" -thiserror = "1.0.31" +jsonrpsee = { workspace = true } +log = { workspace = true, features = ["std"] } +parking_lot = { workspace = true } +thiserror = { workspace = true } # local deps -encointer-communities-rpc-runtime-api = { package = "pallet-encointer-communities-rpc-runtime-api", path = "runtime-api", version = "3.0.2" } -encointer-primitives = { path = "../../primitives", version = "3.0.2" } -encointer-rpc = { path = "../../rpc", version = "3.0.2" } +encointer-primitives = { workspace = true } +encointer-rpc = { workspace = true } +pallet-encointer-communities-rpc-runtime-api = { workspace = true } # substrate deps -sc-rpc = "26.0.0" -sc-rpc-api = "0.30.0" -sp-api = "23.0.0" -sp-blockchain = "25.0.0" -sp-runtime = "28.0.0" +sc-rpc = { workspace = true } +sc-rpc-api = { workspace = true } +sp-api = { workspace = true, features = ["std"] } +sp-blockchain = { workspace = true } +sp-runtime = { workspace = true, features = ["std"] } [dev-dependencies] -sp-core = "25.0.0" +sp-core = { workspace = true, features = ["std"] } diff --git a/communities/rpc/runtime-api/Cargo.toml b/communities/rpc/runtime-api/Cargo.toml index 09580c6a..9da1290b 100644 --- a/communities/rpc/runtime-api/Cargo.toml +++ b/communities/rpc/runtime-api/Cargo.toml @@ -10,11 +10,11 @@ license = "GPL-3.0-or-later" [dependencies] # local deps -encointer-primitives = { path = "../../../primitives", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -sp-api = { default-features = false, version = "23.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +sp-api = { workspace = true } +sp-std = { workspace = true } [features] default = ["std"] diff --git a/communities/rpc/src/lib.rs b/communities/rpc/src/lib.rs index 07c730a6..977689fe 100644 --- a/communities/rpc/src/lib.rs +++ b/communities/rpc/src/lib.rs @@ -24,11 +24,11 @@ use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; -use encointer_communities_rpc_runtime_api::CommunitiesApi as CommunitiesRuntimeApi; use encointer_primitives::{ balances::BalanceEntry, communities::{consts::CACHE_DIRTY_KEY, CidName, CommunityIdentifier, Location}, }; +use pallet_encointer_communities_rpc_runtime_api::CommunitiesApi as CommunitiesRuntimeApi; use parking_lot::RwLock; use sp_api::offchain::{OffchainStorage, STORAGE_PREFIX}; diff --git a/communities/src/benchmarking.rs b/communities/src/benchmarking.rs index 7fa67169..7de57d20 100644 --- a/communities/src/benchmarking.rs +++ b/communities/src/benchmarking.rs @@ -131,7 +131,7 @@ benchmarks! { assert_ok!(Communities::::update_demurrage(RawOrigin::Root.into(), cid, Demurrage::from_num(0.5))); } verify { - assert_eq!(encointer_balances::Pallet::::demurrage_per_block(&cid), 0.5); + assert_eq!(pallet_encointer_balances::Pallet::::demurrage_per_block(&cid), 0.5); } update_nominal_income { diff --git a/communities/src/lib.rs b/communities/src/lib.rs index 1ffb515b..025fb221 100644 --- a/communities/src/lib.rs +++ b/communities/src/lib.rs @@ -23,7 +23,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::Encode; use core::marker::PhantomData; use encointer_primitives::{ balances::{BalanceEntry, Demurrage}, @@ -38,6 +37,7 @@ use encointer_primitives::{ use frame_support::{ensure, pallet_prelude::DispatchResultWithPostInfo, BoundedVec}; use frame_system::pallet_prelude::BlockNumberFor; use log::{info, warn}; +use parity_scale_codec::Encode; use sp_runtime::{traits::Get, DispatchResult, SaturatedConversion}; use sp_std::{prelude::*, result::Result}; @@ -61,7 +61,9 @@ pub mod pallet { #[pallet::config] pub trait Config: - frame_system::Config + encointer_scheduler::Config + encointer_balances::Config + frame_system::Config + + pallet_encointer_scheduler::Config + + pallet_encointer_balances::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -145,7 +147,7 @@ pub mod pallet { >::insert(cid, &community_metadata); if let Some(d) = demurrage { - >::set_demurrage(&cid, d) + >::set_demurrage(&cid, d) .map_err(|_| >::InvalidDemurrage)?; } if let Some(i) = nominal_income { @@ -175,7 +177,8 @@ pub mod pallet { T::TrustableForNonDestructiveAction::ensure_origin(origin)?; ensure!( - >::current_phase() == CeremonyPhaseType::Registering, + >::current_phase() + == CeremonyPhaseType::Registering, Error::::RegistrationPhaseRequired ); Self::ensure_cid_exists(&cid)?; @@ -225,7 +228,8 @@ pub mod pallet { T::CommunityMaster::ensure_origin(origin)?; ensure!( - >::current_phase() == CeremonyPhaseType::Registering, + >::current_phase() + == CeremonyPhaseType::Registering, Error::::RegistrationPhaseRequired ); Self::ensure_cid_exists(&cid)?; @@ -277,7 +281,7 @@ pub mod pallet { Self::ensure_cid_exists(&cid)?; - >::set_demurrage(&cid, demurrage) + >::set_demurrage(&cid, demurrage) .map_err(|_| >::InvalidDemurrage)?; info!(target: LOG, " updated demurrage for cid: {:?}", cid); @@ -525,7 +529,7 @@ impl Pallet { >::remove(cid); - >::purge_balances(cid); + >::purge_balances(cid); Self::deposit_event(Event::CommunityPurged(cid)); } @@ -582,7 +586,7 @@ impl Pallet { i64::lossy_from(d).saturated_into() } - fn validate_bootstrappers(bootstrappers: &Vec) -> DispatchResult { + fn validate_bootstrappers(bootstrappers: &[T::AccountId]) -> DispatchResult { ensure!( bootstrappers.len() <= T::MaxBootstrappers::get() as usize, >::InvalidAmountBootstrappers @@ -736,10 +740,10 @@ impl Pallet { ) -> Vec<(CommunityIdentifier, BalanceEntry>)> { let mut balances: Vec<(CommunityIdentifier, BalanceEntry>)> = vec![]; for cid in Self::community_identifiers().into_iter() { - if encointer_balances::Balance::::contains_key(cid, account.clone()) { + if pallet_encointer_balances::Balance::::contains_key(cid, account.clone()) { balances.push(( cid, - >::balance_entry(cid, &account.clone()), + >::balance_entry(cid, &account.clone()), )); } } diff --git a/communities/src/mock.rs b/communities/src/mock.rs index 42d21d75..ea308971 100644 --- a/communities/src/mock.rs +++ b/communities/src/mock.rs @@ -29,9 +29,9 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, EncointerCommunities: dut::{Pallet, Call, Storage, Event}, - EncointerBalances: encointer_balances::{Pallet, Call, Storage, Event}, + EncointerBalances: pallet_encointer_balances::{Pallet, Call, Storage, Event}, } ); @@ -60,7 +60,7 @@ impl_encointer_balances!(TestRuntime); pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - encointer_scheduler::GenesisConfig:: { + pallet_encointer_scheduler::GenesisConfig:: { current_phase: CeremonyPhaseType::Registering, current_ceremony_index: 1, phase_durations: vec![ diff --git a/communities/src/tests.rs b/communities/src/tests.rs index a0d52c51..76c9eeea 100644 --- a/communities/src/tests.rs +++ b/communities/src/tests.rs @@ -305,7 +305,7 @@ fn updating_demurrage_works() { new_test_ext().execute_with(|| { System::set_block_number(System::block_number() + 1); // this is needed to assert events let cid = register_test_community(None, 0.0, 0.0); - assert!(encointer_balances::DemurragePerBlock::::try_get(cid).is_err()); + assert!(pallet_encointer_balances::DemurragePerBlock::::try_get(cid).is_err()); let demurrage = Demurrage::from_num(0.0001); assert_ok!(EncointerCommunities::update_demurrage( RuntimeOrigin::signed(AccountKeyring::Alice.into()), @@ -317,7 +317,7 @@ fn updating_demurrage_works() { Some(Event::DemurrageUpdated(cid, demurrage).into()) ); assert_eq!( - encointer_balances::DemurragePerBlock::::try_get(cid).unwrap(), + pallet_encointer_balances::DemurragePerBlock::::try_get(cid).unwrap(), demurrage ); }); diff --git a/democracy/Cargo.toml b/democracy/Cargo.toml index 4c6a6883..d1ad935a 100644 --- a/democracy/Cargo.toml +++ b/democracy/Cargo.toml @@ -10,73 +10,73 @@ license = "GPL-3.0-or-later" publish = false [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = ["derive"] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-ceremonies = { package = "pallet-encointer-ceremonies", path = "../ceremonies", default-features = false, version = "3.0.2" } -encointer-communities = { package = "pallet-encointer-communities", path = "../communities", default-features = false, version = "3.0.2" } -encointer-primitives = { path = "../primitives", default-features = false, version = "3.0.2" } -encointer-scheduler = { package = "pallet-encointer-scheduler", path = "../scheduler", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } +pallet-encointer-ceremonies = { workspace = true } +pallet-encointer-communities = { workspace = true } +pallet-encointer-scheduler = { workspace = true } # substrate deps -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-timestamp = { default-features = false, version = "24.0.0" } -sp-io = { default-features = false, version = "27.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-timestamp = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } # benchmarking -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -sp-application-crypto = { default-features = false, optional = true, version = "27.0.0" } -sp-core = { default-features = false, optional = true, version = "25.0.0" } +frame-benchmarking = { workspace = true, optional = true } +sp-application-crypto = { workspace = true, optional = true } +sp-core = { workspace = true, optional = true } [dev-dependencies] -approx = "0.5.1" -encointer-ceremonies = { package = "pallet-encointer-ceremonies", path = "../ceremonies", default-features = false, features = ["mocks"] } -encointer-balances = { package = "pallet-encointer-balances", path = "../balances", default-features = false } -itertools = "0.10.3" -rstest = "0.12.0" -sp-io = "27.0.0" -sp-keystore = "0.31.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +pallet-encointer-ceremonies = { workspace = true, features = ["mocks"] } +pallet-encointer-balances = { workspace = true } +itertools = { workspace = true } +rstest = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +sp-keystore = { workspace = true } +test-utils = { workspace = true } [features] default = ["std"] std = [ - "codec/std", - "encointer-balances/std", - "encointer-ceremonies/std", - "encointer-communities/std", "encointer-primitives/std", - "encointer-scheduler/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std", "log/std", + "pallet-encointer-balances/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities/std", + "pallet-encointer-scheduler/std", "pallet-timestamp/std", + "parity-scale-codec/std", "scale-info/std", "sp-core/std", "sp-io/std", "sp-std/std", ] runtime-benchmarks = [ - "encointer-balances/runtime-benchmarks", - "encointer-ceremonies/runtime-benchmarks", - "encointer-communities/runtime-benchmarks", - "encointer-scheduler/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", "sp-application-crypto", "sp-core", ] try-runtime = [ - "encointer-balances/try-runtime", - "encointer-ceremonies/try-runtime", - "encointer-communities/try-runtime", - "encointer-scheduler/try-runtime", "frame-system/try-runtime", + "pallet-encointer-balances/try-runtime", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-scheduler/try-runtime", ] diff --git a/democracy/src/benchmarking.rs b/democracy/src/benchmarking.rs index f023e3eb..0f133188 100644 --- a/democracy/src/benchmarking.rs +++ b/democracy/src/benchmarking.rs @@ -1,5 +1,4 @@ use crate::{Pallet as EncointerDemocracy, *}; -use codec::Encode; use encointer_primitives::{ ceremonies::Reputation, communities::CommunityIdentifier, @@ -9,6 +8,7 @@ use encointer_primitives::{ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_support::{assert_ok, traits::OnInitialize, BoundedVec}; use frame_system::RawOrigin; +use parity_scale_codec::Encode; #[cfg(not(feature = "std"))] use sp_std::vec; diff --git a/democracy/src/lib.rs b/democracy/src/lib.rs index 7da2150a..22ed6850 100644 --- a/democracy/src/lib.rs +++ b/democracy/src/lib.rs @@ -25,8 +25,8 @@ use encointer_primitives::{ fixed::{transcendental::sqrt, types::U64F64}, scheduler::{CeremonyIndexType, CeremonyPhaseType}, }; -use encointer_scheduler::OnCeremonyPhaseChange; use frame_support::traits::Get; +use pallet_encointer_scheduler::OnCeremonyPhaseChange; pub use weights::WeightInfo; #[cfg(not(feature = "std"))] @@ -55,9 +55,9 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config - + encointer_scheduler::Config - + encointer_ceremonies::Config - + encointer_communities::Config + + pallet_encointer_scheduler::Config + + pallet_encointer_ceremonies::Config + + pallet_encointer_communities::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -163,7 +163,7 @@ pub mod pallet { return Err(Error::::ProposalWaitingForEnactment.into()); } let _sender = ensure_signed(origin)?; - let cindex = >::current_ceremony_index(); + let cindex = >::current_ceremony_index(); let current_proposal_id = Self::proposal_count(); let next_proposal_id = current_proposal_id .checked_add(1u128) @@ -239,7 +239,8 @@ pub mod pallet { fn relevant_cindexes( proposal_id: ProposalIdType, ) -> Result, Error> { - let reputation_lifetime = >::reputation_lifetime(); + let reputation_lifetime = + >::reputation_lifetime(); let proposal = Self::proposals(proposal_id).ok_or(Error::::InexistentProposal)?; Ok(((proposal .start_cindex @@ -282,7 +283,7 @@ pub mod pallet { if >::contains_key(proposal_id, (account_id, community_ceremony)) { continue; } - if >::validate_reputation( + if >::validate_reputation( account_id, &community_ceremony.0, community_ceremony.1, @@ -351,13 +352,13 @@ pub mod pallet { ProposalAccessPolicy::Community(cid) => Ok(relevant_cindexes .into_iter() .map(|cindex| { - >::reputation_count((cid, cindex)) + >::reputation_count((cid, cindex)) }) .sum()), ProposalAccessPolicy::Global => Ok(relevant_cindexes .into_iter() .map(|cindex| { - >::global_reputation_count(cindex) + >::global_reputation_count(cindex) }) .sum()), } @@ -416,14 +417,14 @@ pub mod pallet { match proposal.action { ProposalAction::UpdateNominalIncome(cid, nominal_income) => { - let _ = >::do_update_nominal_income( + let _ = >::do_update_nominal_income( cid, nominal_income, ); }, ProposalAction::SetInactivityTimeout(inactivity_timeout) => { - let _ = >::do_set_inactivity_timeout( + let _ = >::do_set_inactivity_timeout( inactivity_timeout, ); }, diff --git a/democracy/src/mock.rs b/democracy/src/mock.rs index 83f9e5ba..ba3ad995 100644 --- a/democracy/src/mock.rs +++ b/democracy/src/mock.rs @@ -29,10 +29,10 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, - EncointerCommunities: encointer_communities::{Pallet, Call, Storage, Event}, - EncointerCeremonies: encointer_ceremonies::{Pallet, Call, Storage, Event}, - EncointerBalances: encointer_balances::{Pallet, Call, Storage, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerCommunities: pallet_encointer_communities::{Pallet, Call, Storage, Event}, + EncointerCeremonies: pallet_encointer_ceremonies::{Pallet, Call, Storage, Event}, + EncointerBalances: pallet_encointer_balances::{Pallet, Call, Storage, Event}, EncointerDemocracy: dut::{Pallet, Call, Storage, Config, Event}, } ); @@ -67,7 +67,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_scheduler::GenesisConfig:: { + pallet_encointer_scheduler::GenesisConfig:: { current_ceremony_index: 7, phase_durations: vec![ (CeremonyPhaseType::Registering, ONE_DAY), @@ -79,7 +79,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_ceremonies::GenesisConfig:: { + pallet_encointer_ceremonies::GenesisConfig:: { ceremony_reward: BalanceType::from_num(1), location_tolerance: LOCATION_TOLERANCE, // [m] time_tolerance: TIME_TOLERANCE, // [ms] @@ -93,7 +93,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_communities::GenesisConfig:: { + pallet_encointer_communities::GenesisConfig:: { min_solar_trip_time_s: 1, max_speed_mps: 83, ..Default::default() diff --git a/faucet/Cargo.toml b/faucet/Cargo.toml index a271e73d..e5565d51 100644 --- a/faucet/Cargo.toml +++ b/faucet/Cargo.toml @@ -9,46 +9,42 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -approx = { version = "0.5.1", optional = true } -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +approx = { workspace = true, optional = true } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-communities = { package = "pallet-encointer-communities", path = "../communities", default-features = false, version = "3.0.3" } -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } -encointer-reputation-commitments = { package = "pallet-encointer-reputation-commitments", path = "../reputation-commitments", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } +pallet-encointer-communities = { workspace = true } +pallet-encointer-reputation-commitments = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-treasury = { default-features = false, version = "24.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-treasury = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -approx = "0.5.1" -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ "approx/std", - "codec/std", - # local deps - "encointer-communities/std", "encointer-primitives/std", - "encointer-reputation-commitments/std", - # substrate deps "frame-support/std", "frame-system/std", "log/std", + "pallet-encointer-communities/std", + "pallet-encointer-reputation-commitments/std", "pallet-treasury/std", + "parity-scale-codec/std", "scale-info/std", "sp-core/std", "sp-runtime/std", @@ -56,15 +52,15 @@ std = [ ] runtime-benchmarks = [ "approx", - "encointer-communities/runtime-benchmarks", - "encointer-reputation-commitments/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-reputation-commitments/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", ] try-runtime = [ - "encointer-communities/try-runtime", - "encointer-reputation-commitments/try-runtime", "frame-system/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-reputation-commitments/try-runtime", ] diff --git a/faucet/src/benchmarking.rs b/faucet/src/benchmarking.rs index e33569a0..13621d1c 100644 --- a/faucet/src/benchmarking.rs +++ b/faucet/src/benchmarking.rs @@ -1,5 +1,4 @@ use crate::{Pallet as FaucetPallet, *}; -use codec::Encode; use encointer_primitives::{ ceremonies::Reputation, communities::{CommunityMetadata as CommunityMetadataType, Degree, Location}, @@ -9,6 +8,7 @@ use encointer_primitives::{ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_support::BoundedVec; use frame_system::RawOrigin; +use parity_scale_codec::Encode; use sp_std::vec; #[cfg(not(feature = "std"))] @@ -32,10 +32,11 @@ fn test_location() -> Location { fn create_community() -> CommunityIdentifier { let location = test_location(); let bs = bootstrappers::(); - encointer_communities::Pallet::::set_min_solar_trip_time_s(RawOrigin::Root.into(), 1).ok(); - encointer_communities::Pallet::::set_max_speed_mps(RawOrigin::Root.into(), 83).ok(); + pallet_encointer_communities::Pallet::::set_min_solar_trip_time_s(RawOrigin::Root.into(), 1) + .ok(); + pallet_encointer_communities::Pallet::::set_max_speed_mps(RawOrigin::Root.into(), 83).ok(); - encointer_communities::Pallet::::new_community( + pallet_encointer_communities::Pallet::::new_community( RawOrigin::Root.into(), location, bs.clone(), diff --git a/faucet/src/lib.rs b/faucet/src/lib.rs index 3771391a..7631baa8 100644 --- a/faucet/src/lib.rs +++ b/faucet/src/lib.rs @@ -16,7 +16,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::Decode; use core::marker::PhantomData; use encointer_primitives::{ communities::CommunityIdentifier, faucet::*, reputation_commitments::DescriptorType, @@ -32,6 +31,7 @@ use frame_support::{ }; use frame_system::{self as frame_system, ensure_signed}; use log::info; +use parity_scale_codec::Decode; use sp_core::H256; use sp_runtime::{traits::Hash, SaturatedConversion, Saturating}; use sp_std::convert::TryInto; @@ -69,8 +69,8 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config - + encointer_reputation_commitments::Config - + encointer_communities::Config + + pallet_encointer_reputation_commitments::Config + + pallet_encointer_communities::Config + pallet_treasury::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -99,7 +99,8 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let from = ensure_signed(origin)?; - let all_communities = encointer_communities::Pallet::::community_identifiers(); + let all_communities = + pallet_encointer_communities::Pallet::::community_identifiers(); if let Some(wl) = whitelist.clone() { for cid in &wl { if !all_communities.contains(cid) { @@ -134,10 +135,11 @@ pub mod pallet { ::Currency::transfer(&from, &faucet_account, amount, KeepAlive) .map_err(|_| >::InsuffiecientBalance)?; - let purpose_id = >::do_register_purpose( - DescriptorType::try_from(faucet_identifier) - .map_err(|_| >::PurposeIdCreationFailed)?, - )?; + let purpose_id = + >::do_register_purpose( + DescriptorType::try_from(faucet_identifier) + .map_err(|_| >::PurposeIdCreationFailed)?, + )?; >::insert( &faucet_account, @@ -167,7 +169,7 @@ pub mod pallet { } } - >::do_commit_reputation( + >::do_commit_reputation( &from, cid, cindex, diff --git a/faucet/src/mock.rs b/faucet/src/mock.rs index 8ce0423f..cc102c40 100644 --- a/faucet/src/mock.rs +++ b/faucet/src/mock.rs @@ -38,13 +38,13 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, EncointerFaucet: dut::{Pallet, Call, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - EncointerBalances: encointer_balances::{Pallet, Call, Storage, Event}, - EncointerCeremonies: encointer_ceremonies::{Pallet, Call, Storage, Config, Event}, - EncointerReputationCommitments:encointer_reputation_commitments::{Pallet, Call, Storage, Event}, - EncointerCommunities: encointer_communities::{Pallet, Call, Storage, Event}, + EncointerBalances: pallet_encointer_balances::{Pallet, Call, Storage, Event}, + EncointerCeremonies: pallet_encointer_ceremonies::{Pallet, Call, Storage, Config, Event}, + EncointerReputationCommitments:pallet_encointer_reputation_commitments::{Pallet, Call, Storage, Event}, + EncointerCommunities: pallet_encointer_communities::{Pallet, Call, Storage, Event}, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, } ); @@ -162,7 +162,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_ceremonies::GenesisConfig:: { + pallet_encointer_ceremonies::GenesisConfig:: { ceremony_reward: BalanceType::from_num(1), location_tolerance: LOCATION_TOLERANCE, // [m] time_tolerance: TIME_TOLERANCE, // [ms] @@ -176,7 +176,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_communities::GenesisConfig:: { + pallet_encointer_communities::GenesisConfig:: { min_solar_trip_time_s: 1, max_speed_mps: 83, ..Default::default() diff --git a/faucet/src/tests.rs b/faucet/src/tests.rs index 7cf696cd..02f5e509 100644 --- a/faucet/src/tests.rs +++ b/faucet/src/tests.rs @@ -18,7 +18,6 @@ use super::*; use crate::mock::{Balances, EncointerFaucet, EncointerReputationCommitments, System, Treasury}; -use codec::Encode; use encointer_primitives::{ ceremonies::Reputation, faucet::FromStr, @@ -26,6 +25,7 @@ use encointer_primitives::{ }; use frame_support::{assert_err, assert_ok}; use mock::{new_test_ext, RuntimeOrigin, TestRuntime}; +use parity_scale_codec::Encode; use sp_core::bounded_vec; use sp_runtime::{AccountId32, DispatchError}; use test_utils::{helpers::*, storage::*, *}; @@ -270,7 +270,7 @@ fn dripping_works() { cid, 12 ), - encointer_reputation_commitments::Error::::AlreadyCommited + pallet_encointer_reputation_commitments::Error::::AlreadyCommited ); assert_err!( @@ -280,7 +280,7 @@ fn dripping_works() { cid, 13 ), - encointer_reputation_commitments::Error::::NoReputation + pallet_encointer_reputation_commitments::Error::::NoReputation ); assert_err!( @@ -290,7 +290,7 @@ fn dripping_works() { cid2, 12 ), - encointer_reputation_commitments::Error::::NoReputation + pallet_encointer_reputation_commitments::Error::::NoReputation ); }) }) diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 958007b6..4255a9fc 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -9,37 +9,29 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -bs58 = { version = "0.4.0", default-features = false, features = ["alloc"] } -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", - "max-encoded-len", -] } -crc = "2.1.0" -geohash = { package = "substrate-geohash", version = "0.13.0" } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = [ - "derive", -] } -serde = { version = "1.0.188", optional = true, default-features = false, features = [ - "derive", - "alloc", -] } +bs58 = { workspace = true } +crc = { workspace = true } +geohash = { workspace = true } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } +serde = { workspace = true, optional = true } # local deps -ep-core = { path = "core", default-features = false, version = "3.0.2" } +ep-core = { workspace = true } # substrate deps -frame-support = { default-features = false, version = "25.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-io = { default-features = false, version = "27.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-support = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -approx = "0.5.1" -rstest = "0.12.0" -serde_json = "1.0.105" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +rstest = { workspace = true } +serde_json = { workspace = true } +test-utils = { workspace = true } [features] default = ["serde_derive", "std"] @@ -47,9 +39,9 @@ full_crypto = ["sp-core/full_crypto"] serde_derive = ["ep-core/serde_derive", "serde"] std = [ "bs58/std", - "codec/std", "ep-core/std", "frame-support/std", + "parity-scale-codec/std", "scale-info/std", "serde/std", "sp-core/full_crypto", diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 6484825c..4cf32edf 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -9,35 +9,28 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -array-bytes = "6.1.0" -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -fixed = { package = "substrate-fixed", default-features = false, version = "0.5.9" } -impl-serde = { version = "0.4.0", optional = true, default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = [ - "derive", -] } -serde = { version = "1.0.188", optional = true, default-features = false, features = [ - "derive", - "alloc", -] } +array-bytes = { workspace = true } +fixed = { workspace = true } +impl-serde = { workspace = true, optional = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } +serde = { workspace = true, optional = true } -sp-arithmetic = { default-features = false, version = "20.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +sp-arithmetic = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -serde_json = "1.0.105" +serde_json = { workspace = true } [features] default = ["serde_derive", "std"] serde_derive = ["fixed/serde", "impl-serde", "serde"] std = [ - "codec/std", "fixed/std", "impl-serde/std", + "parity-scale-codec/std", "scale-info/std", "serde/std", "sp-arithmetic/std", diff --git a/primitives/core/src/bip340.rs b/primitives/core/src/bip340.rs index 244773cc..25aaf062 100644 --- a/primitives/core/src/bip340.rs +++ b/primitives/core/src/bip340.rs @@ -1,4 +1,4 @@ -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::{ crypto::{AccountId32, ByteArray}, @@ -112,7 +112,7 @@ impl serde::Serialize for Bip340 { S: serde::Serializer, { #[cfg(not(feature = "std"))] - use codec::alloc::string::ToString; + use parity_scale_codec::alloc::string::ToString; serializer.serialize_str(&self.to_string()) } } @@ -124,7 +124,7 @@ impl<'de> serde::Deserialize<'de> for Bip340 { D: serde::Deserializer<'de>, { #[cfg(not(feature = "std"))] - use codec::alloc::string::String; + use parity_scale_codec::alloc::string::String; sp_std::str::FromStr::from_str(&String::deserialize(deserializer)?) .map_err(serde::de::Error::custom) } diff --git a/primitives/core/src/bs58_verify.rs b/primitives/core/src/bs58_verify.rs index 315d345b..d011f2fd 100644 --- a/primitives/core/src/bs58_verify.rs +++ b/primitives/core/src/bs58_verify.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Encointer. If not, see . -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; diff --git a/primitives/core/src/random_number_generator.rs b/primitives/core/src/random_number_generator.rs index cd83f986..dea17e0e 100644 --- a/primitives/core/src/random_number_generator.rs +++ b/primitives/core/src/random_number_generator.rs @@ -18,7 +18,7 @@ //! A simple pseudo random number generator that allows a stream of random numbers to be efficiently //! created from a single initial seed hash. -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_runtime::traits::{Hash, TrailingZeroInput}; diff --git a/primitives/src/balances.rs b/primitives/src/balances.rs index ce006e75..eb3556cd 100644 --- a/primitives/src/balances.rs +++ b/primitives/src/balances.rs @@ -14,9 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Encointer. If not, see . -use codec::{Decode, Encode, MaxEncodedLen}; use ep_core::fixed::types::I64F64; use log::{trace, warn}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; use sp_std::fmt::Debug; diff --git a/primitives/src/bazaar.rs b/primitives/src/bazaar.rs index ba0ffc5a..e576d905 100644 --- a/primitives/src/bazaar.rs +++ b/primitives/src/bazaar.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Encointer. If not, see . -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; diff --git a/primitives/src/ceremonies.rs b/primitives/src/ceremonies.rs index f9c92644..ac42459c 100644 --- a/primitives/src/ceremonies.rs +++ b/primitives/src/ceremonies.rs @@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize}; use crate::communities::{CommunityIdentifier, Location}; -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::{RuntimeDebug, H256}; use sp_runtime::traits::{BlakeTwo256, Hash, IdentifyAccount, Verify}; diff --git a/primitives/src/common.rs b/primitives/src/common.rs index 93c6973b..92270c50 100644 --- a/primitives/src/common.rs +++ b/primitives/src/common.rs @@ -15,8 +15,8 @@ // along with Encointer. If not, see . use crate::bs58_verify::{Bs58Error, Bs58verify}; -use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::traits::Len; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; #[cfg(feature = "serde_derive")] use serde::{Deserialize, Serialize}; diff --git a/primitives/src/communities.rs b/primitives/src/communities.rs index 058b27f5..42de6d1e 100644 --- a/primitives/src/communities.rs +++ b/primitives/src/communities.rs @@ -16,10 +16,10 @@ use crate::common::FromStr as CrateFromStr; use bs58; -use codec::{Decode, Encode, MaxEncodedLen}; use crc::{Crc, CRC_32_CKSUM}; use ep_core::{bip340::Bip340, fixed::types::I64F64}; use geohash::GeoHash as GeohashGeneric; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; use sp_std::{fmt, fmt::Formatter, prelude::Vec, str::FromStr}; diff --git a/primitives/src/democracy.rs b/primitives/src/democracy.rs index ad833edc..13314d53 100644 --- a/primitives/src/democracy.rs +++ b/primitives/src/democracy.rs @@ -2,7 +2,7 @@ use crate::{ ceremonies::{CommunityCeremony, InactivityTimeoutType}, communities::{CommunityIdentifier, NominalIncome as NominalIncomeType}, }; -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use crate::scheduler::CeremonyIndexType; diff --git a/primitives/src/error.rs b/primitives/src/error.rs index 11b3f09e..d6cf92f8 100644 --- a/primitives/src/error.rs +++ b/primitives/src/error.rs @@ -1,4 +1,4 @@ -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; #[cfg(feature = "serde_derive")] diff --git a/primitives/src/faucet.rs b/primitives/src/faucet.rs index 776b911a..8299bb9e 100644 --- a/primitives/src/faucet.rs +++ b/primitives/src/faucet.rs @@ -15,7 +15,7 @@ // along with Encointer. If not, see . use crate::{communities::CommunityIdentifier, reputation_commitments::PurposeIdType}; -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_core::{bounded::BoundedVec, ConstU32, MaxEncodedLen, RuntimeDebug}; diff --git a/primitives/src/scheduler.rs b/primitives/src/scheduler.rs index 7ed12ffb..e24547b8 100644 --- a/primitives/src/scheduler.rs +++ b/primitives/src/scheduler.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Encointer. If not, see . -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; #[cfg(feature = "serde_derive")] diff --git a/primitives/src/vouches.rs b/primitives/src/vouches.rs index 2274bbf1..645cc1df 100644 --- a/primitives/src/vouches.rs +++ b/primitives/src/vouches.rs @@ -15,7 +15,7 @@ // along with Encointer. If not, see . use crate::common::BoundedIpfsCid; -use codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; #[cfg(feature = "serde_derive")] use serde::{Deserialize, Serialize}; diff --git a/reputation-commitments/Cargo.toml b/reputation-commitments/Cargo.toml index 6ff15175..7526b84b 100644 --- a/reputation-commitments/Cargo.toml +++ b/reputation-commitments/Cargo.toml @@ -9,45 +9,43 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -approx = { version = "0.5.1", optional = true } -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = ["derive"] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +approx = { workspace = true, optional = true } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-ceremonies = { package = "pallet-encointer-ceremonies", path = "../ceremonies", default-features = false, version = "3.0.2" } -encointer-communities = { package = "pallet-encointer-communities", path = "../communities", default-features = false, version = "3.0.2" } -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } -encointer-scheduler = { package = "pallet-encointer-scheduler", path = "../scheduler", default-features = false, version = "3.0.2" } +encointer-primitives = { workspace = true } +pallet-encointer-ceremonies = { workspace = true } +pallet-encointer-communities = { workspace = true } +pallet-encointer-scheduler = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-timestamp = { default-features = false, version = "24.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-timestamp = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -approx = "0.5.1" -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ "approx/std", - "codec/std", - "encointer-ceremonies/std", - "encointer-communities/std", - # local deps "encointer-primitives/std", - "encointer-scheduler/std", - # substrate deps "frame-support/std", "frame-system/std", "log/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities/std", + "pallet-encointer-scheduler/std", + "parity-scale-codec/std", "scale-info/std", "sp-core/std", "sp-runtime/std", @@ -55,16 +53,16 @@ std = [ ] runtime-benchmarks = [ "approx", - "encointer-ceremonies/runtime-benchmarks", - "encointer-communities/runtime-benchmarks", - "encointer-scheduler/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", ] try-runtime = [ - "encointer-ceremonies/try-runtime", - "encointer-communities/try-runtime", - "encointer-scheduler/try-runtime", "frame-system/try-runtime", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-scheduler/try-runtime", ] diff --git a/reputation-commitments/src/benchmarking.rs b/reputation-commitments/src/benchmarking.rs index c44a0c30..5a92ea8d 100644 --- a/reputation-commitments/src/benchmarking.rs +++ b/reputation-commitments/src/benchmarking.rs @@ -1,10 +1,10 @@ use crate::{Pallet as ReputationCommitments, *}; -use codec::Encode; use encointer_primitives::{ ceremonies::Reputation, reputation_commitments::FromStr, storage::participant_reputation, }; use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_system::RawOrigin; +use parity_scale_codec::Encode; use sp_runtime::traits::{BlakeTwo256, Hash}; benchmarks! { diff --git a/reputation-commitments/src/lib.rs b/reputation-commitments/src/lib.rs index 4afb80ef..38213e17 100644 --- a/reputation-commitments/src/lib.rs +++ b/reputation-commitments/src/lib.rs @@ -22,10 +22,10 @@ use encointer_primitives::{ reputation_commitments::{DescriptorType, PurposeIdType}, scheduler::{CeremonyIndexType, CeremonyPhaseType}, }; -use encointer_scheduler::OnCeremonyPhaseChange; use frame_system::{self as frame_system, ensure_signed, pallet_prelude::OriginFor}; use log::info; pub use pallet::*; +use pallet_encointer_scheduler::OnCeremonyPhaseChange; use sp_core::H256; use sp_std::convert::TryInto; pub use weights::WeightInfo; @@ -51,7 +51,9 @@ pub mod pallet { #[pallet::config] pub trait Config: - frame_system::Config + encointer_ceremonies::Config + encointer_communities::Config + frame_system::Config + + pallet_encointer_ceremonies::Config + + pallet_encointer_communities::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; type WeightInfo: WeightInfo; @@ -108,8 +110,11 @@ pub mod pallet { return Err(>::InexistentPurpose); } - if !>::participant_reputation((cid, cindex), account) - .is_verified() + if !>::participant_reputation( + (cid, cindex), + account, + ) + .is_verified() { return Err(>::NoReputation); } @@ -139,7 +144,7 @@ pub mod pallet { #[allow(deprecated)] pub fn purge_registry(cindex: CeremonyIndexType) { - let cids = >::community_identifiers(); + let cids = >::community_identifiers(); for cid in cids.into_iter() { >::remove_prefix((cid, cindex), None); } @@ -206,8 +211,9 @@ impl OnCeremonyPhaseChange for Pallet { CeremonyPhaseType::Assigning => {}, CeremonyPhaseType::Attesting => {}, CeremonyPhaseType::Registering => { - let reputation_lifetime = >::reputation_lifetime(); - let cindex = >::current_ceremony_index(); + let reputation_lifetime = + >::reputation_lifetime(); + let cindex = >::current_ceremony_index(); // Clean up with a time delay, such that participants can claim their UBI in the following cycle. if cindex > reputation_lifetime { Self::purge_registry( diff --git a/reputation-commitments/src/mock.rs b/reputation-commitments/src/mock.rs index 9bcb5ba3..e2d78978 100644 --- a/reputation-commitments/src/mock.rs +++ b/reputation-commitments/src/mock.rs @@ -29,11 +29,11 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config, Event}, + EncointerScheduler: pallet_encointer_scheduler::{Pallet, Call, Storage, Config, Event}, EncointerReputationCommitments: dut::{Pallet, Call, Storage, Event}, - EncointerBalances: encointer_balances::{Pallet, Call, Storage, Event}, - EncointerCommunities: encointer_communities::{Pallet, Call, Storage, Event}, - EncointerCeremonies: encointer_ceremonies::{Pallet, Call, Storage, Config, Event}, + EncointerBalances: pallet_encointer_balances::{Pallet, Call, Storage, Event}, + EncointerCommunities: pallet_encointer_communities::{Pallet, Call, Storage, Event}, + EncointerCeremonies: pallet_encointer_ceremonies::{Pallet, Call, Storage, Config, Event}, } ); @@ -56,7 +56,7 @@ impl_encointer_ceremonies!(TestRuntime); pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - encointer_scheduler::GenesisConfig:: { + pallet_encointer_scheduler::GenesisConfig:: { current_phase: CeremonyPhaseType::Registering, current_ceremony_index: 1, phase_durations: vec![ @@ -69,7 +69,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_ceremonies::GenesisConfig:: { + pallet_encointer_ceremonies::GenesisConfig:: { ceremony_reward: BalanceType::from_num(1), location_tolerance: LOCATION_TOLERANCE, // [m] time_tolerance: TIME_TOLERANCE, // [ms] @@ -83,7 +83,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); - encointer_communities::GenesisConfig:: { + pallet_encointer_communities::GenesisConfig:: { min_solar_trip_time_s: 1, max_speed_mps: 83, ..Default::default() diff --git a/reputation-commitments/src/tests.rs b/reputation-commitments/src/tests.rs index 5a9a7a7b..d13e40f7 100644 --- a/reputation-commitments/src/tests.rs +++ b/reputation-commitments/src/tests.rs @@ -21,7 +21,6 @@ use crate::mock::{ EncointerCeremonies, EncointerReputationCommitments, EncointerScheduler, RuntimeOrigin, Timestamp, }; -use codec::Encode; use encointer_primitives::{ ceremonies::Reputation, communities::{CommunityIdentifier, Degree, Location}, @@ -32,6 +31,7 @@ use frame_support::{ traits::{OnFinalize, OnInitialize}, }; use mock::{new_test_ext, System, TestRuntime}; +use parity_scale_codec::Encode; use sp_runtime::traits::{BlakeTwo256, Hash}; use test_utils::{ helpers::{event_deposited, last_event, register_test_community}, diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 3a4a0840..2d0dbaae 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -jsonrpsee = { version = "0.16.3" } -jsonrpsee-core = { version = "0.16.3" } -jsonrpsee-types = { version = "0.16.3" } -thiserror = "1.0.31" +jsonrpsee = { workspace = true } +jsonrpsee-core = { workspace = true } +jsonrpsee-types = { workspace = true } +thiserror = { workspace = true } diff --git a/scheduler/Cargo.toml b/scheduler/Cargo.toml index 6e490918..d548a084 100644 --- a/scheduler/Cargo.toml +++ b/scheduler/Cargo.toml @@ -9,37 +9,35 @@ repository = "https://github.com/encointer/pallets" license = "GPL-3.0-or-later" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -impl-trait-for-tuples = { version = "0.2.2", default-features = false } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +impl-trait-for-tuples = { workspace = true } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-timestamp = { default-features = false, version = "24.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-timestamp = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ - "codec/std", "encointer-primitives/std", "frame-support/std", "frame-system/std", "log/std", "pallet-timestamp/std", + "parity-scale-codec/std", "scale-info/std", "sp-runtime/std", "sp-std/std", @@ -48,6 +46,5 @@ runtime-benchmarks = [ "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", - ] try-runtime = ["frame-system/try-runtime"] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index f82fd2ad..1e53c4d7 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -10,42 +10,41 @@ license = "GPL-3.0-or-later" publish = false [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = [ - "derive", -] } -log = "0.4.20" +log = { workspace = true, features = ["std"] } +parity-scale-codec = { workspace = true } + # local deps -encointer-balances = { package = "pallet-encointer-balances", path = "../balances" } -encointer-ceremonies = { package = "pallet-encointer-ceremonies", path = "../ceremonies" } -encointer-communities = { package = "pallet-encointer-communities", path = "../communities" } -encointer-primitives = { path = "../primitives" } -encointer-scheduler = { package = "pallet-encointer-scheduler", path = "../scheduler" } +encointer-primitives = { workspace = true, features = ["std"] } +pallet-encointer-balances = { workspace = true, features = ["std"] } +pallet-encointer-ceremonies = { workspace = true, features = ["std"] } +pallet-encointer-communities = { workspace = true, features = ["std"] } +pallet-encointer-scheduler = { workspace = true, features = ["std"] } # substrate deps -frame-benchmarking = "25.0.0" -frame-support = "25.0.0" -frame-system = "25.0.0" -pallet-balances = "25.0.0" -pallet-timestamp = "24.0.0" -sp-core = "25.0.0" -sp-inherents = "23.0.0" -sp-io = "27.0.0" -sp-keyring = "28.0.0" -sp-runtime = "28.0.0" -sp-std = "12.0.0" +frame-benchmarking = { workspace = true, features = ["std"] } +frame-support = { workspace = true, features = ["std"] } +frame-system = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-core = { workspace = true, features = ["std"] } +sp-inherents = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +sp-keyring = { workspace = true } +sp-runtime = { workspace = true, features = ["std"] } +sp-std = { workspace = true, features = ["std"] } [features] runtime-benchmarks = [ - "encointer-balances/runtime-benchmarks", - "encointer-ceremonies/runtime-benchmarks", - "encointer-communities/runtime-benchmarks", - "encointer-scheduler/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", ] try-runtime = [ - "encointer-balances/try-runtime", - "encointer-ceremonies/try-runtime", - "encointer-communities/try-runtime", - "encointer-scheduler/try-runtime", + "pallet-encointer-balances/try-runtime", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-scheduler/try-runtime", ] diff --git a/test-utils/src/helpers.rs b/test-utils/src/helpers.rs index 7c7d02fe..f56adbbf 100644 --- a/test-utils/src/helpers.rs +++ b/test-utils/src/helpers.rs @@ -48,7 +48,7 @@ pub fn register_test_community( lon: f64, ) -> CommunityIdentifier where - Runtime: encointer_communities::Config, + Runtime: pallet_encointer_communities::Config, Runtime: frame_system::Config, ::RuntimeOrigin: OriginTrait, { @@ -57,7 +57,7 @@ where let prime = &bs[0]; let location = Location { lat: Degree::from_num(lat), lon: Degree::from_num(lon) }; - encointer_communities::Pallet::::new_community( + pallet_encointer_communities::Pallet::::new_community( Runtime::RuntimeOrigin::signed(prime.clone()), location, bs.clone(), diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 0e63bf18..db91fe21 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -28,13 +28,13 @@ use sp_runtime::{generic, traits::IdentifyAccount, MultiSignature, Perbill}; pub use sp_keyring::AccountKeyring; // reexports for macro resolution -pub use encointer_balances; -pub use encointer_ceremonies; -pub use encointer_communities; pub use encointer_primitives::storage; -pub use encointer_scheduler; pub use frame_system; pub use pallet_balances; +pub use pallet_encointer_balances; +pub use pallet_encointer_ceremonies; +pub use pallet_encointer_communities; +pub use pallet_encointer_scheduler; pub use pallet_timestamp; pub use sp_runtime; @@ -164,7 +164,7 @@ parameter_types! { #[macro_export] macro_rules! impl_encointer_balances { ($t:ident) => { - impl encointer_balances::Config for $t { + impl pallet_encointer_balances::Config for $t { type RuntimeEvent = RuntimeEvent; type DefaultDemurrage = DefaultDemurrage; type ExistentialDeposit = EncointerBalancesExistentialDeposit; @@ -178,7 +178,7 @@ macro_rules! impl_encointer_balances { macro_rules! impl_encointer_communities { ($t:ident) => { use sp_core::ConstU32; - impl encointer_communities::Config for $t { + impl pallet_encointer_communities::Config for $t { type RuntimeEvent = RuntimeEvent; type CommunityMaster = EnsureAlice; type TrustableForNonDestructiveAction = EnsureAlice; @@ -194,7 +194,7 @@ macro_rules! impl_encointer_communities { #[macro_export] macro_rules! impl_encointer_reputation_commitments { ($t:ident) => { - impl encointer_reputation_commitments::Config for $t { + impl pallet_encointer_reputation_commitments::Config for $t { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } @@ -220,7 +220,7 @@ parameter_types! { #[macro_export] macro_rules! impl_encointer_ceremonies { ($t:ident) => { - impl encointer_ceremonies::Config for $t { + impl pallet_encointer_ceremonies::Config for $t { type RuntimeEvent = RuntimeEvent; type CeremonyMaster = EnsureAlice; type Public = ::Signer; @@ -242,7 +242,7 @@ parameter_types! { #[macro_export] macro_rules! impl_encointer_scheduler { ($t:ident, $ceremonies:ident, $reputationcommitments:ident) => { - impl encointer_scheduler::Config for $t { + impl pallet_encointer_scheduler::Config for $t { type RuntimeEvent = RuntimeEvent; type CeremonyMaster = EnsureAlice; type OnCeremonyPhaseChange = ($ceremonies, $reputationcommitments); //OnCeremonyPhaseChange; @@ -252,7 +252,7 @@ macro_rules! impl_encointer_scheduler { }; ($t:ident, $ceremonies:ident) => { - impl encointer_scheduler::Config for $t { + impl pallet_encointer_scheduler::Config for $t { type RuntimeEvent = RuntimeEvent; type CeremonyMaster = EnsureAlice; type OnCeremonyPhaseChange = ($ceremonies, ()); //OnCeremonyPhaseChange; @@ -261,7 +261,7 @@ macro_rules! impl_encointer_scheduler { } }; ($t:ident) => { - impl encointer_scheduler::Config for $t { + impl pallet_encointer_scheduler::Config for $t { type RuntimeEvent = RuntimeEvent; type CeremonyMaster = EnsureAlice; type OnCeremonyPhaseChange = ((), ()); //OnCeremonyPhaseChange; @@ -282,7 +282,7 @@ pub type EnsureAlice = EitherOfDiverse, Ensur /// tests! pub struct TestRandomness(sp_std::marker::PhantomData); -impl +impl frame_support::traits::Randomness> for TestRandomness where T: frame_system::Config, diff --git a/vouches/Cargo.toml b/vouches/Cargo.toml index ae97b67c..c32c1f67 100644 --- a/vouches/Cargo.toml +++ b/vouches/Cargo.toml @@ -10,40 +10,38 @@ license = "GPL-3.0-or-later" publish = false [dependencies] -approx = { version = "0.5.1", optional = true } -codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false, features = ["derive"] } -log = { version = "0.4.20", default-features = false } -scale-info = { version = "2.10.0", default-features = false } +approx = { workspace = true, optional = true } +log = { workspace = true } +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } # local deps -encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"], version = "3.0.2" } +encointer-primitives = { workspace = true } # substrate deps -frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } -frame-support = { default-features = false, version = "25.0.0" } -frame-system = { default-features = false, version = "25.0.0" } -pallet-timestamp = { default-features = false, version = "24.0.0" } -sp-core = { default-features = false, version = "25.0.0" } -sp-runtime = { default-features = false, version = "28.0.0" } -sp-std = { default-features = false, version = "12.0.0" } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-timestamp = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -approx = "0.5.1" -sp-io = "27.0.0" -test-utils = { path = "../test-utils" } +approx = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +test-utils = { workspace = true } [features] default = ["std"] std = [ "approx/std", - "codec/std", - # local deps "encointer-primitives/std", - # substrate deps "frame-benchmarking/std", "frame-support/std", "frame-system/std", "log/std", + "parity-scale-codec/std", "scale-info/std", "sp-core/std", "sp-runtime/std", @@ -54,6 +52,5 @@ runtime-benchmarks = [ "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", - ] try-runtime = ["frame-system/try-runtime"]