Commit 56918785 authored by Gav Wood's avatar Gav Wood Committed by GitHub
Browse files

Enumeratable accounts (#195)

* Merge remote-tracking branch 'origin/master' into gav-xts-dont-panic

* Update wasm.

* consensus, session and staking all panic-safe.

* Democracy doesn't panic in apply.

* Fix tests.

* Extra helper macro, council depanicked.

* Fix one test.

* Fix up all council tests. No panics!

* Council voting depanicked.

* Dispatch returns result.

* session & staking tests updated

* Fix democracy tests.

* Fix council tests.

* Fix up polkadot parachains in runtime

* Fix borked merge

* More Slicable support

Support general `Option` and array types.

* Basic storage types.

* Existential deposit for contract creation

* Basic implemnetation along with removals

* Fix tests.

* externalities builder fix.

* Tests.

* Fix up the runtime.

* Fix tests.

* Add generic `Address` type.

* Initial function integration of Address into Extrinsic.

* Fix build

* All tests compile.

* Fix (some) tests.

* Fix signing.

* Push error.

* transfer can accept Address

* Make Address generic over AccountIndex

* Fix test

* Make Council use Address for dispatch.

* Fix build

* Bend over backwards to support braindead derive.

* Repot some files.

* Fix tests.

* Fix grumbles

* Remove Default bound

* Fix build for new nightly.

* Make `apply_extrinsic` never panic, return useful Result.

* More merge hell

* Doesn't build, but might do soon

* Serde woes

* get substrate-runtime-staking compiling

* Polkadot builds again!

* Fix all build.

* Fix tests & binaries.

* Reserve some extra initial byte values of address for future format changes

* Make semantic of `ReservedBalance` clear.

* Fix panic handler.

* Integrate other balance transformations into the new model

Fix up staking tests.

* Fix runtime tests.

* Fix panic build.

* Tests for demonstrating interaction between balance types.

* Repot some runtime code

* Fix checkedblock in non-std builds

* Get rid of `DoLookup` phantom.

* Attempt to make transaction_pool work with lookups.

* Remove vscode settings

* New attempt at making transaction pool work.

* It builds again!

* --all builds

* Fix tests.

* New build.

* Test account nonce reset.

* polkadot transaction pool tests/framework.

* Address grumbles.

* Revert bad `map_or`

* Rebuild binaries, workaround.

* Avoid casting to usize early.

* reenable sync tests
parent 08840720
......@@ -11,6 +11,7 @@ polkadot-primitives = { path = "../primitives" }
substrate-codec = { path = "../../substrate/codec" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-runtime-executive = { path = "../../substrate/runtime/executive" }
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
substrate-client = { path = "../../substrate/client" }
substrate-primitives = { path = "../../substrate/primitives" }
substrate-executor = { path = "../../substrate/executor" }
......
......@@ -23,6 +23,8 @@ use polkadot_executor::Executor as LocalDispatch;
use substrate_executor::{NativeExecutionDispatch, NativeExecutor};
use state_machine;
use runtime::Address;
use runtime_primitives::traits::AuxLookup;
use primitives::{AccountId, Block, Header, BlockId, Hash, Index, SessionKey, Timestamp, UncheckedExtrinsic};
use primitives::parachain::{CandidateReceipt, DutyRoster, Id as ParaId};
......@@ -135,7 +137,11 @@ impl<B: LocalBackend<Block>> PolkadotApi for Client<B, LocalCallExecutor<B, Nati
}
fn index(&self, at: &CheckedId, account: AccountId) -> Result<Index> {
with_runtime!(self, at, || ::runtime::System::account_index(account))
with_runtime!(self, at, || ::runtime::System::account_nonce(account))
}
fn lookup(&self, at: &Self::CheckedBlockId, address: Address) -> Result<Option<AccountId>> {
with_runtime!(self, at, || <::runtime::Staking as AuxLookup>::lookup(address).ok())
}
fn active_parachains(&self, at: &CheckedId) -> Result<Vec<ParaId>> {
......
......@@ -26,6 +26,7 @@ extern crate substrate_client as client;
extern crate substrate_executor as substrate_executor;
extern crate substrate_runtime_executive;
extern crate substrate_primitives;
extern crate substrate_runtime_primitives as runtime_primitives;
extern crate substrate_state_machine as state_machine;
#[macro_use]
......@@ -37,7 +38,9 @@ extern crate substrate_keyring as keyring;
pub mod full;
pub mod light;
use primitives::{AccountId, Block, BlockId, Hash, Index, SessionKey, Timestamp, UncheckedExtrinsic};
use primitives::{AccountId, Block, BlockId, Hash, Index, SessionKey, Timestamp,
UncheckedExtrinsic};
use runtime::Address;
use primitives::parachain::{CandidateReceipt, DutyRoster, Id as ParaId};
error_chain! {
......@@ -119,9 +122,12 @@ pub trait PolkadotApi {
/// Get the timestamp registered at a block.
fn timestamp(&self, at: &Self::CheckedBlockId) -> Result<Timestamp>;
/// Get the index of an account at a block.
/// Get the nonce (né index) of an account at a block.
fn index(&self, at: &Self::CheckedBlockId, account: AccountId) -> Result<Index>;
/// Get the account id of an address at a block.
fn lookup(&self, at: &Self::CheckedBlockId, address: Address) -> Result<Option<AccountId>>;
/// Get the active parachains at a block.
fn active_parachains(&self, at: &Self::CheckedBlockId) -> Result<Vec<ParaId>>;
......
......@@ -22,6 +22,7 @@ use client::{Client, CallExecutor};
use codec::Slicable;
use state_machine;
use primitives::{AccountId, Block, BlockId, Hash, Index, SessionKey, Timestamp, UncheckedExtrinsic};
use runtime::Address;
use primitives::parachain::{CandidateReceipt, DutyRoster, Id as ParaId};
use full::CheckedId;
use {PolkadotApi, BlockBuilder, RemotePolkadotApi, CheckedBlockId, Result, ErrorKind};
......@@ -84,6 +85,10 @@ impl<B: Backend<Block>, E: CallExecutor<Block>> PolkadotApi for RemotePolkadotAp
Err(ErrorKind::UnknownRuntime.into())
}
fn lookup(&self, _at: &CheckedId, _address: Address) -> Result<Option<AccountId>> {
Err(ErrorKind::UnknownRuntime.into())
}
fn active_parachains(&self, _at: &Self::CheckedBlockId) -> Result<Vec<ParaId>> {
Err(ErrorKind::UnknownRuntime.into())
}
......
......@@ -72,6 +72,7 @@ use runtime_support::Hashable;
use polkadot_api::PolkadotApi;
use polkadot_primitives::{Hash, Block, BlockId, BlockNumber, Header, Timestamp};
use polkadot_primitives::parachain::{Id as ParaId, Chain, DutyRoster, BlockData, Extrinsic as ParachainExtrinsic, CandidateReceipt};
use polkadot_runtime::BareExtrinsic;
use primitives::AuthorityId;
use transaction_pool::{Ready, TransactionPool};
use tokio_core::reactor::{Handle, Timeout, Interval};
......@@ -502,9 +503,9 @@ impl<C, R, P> bft::Proposer<Block> for Proposer<C, R, P>
let mut next_index = {
let readiness_evaluator = Ready::create(self.parent_id.clone(), &*self.client);
let cur_index = self.transaction_pool.cull_and_get_pending(readiness_evaluator, |pending| pending
.filter(|tx| tx.as_ref().as_ref().signed == local_id)
.filter(|tx| tx.sender().map(|s| s == local_id).unwrap_or(false))
.last()
.map(|tx| Ok(tx.as_ref().as_ref().index))
.map(|tx| Ok(tx.index()))
.unwrap_or_else(|| self.client.index(&self.parent_id, local_id))
);
......@@ -531,7 +532,7 @@ impl<C, R, P> bft::Proposer<Block> for Proposer<C, R, P>
=> MisbehaviorKind::BftDoubleCommit(round as u32, (h1, s1.signature), (h2, s2.signature)),
}
};
let extrinsic = Extrinsic {
let extrinsic = BareExtrinsic {
signed: local_id,
index: next_index,
function: Call::Consensus(ConsensusCall::report_misbehavior(report)),
......@@ -540,7 +541,13 @@ impl<C, R, P> bft::Proposer<Block> for Proposer<C, R, P>
next_index += 1;
let signature = MaybeUnsigned(self.local_key.sign(&extrinsic.encode()).into());
let uxt = UncheckedExtrinsic { extrinsic, signature };
let extrinsic = Extrinsic {
signed: extrinsic.signed.into(),
index: extrinsic.index,
function: extrinsic.function,
};
let uxt = UncheckedExtrinsic::new(extrinsic, signature);
self.transaction_pool.import_unchecked_extrinsic(uxt)
.expect("locally signed extrinsic is valid; qed");
......
......@@ -17,7 +17,7 @@
//! Basic parachain that adds a number as part of its state.
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, lang_items, panic_implementation))]
#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, global_allocator, lang_items, panic_implementation, core_panic_info))]
#[cfg(not(feature = "std"))]
extern crate alloc;
......
......@@ -16,15 +16,14 @@
//! Defines WASM module logic.
use core::intrinsics;
use core::{intrinsics, panic};
use parachain::{self, ValidationResult};
use parachain::codec::Slicable;
use super::{HeadData, BlockData};
#[panic_implementation]
#[no_mangle]
pub fn rust_begin_panic(_info: &::core::panic::PanicInfo) -> ! {
pub fn panic(_info: &panic::PanicInfo) -> ! {
unsafe {
intrinsics::abort()
}
......
......@@ -67,6 +67,10 @@ pub type BlockNumber = u64;
/// Alias to Ed25519 pubkey that identifies an account on the relay chain.
pub type AccountId = primitives::hash::H256;
/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
/// never know...
pub type AccountIndex = u64;
/// The Ed25519 pub key of an session that belongs to an authority of the relay chain. This is
/// exactly equivalent to what the substrate calls an "authority".
pub type SessionKey = primitives::AuthorityId;
......
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Typesafe block interaction.
use super::{Call, Block, TIMESTAMP_SET_POSITION, PARACHAINS_SET_POSITION};
use timestamp::Call as TimestampCall;
use parachains::Call as ParachainsCall;
use primitives::parachain::CandidateReceipt;
/// Provides a type-safe wrapper around a structurally valid block.
pub struct CheckedBlock {
inner: Block,
file_line: Option<(&'static str, u32)>,
}
impl CheckedBlock {
/// Create a new checked block. Fails if the block is not structurally valid.
pub fn new(block: Block) -> Result<Self, Block> {
let has_timestamp = block.extrinsics.get(TIMESTAMP_SET_POSITION as usize).map_or(false, |xt| {
!xt.is_signed() && match xt.extrinsic.function {
Call::Timestamp(TimestampCall::set(_)) => true,
_ => false,
}
});
if !has_timestamp { return Err(block) }
let has_heads = block.extrinsics.get(PARACHAINS_SET_POSITION as usize).map_or(false, |xt| {
!xt.is_signed() && match xt.extrinsic.function {
Call::Parachains(ParachainsCall::set_heads(_)) => true,
_ => false,
}
});
if !has_heads { return Err(block) }
Ok(CheckedBlock {
inner: block,
file_line: None,
})
}
// Creates a new checked block, asserting that it is valid.
#[doc(hidden)]
pub fn new_unchecked(block: Block, file: &'static str, line: u32) -> Self {
CheckedBlock {
inner: block,
file_line: Some((file, line)),
}
}
/// Extract the timestamp from the block.
pub fn timestamp(&self) -> ::primitives::Timestamp {
let x = self.inner.extrinsics.get(TIMESTAMP_SET_POSITION as usize).and_then(|xt| match xt.extrinsic.function {
Call::Timestamp(TimestampCall::set(x)) => Some(x),
_ => None
});
match x {
Some(x) => x,
None => panic!("Invalid polkadot block asserted at {:?}", self.file_line),
}
}
/// Extract the parachain heads from the block.
pub fn parachain_heads(&self) -> &[CandidateReceipt] {
let x = self.inner.extrinsics.get(PARACHAINS_SET_POSITION as usize).and_then(|xt| match xt.extrinsic.function {
Call::Parachains(ParachainsCall::set_heads(ref x)) => Some(&x[..]),
_ => None
});
match x {
Some(x) => x,
None => panic!("Invalid polkadot block asserted at {:?}", self.file_line),
}
}
/// Convert into inner block.
pub fn into_inner(self) -> Block { self.inner }
}
impl ::std::ops::Deref for CheckedBlock {
type Target = Block;
fn deref(&self) -> &Block { &self.inner }
}
/// Assert that a block is structurally valid. May lead to panic in the future
/// in case it isn't.
#[macro_export]
macro_rules! assert_polkadot_block {
($block: expr) => {
$crate::CheckedBlock::new_unchecked($block, file!(), line!())
}
}
......@@ -58,11 +58,17 @@ extern crate substrate_runtime_staking as staking;
extern crate substrate_runtime_system as system;
extern crate substrate_runtime_timestamp as timestamp;
#[cfg(feature = "std")]
mod checked_block;
mod parachains;
mod utils;
#[cfg(feature = "std")]
pub use checked_block::CheckedBlock;
pub use utils::{inherent_extrinsics, check_extrinsic};
pub use staking::address::Address as RawAddress;
use rstd::prelude::*;
use primitives::{AccountId, Balance, BlockNumber, Hash, Index, Log, SessionKey, Signature};
use primitives::parachain::CandidateReceipt;
use primitives::{AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, Log, SessionKey, Signature};
use runtime_primitives::{generic, traits::{HasPublicAux, BlakeTwo256, Convert}};
#[cfg(feature = "std")]
......@@ -78,107 +84,23 @@ pub const TIMESTAMP_SET_POSITION: u32 = 0;
/// The position of the parachains set extrinsic.
pub const PARACHAINS_SET_POSITION: u32 = 1;
/// The address format for describing accounts.
pub type Address = staking::Address<Concrete>;
/// Block Id type for this block.
pub type BlockId = generic::BlockId<Block>;
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<AccountId, Index, Call, Signature>;
/// Extrinsic type as expected by this runtime.
pub type Extrinsic = generic::Extrinsic<AccountId, Index, Call>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Index, Call, Signature>;
/// Extrinsic type as expected by this runtime. This is not the type that is signed.
pub type Extrinsic = generic::Extrinsic<Address, Index, Call>;
/// Extrinsic type that is signed.
pub type BareExtrinsic = generic::Extrinsic<AccountId, Index, Call>;
/// Block type as expected by this runtime.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Provides a type-safe wrapper around a structurally valid block.
#[cfg(feature = "std")]
pub struct CheckedBlock {
inner: Block,
file_line: Option<(&'static str, u32)>,
}
#[cfg(feature = "std")]
impl CheckedBlock {
/// Create a new checked block. Fails if the block is not structurally valid.
pub fn new(block: Block) -> Result<Self, Block> {
let has_timestamp = block.extrinsics.get(TIMESTAMP_SET_POSITION as usize).map_or(false, |xt| {
!xt.is_signed() && match xt.extrinsic.function {
Call::Timestamp(TimestampCall::set(_)) => true,
_ => false,
}
});
if !has_timestamp { return Err(block) }
let has_heads = block.extrinsics.get(PARACHAINS_SET_POSITION as usize).map_or(false, |xt| {
!xt.is_signed() && match xt.extrinsic.function {
Call::Parachains(ParachainsCall::set_heads(_)) => true,
_ => false,
}
});
if !has_heads { return Err(block) }
Ok(CheckedBlock {
inner: block,
file_line: None,
})
}
// Creates a new checked block, asserting that it is valid.
#[doc(hidden)]
pub fn new_unchecked(block: Block, file: &'static str, line: u32) -> Self {
CheckedBlock {
inner: block,
file_line: Some((file, line)),
}
}
/// Extract the timestamp from the block.
pub fn timestamp(&self) -> ::primitives::Timestamp {
let x = self.inner.extrinsics.get(TIMESTAMP_SET_POSITION as usize).and_then(|xt| match xt.extrinsic.function {
Call::Timestamp(TimestampCall::set(x)) => Some(x),
_ => None
});
match x {
Some(x) => x,
None => panic!("Invalid polkadot block asserted at {:?}", self.file_line),
}
}
/// Extract the parachain heads from the block.
pub fn parachain_heads(&self) -> &[CandidateReceipt] {
let x = self.inner.extrinsics.get(PARACHAINS_SET_POSITION as usize).and_then(|xt| match xt.extrinsic.function {
Call::Parachains(ParachainsCall::set_heads(ref x)) => Some(&x[..]),
_ => None
});
match x {
Some(x) => x,
None => panic!("Invalid polkadot block asserted at {:?}", self.file_line),
}
}
/// Convert into inner block.
pub fn into_inner(self) -> Block { self.inner }
}
#[cfg(feature = "std")]
impl ::std::ops::Deref for CheckedBlock {
type Target = Block;
fn deref(&self) -> &Block { &self.inner }
}
/// Assert that a block is structurally valid. May lead to panic in the future
/// in case it isn't.
#[cfg(feature = "std")]
#[macro_export]
macro_rules! assert_polkadot_block {
($block: expr) => {
$crate::CheckedBlock::new_unchecked($block, file!(), line!())
}
}
/// Concrete runtime type used to parameterize the various modules.
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
#[derive(Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
pub struct Concrete;
impl HasPublicAux for Concrete {
......@@ -228,6 +150,7 @@ pub type Session = session::Module<Concrete>;
impl staking::Trait for Concrete {
type Balance = Balance;
type DetermineContractAddress = BlakeTwo256;
type AccountIndex = AccountIndex;
}
/// Staking module for this concrete runtime.
pub type Staking = staking::Module<Concrete>;
......@@ -280,7 +203,7 @@ impl_outer_dispatch! {
}
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Concrete, Block, Staking,
pub type Executive = executive::Executive<Concrete, Block, Staking, Staking,
(((((((), Parachains), Council), Democracy), Staking), Session), Timestamp)>;
impl_outer_config! {
......@@ -295,35 +218,6 @@ impl_outer_config! {
}
}
/// Produces the list of inherent extrinsics.
pub fn inherent_extrinsics(timestamp: ::primitives::Timestamp, parachain_heads: Vec<CandidateReceipt>) -> Vec<UncheckedExtrinsic> {
vec![
UncheckedExtrinsic {
extrinsic: Extrinsic {
signed: Default::default(),
function: Call::Timestamp(TimestampCall::set(timestamp)),
index: 0,
},
signature: Default::default(),
},
UncheckedExtrinsic {
extrinsic: Extrinsic {
signed: Default::default(),
function: Call::Parachains(ParachainsCall::set_heads(parachain_heads)),
index: 0,
},
signature: Default::default(),
},
]
}
/// Checks an unchecked extrinsic for validity.
pub fn check_extrinsic(xt: UncheckedExtrinsic) -> bool {
use runtime_primitives::traits::Checkable;
xt.check().is_ok()
}
pub mod api {
impl_stubs!(
authorities => |()| super::Consensus::authorities(),
......@@ -378,14 +272,14 @@ mod tests {
let mut block = Block {
header: Header::new(1, Default::default(), Default::default(), Default::default(), Default::default()),
extrinsics: vec![
UncheckedExtrinsic {
extrinsic: Extrinsic {
UncheckedExtrinsic::new(
generic::Extrinsic {
function: Call::Timestamp(timestamp::Call::set(100_000_000)),
signed: Default::default(),
index: Default::default(),
},
signature: Default::default(),
}
Default::default(),
)
],
};
......@@ -394,14 +288,14 @@ mod tests {
assert_eq!(block, decoded);
block.extrinsics.push(UncheckedExtrinsic {
extrinsic: Extrinsic {
block.extrinsics.push(UncheckedExtrinsic::new(
generic::Extrinsic {
function: Call::Staking(staking::Call::stake()),
signed: Default::default(),
index: 10101,
},
signature: Default::default(),
});
Default::default(),
));
let raw = block.encode();
let decoded = Block::decode(&mut &raw[..]).unwrap();
......@@ -414,25 +308,25 @@ mod tests {
let mut block = Block {
header: Header::new(1, Default::default(), Default::default(), Default::default(), Default::default()),
extrinsics: vec![
UncheckedExtrinsic {
extrinsic: Extrinsic {
UncheckedExtrinsic::new(
generic::Extrinsic {
function: Call::Timestamp(timestamp::Call::set(100_000_000)),
signed: Default::default(),
index: Default::default(),
},
signature: Default::default(),
}
Default::default(),
)
],
};
block.extrinsics.push(UncheckedExtrinsic {
extrinsic: Extrinsic {
block.extrinsics.push(UncheckedExtrinsic::new(
generic::Extrinsic {
function: Call::Staking(staking::Call::stake()),
signed: Default::default(),
index: 10101,
},
signature: Default::default(),
});
Default::default()
));
let raw = block.encode();
let decoded_primitive = ::primitives::Block::decode(&mut &raw[..]).unwrap();
......@@ -444,22 +338,24 @@ mod tests {
#[test]
fn serialize_unchecked() {
let tx = UncheckedExtrinsic {
extrinsic: Extrinsic {
signed: [1; 32].into(),
let tx = UncheckedExtrinsic::new(
Extrinsic {
signed: AccountId::from([1; 32]).into(),
index: 999,
function: Call::Timestamp(TimestampCall::set(135135)),
},
signature: runtime_primitives::Ed25519Signature(primitives::hash::H512([0; 64])).into(),
};
// 71000000
// 0101010101010101010101010101010101010101010101010101010101010101
// e703000000000000
// 00
runtime_primitives::Ed25519Signature(primitives::hash::H512([0; 64])).into()
);
// 6f000000
// ff0101010101010101010101010101010101010101010101010101010101010101
// e7030000
// 0300
// df0f0200
// 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
let v = Slicable::encode(&tx);
assert_eq!(&v[..], &hex!["6f000000ff0101010101010101010101010101010101010101010101010101010101010101e70300000300df0f02000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"][..]);
println!("{}", HexDisplay::from(&v));
assert_eq!(UncheckedExtrinsic::decode(&mut &v[..]).unwrap(), tx);
}
......@@ -467,7 +363,7 @@ mod tests {
#[test]
fn serialize_checked() {
let xt = Extrinsic {
signed: hex!["0d71d1a9cad6f2ab773435a7dec1bac019994d05d1dd5eb3108211dcf25c9d1e"].into(),
signed: AccountId::from(hex!["0d71d1a9cad6f2ab773435a7dec1bac019994d05d1dd5eb3108211dcf25c9d1e"]).into(),
index: 0,
function: Call::CouncilVoting(council::voting::Call::propose(Box::new(
PrivCall::Consensus(consensus::PrivCall::set_code(
......@@ -476,11 +372,6 @@ mod tests {
))),
};
let v = Slicable::encode(&xt);
let data = hex!["e00000000d71d1a9cad6f2ab773435a7dec1bac019994d05d1dd5eb3108211dcf25c9d1e0000000007000000000000006369D39D892B7B87A6769F90E14C618C2B84EBB293E2CC46640136E112C078C75619AC2E0815F2511568736623C055156C8FC427CE2AEE4AE2838F86EFE80208"];
let uxt: UncheckedExtrinsic = Slicable::decode(&mut &data[..]).unwrap();
assert_eq!(uxt.extrinsic, xt);
assert_eq!(Extrinsic::decode(&mut &v[..]).unwrap(), xt);
}
}
......@@ -234,6 +234,7 @@ mod tests {
use runtime_primitives::testing::{Digest, Header};
use consensus;
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
impl HasPublicAux for Test {
type PublicAux = u64;
......
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by