Skip to content

Commit

Permalink
Merge pull request #1132 from opentensor/devnet
Browse files Browse the repository at this point in the history
testnet deploy 1/7/2025
  • Loading branch information
unconst authored Jan 7, 2025
2 parents 667029a + 666b238 commit 3547058
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 88 deletions.
48 changes: 24 additions & 24 deletions Cargo.lock

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

44 changes: 22 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,32 +166,32 @@ sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk.git", tag
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }

# Frontier
fp-evm = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fp-rpc = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fp-self-contained = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false, features = [
fp-evm = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fp-rpc = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fp-self-contained = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false, features = [
"serde",
] }
fp-account = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-storage = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-db = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-consensus = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fp-consensus = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fp-dynamic-fee = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-api = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-rpc = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-rpc-core = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fc-mapping-sync = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
fp-account = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-storage = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-db = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-consensus = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fp-consensus = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fp-dynamic-fee = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-api = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-rpc = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-rpc-core = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-mapping-sync = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }

# Frontier FRAME
pallet-base-fee = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-dynamic-fee = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-ethereum = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-evm = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-evm-chain-id = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-evm-precompile-modexp = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-evm-precompile-sha3fips = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-evm-precompile-simple = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-hotfix-sufficients = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
pallet-base-fee = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-dynamic-fee = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-ethereum = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-evm = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-evm-chain-id = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-evm-precompile-modexp = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-evm-precompile-sha3fips = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-evm-precompile-simple = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
pallet-hotfix-sufficients = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }

#DRAND
pallet-drand = { path = "pallets/drand", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion nakamoto_gen.json

This file was deleted.

28 changes: 14 additions & 14 deletions pallets/subtensor/src/coinbase/run_coinbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<T: Config> Pallet<T> {
// --- 3. Drain the subnet block emission and accumulate it as subnet emission, which increases until the tempo is reached in #4.
// subnet_blockwise_emission -> subnet_pending_emission
for netuid in subnets.clone().iter() {
if *netuid == 0 || !Self::is_registration_allowed(*netuid) {
if *netuid == 0 || !Self::get_network_registration_allowed(*netuid) {
continue;
}
// --- 3.1 Get the network's block-wise emission amount.
Expand Down Expand Up @@ -105,7 +105,10 @@ impl<T: Config> Pallet<T> {
};
}

// --- 4.3 Drain the subnet emission.
// 4.3 Apply pending childkeys of this subnet for the next epoch
Self::do_set_pending_children(*netuid);

// --- 4.4 Drain the subnet emission.
let mut subnet_emission: u64 = PendingEmission::<T>::get(*netuid);
PendingEmission::<T>::insert(*netuid, 0);
log::debug!(
Expand All @@ -114,39 +117,39 @@ impl<T: Config> Pallet<T> {
subnet_emission
);

// --- 4.4 Set last step counter.
// --- 4.5 Set last step counter.
Self::set_blocks_since_last_step(*netuid, 0);
Self::set_last_mechanism_step_block(*netuid, current_block);

if *netuid == 0 || !Self::is_registration_allowed(*netuid) {
if *netuid == 0 || !Self::get_network_registration_allowed(*netuid) {
// Skip netuid 0 payouts
continue;
}

// --- 4.5 Distribute owner take.
// --- 4.6 Distribute owner take.
if SubnetOwner::<T>::contains_key(netuid) {
// Does the subnet have an owner?

// --- 4.5.1 Compute the subnet owner cut.
// --- 4.6.1 Compute the subnet owner cut.
let owner_cut: I96F32 = I96F32::from_num(subnet_emission).saturating_mul(
I96F32::from_num(Self::get_subnet_owner_cut())
.saturating_div(I96F32::from_num(u16::MAX)),
);

// --- 4.5.2 Remove the cut from the subnet emission
// --- 4.6.2 Remove the cut from the subnet emission
subnet_emission = subnet_emission.saturating_sub(owner_cut.to_num::<u64>());

// --- 4.5.3 Add the cut to the balance of the owner
// --- 4.6.3 Add the cut to the balance of the owner
Self::add_balance_to_coldkey_account(
&Self::get_subnet_owner(*netuid),
owner_cut.to_num::<u64>(),
);

// --- 4.5.4 Increase total issuance on the chain.
// --- 4.6.4 Increase total issuance on the chain.
Self::coinbase(owner_cut.to_num::<u64>());
}

// 4.6 Pass emission through epoch() --> hotkey emission.
// 4.7 Pass emission through epoch() --> hotkey emission.
let hotkey_emission: Vec<(T::AccountId, u64, u64)> =
Self::epoch(*netuid, subnet_emission);
log::debug!(
Expand All @@ -155,7 +158,7 @@ impl<T: Config> Pallet<T> {
hotkey_emission
);

// 4.7 Accumulate the tuples on hotkeys:
// 4.8 Accumulate the tuples on hotkeys:
for (hotkey, mining_emission, validator_emission) in hotkey_emission {
// 4.8 Accumulate the emission on the hotkey and parent hotkeys.
Self::accumulate_hotkey_emission(
Expand All @@ -166,9 +169,6 @@ impl<T: Config> Pallet<T> {
);
log::debug!("Accumulated emissions on hotkey {:?} for netuid {:?}: mining {:?}, validator {:?}", hotkey, *netuid, mining_emission, validator_emission);
}

// 4.5 Apply pending childkeys of this subnet for the next epoch
Self::do_set_pending_children(*netuid);
} else {
// No epoch, increase blocks since last step and continue
Self::set_blocks_since_last_step(
Expand Down
4 changes: 3 additions & 1 deletion pallets/subtensor/src/staking/set_children.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ impl<T: Config> Pallet<T> {
}

// Check that the parent key has at least the minimum own stake
// if children vector is not empty
// (checking with check_weights_min_stake wouldn't work because it considers
// grandparent stake in this case)
ensure!(
Self::get_total_stake_for_hotkey(&hotkey) >= StakeThreshold::<T>::get(),
children.is_empty()
|| Self::get_total_stake_for_hotkey(&hotkey) >= StakeThreshold::<T>::get(),
Error::<T>::NotEnoughStakeToSetChildkeys
);

Expand Down
6 changes: 5 additions & 1 deletion pallets/subtensor/src/subnets/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ impl<T: Config> Pallet<T> {

// 5. Retrieve or initialize the VecDeque of commits for the hotkey.
let cur_block = Self::get_current_block_as_u64();
let cur_epoch = Self::get_epoch_index(netuid, cur_block);
let cur_epoch = match Self::should_run_epoch(netuid, commit_block) {
true => Self::get_epoch_index(netuid, cur_block).saturating_add(1),
false => Self::get_epoch_index(netuid, cur_block),
};

CRV3WeightCommits::<T>::try_mutate(netuid, cur_epoch, |commits| -> DispatchResult {
// 6. Verify that the number of unrevealed commits is within the allowed limit.

Expand Down
Loading

0 comments on commit 3547058

Please sign in to comment.