Check the genesis hash in transactions regardless of era. (#3286)

* Check the genesis hash in transactions regardless of era.

* Fix check-fees, too.

* Undo.

* Subkey supports new signing.

* Remove unneeded type param.

* Bump tx version

* Build.

* Another build fix

* Build again

* Cleanup

* Another fix.

* Fix

* Fixes

* 6 second blocks.

* Fixes

* Build fix

* Fix

* Fix.
This commit is contained in:
Gavin Wood
2019-08-02 18:30:20 +02:00
committed by GitHub
parent ae6c2f7f8c
commit 7927e80bc6
16 changed files with 102 additions and 116 deletions
@@ -54,6 +54,7 @@ use crate::{RuntimeAdapter, create_block};
pub fn next<F, RA>(
factory_state: &mut RA,
client: &Arc<ComponentClient<FullComponents<F>>>,
genesis_hash: <RA::Block as BlockT>::Hash,
prior_block_hash: <RA::Block as BlockT>::Hash,
prior_block_id: BlockId<F::Block>,
) -> Option<<F as ServiceFactory>::Block>
@@ -91,6 +92,7 @@ where
&from.1,
&to,
&amount,
&genesis_hash,
&prior_block_hash,
);
@@ -77,6 +77,7 @@ pub trait RuntimeAdapter {
key: &Self::Secret,
destination: &Self::AccountId,
amount: &Self::Balance,
genesis_hash: &<Self::Block as BlockT>::Hash,
prior_block_hash: &<Self::Block as BlockT>::Hash,
) -> <Self::Block as BlockT>::Extrinsic;
@@ -118,12 +119,24 @@ where
select_chain.best_chain().map_err(|e| format!("{:?}", e).into());
let mut best_hash = best_header?.hash();
let best_block_id = BlockId::<F::Block>::hash(best_hash);
let genesis_hash = client.block_hash(Zero::zero())?
.expect("Genesis block always exists; qed").into();
while let Some(block) = match factory_state.mode() {
Mode::MasterToNToM =>
complex_mode::next::<F, RA>(&mut factory_state, &client, best_hash.into(), best_block_id),
_ =>
simple_modes::next::<F, RA>(&mut factory_state, &client, best_hash.into(), best_block_id)
Mode::MasterToNToM => complex_mode::next::<F, RA>(
&mut factory_state,
&client,
genesis_hash,
best_hash.into(),
best_block_id,
),
_ => simple_modes::next::<F, RA>(
&mut factory_state,
&client,
genesis_hash,
best_hash.into(),
best_block_id,
),
} {
best_hash = block.header().hash();
import_block::<F>(&client, block);
@@ -49,6 +49,7 @@ use crate::{Mode, RuntimeAdapter, create_block};
pub fn next<F, RA>(
factory_state: &mut RA,
client: &Arc<ComponentClient<FullComponents<F>>>,
genesis_hash: <RA::Block as BlockT>::Hash,
prior_block_hash: <RA::Block as BlockT>::Hash,
prior_block_id: BlockId<F::Block>,
) -> Option<<F as ServiceFactory>::Block>
@@ -82,6 +83,7 @@ where
&from.1,
&to,
&amount,
&genesis_hash,
&prior_block_hash,
);