Skip to content

Commit f1504c6

Browse files
committed
Fix TX-extension type definition
1 parent 60e1284 commit f1504c6

File tree

5 files changed

+34
-13
lines changed

5 files changed

+34
-13
lines changed

node/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ frame-system.workspace = true
7070
pallet-transaction-payment.workspace = true
7171
pallet-commitments.workspace = true
7272
pallet-drand.workspace = true
73+
pallet-rate-limiting.workspace = true
7374
sp-crypto-ec-utils = { workspace = true, default-features = true, features = [
7475
"bls12-381",
7576
] }
@@ -173,6 +174,7 @@ runtime-benchmarks = [
173174
"polkadot-sdk/runtime-benchmarks",
174175
"pallet-subtensor/runtime-benchmarks",
175176
"pallet-shield/runtime-benchmarks",
177+
"pallet-rate-limiting/runtime-benchmarks",
176178
]
177179

178180
pow-faucet = []

node/src/benchmarking.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ pub fn create_benchmark_extrinsic(
143143
pallet_subtensor::transaction_extension::SubtensorTransactionExtension::<
144144
runtime::Runtime,
145145
>::new(),
146-
pallet_drand::drand_priority::DrandPriority::<runtime::Runtime>::new(),
147-
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(true),
146+
// Keep the same order while staying under the 12-item tuple limit.
147+
(
148+
pallet_drand::drand_priority::DrandPriority::<runtime::Runtime>::new(),
149+
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(true),
150+
),
151+
pallet_rate_limiting::RateLimitTransactionExtension::<runtime::Runtime>::new(),
148152
);
149153

150154
let raw_payload = runtime::SignedPayload::from_raw(

node/src/mev_shield/author.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,12 @@ where
396396
pallet_subtensor::transaction_extension::SubtensorTransactionExtension::<
397397
runtime::Runtime,
398398
>::new(),
399-
pallet_drand::drand_priority::DrandPriority::<runtime::Runtime>::new(),
400-
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(false),
399+
// Keep the same order while staying under the 12-item tuple limit.
400+
(
401+
pallet_drand::drand_priority::DrandPriority::<runtime::Runtime>::new(),
402+
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(false),
403+
),
404+
pallet_rate_limiting::RateLimitTransactionExtension::<runtime::Runtime>::new(),
401405
);
402406

403407
// 3) Manually construct the `Implicit` tuple that the runtime will also derive.
@@ -431,8 +435,12 @@ where
431435
(), // ChargeTransactionPaymentWrapper::Implicit = ()
432436
(), // SudoTransactionExtension::Implicit = ()
433437
(), // SubtensorTransactionExtension::Implicit = ()
434-
(), // DrandPriority::Implicit = ()
435-
None, // CheckMetadataHash::Implicit = Option<[u8; 32]>
438+
// Match the nested tuple shape used by TransactionExtensions.
439+
(
440+
(), // DrandPriority::Implicit = ()
441+
None, // CheckMetadataHash::Implicit = Option<[u8; 32]>
442+
),
443+
(), // RateLimitTransactionExtension::Implicit = ()
436444
);
437445

438446
// 4) Build the exact signable payload from call + extra + implicit.

pallets/admin-utils/src/benchmarking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ mod benchmarks {
7373
#[allow(deprecated)]
7474
let _ = AdminUtils::<T>::sudo_set_serving_rate_limit(
7575
RawOrigin::Root.into(),
76-
1u16.into(), /*netuid*/
77-
100u64, /*serving_rate_limit*/
76+
1u16.into(), /*netuid*/
77+
100u64, /*serving_rate_limit*/
7878
);
7979
}
8080
}

runtime/src/lib.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,17 @@ impl frame_system::offchain::CreateSignedTransaction<pallet_drand::Call<Runtime>
175175
frame_system::CheckEra::<Runtime>::from(Era::Immortal),
176176
check_nonce::CheckNonce::<Runtime>::from(nonce).into(),
177177
frame_system::CheckWeight::<Runtime>::new(),
178-
pallet_rate_limiting::RateLimitTransactionExtension::<Runtime>::new(),
179178
ChargeTransactionPaymentWrapper::new(
180179
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(0),
181180
),
182181
SudoTransactionExtension::<Runtime>::new(),
183182
pallet_subtensor::transaction_extension::SubtensorTransactionExtension::<Runtime>::new(
184183
),
185-
pallet_drand::drand_priority::DrandPriority::<Runtime>::new(),
186-
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(true),
184+
(
185+
pallet_drand::drand_priority::DrandPriority::<Runtime>::new(),
186+
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(true),
187+
),
188+
pallet_rate_limiting::RateLimitTransactionExtension::<Runtime>::new(),
187189
);
188190

189191
let raw_payload = SignedPayload::new(call.clone(), extra.clone()).ok()?;
@@ -1679,6 +1681,8 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
16791681
// Block type as expected by this runtime.
16801682
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
16811683
// The extensions to the basic transaction logic.
1684+
// Note: The SDK only implements TransactionExtension for tuples up to 12 items, so we nest the last
1685+
// two extensions to keep order/encoding while staying under the limit.
16821686
pub type TransactionExtensions = (
16831687
frame_system::CheckNonZeroSender<Runtime>,
16841688
frame_system::CheckSpecVersion<Runtime>,
@@ -1691,8 +1695,11 @@ pub type TransactionExtensions = (
16911695
ChargeTransactionPaymentWrapper<Runtime>,
16921696
SudoTransactionExtension<Runtime>,
16931697
pallet_subtensor::transaction_extension::SubtensorTransactionExtension<Runtime>,
1694-
pallet_drand::drand_priority::DrandPriority<Runtime>,
1695-
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
1698+
(
1699+
pallet_drand::drand_priority::DrandPriority<Runtime>,
1700+
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
1701+
),
1702+
pallet_rate_limiting::RateLimitTransactionExtension<Runtime>,
16961703
);
16971704

16981705
type Migrations = (

0 commit comments

Comments
 (0)