Substrate relay guards (#470)

* substrate relay guards

* checked time condition

* ChainWithBalances

* removed obsolete comment

* Update relays/substrate-client/src/chain.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* trailing space

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
Svyatoslav Nikolsky
2020-11-02 15:01:59 +03:00
committed by Bastian Köcher
parent cc1da1bb39
commit b027c81266
12 changed files with 498 additions and 20 deletions
+1
View File
@@ -18,6 +18,7 @@ rialto-runtime = { path = "../../bin/rialto/runtime" }
# Substrate Dependencies
frame-system = "2.0"
frame-support = "2.0"
pallet-transaction-payment = "2.0"
sp-core = "2.0"
sp-keyring = "2.0"
+17 -2
View File
@@ -18,12 +18,13 @@
use codec::Encode;
use headers_relay::sync_types::SourceHeader;
use relay_substrate_client::{Chain, ChainBase, Client, TransactionSignScheme};
use sp_core::Pair;
use relay_substrate_client::{Chain, ChainBase, ChainWithBalances, Client, TransactionSignScheme};
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{
generic::SignedPayload,
traits::{Header as HeaderT, IdentifyAccount},
};
use std::time::Duration;
pub use rialto_runtime::BridgeMillauCall;
@@ -42,12 +43,26 @@ impl ChainBase for Rialto {
}
impl Chain for Rialto {
const NAME: &'static str = "Rialto";
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(5);
type AccountId = rialto_runtime::AccountId;
type Index = rialto_runtime::Index;
type SignedBlock = rialto_runtime::SignedBlock;
type Call = rialto_runtime::Call;
}
impl ChainWithBalances for Rialto {
type NativeBalance = rialto_runtime::Balance;
fn account_info_storage_key(account_id: &Self::AccountId) -> StorageKey {
use frame_support::storage::generator::StorageMap;
StorageKey(frame_system::Account::<rialto_runtime::Runtime>::storage_map_final_key(
account_id,
))
}
}
impl TransactionSignScheme for Rialto {
type Chain = Rialto;
type AccountKeyPair = sp_core::sr25519::Pair;