Skip to content

Commit d790e74

Browse files
committed
Merge branch 'devnet-ready' into fix/total-stake-migration
2 parents 05b5c6b + 357a9e1 commit d790e74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3958
-691
lines changed

.github/workflows/docker.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7+
inputs:
8+
branch-or-tag:
9+
description: "Branch or tag to use for the Docker image tag and ref to checkout (optional)"
10+
required: false
11+
default: ""
12+
13+
push:
14+
branches:
15+
- devnet-ready
16+
- devnet
17+
- testnet
718

819
permissions:
920
contents: read
@@ -16,8 +27,18 @@ jobs:
1627
runs-on: SubtensorCI
1728

1829
steps:
30+
- name: Determine Docker tag and ref
31+
id: tag
32+
run: |
33+
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
34+
echo "Determined branch or tag: $branch_or_tag"
35+
echo "tag=$branch_or_tag" >> $GITHUB_ENV
36+
echo "ref=$branch_or_tag" >> $GITHUB_ENV
37+
1938
- name: Checkout code
2039
uses: actions/checkout@v4
40+
with:
41+
ref: ${{ env.ref }}
2142

2243
- name: Set up QEMU
2344
uses: docker/setup-qemu-action@v2
@@ -32,18 +53,10 @@ jobs:
3253
username: ${{ github.actor }}
3354
password: ${{ secrets.GITHUB_TOKEN }}
3455

35-
- name: Extract metadata (tags, labels) for Docker
36-
id: meta
37-
uses: docker/metadata-action@v4
38-
with:
39-
images: ghcr.io/${{ github.repository }}
40-
4156
- name: Build and push Docker image
4257
uses: docker/build-push-action@v4
4358
with:
4459
context: .
4560
push: true
4661
tags: |
47-
${{ steps.meta.outputs.tags }}
48-
ghcr.io/${{ github.repository }}:latest
49-
labels: ${{ steps.meta.outputs.labels }}
62+
ghcr.io/${{ github.repository }}:${{ env.tag }}

Cargo.lock

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ fc-consensus = { git = "https://github.com/opentensor/frontier", rev = "635bdac8
180180
fp-consensus = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
181181
fp-dynamic-fee = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
182182
fc-api = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
183-
fc-rpc = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
183+
fc-rpc = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false, features = ["rpc-binary-search-estimate"]}
184184
fc-rpc-core = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
185185
fc-mapping-sync = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
186+
precompile-utils = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
186187

187188
# Frontier FRAME
188189
pallet-base-fee = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }

hyperparameters.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TxRateLimit: u64 = 1; // [1 @ 64,888]
77
### netuid 1 (text_prompting)
88
```rust
99
Rho: u16 = 10;
10-
Kappa: u16 = 32_767; // 0.5 = 65535/2
10+
Kappa: u16 = 32_767; // 0.5 = 65535/2
1111
MaxAllowedUids: u16 = 1024;
1212
Issuance: u64 = 0;
1313
MinAllowedWeights: u16 = 8;
@@ -32,10 +32,11 @@ ActivityCutoff: u16 = 5000;
3232
MaxRegistrationsPerBlock: u16 = 1;
3333
PruningScore : u16 = u16::MAX;
3434
BondsMovingAverage: u64 = 900_000;
35+
BondsPenalty: u16 = 0;
3536
WeightsVersionKey: u64 = 1020;
3637
MinDifficulty: u64 = 10_000_000;
3738
MaxDifficulty: u64 = u64::MAX / 4;
38-
ServingRateLimit: u64 = 10;
39+
ServingRateLimit: u64 = 10;
3940
Burn: u64 = 1_000_000_000; // 1 tao
4041
MinBurn: u64 = 1_000_000_000; // 1 tao
4142
MaxBurn: u64 = 100_000_000_000; // 100 tao
@@ -45,7 +46,7 @@ WeightsSetRateLimit: u64 = 100;
4546
### netuid 3 (causallmnext)
4647
```rust
4748
Rho: u16 = 10;
48-
Kappa: u16 = 32_767; // 0.5 = 65535/2
49+
Kappa: u16 = 32_767; // 0.5 = 65535/2
4950
MaxAllowedUids: u16 = 4096;
5051
Issuance: u64 = 0;
5152
MinAllowedWeights: u16 = 50;
@@ -70,6 +71,7 @@ ActivityCutoff: u16 = 5000; // [5000 @ 7,163]
7071
MaxRegistrationsPerBlock: u16 = 1;
7172
PruningScore : u16 = u16::MAX;
7273
BondsMovingAverage: u64 = 900_000;
74+
BondsPenalty: u16 = 0;
7375
WeightsVersionKey: u64 = 400;
7476
MinDifficulty: u64 = 10_000_000;
7577
MaxDifficulty: u64 = u64::MAX / 4;

node/src/chain_spec/localnet.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ fn localnet_genesis(
7777
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
7878
2000000000000u128,
7979
),
80+
// ETH
81+
(
82+
// Alith - 0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac
83+
AccountId::from_str("5Fghzk1AJt88PeFEzuRfXzbPchiBbsVGTTXcdx599VdZzkTA").unwrap(),
84+
2000000000000u128,
85+
),
86+
(
87+
// Baltathar - 0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0
88+
AccountId::from_str("5GeqNhKWj1KG78VHzbmo3ZjZgUTrCuWeamdgiA114XHGdaEr").unwrap(),
89+
2000000000000u128,
90+
),
8091
];
8192

8293
// Check if the environment variable is set

pallets/admin-utils/src/benchmarking.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ mod benchmarks {
100100
_(RawOrigin::Root, 1u16/*netuid*/, 100u64/*bonds_moving_average*/)/*sudo_set_bonds_moving_average*/;
101101
}
102102

103+
#[benchmark]
104+
fn sudo_set_bonds_penalty() {
105+
pallet_subtensor::Pallet::<T>::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/);
106+
107+
#[extrinsic_call]
108+
_(RawOrigin::Root, 1u16/*netuid*/, 100u16/*bonds_penalty*/)/*sudo_set_bonds_penalty*/;
109+
}
110+
103111
#[benchmark]
104112
fn sudo_set_max_allowed_validators() {
105113
pallet_subtensor::Pallet::<T>::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/);

pallets/admin-utils/src/lib.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,31 @@ pub mod pallet {
685685
Ok(())
686686
}
687687

688+
/// The extrinsic sets the bonds penalty for a subnet.
689+
/// It is only callable by the root account or subnet owner.
690+
/// The extrinsic will call the Subtensor pallet to set the bonds penalty.
691+
#[pallet::call_index(60)]
692+
#[pallet::weight(<T as Config>::WeightInfo::sudo_set_bonds_penalty())]
693+
pub fn sudo_set_bonds_penalty(
694+
origin: OriginFor<T>,
695+
netuid: u16,
696+
bonds_penalty: u16,
697+
) -> DispatchResult {
698+
pallet_subtensor::Pallet::<T>::ensure_subnet_owner_or_root(origin, netuid)?;
699+
700+
ensure!(
701+
pallet_subtensor::Pallet::<T>::if_subnet_exist(netuid),
702+
Error::<T>::SubnetDoesNotExist
703+
);
704+
pallet_subtensor::Pallet::<T>::set_bonds_penalty(netuid, bonds_penalty);
705+
log::debug!(
706+
"BondsPenalty( netuid: {:?} bonds_penalty: {:?} ) ",
707+
netuid,
708+
bonds_penalty
709+
);
710+
Ok(())
711+
}
712+
688713
/// The extrinsic sets the maximum registrations per block for a subnet.
689714
/// It is only callable by the root account.
690715
/// The extrinsic will call the Subtensor pallet to set the maximum registrations per block.

pallets/admin-utils/src/tests/mock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ parameter_types! {
8686
pub const InitialImmunityPeriod: u16 = 2;
8787
pub const InitialMaxAllowedUids: u16 = 2;
8888
pub const InitialBondsMovingAverage: u64 = 900_000;
89+
pub const InitialBondsPenalty: u16 = 0;
8990
pub const InitialStakePruningMin: u16 = 0;
9091
pub const InitialFoundationDistribution: u64 = 0;
9192
pub const InitialDefaultDelegateTake: u16 = 11_796; // 18% honest number.
@@ -163,6 +164,7 @@ impl pallet_subtensor::Config for Test {
163164
type InitialMaxRegistrationsPerBlock = InitialMaxRegistrationsPerBlock;
164165
type InitialPruningScore = InitialPruningScore;
165166
type InitialBondsMovingAverage = InitialBondsMovingAverage;
167+
type InitialBondsPenalty = InitialBondsPenalty;
166168
type InitialMaxAllowedValidators = InitialMaxAllowedValidators;
167169
type InitialDefaultDelegateTake = InitialDefaultDelegateTake;
168170
type InitialMinDelegateTake = InitialMinDelegateTake;

0 commit comments

Comments
 (0)