Skip to content

Commit 3988e11

Browse files
authored
Merge branch 'devnet-ready' into spiigot/fix-commit-onexact-epoch
2 parents 129bf3e + 80150de commit 3988e11

File tree

20 files changed

+422
-435
lines changed

20 files changed

+422
-435
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,32 +166,32 @@ sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk.git", tag
166166
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
167167

168168
# Frontier
169-
fp-evm = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
170-
fp-rpc = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
171-
fp-self-contained = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false, features = [
169+
fp-evm = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
170+
fp-rpc = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
171+
fp-self-contained = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false, features = [
172172
"serde",
173173
] }
174-
fp-account = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
175-
fc-storage = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
176-
fc-db = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
177-
fc-consensus = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
178-
fp-consensus = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
179-
fp-dynamic-fee = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
180-
fc-api = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
181-
fc-rpc = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
182-
fc-rpc-core = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
183-
fc-mapping-sync = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
174+
fp-account = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
175+
fc-storage = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
176+
fc-db = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
177+
fc-consensus = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
178+
fp-consensus = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
179+
fp-dynamic-fee = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
180+
fc-api = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
181+
fc-rpc = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
182+
fc-rpc-core = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
183+
fc-mapping-sync = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
184184

185185
# Frontier FRAME
186-
pallet-base-fee = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
187-
pallet-dynamic-fee = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
188-
pallet-ethereum = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
189-
pallet-evm = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
190-
pallet-evm-chain-id = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
191-
pallet-evm-precompile-modexp = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
192-
pallet-evm-precompile-sha3fips = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
193-
pallet-evm-precompile-simple = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
194-
pallet-hotfix-sufficients = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
186+
pallet-base-fee = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
187+
pallet-dynamic-fee = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
188+
pallet-ethereum = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
189+
pallet-evm = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
190+
pallet-evm-chain-id = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
191+
pallet-evm-precompile-modexp = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
192+
pallet-evm-precompile-sha3fips = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
193+
pallet-evm-precompile-simple = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
194+
pallet-hotfix-sufficients = { git = "https://github.com/gztensor/frontier", rev = "b9c606f9", default-features = false }
195195

196196
#DRAND
197197
pallet-drand = { path = "pallets/drand", default-features = false }

chainspecs/plain_spec_finney.json

Lines changed: 3 additions & 1 deletion
Large diffs are not rendered by default.

chainspecs/raw_spec_finney.json

Lines changed: 3 additions & 1 deletion
Large diffs are not rendered by default.

nakamoto_gen.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ clap = { workspace = true, features = ["derive"] }
2525
futures = { workspace = true, features = ["thread-pool"] }
2626
scale-codec = { workspace = true }
2727
serde = { workspace = true, features = ["derive"] }
28+
hex = { workspace = true }
2829

2930
# Storage import
3031
memmap2 = { workspace = true }

node/src/chain_spec/code_substitute_2585476.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

node/src/chain_spec/finney.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(clippy::unwrap_used)]
33

44
use super::*;
5+
use hex::FromHex;
56

67
pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
78
let path: PathBuf = std::path::PathBuf::from("./snapshot.json");
@@ -69,7 +70,7 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
6970
properties.insert("tokenDecimals".into(), 9.into());
7071
properties.insert("ss58Format".into(), 42.into());
7172

72-
Ok(ChainSpec::builder(
73+
let chain_spec = ChainSpec::builder(
7374
wasm_binary,
7475
Extensions {
7576
bad_blocks: Some(HashSet::new()),
@@ -181,7 +182,25 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
181182
balances_issuance,
182183
))
183184
.with_properties(properties)
184-
.build())
185+
.build();
186+
187+
// Load and set the code substitute to avoid archive node sync panic
188+
// See <https://github.com/opentensor/subtensor/pull/1051>
189+
//
190+
// Need to do it in this hacky way because the ChainSpec builder doesn't support setting it
191+
let code_substitute_2585476_hex = include_bytes!("code_substitute_2585476.txt");
192+
let chain_spec_json = chain_spec.as_json(false).unwrap();
193+
let mut chain_spec_json = serde_json::from_str(&chain_spec_json).unwrap();
194+
sc_chain_spec::set_code_substitute_in_json_chain_spec(
195+
&mut chain_spec_json,
196+
Vec::from_hex(code_substitute_2585476_hex)
197+
.unwrap()
198+
.as_slice(),
199+
2585476,
200+
);
201+
let chain_spec_bytes = chain_spec_json.to_string().into_bytes();
202+
let chain_spec = ChainSpec::from_json_bytes(chain_spec_bytes).unwrap();
203+
Ok(chain_spec)
185204
}
186205

187206
// Configure initial storage state for FRAME modules.

pallets/admin-utils/src/benchmarking.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! Benchmarking setup
22
#![cfg(feature = "runtime-benchmarks")]
33
#![allow(clippy::arithmetic_side_effects)]
4-
use super::*;
4+
5+
extern crate alloc;
6+
use alloc::vec::Vec;
57

68
#[allow(unused)]
79
use crate::Pallet as AdminUtils;
@@ -10,6 +12,8 @@ use frame_benchmarking::v2::*;
1012
use frame_support::BoundedVec;
1113
use frame_system::RawOrigin;
1214

15+
use super::*;
16+
1317
#[benchmarks]
1418
mod benchmarks {
1519
use super::*;

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<T: Config> Pallet<T> {
6565
// --- 3. Drain the subnet block emission and accumulate it as subnet emission, which increases until the tempo is reached in #4.
6666
// subnet_blockwise_emission -> subnet_pending_emission
6767
for netuid in subnets.clone().iter() {
68-
if *netuid == 0 || !Self::is_registration_allowed(*netuid) {
68+
if *netuid == 0 || !Self::get_network_registration_allowed(*netuid) {
6969
continue;
7070
}
7171
// --- 3.1 Get the network's block-wise emission amount.
@@ -105,7 +105,10 @@ impl<T: Config> Pallet<T> {
105105
};
106106
}
107107

108-
// --- 4.3 Drain the subnet emission.
108+
// 4.3 Apply pending childkeys of this subnet for the next epoch
109+
Self::do_set_pending_children(*netuid);
110+
111+
// --- 4.4 Drain the subnet emission.
109112
let mut subnet_emission: u64 = PendingEmission::<T>::get(*netuid);
110113
PendingEmission::<T>::insert(*netuid, 0);
111114
log::debug!(
@@ -114,39 +117,39 @@ impl<T: Config> Pallet<T> {
114117
subnet_emission
115118
);
116119

117-
// --- 4.4 Set last step counter.
120+
// --- 4.5 Set last step counter.
118121
Self::set_blocks_since_last_step(*netuid, 0);
119122
Self::set_last_mechanism_step_block(*netuid, current_block);
120123

121-
if *netuid == 0 || !Self::is_registration_allowed(*netuid) {
124+
if *netuid == 0 || !Self::get_network_registration_allowed(*netuid) {
122125
// Skip netuid 0 payouts
123126
continue;
124127
}
125128

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

130-
// --- 4.5.1 Compute the subnet owner cut.
133+
// --- 4.6.1 Compute the subnet owner cut.
131134
let owner_cut: I96F32 = I96F32::from_num(subnet_emission).saturating_mul(
132135
I96F32::from_num(Self::get_subnet_owner_cut())
133136
.saturating_div(I96F32::from_num(u16::MAX)),
134137
);
135138

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

139-
// --- 4.5.3 Add the cut to the balance of the owner
142+
// --- 4.6.3 Add the cut to the balance of the owner
140143
Self::add_balance_to_coldkey_account(
141144
&Self::get_subnet_owner(*netuid),
142145
owner_cut.to_num::<u64>(),
143146
);
144147

145-
// --- 4.5.4 Increase total issuance on the chain.
148+
// --- 4.6.4 Increase total issuance on the chain.
146149
Self::coinbase(owner_cut.to_num::<u64>());
147150
}
148151

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

158-
// 4.7 Accumulate the tuples on hotkeys:
161+
// 4.8 Accumulate the tuples on hotkeys:
159162
for (hotkey, mining_emission, validator_emission) in hotkey_emission {
160163
// 4.8 Accumulate the emission on the hotkey and parent hotkeys.
161164
Self::accumulate_hotkey_emission(
@@ -166,9 +169,6 @@ impl<T: Config> Pallet<T> {
166169
);
167170
log::debug!("Accumulated emissions on hotkey {:?} for netuid {:?}: mining {:?}, validator {:?}", hotkey, *netuid, mining_emission, validator_emission);
168171
}
169-
170-
// 4.5 Apply pending childkeys of this subnet for the next epoch
171-
Self::do_set_pending_children(*netuid);
172172
} else {
173173
// No epoch, increase blocks since last step and continue
174174
Self::set_blocks_since_last_step(

0 commit comments

Comments
 (0)