Skip to content

Commit

Permalink
Bridges - changes for Bridges V2 - relay client part (#4494)
Browse files Browse the repository at this point in the history
Contains mainly changes/nits/refactors related to the relayer code
(`client-substrate` and `lib-substrate-relay`) migrated from the Bridges
V2 [branch](#4427).

Relates to:
paritytech/parity-bridges-common#2976
Companion: paritytech/parity-bridges-common#2988


## TODO
- [x] fix comments

## Questions
- [x] Do we need more testing for client V2 stuff? If so, how/what is
the ultimate test? @svyatonik
- [x] check
[comment](#4494 (comment))
for more testing

---------

Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
Co-authored-by: Serban Iorga <serban@parity.io>
  • Loading branch information
3 people authored Jun 14, 2024
1 parent 7f7f5fa commit 977254c
Show file tree
Hide file tree
Showing 46 changed files with 2,688 additions and 1,479 deletions.
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.

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

0 comments on commit 977254c

Please sign in to comment.