Skip to content

Commit 6bf5072

Browse files
committed
remove unused params
1 parent 27bc798 commit 6bf5072

File tree

3 files changed

+8
-56
lines changed

3 files changed

+8
-56
lines changed

node/src/mev_shield/proposer.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ pub fn spawn_revealer<B, C, Pool>(
541541
type RuntimeNonce = <node_subtensor_runtime::Runtime as frame_system::Config>::Nonce;
542542

543543
// Safely parse plaintext layout without panics.
544-
// Layout: signer (32) || nonce (4) || mortality (1) || call (..)
544+
// Layout: signer (32) || nonce (4) || call (..)
545545
// || sig_kind (1) || sig (64)
546546
let min_plain_len: usize = 32usize
547547
.saturating_add(4)
@@ -582,20 +582,8 @@ pub fn spawn_revealer<B, C, Pool>(
582582
}
583583
};
584584

585-
let mortality_byte = match plaintext.get(36) {
586-
Some(b) => *b,
587-
None => {
588-
log::debug!(
589-
target: "mev-shield",
590-
" id=0x{}: missing mortality byte",
591-
hex::encode(id.as_bytes())
592-
);
593-
continue;
594-
}
595-
};
596-
597585
let sig_off = match plaintext.len().checked_sub(65) {
598-
Some(off) if off >= 37 => off,
586+
Some(off) if off >= 36 => off,
599587
_ => {
600588
log::debug!(
601589
target: "mev-shield",
@@ -606,7 +594,7 @@ pub fn spawn_revealer<B, C, Pool>(
606594
}
607595
};
608596

609-
let call_bytes = match plaintext.get(37..sig_off) {
597+
let call_bytes = match plaintext.get(36..sig_off) {
610598
Some(s) => s,
611599
None => {
612600
log::debug!(
@@ -681,13 +669,6 @@ pub fn spawn_revealer<B, C, Pool>(
681669
let raw_nonce_u32 = u32::from_le_bytes(nonce_array);
682670
let account_nonce: RuntimeNonce = raw_nonce_u32.saturated_into();
683671

684-
// Mortality currently only supports immortal; we still
685-
// parse the byte to keep layout consistent.
686-
let _mortality = match mortality_byte {
687-
0 => Era::Immortal,
688-
_ => Era::Immortal,
689-
};
690-
691672
let inner_call: node_subtensor_runtime::RuntimeCall =
692673
match Decode::decode(&mut &call_bytes[..]) {
693674
Ok(c) => c,
@@ -733,7 +714,6 @@ pub fn spawn_revealer<B, C, Pool>(
733714
id,
734715
signer: signer.clone(),
735716
nonce: account_nonce,
736-
mortality: Era::Immortal,
737717
call: Box::new(inner_call),
738718
signature,
739719
}

pallets/shield/src/lib.rs

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub mod pallet {
1010
use frame_support::{
1111
dispatch::{GetDispatchInfo, PostDispatchInfo},
1212
pallet_prelude::*,
13-
traits::{ConstU32, Currency},
13+
traits::ConstU32,
1414
weights::Weight,
1515
};
1616
use frame_system::pallet_prelude::*;
@@ -60,14 +60,13 @@ pub mod pallet {
6060
// ----------------- Types -----------------
6161

6262
/// AEAD‑independent commitment over the revealed payload.
63-
#[freeze_struct("6c00690caddfeb78")]
63+
#[freeze_struct("b307ebc1f8eae75")]
6464
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
6565
pub struct Submission<AccountId, BlockNumber, Moment, Hash> {
6666
pub author: AccountId,
6767
pub key_epoch: u64,
6868
pub commitment: Hash,
6969
pub ciphertext: BoundedVec<u8, ConstU32<8192>>,
70-
pub payload_version: u16,
7170
pub submitted_in: BlockNumber,
7271
pub submitted_at: Moment,
7372
pub max_weight: Weight,
@@ -96,17 +95,6 @@ pub mod pallet {
9695
> + GetDispatchInfo;
9796

9897
type AuthorityOrigin: AuthorityOriginExt<Self::RuntimeOrigin, AccountId = AccountId32>;
99-
100-
#[pallet::constant]
101-
type SlotMs: Get<u64>;
102-
#[pallet::constant]
103-
type AnnounceAtMs: Get<u64>;
104-
#[pallet::constant]
105-
type GraceMs: Get<u64>;
106-
#[pallet::constant]
107-
type DecryptWindowMs: Get<u64>;
108-
109-
type Currency: Currency<Self::AccountId>;
11098
}
11199

112100
#[pallet::pallet]
@@ -215,7 +203,7 @@ pub mod pallet {
215203
///
216204
/// ```text
217205
/// raw_payload =
218-
/// signer (32B) || nonce (u32 LE) || mortality_byte || SCALE(call)
206+
/// signer (32B) || nonce (u32 LE) || SCALE(call)
219207
/// commitment = blake2_256(raw_payload)
220208
/// ```
221209
///
@@ -232,7 +220,6 @@ pub mod pallet {
232220
key_epoch: u64,
233221
commitment: T::Hash,
234222
ciphertext: BoundedVec<u8, ConstU32<8192>>,
235-
payload_version: u16,
236223
max_weight: Weight,
237224
) -> DispatchResult {
238225
let who = ensure_signed(origin)?;
@@ -248,7 +235,6 @@ pub mod pallet {
248235
key_epoch,
249236
commitment,
250237
ciphertext,
251-
payload_version,
252238
submitted_in: <frame_system::Pallet<T>>::block_number(),
253239
submitted_at: now,
254240
max_weight,
@@ -278,7 +264,6 @@ pub mod pallet {
278264
id: T::Hash,
279265
signer: T::AccountId,
280266
nonce: T::Nonce,
281-
mortality: sp_runtime::generic::Era,
282267
call: Box<<T as Config>::RuntimeCall>,
283268
signature: MultiSignature,
284269
) -> DispatchResultWithPostInfo {
@@ -289,7 +274,7 @@ pub mod pallet {
289274
};
290275

291276
let payload_bytes =
292-
Self::build_raw_payload_bytes(&signer, nonce, &mortality, call.as_ref());
277+
Self::build_raw_payload_bytes(&signer, nonce, call.as_ref());
293278

294279
// 1) Commitment check against on-chain stored commitment.
295280
let recomputed: T::Hash = T::Hashing::hash(&payload_bytes);
@@ -347,11 +332,10 @@ pub mod pallet {
347332
/// - signature message (after domain separation).
348333
///
349334
/// Layout:
350-
/// signer (32B) || nonce (u32 LE) || mortality_byte || SCALE(call)
335+
/// signer (32B) || nonce (u32 LE) || SCALE(call)
351336
fn build_raw_payload_bytes(
352337
signer: &T::AccountId,
353338
nonce: T::Nonce,
354-
mortality: &sp_runtime::generic::Era,
355339
call: &<T as Config>::RuntimeCall,
356340
) -> Vec<u8> {
357341
let mut out = Vec::new();
@@ -361,13 +345,6 @@ pub mod pallet {
361345
let n_u32: u32 = nonce.saturated_into();
362346
out.extend_from_slice(&n_u32.to_le_bytes());
363347

364-
// Simple 1-byte mortality code to match the off-chain layout.
365-
let m_byte: u8 = match mortality {
366-
sp_runtime::generic::Era::Immortal => 0,
367-
_ => 1,
368-
};
369-
out.push(m_byte);
370-
371348
// Append SCALE-encoded call.
372349
out.extend(call.encode());
373350

runtime/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,6 @@ impl frame_system::offchain::SigningTypes for Runtime {
122122

123123
impl pallet_shield::Config for Runtime {
124124
type RuntimeCall = RuntimeCall;
125-
type SlotMs = ShieldSlotMs;
126-
type AnnounceAtMs = ShieldAnnounceAtMs;
127-
type GraceMs = ShieldGraceMs;
128-
type DecryptWindowMs = ShieldDecryptWindowMs;
129-
type Currency = Balances;
130125
type AuthorityOrigin = pallet_shield::EnsureAuraAuthority<Self>;
131126
}
132127

0 commit comments

Comments
 (0)