Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to polkadot-v1.0.0 #332

Merged
merged 10 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,107 changes: 490 additions & 617 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions balances-tx-payment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ pallet-encointer-balances = { path = "../balances", default-features = false }
pallet-encointer-ceremonies = { path = "../ceremonies", default-features = false }

# substrate dependencies
frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
pallet-asset-tx-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
sp-runtime = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }
pallet-asset-tx-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }
pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }
sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }

[dev-dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
rstest = "0.12.0"
scale-info = { version = "2.0.1", default-features = false }
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
scale-info = { version = "2.5.0", default-features = false }
sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
test-utils = { path = "../test-utils" }

[features]
Expand Down
20 changes: 10 additions & 10 deletions balances-tx-payment/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "encointer-balances-tx-payment-rpc"
version = "1.0.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
jsonrpsee = { version = "0.16.2", features = [
"client-core",
"server",
Expand All @@ -21,12 +21,12 @@ encointer-primitives = { path = "../../primitives" }
encointer-rpc = { path = "../../rpc" }

# substrate deps
pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.42" }
sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-core = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-rpc = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-runtime = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }
pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v1.0.0" }
sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-core = { version = "21.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-rpc = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
10 changes: 5 additions & 5 deletions balances-tx-payment/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ edition = "2021"
encointer-primitives = { path = "../../../primitives", default-features = false }

# substrate deps
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
scale-info = { version = "2.0.1", default-features = false }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-std = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
scale-info = { version = "2.5.0", default-features = false }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }

[features]
default = ["std"]
Expand Down
22 changes: 11 additions & 11 deletions balances/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ edition = "2021"

[dependencies]
approx = { version = "0.5.1", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
log = { version = "0.4.14", default-features = false }
scale-info = { version = "2.0.1", default-features = false }
scale-info = { version = "2.5.0", default-features = false }

# local deps
encointer-primitives = { path = "../primitives", default-features = false }
encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"] }

# substrate deps
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
pallet-asset-tx-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-runtime = { version = "7.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-std = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-asset-tx-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }

[dev-dependencies]
approx = "0.5.1"
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
test-utils = { path = "../test-utils" }

[features]
Expand Down
29 changes: 12 additions & 17 deletions balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use frame_support::{
ensure,
traits::{tokens::fungibles, Get},
};
use frame_system::{self as frame_system, ensure_signed};
use frame_system::{self as frame_system, ensure_signed, pallet_prelude::BlockNumberFor};
use log::{debug, info};
use sp_runtime::DispatchError;
use sp_std::convert::TryInto;
Expand Down Expand Up @@ -126,8 +126,9 @@ pub mod pallet {
}
}

#[derive(frame_support::DefaultNoBound)]
clangenb marked this conversation as resolved.
Show resolved Hide resolved
#[pallet::genesis_config]
pub struct GenesisConfig {
pub struct GenesisConfig<T> {
/// Example parameter tuning for the fee-conversion
///
/// [CC]: 1 Unit of Community Currency
Expand All @@ -142,18 +143,12 @@ pub mod pallet {
///
/// FCF = 0.01 / (20 * 5*10^-12 [KKSM]) = 0.01 / (20 * 5 * 10e-12) = 100_000
pub fee_conversion_factor: FeeConversionFactorType,
}

#[cfg(feature = "std")]
#[allow(clippy::derivable_impls)]
impl Default for GenesisConfig {
fn default() -> Self {
Self { fee_conversion_factor: Default::default() }
}
#[serde(skip)]
pub _config: sp_std::marker::PhantomData<T>,
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
<FeeConversionFactor<T>>::put(self.fee_conversion_factor);
}
Expand Down Expand Up @@ -190,7 +185,7 @@ pub mod pallet {
_,
Blake2_128Concat,
CommunityIdentifier,
BalanceEntry<T::BlockNumber>,
BalanceEntry<BlockNumberFor<T>>,
ValueQuery,
>;

Expand All @@ -202,7 +197,7 @@ pub mod pallet {
CommunityIdentifier,
Blake2_128Concat,
T::AccountId,
BalanceEntry<T::BlockNumber>,
BalanceEntry<BlockNumberFor<T>>,
ValueQuery,
>;

Expand All @@ -226,7 +221,7 @@ impl<T: Config> Pallet<T> {
fn balance_entry_updated(
community_id: CommunityIdentifier,
who: &T::AccountId,
) -> BalanceEntry<T::BlockNumber> {
) -> BalanceEntry<BlockNumberFor<T>> {
let entry = <Balance<T>>::get(community_id, who);
Self::apply_demurrage(entry, Self::demurrage(&community_id))
}
Expand All @@ -238,7 +233,7 @@ impl<T: Config> Pallet<T> {
/// get total_issuance and apply demurrage. This is not a noop! It changes state.
fn total_issuance_entry_updated(
community_id: CommunityIdentifier,
) -> BalanceEntry<T::BlockNumber> {
) -> BalanceEntry<BlockNumberFor<T>> {
let entry = <TotalIssuance<T>>::get(community_id);
Self::apply_demurrage(entry, Self::demurrage(&community_id))
}
Expand All @@ -248,9 +243,9 @@ impl<T: Config> Pallet<T> {
/// balance_now = balance_last_written
/// * exp(-1* demurrage_rate_per_block * number_of_blocks_since_last_written)
pub(crate) fn apply_demurrage(
entry: BalanceEntry<T::BlockNumber>,
entry: BalanceEntry<BlockNumberFor<T>>,
demurrage: Demurrage,
) -> BalanceEntry<T::BlockNumber> {
) -> BalanceEntry<BlockNumberFor<T>> {
let current_block = frame_system::Pallet::<T>::block_number();

entry.apply_demurrage(demurrage, current_block)
Expand Down
19 changes: 8 additions & 11 deletions balances/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
use crate as dut;
use encointer_primitives::balances::{BalanceType, Demurrage};
use frame_support::pallet_prelude::GenesisBuild;
use sp_runtime::BuildStorage;
use test_utils::*;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
type Block = frame_system::mocking::MockBlock<TestRuntime>;

frame_support::parameter_types! {
pub const DefaultDemurrage: Demurrage = Demurrage::from_bits(0x0000000000000000000001E3F0A8A973_i128);
Expand All @@ -31,15 +30,12 @@ frame_support::parameter_types! {
}

frame_support::construct_runtime!(
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
pub enum TestRuntime
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
EncointerScheduler: encointer_scheduler::{Pallet, Call, Storage, Config<T>, Event},
EncointerBalances: dut::{Pallet, Call, Storage, Event<T>, Config},
EncointerBalances: dut::{Pallet, Call, Storage, Event<T>, Config<T>},
}
);

Expand All @@ -58,10 +54,11 @@ impl_encointer_scheduler!(TestRuntime);

// genesis values
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::default().build_storage::<TestRuntime>().unwrap();
let mut t = frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();

let conf = dut::GenesisConfig { fee_conversion_factor: 100_000 };
GenesisBuild::<TestRuntime>::assimilate_storage(&conf, &mut t).unwrap();
dut::GenesisConfig::<TestRuntime> { fee_conversion_factor: 100_000, ..Default::default() }
.assimilate_storage(&mut t)
.unwrap();

t.into()
}
Expand Down
18 changes: 9 additions & 9 deletions bazaar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ authors = ["encointer.org <[email protected]>"]
edition = "2021"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
log = { version = "0.4.14", default-features = false }
scale-info = { version = "2.0.1", default-features = false }
scale-info = { version = "2.5.0", default-features = false }

# local deps
encointer-communities = { package = "pallet-encointer-communities", path = "../communities", default-features = false }
encointer-primitives = { path = "../primitives", default-features = false }
encointer-primitives = { path = "../primitives", default-features = false, features = ["serde_derive"] }

# substrate deps
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-core = { version = "7.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-std = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }


[dev-dependencies]
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
test-utils = { path = "../test-utils" }

[features]
Expand Down
10 changes: 5 additions & 5 deletions bazaar/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ encointer-primitives = { path = "../../primitives" }
encointer-rpc = { path = "../../rpc" }

# substrate deps
sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-runtime = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
6 changes: 3 additions & 3 deletions bazaar/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ edition = "2021"
encointer-primitives = { path = "../../../primitives", default-features = false }

# substrate deps
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-std = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }

[features]
default = ["std"]
Expand Down
Loading