Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
To polkadot-v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Oct 30, 2023
1 parent 660c6b7 commit 3b7fdf5
Show file tree
Hide file tree
Showing 33 changed files with 706 additions and 119 deletions.
673 changes: 622 additions & 51 deletions Cargo.lock

Large diffs are not rendered by default.

43 changes: 22 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ bitvec = { version = "1.0", default-features = false, features = ["all
codec = { package = "parity-scale-codec", version = "3.6", default-features = false, features = ["derive"] }
finality-grandpa = { version = "0.16", default-features = false }
hash-db = { version = "0.16", default-features = false }
log = { version = "0.4" }
num-traits = { version = "0.2", default-features = false }
scale-info = { version = "2.9", default-features = false, features = ["derive"] }
scale-info = { version = "2.10", default-features = false, features = ["derive"] }
serde = { version = "1.0", default-features = false }
trie-db = { version = "0.27", default-features = false }
trie-db = { version = "0.28", default-features = false }

# darwinia
bp-header-chain = { path = "primitives/header-chain", default-features = false }
bp-messages = { path = "primitives/messages", default-features = false }
bp-message-dispatch = { path = "primitives/message-dispatch", default-features = false }
bp-messages = { path = "primitives/messages", default-features = false }
bp-parachains = { path = "primitives/parachains", default-features = false }
bp-polkadot-core = { path = "primitives/polkadot-core", default-features = false }
bp-runtime = { path = "primitives/runtime", default-features = false }
Expand All @@ -32,23 +33,23 @@ pallet-bridge-parachains = { path = "modules/parachains", default-features = fal
pallet-fee-market = { path = "modules/fee-market", default-features = false }

# frontier
fp-account = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0", default-features = false, features = ["serde"] }
fp-account = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.1.0", default-features = false, features = ["serde"] }

# substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-root-testing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-root-testing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
1 change: 1 addition & 0 deletions modules/dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version = "0.1.0"
[dependencies]
# crates.io
codec = { package = "parity-scale-codec", workspace = true }
log = { workspace = true }
scale-info = { workspace = true }

# darwinia-messages-substrate
Expand Down
7 changes: 4 additions & 3 deletions modules/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ use bp_runtime::{
};
// substrate
use frame_support::{
dispatch::{DispatchInfo, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo, Weight},
ensure, log,
dispatch::{DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo},
ensure,
pallet_prelude::Pays,
traits::Get,
weights::Weight,
};
use frame_system::RawOrigin;
use sp_runtime::traits::{BadOrigin, Convert, IdentifyAccount, MaybeDisplay, Verify};
use sp_runtime::traits::{BadOrigin, Convert, Dispatchable, IdentifyAccount, MaybeDisplay, Verify};
use sp_std::{fmt::Debug, prelude::*};

#[frame_support::pallet]
Expand Down
3 changes: 2 additions & 1 deletion modules/fee-market/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version = "0.1.0"
[dependencies]
# crates.io
codec = { package = "parity-scale-codec", workspace = true }
log = { workspace = true }
scale-info = { workspace = true }

# darwinia-messages-substrate
Expand Down Expand Up @@ -51,8 +52,8 @@ std = [
"pallet-timestamp/std",
"sp-core/std",
"sp-io/std",
"sp-std/std",
"sp-runtime/std",
"sp-std/std",
# substrate optional
"frame-benchmarking?/std",

Expand Down
5 changes: 1 addition & 4 deletions modules/fee-market/src/s2s/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ use bp_messages::{
MessageNonce, UnrewardedRelayer, VerificationError,
};
// --- paritytech ---
use frame_support::{
log,
traits::{Currency as CurrencyT, ExistenceRequirement, Get},
};
use frame_support::traits::{Currency as CurrencyT, ExistenceRequirement, Get};
use sp_runtime::traits::{AccountIdConversion, CheckedDiv, Saturating, UniqueSaturatedInto, Zero};
use sp_std::{
cmp::{max, min},
Expand Down
1 change: 1 addition & 0 deletions modules/grandpa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version = "0.1.0"
# crates.io
codec = { package = "parity-scale-codec", workspace = true }
finality-grandpa = { workspace = true }
log = { workspace = true }
num-traits = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion modules/grandpa/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::{Config, Pallet};
use bp_runtime::FilterCall;
// substrate
use frame_support::{dispatch::CallableCallFor, log, traits::IsSubType};
use frame_support::{dispatch::CallableCallFor, traits::IsSubType};
use sp_runtime::{
traits::Header,
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
Expand Down
16 changes: 8 additions & 8 deletions modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ use bp_runtime::{
};
use storage_types::StoredAuthoritySet;
// substrate
use frame_support::{ensure, fail, log, DefaultNoBound};
use frame_support::{ensure, fail, DefaultNoBound};
use frame_system::ensure_signed;
use sp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID};
use sp_runtime::traits::{Header as HeaderT, Zero};
Expand Down Expand Up @@ -347,7 +347,7 @@ pub mod pallet {
pub type PalletOperatingMode<T: Config<I>, I: 'static = ()> =
StorageValue<_, BasicOperatingMode, ValueQuery>;

#[derive(DefaultNoBound)]
#[derive(DefaultNoBound)]
#[pallet::genesis_config]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Optional module owner account.
Expand Down Expand Up @@ -531,12 +531,12 @@ pub mod pallet {
let initial_hash = header.hash();
let header = StoredBridgedHeader::<T, I>::try_from_inner(*header).map_err(|e| {
log::error!(
target: LOG_TARGET,
"Failed to initialize bridge. Size of header {:?} ({}) is larger that the configured value {}",
initial_hash,
e.value_size,
e.maximal_size,
);
target: LOG_TARGET,
"Failed to initialize bridge. Size of header {:?} ({}) is larger that the configured value {}",
initial_hash,
e.value_size,
e.maximal_size,
);

Error::<T, I>::TooLargeHeader
})?;
Expand Down
1 change: 1 addition & 0 deletions modules/messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version = "0.1.0"
# crates.io
bitvec = { workspace = true }
codec = { package = "parity-scale-codec", workspace = true }
log = { workspace = true }
num-traits = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true, optional = true, features = ["derive"] }
Expand Down
3 changes: 2 additions & 1 deletion modules/messages/src/inbound_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use bp_messages::{
ReceivalResult, UnrewardedRelayer,
};
// substrate
use frame_support::{traits::Get, RuntimeDebug};
use frame_support::traits::Get;
use sp_runtime::RuntimeDebug;

/// Inbound lane storage.
pub trait InboundLaneStorage {
Expand Down
6 changes: 3 additions & 3 deletions modules/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ use bp_messages::{
};
use bp_runtime::{BasicOperatingMode, ChainId, OwnedBridgeModule, Size};
// substrate
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, log, traits::Get, DefaultNoBound};
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound};
use sp_core::H256;
use sp_runtime::traits::Convert;
use sp_std::{cell::RefCell, marker::PhantomData, prelude::*};
Expand Down Expand Up @@ -681,8 +681,8 @@ pub mod pallet {
pub type OutboundMessages<T: Config<I>, I: 'static = ()> =
StorageMap<_, Blake2_128Concat, MessageKey, StoredMessageData<T, I>>;

#[derive(DefaultNoBound)]
#[pallet::genesis_config]
#[derive(DefaultNoBound)]
#[pallet::genesis_config]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Initial pallet operating mode.
pub operating_mode: MessagesOperatingMode,
Expand Down
3 changes: 2 additions & 1 deletion modules/messages/src/outbound_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use bp_messages::{
UnrewardedRelayer,
};
// substrate
use frame_support::{traits::Get, RuntimeDebug};
use frame_support::traits::Get;
use sp_runtime::RuntimeDebug;
use sp_std::collections::vec_deque::VecDeque;

/// Outbound lane storage.
Expand Down
1 change: 1 addition & 0 deletions modules/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "0.1.0"
[dependencies]
# crates.io
codec = { package = "parity-scale-codec", workspace = true }
log = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }

Expand Down
2 changes: 1 addition & 1 deletion modules/parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub mod pallet {
BasicOperatingMode, BoundedStorageValue, OwnedBridgeModule, StorageDoubleMapKeyProvider,
StorageMapKeyProvider,
};
use frame_support::{log, pallet_prelude::*};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;

/// Stored parachain head of given parachains pallet.
Expand Down
4 changes: 2 additions & 2 deletions primitives/header-chain/src/justification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use codec::{Decode, Encode};
use finality_grandpa::voter_set::VoterSet;
use scale_info::TypeInfo;
// substrate
use frame_support::{RuntimeDebug, RuntimeDebugNoBound};
use frame_support::RuntimeDebugNoBound;
use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, SetId};
use sp_runtime::traits::Header as HeaderT;
use sp_runtime::{traits::Header as HeaderT, RuntimeDebug};
use sp_std::{
collections::{btree_map::BTreeMap, btree_set::BTreeSet},
prelude::*,
Expand Down
3 changes: 1 addition & 2 deletions primitives/message-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ use bp_runtime::{
ChainId, Size,
};
// substrate
use frame_support::RuntimeDebug;
use sp_runtime::transaction_validity::TransactionValidityError;
use sp_runtime::{transaction_validity::TransactionValidityError, RuntimeDebug};
use sp_std::prelude::*;

/// Message dispatch weight.
Expand Down
2 changes: 2 additions & 0 deletions primitives/messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bp-runtime = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

[dev-dependencies]
Expand All @@ -43,5 +44,6 @@ std = [
"frame-support/std",
"frame-system/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
]
3 changes: 2 additions & 1 deletion primitives/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ use serde::{Deserialize, Serialize};
// darwinia-network
use bp_runtime::{BasicOperatingMode, OperatingMode};
// substrate
use frame_support::{PalletError, RuntimeDebug};
use frame_support::PalletError;
use sp_runtime::RuntimeDebug;
use sp_std::{collections::vec_deque::VecDeque, prelude::*};

// Weight is reexported to avoid additional frame-support dependencies in related crates.
Expand Down
3 changes: 2 additions & 1 deletion primitives/messages/src/source_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use crate::{
};
use bp_runtime::Size;
// substrate
use frame_support::{weights::Weight, Parameter, RuntimeDebug};
use frame_support::{weights::Weight, Parameter};
use sp_runtime::RuntimeDebug;
use sp_std::{collections::vec_deque::VecDeque, fmt::Debug, ops::RangeInclusive};

/// Error message that is used in `ForbidOutboundMessages` implementation.
Expand Down
3 changes: 2 additions & 1 deletion primitives/messages/src/target_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ use crate::{LaneId, Message, MessageData, MessageKey, OutboundLaneData, Verifica

use bp_runtime::{messages::MessageDispatchResult, Size};
use codec::{Decode, Encode, Error as CodecError};
use frame_support::{weights::Weight, Parameter, RuntimeDebug};
use frame_support::{weights::Weight, Parameter};
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
use sp_std::{collections::btree_map::BTreeMap, prelude::*};

/// Proved messages from the source chain.
Expand Down
2 changes: 2 additions & 0 deletions primitives/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bp-runtime = { workspace = true }
# substrate
frame-support = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }

[features]
default = ["std"]
Expand All @@ -33,4 +34,5 @@ std = [
# substrate
"frame-support/std",
"sp-core/std",
"sp-runtime/std",
]
3 changes: 2 additions & 1 deletion primitives/parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ use bp_polkadot_core::{
};
use bp_runtime::{StorageDoubleMapKeyProvider, StorageMapKeyProvider};
// substrate
use frame_support::{Blake2_128Concat, RuntimeDebug, Twox64Concat};
use frame_support::{Blake2_128Concat, Twox64Concat};
use sp_core::storage::StorageKey;
use sp_runtime::RuntimeDebug;

/// Best known parachain head hash.
#[derive(Clone, PartialEq, Decode, Encode, MaxEncodedLen, RuntimeDebug, TypeInfo)]
Expand Down
7 changes: 3 additions & 4 deletions primitives/polkadot-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,20 @@ use bp_messages::MessageNonce;
use bp_runtime::{Chain, EncodedOrDecodedCall};
// substrate
use frame_support::{
dispatch::{DispatchClass, Dispatchable},
dispatch::DispatchClass,
parameter_types,
weights::{
constants::{BlockExecutionWeight, WEIGHT_REF_TIME_PER_SECOND},
Weight,
},
RuntimeDebug,
};
use frame_system::limits;
use sp_core::Hasher as HasherT;
use sp_runtime::{
generic,
traits::{BlakeTwo256, DispatchInfoOf, IdentifyAccount, Verify},
traits::{BlakeTwo256, DispatchInfoOf, Dispatchable, IdentifyAccount, Verify},
transaction_validity::TransactionValidityError,
MultiAddress, MultiSignature, OpaqueExtrinsic,
MultiAddress, MultiSignature, OpaqueExtrinsic, RuntimeDebug,
};

/// Block number type used in Polkadot-like chains.
Expand Down
2 changes: 1 addition & 1 deletion primitives/polkadot-core/src/parachains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use serde::{Deserialize, Serialize};
// darwinia-network
use bp_runtime::Size;
// substrate
use frame_support::RuntimeDebug;
use sp_core::Hasher;
use sp_runtime::RuntimeDebug;
use sp_std::prelude::*;

/// Parachain head hash.
Expand Down
1 change: 1 addition & 0 deletions primitives/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version = "0.1.0"
# crates.io
codec = { package = "parity-scale-codec", workspace = true }
hash-db = { workspace = true }
log = { workspace = true }
num-traits = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true }
Expand Down
5 changes: 2 additions & 3 deletions primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ use num_traits::{CheckedSub, One};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
// substrate
use frame_support::{
log, pallet_prelude::DispatchResult, PalletError, RuntimeDebug, StorageHasher, StorageValue,
};
use frame_support::{pallet_prelude::DispatchResult, PalletError, StorageHasher, StorageValue};
use frame_system::RawOrigin;
use sp_core::{storage::StorageKey, H256};
use sp_io::hashing::blake2_256;
use sp_runtime::{
traits::{BadOrigin, Header as HeaderT},
transaction_validity::TransactionValidity,
RuntimeDebug,
};
use sp_std::{fmt::Debug, prelude::*};

Expand Down
Loading

0 comments on commit 3b7fdf5

Please sign in to comment.