Add rialto-parachain runtime and node (#1142)

* Substrate: 63b32fbaa2764c0a8ee76b70cdfa0fcb59b7181f
Polkadot:  7229ab87acf5bc5d4d10655ad1a9819a1e317442
Cumulus:   d5284b0e78

* rialto parachain runtime

* fixed tests

* add node + bump refs (not compiling yet):
Substrate:           630422d6108cbaaca893ab213dde69f3bdaa1f6b
Polkadot:            7229ab87acf5bc5d4d10655ad1a9819a1e317442
Cumulus:             5af2990cfd
GrandpaBridgeGadget: c152c45ac331eb8ab40d956ab1d008d181810ef4

* fix compilation (collator is not working)

* more fixes

* fmt

* spellcheck

* fix warnings

* fix compilation

* fmt

* trigger CI

* trigger CI

* Revert "trigger CI"

This reverts commit a31f53cec47909817b31a48f3c9f1abd9321f72c.

* benchmarks

* fix benchmarks

* fix again

* Revert "Revert "trigger CI""

This reverts commit 1dea8b42ac8bca830dea982fd2613eb89d607a6c.

* Revert "Revert "Revert "trigger CI"""

This reverts commit 8fb74fa5eba483b7f6a3ce3e25a60757aef4c6bc.

* try fix

* lost lock file

* spellcheck

* try to disable sccache for cargo check

* Revert "Revert "Revert "Revert "trigger CI""""

This reverts commit f157461482d4c1d19156715c4b1ee2acb169531b.

* try to disable again

* disable sccache for test
This commit is contained in:
Svyatoslav Nikolsky
2021-09-23 00:13:12 +03:00
committed by Bastian Köcher
parent eaf519dc1b
commit 70f87e826c
43 changed files with 2504 additions and 149 deletions
@@ -332,7 +332,7 @@ mod tests {
// then
assert!(format!("{:?}", call_hex).starts_with(
"0x11030000000001000000b0d60f000000000001d43593c715fdd31c61141abd04a99fd6822c8558854cc\
"0x11030000000001000000381409000000000001d43593c715fdd31c61141abd04a99fd6822c8558854cc\
de39a5684e7a56da27d01d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01"
))
}
@@ -102,6 +102,6 @@ mod tests {
let hex = encode_message.encode().unwrap();
// then
assert_eq!(format!("{:?}", hex), "0x01000000b0d60f000000000002d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d003c000130000000000000000000000000");
assert_eq!(format!("{:?}", hex), "0x0100000010f108000000000002d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d003c000130000000000000000000000000");
}
}
@@ -320,7 +320,7 @@ mod tests {
payload,
MessagePayload {
spec_version: relay_millau_client::Millau::RUNTIME_VERSION.spec_version,
weight: 1038000,
weight: 576000,
origin: CallOrigin::SourceAccount(sp_keyring::AccountKeyring::Alice.to_account_id()),
dispatch_fee_payment: bp_runtime::messages::DispatchFeePayment::AtSourceChain,
call: hex!("0001081234").to_vec(),
@@ -360,7 +360,7 @@ mod tests {
payload,
MessagePayload {
spec_version: relay_millau_client::Millau::RUNTIME_VERSION.spec_version,
weight: 1038000,
weight: 576000,
origin: CallOrigin::TargetAccount(
sp_keyring::AccountKeyring::Alice.to_account_id(),
sp_keyring::AccountKeyring::Bob.into(),
+1 -1
View File
@@ -34,11 +34,11 @@ pallet-transaction-payment = { git = "https://github.com/paritytech/substrate",
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" }
+1 -1
View File
@@ -19,13 +19,13 @@ use codec::{Codec, Encode};
use frame_support::weights::WeightToFeePolynomial;
use jsonrpsee_ws_client::{DeserializeOwned, Serialize};
use num_traits::Zero;
use sc_transaction_pool_api::TransactionStatus;
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{
generic::SignedBlock,
traits::{Block as BlockT, Dispatchable, Member},
EncodedJustification,
};
use sp_transaction_pool::TransactionStatus;
use std::{fmt::Debug, time::Duration};
/// Substrate-based chain from minimal relay-client point of view.
@@ -18,7 +18,7 @@
use crate::chain::{Chain, ChainWithBalances, TransactionStatusOf};
use crate::rpc::Substrate;
use crate::{ConnectionParams, Error, HeaderIdOf, Result};
use crate::{ConnectionParams, Error, HashOf, HeaderIdOf, Result};
use async_std::sync::{Arc, Mutex};
use async_trait::async_trait;
@@ -61,7 +61,7 @@ pub struct Client<C: Chain> {
/// Substrate RPC client.
client: Arc<RpcClient>,
/// Genesis block hash.
genesis_hash: C::Hash,
genesis_hash: HashOf<C>,
/// If several tasks are submitting their transactions simultaneously using `submit_signed_extrinsic`
/// method, they may get the same transaction nonce. So one of transactions will be rejected
/// from the pool. This lock is here to prevent situations like that.
@@ -39,10 +39,12 @@ pub trait Environment<C: ChainWithBalances>: Send + Sync + 'static {
fn now(&self) -> Instant {
Instant::now()
}
/// Sleep given amount of time.
async fn sleep(&mut self, duration: Duration) {
async_std::task::sleep(duration).await
}
/// Abort current process. Called when guard condition check fails.
async fn abort(&mut self) {
std::process::abort();
+2 -2
View File
@@ -131,13 +131,13 @@ impl<P: HeadersSyncPipeline> HeadersSync<P> {
}
// if queue is empty and best header on target is > than best header on source,
// then we shoud reorg
// then we shoud reorganization
let best_queued_number = self.headers.best_queued_number();
if best_queued_number.is_zero() && source_best_number < target_best_header.0 {
return Some(source_best_number);
}
// we assume that there were no reorgs if we have already downloaded best header
// we assume that there were no reorganizations if we have already downloaded best header
let best_downloaded_number = std::cmp::max(
std::cmp::max(best_queued_number, self.headers.best_synced_number()),
target_best_header.0,
+4 -4
View File
@@ -38,13 +38,13 @@ use std::{
/// When we submit headers to target node, but see no updates of best
/// source block known to target node during STALL_SYNC_TIMEOUT seconds,
/// we consider that our headers are rejected because there has been reorg in target chain.
/// This reorg could invalidate our knowledge about sync process (i.e. we have asked if
/// HeaderA is known to target, but then reorg happened and the answer is different
/// we consider that our headers are rejected because there has been reorganization in target chain.
/// This reorganization could invalidate our knowledge about sync process (i.e. we have asked if
/// HeaderA is known to target, but then reorganization happened and the answer is different
/// now) => we need to reset sync.
/// The other option is to receive **EVERY** best target header and check if it is
/// direct child of previous best header. But: (1) subscription doesn't guarantee that
/// the subscriber will receive every best header (2) reorg won't always lead to sync
/// the subscriber will receive every best header (2) reorganization won't always lead to sync
/// stall and restart is a heavy operation (we forget all in-memory headers).
const STALL_SYNC_TIMEOUT: Duration = Duration::from_secs(5 * 60);
/// Delay after we have seen update of best source header at target node,