Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b4789de
Introduce add_stake job.
shamil-gadelshin Jul 17, 2025
61cef76
Add events.
shamil-gadelshin Jul 18, 2025
f880400
Add drand callback
shamil-gadelshin Jul 21, 2025
040a884
Move several extrinsics.
shamil-gadelshin Jul 21, 2025
690e327
Restore tests.
shamil-gadelshin Jul 21, 2025
2c56a1a
Add drand trigger test.
shamil-gadelshin Jul 22, 2025
9f53c33
Add tests for some extrinsics.
shamil-gadelshin Jul 22, 2025
5b73e2a
Add some benchmarks.
shamil-gadelshin Jul 23, 2025
68e6167
Add remove_stake_full_limit aggregate extrinsic.
shamil-gadelshin Jul 24, 2025
a4ce54d
Move stake
shamil-gadelshin Jul 31, 2025
cda6976
Add transfer_stake job
shamil-gadelshin Aug 1, 2025
8ddd901
Add swap_stake job.
shamil-gadelshin Aug 1, 2025
75f20a4
Add remaining benchmarks
shamil-gadelshin Aug 1, 2025
1dfda1c
Add sorting test
shamil-gadelshin Aug 4, 2025
a4f0733
Add transactions to staking jobs.
shamil-gadelshin Aug 5, 2025
ed284fa
Update weights for extrinsics.
shamil-gadelshin Aug 6, 2025
99ed924
Add EVM origin infrastructure
shamil-gadelshin Aug 11, 2025
100fb66
Add add_stake precompile
shamil-gadelshin Aug 11, 2025
68edf7b
Add remove_stake precompile
shamil-gadelshin Aug 11, 2025
46b9b65
Add add_stake_limit and remove_stake_limit precompiles
shamil-gadelshin Aug 11, 2025
b4368fb
Add move_stake and transfer_stake precompiles.
shamil-gadelshin Aug 11, 2025
df9ae51
Add remove_stake_full_limit precompile.
shamil-gadelshin Aug 11, 2025
f2c8a35
Add swap_stake_limit_aggregate extrinsic.
shamil-gadelshin Aug 12, 2025
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
11 changes: 10 additions & 1 deletion pallets/admin-utils/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use frame_support::{
};
use frame_system::{self as system, offchain::CreateTransactionBase};
use frame_system::{EnsureNever, EnsureRoot, limits};
use pallet_subtensor::EvmOriginHelper;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_grandpa::AuthorityList as GrandpaAuthorityList;
use sp_core::U256;
Expand All @@ -28,7 +29,7 @@ frame_support::construct_runtime!(
System: frame_system = 1,
Balances: pallet_balances = 2,
AdminUtils: crate = 3,
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>, Error<T>} = 4,
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>, Error<T>, Origin<T>} = 4,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 5,
Drand: pallet_drand::{Pallet, Call, Storage, Event<T>} = 6,
Grandpa: pallet_grandpa = 7,
Expand Down Expand Up @@ -151,8 +152,15 @@ parameter_types! {
pub const LeaseDividendsDistributionInterval: u32 = 100; // 100 blocks
}

impl EvmOriginHelper<RuntimeOrigin, AccountId> for () {
fn make_evm_origin(_: AccountId) -> RuntimeOrigin {
RuntimeOrigin::none()
}
}
impl pallet_subtensor::Config for Test {
type EvmOriginHelper = ();
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type InitialIssuance = InitialIssuance;
Expand Down Expand Up @@ -396,6 +404,7 @@ impl pallet_drand::Config for Test {
type Verifier = pallet_drand::verifier::QuicknetVerifier;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type HttpFetchTimeout = ConstU64<1_000>;
type OnPulseReceived = ();
}

impl frame_system::offchain::SigningTypes for Test {
Expand Down
1 change: 1 addition & 0 deletions pallets/commitments/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ impl pallet_drand::Config for Test {
type Verifier = pallet_drand::verifier::QuicknetVerifier;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type HttpFetchTimeout = ConstU64<1_000>;
type OnPulseReceived = ();
}

pub mod test_crypto {
Expand Down
22 changes: 22 additions & 0 deletions pallets/drand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ impl<T: SigningTypes> SignedPayload<T> for PulsesPayload<T::Public, BlockNumberF
}
}

/// Callback method to signal new pulses
pub trait OnPulseReceived {
/// Callback method to signal new pulses
fn on_pulse_received(round: RoundNumber);
}

impl OnPulseReceived for () {
fn on_pulse_received(_round: RoundNumber) {}
}

// Enables a chain of method calls
impl<X: OnPulseReceived, Y: OnPulseReceived> OnPulseReceived for (X, Y) {
fn on_pulse_received(round: RoundNumber) {
X::on_pulse_received(round);
Y::on_pulse_received(round);
}
}

#[frame_support::pallet]
pub mod pallet {
use super::*;
Expand Down Expand Up @@ -174,6 +192,9 @@ pub mod pallet {
/// complete.
#[pallet::constant]
type HttpFetchTimeout: Get<u64>;
///
/// Warning: calculate weight properly when change this parameter
type OnPulseReceived: OnPulseReceived;
}

/// the drand beacon configuration
Expand Down Expand Up @@ -352,6 +373,7 @@ pub mod pallet {
// Emit event with all new rounds
if !new_rounds.is_empty() {
Self::deposit_event(Event::NewPulse { rounds: new_rounds });
T::OnPulseReceived::on_pulse_received(last_stored_round);
}

Ok(())
Expand Down
1 change: 1 addition & 0 deletions pallets/drand/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl pallet_drand_bridge::Config for Test {
type Verifier = QuicknetVerifier;
type UnsignedPriority = UnsignedPriority;
type HttpFetchTimeout = ConstU64<1_000>;
type OnPulseReceived = ();
}

// Build genesis storage according to the mock runtime.
Expand Down
Loading