Bump Substrate (#871)

* Bump Substrate

* Change usage of "Module" to "Pallet"

Related Substrate PR: https://github.com/paritytech/substrate/pull/8372

* Add `OnSetCode` config param

Related Substrate PR: https://github.com/paritytech/substrate/pull/8496

* Update Aura Slot duration time type

Related Substrate PR: https://github.com/paritytech/substrate/pull/8386

* Add `OnSetCode` to mock runtimes

* Add support for multiple justifications

Related Substrate PR: https://github.com/paritytech/substrate/pull/7640

* Use updated justification type in more places

* Make GenesisConfig type non-optional

Related Substrate PR: https://github.com/paritytech/substrate/pull/8275

* Update service to use updated telemetry

Related Substrate PR: https://github.com/paritytech/substrate/pull/8143

* Appease Clippy
This commit is contained in:
Hernando Castano
2021-04-07 11:56:45 -04:00
committed by Bastian Köcher
parent d9c553374c
commit c6ae74725b
32 changed files with 501 additions and 395 deletions
@@ -29,7 +29,7 @@ use relay_ethereum_client::{
};
use relay_rialto_client::HeaderId as RialtoHeaderId;
use relay_utils::{HeaderId, MaybeConnectionError};
use sp_runtime::Justification;
use sp_runtime::EncodedJustification;
use std::collections::HashSet;
// to encode/decode contract calls
@@ -68,7 +68,7 @@ pub trait EthereumHighLevelRpc {
params: EthereumSigningParams,
contract_address: Address,
id: RialtoHeaderId,
justification: Justification,
justification: EncodedJustification,
) -> RpcResult<RialtoHeaderId>;
/// Submit ethereum transaction.
@@ -194,7 +194,7 @@ impl EthereumHighLevelRpc for EthereumClient {
params: EthereumSigningParams,
contract_address: Address,
id: RialtoHeaderId,
justification: Justification,
justification: EncodedJustification,
) -> RpcResult<RialtoHeaderId> {
let _ = self
.submit_ethereum_transaction(
@@ -36,7 +36,7 @@ use relay_substrate_client::{
ConnectionParams as SubstrateConnectionParams,
};
use relay_utils::{metrics::MetricsParams, relay_loop::Client as RelayClient};
use sp_runtime::Justification;
use sp_runtime::EncodedJustification;
use std::fmt::Debug;
use std::{collections::HashSet, time::Duration};
@@ -84,7 +84,7 @@ impl HeadersSyncPipeline for SubstrateHeadersSyncPipeline {
type Number = rialto_runtime::BlockNumber;
type Header = RialtoSyncHeader;
type Extra = ();
type Completion = Justification;
type Completion = EncodedJustification;
fn estimate_size(source: &QueuedHeader<Self>) -> usize {
source.header().encode().len()
@@ -151,7 +151,11 @@ impl TargetClient<SubstrateHeadersSyncPipeline> for EthereumHeadersTarget {
self.client.incomplete_substrate_headers(self.contract).await
}
async fn complete_header(&self, id: RialtoHeaderId, completion: Justification) -> Result<RialtoHeaderId, RpcError> {
async fn complete_header(
&self,
id: RialtoHeaderId,
completion: EncodedJustification,
) -> Result<RialtoHeaderId, RpcError> {
self.client
.complete_substrate_header(self.sign_params.clone(), self.contract, id, completion)
.await
@@ -32,6 +32,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "mast
pallet-balances = { 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" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
+6 -4
View File
@@ -24,7 +24,7 @@ use sp_runtime::{
traits::{
AtLeast32Bit, Block as BlockT, Dispatchable, MaybeDisplay, MaybeSerialize, MaybeSerializeDeserialize, Member,
},
Justification,
EncodedJustification,
};
use std::{fmt::Debug, time::Duration};
@@ -71,7 +71,7 @@ pub trait BlockWithJustification<Header> {
/// Return block header.
fn header(&self) -> Header;
/// Return block justification, if known.
fn justification(&self) -> Option<&Justification>;
fn justification(&self) -> Option<&EncodedJustification>;
}
/// Substrate-based chain transactions signing scheme.
@@ -97,7 +97,9 @@ impl<Block: BlockT> BlockWithJustification<Block::Header> for SignedBlock<Block>
self.block.header().clone()
}
fn justification(&self) -> Option<&Justification> {
self.justification.as_ref()
fn justification(&self) -> Option<&EncodedJustification> {
self.justifications
.as_ref()
.and_then(|j| j.get(sp_finality_grandpa::GRANDPA_ENGINE_ID))
}
}
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Module provides a set of guard functions that are running in background threads
//! Pallet provides a set of guard functions that are running in background threads
//! and are aborting process if some condition fails.
use crate::{Chain, ChainWithBalances, Client};
@@ -26,7 +26,7 @@ use headers_relay::{
sync_types::{HeaderIdOf, HeadersSyncPipeline, QueuedHeader, SourceHeader},
};
use relay_utils::relay_loop::Client as RelayClient;
use sp_runtime::{traits::Header as HeaderT, Justification};
use sp_runtime::{traits::Header as HeaderT, EncodedJustification};
use std::marker::PhantomData;
/// Substrate node as headers source.
@@ -69,7 +69,7 @@ where
C: Chain,
C::BlockNumber: relay_utils::BlockNumberBase,
C::Header: Into<P::Header>,
P: HeadersSyncPipeline<Extra = (), Completion = Justification, Hash = C::Hash, Number = C::BlockNumber>,
P: HeadersSyncPipeline<Extra = (), Completion = EncodedJustification, Hash = C::Hash, Number = C::BlockNumber>,
P::Header: SourceHeader<C::Hash, C::BlockNumber>,
{
async fn best_block_number(&self) -> Result<P::Number, Error> {
+1 -1
View File
@@ -16,7 +16,7 @@
//! Relaying source chain headers to target chain. This module provides entrypoint
//! that starts reading new headers from source chain and submit these headers as
//! module/contract transactions to the target chain. Module/contract on the target
//! module/contract transactions to the target chain. Pallet/contract on the target
//! chain is a light-client of the source chain. All other trustless bridge
//! applications are built using this light-client, so running headers-relay is
//! essential for running all other bridge applications.