Skip to content

Commit

Permalink
fix: fixed GenesisConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul1010 committed Aug 1, 2023
1 parent 4fdf867 commit 6cdbca3
Show file tree
Hide file tree
Showing 29 changed files with 243 additions and 334 deletions.
285 changes: 162 additions & 123 deletions Cargo.lock

Large diffs are not rendered by default.

55 changes: 29 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ try-runtime-cli = { git = "https://github.com/paritytech//substrate", rev = "6d2
pallet-glutton = { git = "https://github.com/paritytech//substrate", rev = "6d28d2eb6fa1589105e970ff1b97555d91a1495b" }
sp-database = { git = "https://github.com/paritytech//substrate", rev = "6d28d2eb6fa1589105e970ff1b97555d91a1495b" }
pallet-message-queue = { git = "https://github.com/paritytech//substrate", rev = "6d28d2eb6fa1589105e970ff1b97555d91a1495b" }
pallet-contracts = { git = "https://github.com/paritytech//substrate", rev = "6d28d2eb6fa1589105e970ff1b97555d91a1495b" }
pallet-contracts-primitives = { git = "https://github.com/paritytech//substrate", rev = "6d28d2eb6fa1589105e970ff1b97555d91a1495b" }

[patch."https://github.com/paritytech/polkadot"]
kusama-runtime = { git = "https://github.com/paritytech//polkadot", rev = "1ed6e2e50a4ce61f6cda46a730efc11a07b6ebb3" }
Expand Down Expand Up @@ -232,6 +234,7 @@ polkadot-collator-protocol = { git = "https://github.com/paritytech//polkadot",
polkadot-availability-recovery = { git = "https://github.com/paritytech//polkadot", rev = "1ed6e2e50a4ce61f6cda46a730efc11a07b6ebb3" }

[patch."https://github.com/paritytech/cumulus"]
cumulus-client-collator = { git = "https://github.com/paritytech//cumulus", rev = "a188eb95c522f3ca4c43ef7fed19a6107224217c" }
cumulus-client-cli = { git = "https://github.com/paritytech//cumulus", rev = "a188eb95c522f3ca4c43ef7fed19a6107224217c" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech//cumulus", rev = "a188eb95c522f3ca4c43ef7fed19a6107224217c" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech//cumulus", rev = "a188eb95c522f3ca4c43ef7fed19a6107224217c" }
Expand Down Expand Up @@ -272,31 +275,31 @@ orml-xcm = { git = "https://github.com/open-web3-stack//open-runtime-module-libr
orml-xtokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v1.0.0" }

[patch."https://github.com/paritytech/frontier"]
fc-api = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-cli = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-consensus = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-db = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-mapping-sync = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-rpc = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-rpc-core = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-storage = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fc-api = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-cli = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-consensus = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-db = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-mapping-sync = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-rpc = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-rpc-core = { git = "https://github.com/paritytech//frontier", branch = "master" }
fc-storage = { git = "https://github.com/paritytech//frontier", branch = "master" }
# Frontier Primitive
fp-account = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-consensus = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-dynamic-fee = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-ethereum = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-evm = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-rpc = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-self-contained = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-storage = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
fp-account = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-consensus = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-dynamic-fee = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-ethereum = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-evm = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-rpc = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-self-contained = { git = "https://github.com/paritytech//frontier", branch = "master" }
fp-storage = { git = "https://github.com/paritytech//frontier", branch = "master" }
# Frontier FRAME
pallet-base-fee = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-dynamic-fee = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-ethereum = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-evm = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-evm-chain-id = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-evm-precompile-modexp = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-evm-precompile-simple = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-evm-test-vector-support = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-hotfix-sufficients = { git = "https://github.com/paritytech//frontier", rev = "ff8bd85fe73da92a6266b1f3859e9e9c78a5f420" }
pallet-base-fee = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-dynamic-fee = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-ethereum = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-evm = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-evm-chain-id = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-evm-precompile-modexp = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-evm-precompile-simple = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-evm-test-vector-support = { git = "https://github.com/paritytech//frontier", branch = "master" }
pallet-hotfix-sufficients = { git = "https://github.com/paritytech//frontier", branch = "master" }
2 changes: 1 addition & 1 deletion crates/annuity/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ();
Expand Down
13 changes: 1 addition & 12 deletions crates/btc-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ pub mod pallet {
pub(super) type DisableInclusionCheck<T: Config> = StorageValue<_, bool, ValueQuery>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
/// Global security parameter k for stable Bitcoin transactions
pub bitcoin_confirmations: u32,
Expand All @@ -390,18 +391,6 @@ pub mod pallet {
pub disable_inclusion_check: bool,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
bitcoin_confirmations: Default::default(),
parachain_confirmations: Default::default(),
disable_difficulty_check: Default::default(),
disable_inclusion_check: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
15 changes: 2 additions & 13 deletions crates/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ pub mod pallet {
use core::ops::Div;
use frame_support::{
dispatch::{DispatchClass, DispatchResultWithPostInfo},
inherent::Vec,
pallet_prelude::*,
sp_runtime::{
traits::{AccountIdConversion, CheckedSub, Saturating, Zero},
Expand All @@ -74,7 +73,7 @@ pub mod pallet {
use pallet_session::SessionManager;
use sp_runtime::traits::Convert;
use sp_staking::SessionIndex;

use sp_std::prelude::*;
type BalanceOf<T> = <<T as Config>::StakingCurrency as Currency<<T as SystemConfig>::AccountId>>::Balance;

/// A convertor from collators id. Since this pallet does not have stash/controller, this is
Expand Down Expand Up @@ -178,23 +177,13 @@ pub mod pallet {
pub type CandidacyBond<T> = StorageValue<_, BalanceOf<T>, ValueQuery>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub invulnerables: Vec<T::AccountId>,
pub candidacy_bond: BalanceOf<T>,
pub desired_candidates: u32,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
invulnerables: Default::default(),
candidacy_bond: Default::default(),
desired_candidates: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
2 changes: 1 addition & 1 deletion crates/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ();
Expand Down
11 changes: 1 addition & 10 deletions crates/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,21 +255,12 @@ pub mod pallet {
pub type NextLaunchTimestamp<T: Config> = StorageValue<_, u64, ValueQuery>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
_phantom: sp_std::marker::PhantomData<T>,
next_launch_timestamp: u64,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig {
_phantom: Default::default(),
next_launch_timestamp: 0,
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
2 changes: 1 addition & 1 deletion crates/democracy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ();
Expand Down
13 changes: 2 additions & 11 deletions crates/dex-general/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub use pallet::*;

use codec::{Decode, Encode, FullCodec};
use frame_support::{
inherent::Vec, pallet_prelude::*, storage::bounded_btree_map::BoundedBTreeMap, traits::Get, PalletId, RuntimeDebug,
pallet_prelude::*, storage::bounded_btree_map::BoundedBTreeMap, traits::Get, PalletId, RuntimeDebug,
};
use orml_traits::MultiCurrency;
use sp_core::U256;
Expand Down Expand Up @@ -174,6 +174,7 @@ pub mod pallet {
>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
/// Refer: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2Pair.sol#L88
pub struct GenesisConfig<T: Config> {
/// The receiver of the protocol fee.
Expand All @@ -183,16 +184,6 @@ pub mod pallet {
pub fee_point: u8,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
fee_receiver: None,
fee_point: 5,
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
2 changes: 1 addition & 1 deletion crates/dex-stable/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ();
Expand Down
2 changes: 1 addition & 1 deletion crates/escrow/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ();
Expand Down
15 changes: 1 addition & 14 deletions crates/fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub mod pallet {
StorageMap<_, Blake2_128Concat, DefaultVaultId<T>, UnsignedFixedPoint<T>, OptionQuery>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub issue_fee: UnsignedFixedPoint<T>,
pub issue_griefing_collateral: UnsignedFixedPoint<T>,
Expand All @@ -185,20 +186,6 @@ pub mod pallet {
pub replace_griefing_collateral: UnsignedFixedPoint<T>,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
issue_fee: Default::default(),
issue_griefing_collateral: Default::default(),
redeem_fee: Default::default(),
premium_redeem_fee: Default::default(),
punishment_fee: Default::default(),
replace_griefing_collateral: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
11 changes: 1 addition & 10 deletions crates/issue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,12 @@ pub mod pallet {
pub(super) type StorageVersion<T: Config> = StorageValue<_, Version, ValueQuery, DefaultForStorageVersion>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub issue_period: T::BlockNumber,
pub issue_btc_dust_value: BalanceOf<T>,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
issue_period: Default::default(),
issue_btc_dust_value: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
12 changes: 1 addition & 11 deletions crates/loans/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,21 +577,11 @@ pub mod pallet {
pub(crate) type StorageVersion<T: Config> = StorageValue<_, Versions, ValueQuery, DefaultVersion<T>>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig {
pub max_exchange_rate: Rate,
pub min_exchange_rate: Rate,
}

#[cfg(feature = "std")]
impl Default for GenesisConfig {
fn default() -> Self {
Self {
max_exchange_rate: Rate::from_inner(DEFAULT_MAX_EXCHANGE_RATE),
min_exchange_rate: Rate::from_inner(DEFAULT_MIN_EXCHANGE_RATE),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
fn build(&self) {
Expand Down
11 changes: 1 addition & 10 deletions crates/oracle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,12 @@ pub mod pallet {
pub(super) type StorageVersion<T: Config> = StorageValue<_, Version, ValueQuery, DefaultForStorageVersion>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub max_delay: u32,
pub authorized_oracles: Vec<(T::AccountId, NameOf<T>)>,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
max_delay: Default::default(),
authorized_oracles: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
12 changes: 1 addition & 11 deletions crates/redeem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,23 +197,13 @@ pub mod pallet {
pub(super) type StorageVersion<T: Config> = StorageValue<_, Version, ValueQuery, DefaultForStorageVersion>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub redeem_period: T::BlockNumber,
pub redeem_btc_dust_value: BalanceOf<T>,
pub redeem_transaction_size: u32,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
redeem_period: Default::default(),
redeem_btc_dust_value: Default::default(),
redeem_transaction_size: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
11 changes: 1 addition & 10 deletions crates/replace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,12 @@ pub mod pallet {
pub(super) type StorageVersion<T: Config> = StorageValue<_, Version, ValueQuery, DefaultForStorageVersion>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub replace_period: T::BlockNumber,
pub replace_btc_dust_value: BalanceOf<T>,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
replace_period: Default::default(),
replace_btc_dust_value: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Expand Down
Loading

0 comments on commit 6cdbca3

Please sign in to comment.