Migrate to new substrate (#79)

* new substrate version + actually verify justification

* cargo update + fix remaining stuff

* add weight=0 comments

* cargo fmt --all

* fix hash types
This commit is contained in:
Svyatoslav Nikolsky
2020-04-28 16:40:23 +03:00
committed by Bastian Köcher
parent 4bbef4d45a
commit 50d6ed186f
14 changed files with 282 additions and 235 deletions
+18 -18
View File
@@ -13,57 +13,57 @@ hash-db = { version = "0.15.2", default-features = false }
# Substrate Based Dependencies
[dependencies.frame-support]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dependencies.frame-system]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dependencies.pallet-session]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dependencies.sp-core]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dependencies.sp-finality-grandpa]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dependencies.sp-runtime]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dependencies.sp-trie]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
# Dev Dependencies
[dev-dependencies.sp-io]
version = "2.0.0-alpha.2"
version = "2.0.0-alpha.6"
default-features = false
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[dev-dependencies.sp-state-machine]
version = "0.8.0-alpha.2"
rev = "2afecf81ee19b8a6edb364b419190ea47c4a4a31"
version = "0.8.0-alpha.6"
rev = "c13ad41634d0bd7cf07897c2aa062b917d520520"
git = "https://github.com/paritytech/substrate/"
[features]
+8 -4
View File
@@ -96,11 +96,11 @@ pub trait Trait: system::Trait {}
decl_storage! {
trait Store for Module<T: Trait> as Bridge {
/// The number of current bridges managed by the module.
pub NumBridges get(num_bridges) config(): BridgeId;
pub NumBridges get(fn num_bridges) config(): BridgeId;
/// Maps a bridge id to a bridge struct. Allows a single
/// `bridge` module to manage multiple bridges.
pub TrackedBridges get(tracked_bridges): map hasher(blake2_256) BridgeId => Option<BridgeInfo<T>>;
pub TrackedBridges get(fn tracked_bridges): map hasher(blake2_128_concat) BridgeId => Option<BridgeInfo<T>>;
}
}
@@ -108,6 +108,7 @@ decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
type Error = Error<T>;
#[weight = 0] // TODO: update me
fn initialize_bridge(
origin,
block_header: T::Header,
@@ -131,6 +132,7 @@ decl_module! {
NumBridges::put(new_bridge_id);
}
#[weight = 0] // TODO: update me
fn submit_finalized_headers(origin) {
let _sender = ensure_signed(origin)?;
}
@@ -155,8 +157,7 @@ impl<T: Trait> Module<T> {
proof: StorageProof,
validator_set: &Vec<(AuthorityId, AuthorityWeight)>,
) -> DispatchResult {
let checker =
<StorageProofChecker<<T::Hashing as sp_runtime::traits::Hash>::Hasher>>::new(*state_root, proof.clone());
let checker = <StorageProofChecker<T::Hashing>>::new(*state_root, proof.clone());
let checker = checker.map_err(Self::map_storage_err)?;
@@ -259,6 +260,9 @@ mod tests {
type Event = ();
type BlockHashCount = ();
type MaximumBlockWeight = ();
type DbWeight = ();
type BlockExecutionWeight = ();
type ExtrinsicBaseWeight = ();
type AvailableBlockRatio = ();
type MaximumBlockLength = ();
type Version = ();