Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
b4a4875
E2E workflow stub
shamil-gadelshin Feb 17, 2026
860aab9
Merge pull request #2428 from opentensor/e2e-workflow-stub
sam0x17 Feb 17, 2026
61d15e2
hoist crypto dependencies and add zeroize
l0r1s Feb 9, 2026
555aacb
introduce ShieldKeystore on node side
l0r1s Feb 9, 2026
8858849
add InherentDatapProvider for MEV shield
l0r1s Feb 9, 2026
b872011
add key rotation task on own block import
l0r1s Feb 9, 2026
b1fb00b
remove old author/proposer tasks
l0r1s Feb 9, 2026
a3db025
extract Executive Context
l0r1s Feb 9, 2026
fda9e85
remove keys default and swap safely
l0r1s Feb 9, 2026
d1ef7a9
make inherent public key possibly none in case of node failure
l0r1s Feb 9, 2026
b23a283
move shield client logic to own stc-shield crate
l0r1s Feb 9, 2026
0c4c7dc
added shield primitives crate (stp-shield)
l0r1s Feb 9, 2026
837b626
refactor MemoryShieldKeystore and implement ShieldKeystore
l0r1s Feb 9, 2026
3649fbb
fix types following stp-shield crate creation
l0r1s Feb 9, 2026
6c8a0fd
remove unused deps from node
l0r1s Feb 9, 2026
d4ea4bc
added subtensor primitives for I/O aka custom host functions (stp-io)
l0r1s Feb 9, 2026
c730f6f
fix imports and features
l0r1s Feb 9, 2026
0b3ffc3
stp-shield: added basic shield runtime API
l0r1s Feb 9, 2026
1ce48ca
fix type errors in node consensus
l0r1s Feb 9, 2026
cc96105
stp-io: aead_decrypt now returns Vec<u8> because unknown result size
l0r1s Feb 10, 2026
95a1be9
add SubtensorHostFunctions to node
l0r1s Feb 10, 2026
d7eb559
rework the pallet-shield
l0r1s Feb 10, 2026
aad59bb
implement stp_shield::ShieldApi Runtime API
l0r1s Feb 10, 2026
600a6af
pallet-shield: expose Current and Next keys
l0r1s Feb 10, 2026
31347e6
pallet-shield: tx ext to filter based on used key
l0r1s Feb 11, 2026
e24415d
pallet-shield: fix shielded transaction format
l0r1s Feb 11, 2026
33eb516
some renaming
l0r1s Feb 11, 2026
24989e6
fix some tx extensions org
l0r1s Feb 11, 2026
9ccfe1b
move ShieldedTransaction to shield/primitives
l0r1s Feb 11, 2026
5c17f8d
fix runtime API impl
l0r1s Feb 11, 2026
9555252
renaming
l0r1s Feb 12, 2026
2bb2648
simplify key rotation in pallet-shield
l0r1s Feb 13, 2026
d86ce0d
fix shield tx extension
l0r1s Feb 13, 2026
0acd062
types in stp-shield and more logging
l0r1s Feb 13, 2026
5a4c4fe
track CurrentKey and fix extension
l0r1s Feb 13, 2026
1f43c3e
added tests for MemoryShieldKeystore
l0r1s Feb 13, 2026
b65d190
added shielded_tx tests
l0r1s Feb 13, 2026
8e9a607
cargo fmt
l0r1s Feb 13, 2026
928c2ae
added shield extension tests
l0r1s Feb 13, 2026
d4bcc94
update comment
l0r1s Feb 13, 2026
0d9b364
added tests for pallet-shield
l0r1s Feb 13, 2026
88d07de
update workspace Cargo.toml
l0r1s Feb 14, 2026
bf1ec4d
fix Cargo.toml for pallet-shield and workspace
l0r1s Feb 14, 2026
ed8b1fb
move stp-shield/stc-shield to polkadot-sdk to avoid circular deps
l0r1s Feb 14, 2026
cc88c59
update benchmarks
l0r1s Feb 14, 2026
ca2152b
update Cargo.toml/lock
l0r1s Feb 14, 2026
4fe3441
added migration to clear old storage + tests
l0r1s Feb 16, 2026
4a57233
commit Cargo.lock
l0r1s Feb 16, 2026
301b9d5
cargo check
l0r1s Feb 16, 2026
b10a135
clippy fix
l0r1s Feb 16, 2026
7ad09d5
update fix_rust script to match CI
l0r1s Feb 16, 2026
935d3f3
fix clippy with expect used for the stp-io methods
l0r1s Feb 16, 2026
b913cd0
zepter fix
l0r1s Feb 16, 2026
4f72743
fix benchmark compilation issue with rand stuff
l0r1s Feb 16, 2026
9cd6e1a
use rand_chacha (portable + nostd) instead of OsRng in benchmarks
l0r1s Feb 17, 2026
34d8357
downgrade rand_chacha back to 0.3.1
l0r1s Feb 17, 2026
df0d064
fix compilation issues after cherrypick on devnet-ready
l0r1s Feb 17, 2026
9a08ef0
move CustomTransactionError to subtensor common
l0r1s Feb 18, 2026
0a5359b
added new custom transaction error for shielded txs
l0r1s Feb 18, 2026
aee4aa4
bump frontier and psdk deps
l0r1s Feb 18, 2026
e39bfe7
setup pnpm workspace for e2e
l0r1s Feb 18, 2026
5f656bf
added shared e2e package including node utils, chainspec and sequencer
l0r1s Feb 18, 2026
db4d93c
add helpers to e2e/shared/client
l0r1s Feb 18, 2026
47a6743
setup e2e/shield package for mev shields e2e tests
l0r1s Feb 18, 2026
d2bf68d
added e2e tests for shield
l0r1s Feb 18, 2026
7bd9825
add workflow to run e2e
l0r1s Feb 19, 2026
6a855c4
Merge branch 'devnet-ready' into mev-shield-rework
l0r1s Feb 19, 2026
f143f01
added missing readmes
l0r1s Feb 19, 2026
92751a5
Merge branch 'devnet-ready' into mev-shield-rework
l0r1s Feb 19, 2026
1a81775
move multiple tx in same block tests to basic/scaling
l0r1s Feb 19, 2026
c0b9a6f
fix rand crate api changes when upgrading
l0r1s Feb 19, 2026
a548094
split E2E into another PR
l0r1s Feb 19, 2026
d6f0293
remove e2e workflow
l0r1s Feb 19, 2026
a948c1c
Merge branch 'main' into mev-shield-rework
l0r1s Feb 19, 2026
6cb72db
fix clippy
l0r1s Feb 19, 2026
4e5f4d2
bump spec version to 381
l0r1s Feb 19, 2026
3bf35a3
fix benchmarks
l0r1s Feb 19, 2026
ee5e3df
fix benchmarks
l0r1s Feb 19, 2026
4e56a30
trigger ci
l0r1s Feb 23, 2026
c6291ed
set longevity to 3 for mev shield txs
l0r1s Feb 23, 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
4 changes: 4 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: E2E Tests

on:
workflow_dispatch:
1,211 changes: 702 additions & 509 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.

2 changes: 2 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ use sp_runtime::{
use subtensor_macros::freeze_struct;

pub use currency::*;
pub use transaction_error::*;

mod currency;
mod transaction_error;

/// Balance of an account.
pub type Balance = u64;
Expand Down
70 changes: 70 additions & 0 deletions common/src/transaction_error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError};

#[derive(Debug, PartialEq)]
pub enum CustomTransactionError {
ColdkeySwapAnnounced,
StakeAmountTooLow,
BalanceTooLow,
SubnetNotExists,
HotkeyAccountDoesntExist,
NotEnoughStakeToWithdraw,
RateLimitExceeded,
InsufficientLiquidity,
SlippageTooHigh,
TransferDisallowed,
HotKeyNotRegisteredInNetwork,
InvalidIpAddress,
ServingRateLimitExceeded,
InvalidPort,
BadRequest,
ZeroMaxAmount,
InvalidRevealRound,
CommitNotFound,
CommitBlockNotInRevealRange,
InputLengthsUnequal,
UidNotFound,
EvmKeyAssociateRateLimitExceeded,
ColdkeySwapDisputed,
InvalidRealAccount,
FailedShieldedTxParsing,
InvalidShieldedTxPubKeyHash,
}

impl From<CustomTransactionError> for u8 {
fn from(variant: CustomTransactionError) -> u8 {
match variant {
CustomTransactionError::ColdkeySwapAnnounced => 0,
CustomTransactionError::StakeAmountTooLow => 1,
CustomTransactionError::BalanceTooLow => 2,
CustomTransactionError::SubnetNotExists => 3,
CustomTransactionError::HotkeyAccountDoesntExist => 4,
CustomTransactionError::NotEnoughStakeToWithdraw => 5,
CustomTransactionError::RateLimitExceeded => 6,
CustomTransactionError::InsufficientLiquidity => 7,
CustomTransactionError::SlippageTooHigh => 8,
CustomTransactionError::TransferDisallowed => 9,
CustomTransactionError::HotKeyNotRegisteredInNetwork => 10,
CustomTransactionError::InvalidIpAddress => 11,
CustomTransactionError::ServingRateLimitExceeded => 12,
CustomTransactionError::InvalidPort => 13,
CustomTransactionError::BadRequest => 255,
CustomTransactionError::ZeroMaxAmount => 14,
CustomTransactionError::InvalidRevealRound => 15,
CustomTransactionError::CommitNotFound => 16,
CustomTransactionError::CommitBlockNotInRevealRange => 17,
CustomTransactionError::InputLengthsUnequal => 18,
CustomTransactionError::UidNotFound => 19,
CustomTransactionError::EvmKeyAssociateRateLimitExceeded => 20,
CustomTransactionError::ColdkeySwapDisputed => 21,
CustomTransactionError::InvalidRealAccount => 22,
CustomTransactionError::FailedShieldedTxParsing => 23,
CustomTransactionError::InvalidShieldedTxPubKeyHash => 24,
}
}
}

impl From<CustomTransactionError> for TransactionValidityError {
fn from(variant: CustomTransactionError) -> Self {
TransactionValidityError::Invalid(InvalidTransaction::Custom(variant.into()))
}
}
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"]
56 changes: 29 additions & 27 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,41 +124,43 @@ pub fn create_benchmark_extrinsic(
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2) as u64;
let extra: runtime::TransactionExtensions = (
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
frame_system::CheckGenesis::<runtime::Runtime>::new(),
frame_system::CheckEra::<runtime::Runtime>::from(sp_runtime::generic::Era::mortal(
period,
best_block.saturated_into(),
)),
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),
let extra: runtime::TxExtension = (
(
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
frame_system::CheckGenesis::<runtime::Runtime>::new(),
frame_system::CheckEra::<runtime::Runtime>::from(sp_runtime::generic::Era::mortal(
period,
best_block.saturated_into(),
)),
check_nonce::CheckNonce::<runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<runtime::Runtime>::new(),
),
(
transaction_payment_wrapper::ChargeTransactionPaymentWrapper::new(0),
sudo_wrapper::SudoTransactionExtension::<runtime::Runtime>::new(),
pallet_shield::CheckShieldedTxValidity::<runtime::Runtime>::new(),
pallet_subtensor::SubtensorTransactionExtension::<runtime::Runtime>::new(),
pallet_drand::drand_priority::DrandPriority::<runtime::Runtime>::new(),
),
sudo_wrapper::SudoTransactionExtension::<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),
);

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>;
11 changes: 9 additions & 2 deletions node/src/consensus/aura_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ use sp_inherents::CreateInherentDataProviders;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::Block as BlockT;
use sp_runtime::traits::NumberFor;
use stc_shield::InherentDataProvider as ShieldInherentDataProvider;
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 +104,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 = ShieldInherentDataProvider::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 +131,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
11 changes: 9 additions & 2 deletions node/src/consensus/babe_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ use sp_consensus_slots::SlotDuration;
use sp_inherents::CreateInherentDataProviders;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::NumberFor;
use stc_shield::InherentDataProvider as ShieldInherentDataProvider;
use std::{error::Error, sync::Arc};
use stp_shield::ShieldKeystorePtr;

pub struct BabeConsensus {
babe_link: Option<BabeLink<Block>>,
Expand All @@ -42,6 +44,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 +114,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 +141,8 @@ impl ConsensusMechanism for BabeConsensus {
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
let shield = ShieldInherentDataProvider::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