Bump substrate version (#120)

* bump substrate

* cargo fmt --all
This commit is contained in:
Svyatoslav Nikolsky
2020-06-03 06:23:32 +03:00
committed by Bastian Köcher
parent 944859319e
commit a7e7c895f6
15 changed files with 277 additions and 217 deletions
@@ -11,35 +11,36 @@ edition = "2018"
codec = { package = "parity-scale-codec", version = "1.0.0" }
ethereum-types = "0.9.2"
finality-grandpa = "0.12.3"
# Runtime/chain specific dependencies
bridge-node-runtime = { path = "../../../bin/node/runtime" }
[dependencies.sp-blockchain]
version = "2.0.0-alpha.6"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
version = "2.0.0-rc1"
rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee"
git = "https://github.com/paritytech/substrate/"
[dependencies.sp-finality-grandpa]
version = "2.0.0-alpha.6"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
version = "2.0.0-rc1"
rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee"
git = "https://github.com/paritytech/substrate/"
[dependencies.sp-runtime]
version = "2.0.0-alpha.6"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
version = "2.0.0-rc1"
rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee"
git = "https://github.com/paritytech/substrate/"
[dependencies.sc-finality-grandpa]
version = "0.8.0-dev"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee"
git = "https://github.com/paritytech/substrate/"
[dev-dependencies]
hex = "0.4"
[dev-dependencies.sp-core]
version = "2.0.0-alpha.6"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
version = "2.0.0-rc1"
rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee"
git = "https://github.com/paritytech/substrate/"
@@ -17,6 +17,7 @@
use bridge_node_runtime::{Block, BlockNumber, Hash, Header as RuntimeHeader};
use codec::{Decode, Encode};
use ethereum_types::U256;
use finality_grandpa::voter_set::VoterSet;
use sp_blockchain::Error as ClientError;
use sp_finality_grandpa::{AuthorityList, ConsensusLog, GRANDPA_ENGINE_ID};
@@ -29,6 +30,8 @@ pub enum Error {
HeaderDecode(codec::Error),
/// Failed to decode best voters set.
BestSetDecode(codec::Error),
/// Best voters set is invalid.
InvalidBestSet,
/// Failed to decode finality proof.
FinalityProofDecode(codec::Error),
/// Failed to verify justification.
@@ -108,12 +111,14 @@ pub fn verify_substrate_finality_proof(
raw_best_set: &[u8],
raw_finality_proof: &[u8],
) -> Result<(), Error> {
let best_set = AuthorityList::decode(&mut &raw_best_set[..]).map_err(Error::BestSetDecode)?;
let best_set = AuthorityList::decode(&mut &raw_best_set[..])
.map_err(Error::BestSetDecode)
.and_then(|authorities| VoterSet::new(authorities.into_iter()).ok_or(Error::InvalidBestSet))?;
sc_finality_grandpa::GrandpaJustification::<Block>::decode_and_verify_finalizes(
&raw_finality_proof,
(finality_target_hash, finality_target_number),
best_set_id,
&best_set.into_iter().collect(),
&best_set,
)
.map_err(Error::JustificationVerify)
.map(|_| ())