mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
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:
@@ -54,9 +54,10 @@ type Number = <<node_primitives::Block as BlockT>::Header as HeaderT>::Number;
|
||||
impl<Number> FactoryState<Number> {
|
||||
fn build_extra(index: node_primitives::Index, phase: u64) -> node_runtime::SignedExtra {
|
||||
(
|
||||
system::CheckGenesis::new(),
|
||||
system::CheckEra::from(Era::mortal(256, phase)),
|
||||
system::CheckNonce::from(index),
|
||||
system::CheckWeight::from(),
|
||||
system::CheckWeight::new(),
|
||||
balances::TakeFees::from(0)
|
||||
)
|
||||
}
|
||||
@@ -134,6 +135,7 @@ impl RuntimeAdapter for FactoryState<Number> {
|
||||
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 {
|
||||
let index = self.extract_index(&sender, prior_block_hash);
|
||||
@@ -147,7 +149,7 @@ impl RuntimeAdapter for FactoryState<Number> {
|
||||
(*amount).into()
|
||||
)
|
||||
)
|
||||
}, key, (prior_block_hash.clone(), (), (), ()))
|
||||
}, key, (genesis_hash.clone(), prior_block_hash.clone(), (), (), ()))
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(&self) -> InherentData {
|
||||
|
||||
@@ -424,11 +424,12 @@ mod tests {
|
||||
|
||||
let function = Call::Balances(BalancesCall::transfer(to.into(), amount));
|
||||
|
||||
let check_genesis = system::CheckGenesis::new();
|
||||
let check_era = system::CheckEra::from(Era::Immortal);
|
||||
let check_nonce = system::CheckNonce::from(index);
|
||||
let check_weight = system::CheckWeight::from();
|
||||
let check_weight = system::CheckWeight::new();
|
||||
let take_fees = balances::TakeFees::from(0);
|
||||
let extra = (check_era, check_nonce, check_weight, take_fees);
|
||||
let extra = (check_genesis, check_era, check_nonce, check_weight, take_fees);
|
||||
|
||||
let raw_payload = (function, extra.clone(), genesis_hash);
|
||||
let signature = raw_payload.using_encoded(|payload| if payload.len() > 256 {
|
||||
|
||||
Reference in New Issue
Block a user