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

Bridges - changes for Bridges V2 - relay client part #4494

Merged
merged 16 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bridges/modules/grandpa/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ const MAX_VOTE_ANCESTRIES_RANGE_END: u32 =
// the same with validators - if there are too much validators, let's run benchmarks on subrange
fn precommits_range_end<T: Config<I>, I: 'static>() -> u32 {
let max_bridged_authorities = T::BridgedChain::MAX_AUTHORITIES_COUNT;
if max_bridged_authorities > 128 {
let max_bridged_authorities = if max_bridged_authorities > 128 {
sp_std::cmp::max(128, max_bridged_authorities / 5)
} else {
max_bridged_authorities
};

required_justification_precommits(max_bridged_authorities)
}

Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/relayers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub mod pallet {
/// The overarching event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Type of relayer reward.
type Reward: AtLeast32BitUnsigned + Copy + Parameter + MaxEncodedLen;
type Reward: AtLeast32BitUnsigned + Copy + Member + Parameter + MaxEncodedLen;
/// Pay rewards scheme.
type PaymentProcedure: PaymentProcedure<Self::AccountId, Self::Reward>;
/// Stake and slash scheme.
Expand Down
4 changes: 2 additions & 2 deletions bridges/primitives/relayers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ pub struct RelayerRewardsKeyProvider<AccountId, Reward>(PhantomData<(AccountId,

impl<AccountId, Reward> StorageDoubleMapKeyProvider for RelayerRewardsKeyProvider<AccountId, Reward>
where
AccountId: Codec + EncodeLike,
Reward: Codec + EncodeLike,
AccountId: 'static + Codec + EncodeLike + Send + Sync,
Reward: 'static + Codec + EncodeLike + Send + Sync,
{
const MAP_NAME: &'static str = "RelayerRewards";

Expand Down
10 changes: 5 additions & 5 deletions bridges/primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ pub trait StorageMapKeyProvider {
/// The same as `StorageMap::Hasher1`.
type Hasher: StorageHasher;
/// The same as `StorageMap::Key1`.
type Key: FullCodec;
type Key: FullCodec + Send + Sync;
/// The same as `StorageMap::Value`.
type Value: FullCodec;
type Value: 'static + FullCodec;

/// This is a copy of the
/// `frame_support::storage::generator::StorageMap::storage_map_final_key`.
Expand All @@ -277,13 +277,13 @@ pub trait StorageDoubleMapKeyProvider {
/// The same as `StorageDoubleMap::Hasher1`.
type Hasher1: StorageHasher;
/// The same as `StorageDoubleMap::Key1`.
type Key1: FullCodec;
type Key1: FullCodec + Send + Sync;
/// The same as `StorageDoubleMap::Hasher2`.
type Hasher2: StorageHasher;
/// The same as `StorageDoubleMap::Key2`.
type Key2: FullCodec;
type Key2: FullCodec + Send + Sync;
/// The same as `StorageDoubleMap::Value`.
type Value: FullCodec;
type Value: 'static + FullCodec;

/// This is a copy of the
/// `frame_support::storage::generator::StorageDoubleMap::storage_double_map_final_key`.
Expand Down
1 change: 1 addition & 0 deletions bridges/relays/client-substrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rand = "0.8.5"
scale-info = { version = "2.11.1", features = ["derive"] }
tokio = { version = "1.37", features = ["rt-multi-thread"] }
thiserror = { workspace = true }
quick_cache = "0.3"

# Bridge dependencies

Expand Down
3 changes: 3 additions & 0 deletions bridges/relays/client-substrate/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ use sp_runtime::{
};
use std::{fmt::Debug, time::Duration};

/// Signed block type of given chain.
pub type SignedBlockOf<C> = <C as Chain>::SignedBlock;

/// Substrate-based chain from minimal relay-client point of view.
pub trait Chain: ChainBase + Clone {
/// Chain name.
Expand Down
Loading
Loading