Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1117742
hoist crypto dependencies and add zeroize
l0r1s Feb 9, 2026
1b344f3
introduce ShieldKeystore on node side
l0r1s Feb 9, 2026
3c3526b
add InherentDatapProvider for MEV shield
l0r1s Feb 9, 2026
d129bf0
add key rotation task on own block import
l0r1s Feb 9, 2026
ce36fcf
remove old author/proposer tasks
l0r1s Feb 9, 2026
4e732d3
extract Executive Context
l0r1s Feb 9, 2026
f70bc1b
remove keys default and swap safely
l0r1s Feb 9, 2026
e1c1b03
make inherent public key possibly none in case of node failure
l0r1s Feb 9, 2026
991d3df
move shield client logic to own stc-shield crate
l0r1s Feb 9, 2026
d99c6bf
added shield primitives crate (stp-shield)
l0r1s Feb 9, 2026
5369a9f
refactor MemoryShieldKeystore and implement ShieldKeystore
l0r1s Feb 9, 2026
c1c1c00
fix types following stp-shield crate creation
l0r1s Feb 9, 2026
58969a7
remove unused depndencies from node
l0r1s Feb 9, 2026
3ca3d28
added subtensor primitives for I/O aka custom host functions (stp-io)
l0r1s Feb 9, 2026
13d4f74
fix imports and features
l0r1s Feb 9, 2026
dd85d1c
stp-shield: added basic shield runtime API
l0r1s Feb 9, 2026
a4e87ec
fix type errors in node consensus
l0r1s Feb 9, 2026
d14bc77
stp-io: aead_decrypt now returns Vec<u8> because unknown result size
l0r1s Feb 10, 2026
1b33e99
add SubtensorHostFunctions to node
l0r1s Feb 10, 2026
5c009c5
rework the pallet-shield
l0r1s Feb 10, 2026
7dd713d
implement stp_shield::ShieldApi Runtime API
l0r1s Feb 10, 2026
870a1ec
pallet-shield: expose Current and Next keys
l0r1s Feb 10, 2026
cd98c1e
pallet-shield: tx ext to filter based on used key
l0r1s Feb 11, 2026
5532aeb
pallet-shield: fix shielded transaction format
l0r1s Feb 11, 2026
a74c32a
some renaming
l0r1s Feb 11, 2026
5af44b5
fix some tx extensions org
l0r1s Feb 11, 2026
ba04acd
move ShieldedTransaction to shield/primitives
l0r1s Feb 11, 2026
c9b8721
fix runtime API impl
l0r1s Feb 11, 2026
e7516f9
renaming
l0r1s Feb 12, 2026
d5ff1f0
simplify key rotation in pallet-shield
l0r1s Feb 13, 2026
95b633d
fix shield tx extension
l0r1s Feb 13, 2026
611815d
types in stp-shield and more logging
l0r1s Feb 13, 2026
1a6086b
track CurrentKey and fix extension
l0r1s Feb 13, 2026
59f5380
added tests for MemoryShieldKeystore
l0r1s Feb 13, 2026
2c64145
added shielded_tx tests
l0r1s Feb 13, 2026
c711619
cargo fmt
l0r1s Feb 13, 2026
c1a3a51
added shield extension tests
l0r1s Feb 13, 2026
1b4aa89
update comment
l0r1s Feb 13, 2026
2f7ec42
added tests for pallet-shield
l0r1s Feb 13, 2026
963eafe
update workspace Cargo.toml
l0r1s Feb 14, 2026
6626654
fix Cargo.toml for pallet-shield and workspace
l0r1s Feb 14, 2026
68a3f92
move stp-shield/stc-shield to polkadot-sdk to avoid circular deps
l0r1s Feb 14, 2026
c7f9c05
update benchmarks
l0r1s Feb 14, 2026
6beec65
Merge branch 'main' into mev-block-builder
l0r1s Feb 14, 2026
464231c
update Cargo.toml/lock
l0r1s Feb 14, 2026
4977da3
added migration to clear old storage + tests
l0r1s Feb 16, 2026
43f6088
commit Cargo.lock
l0r1s Feb 16, 2026
947b873
cargo check
l0r1s Feb 16, 2026
33311de
clippy fix
l0r1s Feb 16, 2026
bea1186
update fix_rust script to match CI
l0r1s Feb 16, 2026
d1b439b
fix clippy with expect used for the stp-io methods
l0r1s Feb 16, 2026
1003f23
zepter fix
l0r1s Feb 16, 2026
31d65fe
fix benchmark compilation issue with rand stuff
l0r1s Feb 16, 2026
873a6b5
use rand_chacha (portable + nostd) instead of OsRng in benchmarks
l0r1s Feb 17, 2026
b90f426
remove unused recipe.json/snapshot.json
l0r1s Feb 17, 2026
edcfcd0
downgrade rand_chacha back to 0.3.1
l0r1s Feb 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,158 changes: 664 additions & 494 deletions Cargo.lock

Large diffs are not rendered by default.

478 changes: 144 additions & 334 deletions Cargo.toml

Large diffs are not rendered by default.

19 changes: 6 additions & 13 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ clap = { workspace = true, features = ["derive"] }
futures = { workspace = true, features = ["thread-pool"] }
serde = { workspace = true, features = ["derive"] }
hex.workspace = true
tokio = { workspace = true, features = ["time"] }

# Storage import
memmap2.workspace = true
Expand Down Expand Up @@ -77,6 +78,7 @@ sp-keystore.workspace = true
polkadot-sdk = { workspace = true, features = [
"cumulus-primitives-proof-size-hostfunction",
] }
stp-io.workspace = true

# These dependencies are used for the subtensor's RPCs
jsonrpsee = { workspace = true, features = ["server"] }
Expand All @@ -94,6 +96,7 @@ pallet-transaction-payment-rpc-runtime-api.workspace = true
# These dependencies are used for runtime benchmarking
frame-benchmarking.workspace = true
frame-benchmarking-cli.workspace = true
pallet-subtensor.workspace = true

# Needed for Frontier
fc-mapping-sync.workspace = true
Expand All @@ -116,18 +119,8 @@ num-traits = { workspace = true, features = ["std"] }

# Mev Shield
pallet-shield.workspace = true
tokio = { version = "1.38", features = ["time"] }
x25519-dalek = "2"
hkdf = "0.12"
chacha20poly1305 = { version = "0.10", features = ["std"] }
codec.workspace = true
rand.workspace = true
sha2.workspace = true
anyhow.workspace = true
pallet-subtensor.workspace = true
ml-kem.workspace = true
rand_core = "0.9.3"
blake2 = "0.10.6"
stp-shield.workspace = true
stc-shield.workspace = true

# Local Dependencies
node-subtensor-runtime = { workspace = true, features = ["std"] }
Expand Down Expand Up @@ -187,8 +180,8 @@ try-runtime = [
"pallet-commitments/try-runtime",
"pallet-drand/try-runtime",
"polkadot-sdk/try-runtime",
"pallet-shield/try-runtime",
"pallet-subtensor/try-runtime",
"pallet-shield/try-runtime",
]

metadata-hash = ["node-subtensor-runtime/metadata-hash"]
39 changes: 19 additions & 20 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub fn create_benchmark_extrinsic(
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2) as u64;
let extra: runtime::TransactionExtensions =
let extra: runtime::TxExtension = (
(
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
Expand All @@ -136,32 +136,31 @@ pub fn create_benchmark_extrinsic(
)),
check_nonce::CheckNonce::<runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<runtime::Runtime>::new(),
transaction_payment_wrapper::ChargeTransactionPaymentWrapper::new(
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
),
),
(
transaction_payment_wrapper::ChargeTransactionPaymentWrapper::new(0),
sudo_wrapper::SudoTransactionExtension::<runtime::Runtime>::new(),
pallet_subtensor::transaction_extension::SubtensorTransactionExtension::<
runtime::Runtime,
>::new(),
pallet_shield::CheckShieldedTxValidity::<runtime::Runtime>::new(),
pallet_subtensor::SubtensorTransactionExtension::<runtime::Runtime>::new(),
pallet_drand::drand_priority::DrandPriority::<runtime::Runtime>::new(),
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(true),
);
),
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(true),
);

let raw_payload = runtime::SignedPayload::from_raw(
call.clone(),
extra.clone(),
(
(),
runtime::VERSION.spec_version,
runtime::VERSION.transaction_version,
genesis_hash,
best_hash,
(),
(),
(),
(),
(),
(),
(
(),
runtime::VERSION.spec_version,
runtime::VERSION.transaction_version,
genesis_hash,
best_hash,
(),
(),
),
((), (), (), (), ()),
None,
),
);
Expand Down
1 change: 1 addition & 0 deletions node/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ pub type HostFunctions = (
frame_benchmarking::benchmarking::HostFunctions,
sp_crypto_ec_utils::bls12_381::host_calls::HostFunctions,
ProofSize,
stp_io::SubtensorHostFunctions,
);
pub type RuntimeExecutor = WasmExecutor<HostFunctions>;
10 changes: 8 additions & 2 deletions node/src/consensus/aura_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ use sp_keystore::KeystorePtr;
use sp_runtime::traits::Block as BlockT;
use sp_runtime::traits::NumberFor;
use std::{error::Error, sync::Arc};
use stp_shield::ShieldKeystorePtr;

pub struct AuraConsensus;

impl ConsensusMechanism for AuraConsensus {
type InherentDataProviders = (
sp_consensus_aura::inherents::InherentDataProvider,
sp_timestamp::InherentDataProvider,
stc_shield::InherentDataProvider,
);

fn start_authoring<C, SC, I, PF, SO, L, CIDP, BS, Error>(
Expand Down Expand Up @@ -101,18 +103,21 @@ impl ConsensusMechanism for AuraConsensus {

fn create_inherent_data_providers(
slot_duration: SlotDuration,
shield_keystore: ShieldKeystorePtr,
) -> Result<Self::InherentDataProviders, Box<dyn Error + Send + Sync>> {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let slot =
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
let shield = stc_shield::InherentDataProvider::new(shield_keystore);
Ok((slot, timestamp, shield))
}

fn pending_create_inherent_data_providers(
slot_duration: SlotDuration,
shield_keystore: ShieldKeystorePtr,
) -> Result<Self::InherentDataProviders, Box<dyn Error + Send + Sync>> {
let current = sp_timestamp::InherentDataProvider::from_system_time();
let next_slot = current
Expand All @@ -125,7 +130,8 @@ impl ConsensusMechanism for AuraConsensus {
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
let shield = stc_shield::InherentDataProvider::new(shield_keystore);
Ok((slot, timestamp, shield))
}

fn new() -> Self {
Expand Down
10 changes: 8 additions & 2 deletions node/src/consensus/babe_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use sp_inherents::CreateInherentDataProviders;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::NumberFor;
use std::{error::Error, sync::Arc};
use stp_shield::ShieldKeystorePtr;

pub struct BabeConsensus {
babe_link: Option<BabeLink<Block>>,
Expand All @@ -42,6 +43,7 @@ impl ConsensusMechanism for BabeConsensus {
type InherentDataProviders = (
sp_consensus_babe::inherents::InherentDataProvider,
sp_timestamp::InherentDataProvider,
stc_shield::InherentDataProvider,
);

#[allow(clippy::expect_used)]
Expand Down Expand Up @@ -111,18 +113,21 @@ impl ConsensusMechanism for BabeConsensus {

fn create_inherent_data_providers(
slot_duration: SlotDuration,
shield_keystore: ShieldKeystorePtr,
) -> Result<Self::InherentDataProviders, Box<dyn Error + Send + Sync>> {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let slot =
sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
let shield = stc_shield::InherentDataProvider::new(shield_keystore);
Ok((slot, timestamp, shield))
}

fn pending_create_inherent_data_providers(
slot_duration: SlotDuration,
shield_keystore: ShieldKeystorePtr,
) -> Result<Self::InherentDataProviders, Box<dyn Error + Send + Sync>> {
let current = sp_timestamp::InherentDataProvider::from_system_time();
let next_slot = current
Expand All @@ -135,7 +140,8 @@ impl ConsensusMechanism for BabeConsensus {
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
let shield = stc_shield::InherentDataProvider::new(shield_keystore);
Ok((slot, timestamp, shield))
}

fn new() -> Self {
Expand Down
3 changes: 3 additions & 0 deletions node/src/consensus/consensus_mechanism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use sp_keystore::KeystorePtr;
use sp_runtime::traits::NumberFor;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use stp_shield::ShieldKeystorePtr;

use crate::client::FullClient;
use crate::service::BIQ;
Expand Down Expand Up @@ -85,11 +86,13 @@ pub trait ConsensusMechanism {
/// Creates IDPs for the consensus mechanism.
fn create_inherent_data_providers(
slot_duration: SlotDuration,
shield_keystore: ShieldKeystorePtr,
) -> Result<Self::InherentDataProviders, Box<dyn std::error::Error + Send + Sync>>;

/// Creates IDPs for the consensus mechanism for pending blocks.
fn pending_create_inherent_data_providers(
slot_duration: SlotDuration,
shield_keystore: ShieldKeystorePtr,
) -> Result<Self::InherentDataProviders, Box<dyn std::error::Error + Send + Sync>>;

/// Creates the frontier consensus data provider with this mechanism.
Expand Down
1 change: 0 additions & 1 deletion node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ pub mod client;
pub mod conditional_evm_block_import;
pub mod consensus;
pub mod ethereum;
pub mod mev_shield;
pub mod rpc;
pub mod service;
1 change: 0 additions & 1 deletion node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mod command;
mod conditional_evm_block_import;
mod consensus;
mod ethereum;
mod mev_shield;
mod rpc;
mod service;

Expand Down
Loading
Loading