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
+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 = ();