mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Add ‘transaction_version’ to the signed transaction (#5979)
* Add ‘transaction_version’ to the signed transaction This allows hardware wallets to know which transactions they can safely sign. To reduce transaction size, I reduced it to a ‘u8’ from a ‘u32’. Fixes #5951. * Restore transaction_version to a u32 * Fix comments `transaction_version` is not part of a tx, but is still signed. Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Fix the test suite I had forgotten to change the production of transactions in the test code. * Fix benchmarks * Improve docs for `CheckTxVersion` in `frame_system` Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Remove spurious cast Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -68,7 +68,8 @@ pub fn to_session_keys(
|
||||
/// Returns transaction extra.
|
||||
pub fn signed_extra(nonce: Index, extra_fee: Balance) -> SignedExtra {
|
||||
(
|
||||
frame_system::CheckVersion::new(),
|
||||
frame_system::CheckSpecVersion::new(),
|
||||
frame_system::CheckTxVersion::new(),
|
||||
frame_system::CheckGenesis::new(),
|
||||
frame_system::CheckEra::from(Era::mortal(256, 0)),
|
||||
frame_system::CheckNonce::from(nonce),
|
||||
@@ -79,10 +80,10 @@ pub fn signed_extra(nonce: Index, extra_fee: Balance) -> SignedExtra {
|
||||
}
|
||||
|
||||
/// Sign given `CheckedExtrinsic`.
|
||||
pub fn sign(xt: CheckedExtrinsic, version: u32, genesis_hash: [u8; 32]) -> UncheckedExtrinsic {
|
||||
pub fn sign(xt: CheckedExtrinsic, spec_version: u32, tx_version: u32, genesis_hash: [u8; 32]) -> UncheckedExtrinsic {
|
||||
match xt.signed {
|
||||
Some((signed, extra)) => {
|
||||
let payload = (xt.function, extra.clone(), version, genesis_hash, genesis_hash);
|
||||
let payload = (xt.function, extra.clone(), spec_version, tx_version, genesis_hash, genesis_hash);
|
||||
let key = AccountKeyring::from_account_id(&signed).unwrap();
|
||||
let signature = payload.using_encoded(|b| {
|
||||
if b.len() > 256 {
|
||||
|
||||
Reference in New Issue
Block a user