Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule coldkey swap and dissolve network #713

Merged
merged 52 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cb78f39
clippy
Jul 26, 2024
d9b8eb9
stash
Jul 29, 2024
d7ef058
fix compile error
open-junius Jul 30, 2024
2260fa0
fix error
open-junius Jul 30, 2024
ed345c5
fix clippy
open-junius Jul 30, 2024
3e6d1af
fix clippy
open-junius Jul 30, 2024
8dda65d
fix unit test
open-junius Jul 30, 2024
8d1c3d6
Merge pull request #698 from opentensor/junius/fix_scheduled_coldkey_…
distributedstatemachine Jul 30, 2024
0b5e24d
chore: scheduler tests
Jul 30, 2024
850caf6
chore: lints
Jul 30, 2024
d790ab3
fix: hotkey swap delegates
Jul 30, 2024
50179b5
Update pallets/subtensor/tests/swap_hotkey.rs
distributedstatemachine Jul 30, 2024
6cbd4d0
Update pallets/subtensor/tests/swap_hotkey.rs
distributedstatemachine Jul 30, 2024
bdb3e17
Update pallets/subtensor/tests/swap_hotkey.rs
distributedstatemachine Jul 30, 2024
883799f
chore: additional tests
Jul 31, 2024
c61782f
chore: bump spec version
Jul 31, 2024
3d4d571
start the unit test fix
open-junius Jul 31, 2024
cab0fc3
chore: fix tests
Jul 31, 2024
a125856
fix unit test
open-junius Aug 1, 2024
0c1816c
fixed the config level issue
open-junius Aug 1, 2024
aad89d8
fix compilation
open-junius Aug 1, 2024
53ccd94
all unit test passed
open-junius Aug 1, 2024
2f83b84
clean up code
open-junius Aug 1, 2024
d80a928
fix clippy
open-junius Aug 1, 2024
1633b6c
fix admin test
open-junius Aug 1, 2024
49bd0c5
fix test
open-junius Aug 1, 2024
0f2fa05
remove unneeded feature
open-junius Aug 1, 2024
59dc95c
clean up code
open-junius Aug 1, 2024
6ff7b3f
Merge pull request #701 from opentensor/fix/swap_delegates
distributedstatemachine Aug 1, 2024
9250464
update feature dependency
open-junius Aug 2, 2024
af4bf35
fix zepter
open-junius Aug 2, 2024
0bce83e
fix clippy
open-junius Aug 2, 2024
16b097c
Merge pull request #707 from opentensor/junius/fix_scheduled_coldkey_…
distributedstatemachine Aug 3, 2024
22cc4b5
chore: skip wasm builds on test scripts
Jul 31, 2024
21e3c26
feat: patch errors and assertions
Aug 4, 2024
fa1f279
Merge remote-tracking branch 'origin/devnet-ready' into feat/schedule…
Aug 4, 2024
67de45c
add schedule dissolve network
open-junius Aug 6, 2024
106df9e
fix clippy
open-junius Aug 6, 2024
cc036e5
fix clippy
open-junius Aug 6, 2024
70f624f
udpate comments
open-junius Aug 6, 2024
771b120
fix bechmarks
open-junius Aug 7, 2024
03a85f1
Create publish script to publish crates in the correct order
keithtensor Aug 6, 2024
c4eeca1
Put publish.sh inside scripts/
keithtensor Aug 7, 2024
6366607
Add bump-version binary to help with bumping all crate versions
keithtensor Aug 8, 2024
9e98762
Remove VERSION file and instead pass version as an argument
keithtensor Aug 14, 2024
3707b8d
Merge pull request #719 from opentensor/schedule_dissolve_network
distributedstatemachine Aug 16, 2024
188a8d8
Merge pull request #720 from opentensor/crates-io-publish-script
unconst Aug 16, 2024
74fcd80
chore: tidy
Aug 19, 2024
8ab4573
clean code and fix a bug
open-junius Aug 19, 2024
e2f372b
remove unused dispatch
open-junius Aug 19, 2024
e432f4c
Merge remote-tracking branch 'origin/devnet-ready' into feat/schedule…
Aug 19, 2024
51aa073
Merge remote-tracking branch 'origin/devnet' into feat/scheduled_cold…
Aug 19, 2024
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
49 changes: 32 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ members = [
"pallets/collective",
"pallets/registry",
"runtime",
"support/tools",
"support/macros",
"support/linting",
]
Expand Down
9 changes: 7 additions & 2 deletions pallets/admin-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ sp-io = { workspace = true }
sp-tracing = { workspace = true }
sp-consensus-aura = { workspace = true }
pallet-balances = { workspace = true, features = ["std"] }

pallet-scheduler = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand All @@ -50,12 +51,14 @@ std = [
"pallet-subtensor/std",
"sp-consensus-aura/std",
"pallet-balances/std",
"pallet-scheduler/std",
"sp-runtime/std",
"sp-tracing/std",
"sp-weights/std",
"log/std",
"sp-core/std",
"sp-io/std",
"sp-std/std",
"substrate-fixed/std",
]
runtime-benchmarks = [
Expand All @@ -64,12 +67,14 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-subtensor/runtime-benchmarks"
"pallet-subtensor/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-scheduler/try-runtime",
"sp-runtime/try-runtime",
"pallet-subtensor/try-runtime"
]
45 changes: 41 additions & 4 deletions pallets/admin-utils/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

use frame_support::{
assert_ok, derive_impl, parameter_types,
traits::{Everything, Hooks},
traits::{Everything, Hooks, PrivilegeCmp},
weights,
};
use frame_system as system;
use frame_system::{limits, EnsureNever};
use frame_system::{limits, EnsureNever, EnsureRoot};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::U256;
use sp_core::{ConstU64, H256};
use sp_runtime::{
traits::{BlakeTwo256, ConstU32, IdentityLookup},
BuildStorage,
BuildStorage, Perbill,
};
use sp_std::cmp::Ordering;
use sp_weights::Weight;

type Block = frame_system::mocking::MockBlock<Test>;

Expand All @@ -25,6 +27,7 @@ frame_support::construct_runtime!(
Balances: pallet_balances,
AdminUtils: pallet_admin_utils,
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>, Error<T>},
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
}
);

Expand Down Expand Up @@ -120,17 +123,20 @@ parameter_types! {
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
pub const InitialHotkeyEmissionTempo: u64 = 1;
pub const InitialNetworkMaxStake: u64 = u64::MAX; // Maximum possible value for u64, this make the make stake infinity
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
}

impl pallet_subtensor::Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type InitialIssuance = InitialIssuance;
type SudoRuntimeCall = TestRuntimeCall;
type CouncilOrigin = EnsureNever<AccountId>;
type SenateMembers = ();
type TriumvirateInterface = ();

type Scheduler = Scheduler;
type InitialMinAllowedWeights = InitialMinAllowedWeights;
type InitialEmissionValue = InitialEmissionValue;
type InitialMaxWeightsLimit = InitialMaxWeightsLimit;
Expand Down Expand Up @@ -181,6 +187,9 @@ impl pallet_subtensor::Config for Test {
type LiquidAlphaOn = InitialLiquidAlphaOn;
type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo;
type InitialNetworkMaxStake = InitialNetworkMaxStake;
type Preimages = ();
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
Expand Down Expand Up @@ -226,6 +235,14 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = ();
}

pub struct OriginPrivilegeCmp;

impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {
fn cmp_privilege(_left: &OriginCaller, _right: &OriginCaller) -> Option<Ordering> {
None
}
}

impl pallet_admin_utils::Config for Test {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = AuraId;
Expand All @@ -235,6 +252,26 @@ impl pallet_admin_utils::Config for Test {
type WeightInfo = ();
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
BlockWeights::get().max_block;
pub const MaxScheduledPerBlock: u32 = 50;
pub const NoPreimagePostponement: Option<u32> = Some(10);
}

impl pallet_scheduler::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Test>;
type OriginPrivilegeCmp = OriginPrivilegeCmp;
type Preimages = ();
}

// Build genesis storage according to the mock runtime.
pub fn new_test_ext() -> sp_io::TestExternalities {
sp_tracing::try_init_simple();
Expand Down
11 changes: 10 additions & 1 deletion pallets/subtensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ num-traits = { version = "0.2.19", default-features = false, features = ["libm"]

[dev-dependencies]
pallet-balances = { workspace = true, features = ["std"] }
pallet-scheduler = { workspace = true }
sp-version = { workspace = true }
# Substrate
sp-tracing = { workspace = true }
parity-util-mem = { workspace = true, features = ["primitive-types"] }
rand = { workspace = true }
sp-core = { workspace = true }
sp-std = { workspace = true }
pallet-preimage = { workspace = true }

[features]
default = ["std"]
Expand All @@ -68,6 +71,8 @@ std = [
"pallet-membership/std",
"substrate-fixed/std",
"pallet-balances/std",
"pallet-preimage/std",
"pallet-scheduler/std",
"pallet-transaction-payment/std",
"pallet-utility/std",
"sp-core/std",
Expand All @@ -94,13 +99,17 @@ runtime-benchmarks = [
"pallet-membership/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-collective/runtime-benchmarks"
"pallet-collective/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-membership/try-runtime",
"pallet-preimage/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-utility/try-runtime",
"sp-runtime/try-runtime",
Expand Down
4 changes: 2 additions & 2 deletions pallets/subtensor/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ sp-runtime = { workspace = true }

# local packages

subtensor-custom-rpc-runtime-api = { version = "0.0.2", path = "../runtime-api", default-features = false }
pallet-subtensor = { version = "4.0.0-dev", path = "../../subtensor", default-features = false }
subtensor-custom-rpc-runtime-api = { path = "../runtime-api", default-features = false }
pallet-subtensor = { path = "../../subtensor", default-features = false }

[features]
default = ["std"]
Expand Down
Loading
Loading