mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-24 17:07:58 +00:00
Improve SignedExtension matching logic and remove SkipCheckIfFeeless bits (#1283)
* First pass making matching on signed exts more general and handlng SkipCheckifFeeless * remove unneeded derives (only exts we can decode into are handled by the user) * No SkipCheckIfFeeless in integration tests either * Cargo fmt * Remove SkipCheckIfFeeless specific logic * clippy * matches to just return bool, not result * remove now-invalid comment * return error from find if .iter() errors
This commit is contained in:
@@ -5,9 +5,7 @@
|
||||
use crate::{test_context, utils::node_runtime};
|
||||
use codec::{Compact, Encode};
|
||||
use futures::StreamExt;
|
||||
use subxt::config::signed_extensions::{
|
||||
ChargeAssetTxPayment, CheckMortality, CheckNonce, SkipCheckIfFeeless,
|
||||
};
|
||||
use subxt::config::signed_extensions::{ChargeAssetTxPayment, CheckMortality, CheckNonce};
|
||||
use subxt::config::DefaultExtrinsicParamsBuilder;
|
||||
use subxt::config::SubstrateConfig;
|
||||
use subxt::utils::Era;
|
||||
@@ -280,25 +278,23 @@ async fn decode_signed_extensions_from_blocks() {
|
||||
let extensions1 = transaction1.signed_extensions().unwrap();
|
||||
|
||||
let nonce1 = extensions1.nonce().unwrap();
|
||||
let nonce1_static = extensions1.find::<CheckNonce>().unwrap().unwrap().0;
|
||||
let nonce1_static = extensions1.find::<CheckNonce>().unwrap().unwrap();
|
||||
let tip1 = extensions1.tip().unwrap();
|
||||
let tip1_static: u128 = extensions1
|
||||
.find::<SkipCheckIfFeeless<SubstrateConfig, ChargeAssetTxPayment<SubstrateConfig>>>()
|
||||
.find::<ChargeAssetTxPayment<SubstrateConfig>>()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.inner_signed_extension()
|
||||
.tip();
|
||||
|
||||
let transaction2 = submit_transfer_extrinsic_and_get_it_back!(5678);
|
||||
let extensions2 = transaction2.signed_extensions().unwrap();
|
||||
let nonce2 = extensions2.nonce().unwrap();
|
||||
let nonce2_static = extensions2.find::<CheckNonce>().unwrap().unwrap().0;
|
||||
let nonce2_static = extensions2.find::<CheckNonce>().unwrap().unwrap();
|
||||
let tip2 = extensions2.tip().unwrap();
|
||||
let tip2_static: u128 = extensions2
|
||||
.find::<SkipCheckIfFeeless<SubstrateConfig, ChargeAssetTxPayment<SubstrateConfig>>>()
|
||||
.find::<ChargeAssetTxPayment<SubstrateConfig>>()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.inner_signed_extension()
|
||||
.tip();
|
||||
|
||||
assert_eq!(nonce1, 0);
|
||||
@@ -318,7 +314,7 @@ async fn decode_signed_extensions_from_blocks() {
|
||||
"CheckMortality",
|
||||
"CheckNonce",
|
||||
"CheckWeight",
|
||||
"SkipCheckIfFeeless",
|
||||
"ChargeAssetTxPayment",
|
||||
];
|
||||
|
||||
assert_eq!(extensions1.iter().count(), expected_signed_extensions.len());
|
||||
|
||||
Reference in New Issue
Block a user