Skip to content

Commit 86ee896

Browse files
committed
Merge branch 'development' into feat/chain-extension
2 parents 52e1ed3 + 0b283e2 commit 86ee896

File tree

11 files changed

+33530
-11
lines changed

11 files changed

+33530
-11
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ sc-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git",
6767
sc-consensus-grandpa-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
6868
sc-chain-spec-derive = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
6969
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
70+
sc-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
7071
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
7172
sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
7273
sc-network = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }

docs/running-subtensor-locally.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,31 +174,31 @@ You can now run the public subtensor node either as a lite node or as an archive
174174
To run a lite node connected to the mainchain, execute the below command (note the `--sync=warp` flag which runs the subtensor node in lite mode):
175175

176176
```bash title="With --sync=warp setting, for lite node"
177-
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 64 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --ws-max-connections 16000 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external --ws-external
177+
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
178178
```
179179

180180
### Archive node on mainchain
181181

182182
To run an archive node connected to the mainchain, execute the below command (note the `--sync=full` which syncs the node to the full chain and `--pruning archive` flags, which disables the node's automatic pruning of older historical data):
183183

184184
```bash title="With --sync=full and --pruning archive setting, for archive node"
185-
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 64 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --ws-max-connections 16000 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external --ws-external
185+
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
186186
```
187187

188188
### Lite node on testchain
189189

190190
To run a lite node connected to the testchain, execute the below command:
191191

192192
```bash title="With bootnodes set to testnet and --sync=warp setting, for lite node."
193-
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 64 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --ws-max-connections 16000 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external --ws-external
193+
./target/release/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
194194
```
195195

196196
### Archive node on testchain
197197

198198
To run an archive node connected to the testchain, execute the below command:
199199

200200
```bash title="With bootnodes set to testnet and --sync=full and --pruning archive setting, for archive node"
201-
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 64 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --ws-max-connections 16000 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external --ws-external
201+
./target/release/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
202202
```
203203

204204
## Running on cloud

node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ sc-consensus-grandpa-rpc = { workspace = true }
4747
sp-consensus-grandpa = { workspace = true }
4848
sc-chain-spec-derive = { workspace = true }
4949
sc-chain-spec = { workspace = true }
50+
sc-consensus-slots = { workspace = true }
5051
sc-client-api = { workspace = true }
5152
sp-runtime = { workspace = true }
5253
sp-io = { workspace = true }

node/src/service.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use node_subtensor_runtime::{opaque::Block, RuntimeApi};
55
use sc_client_api::{Backend, BlockBackend};
66
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
77
use sc_consensus_grandpa::SharedVoterState;
8+
use sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging;
89
use sc_executor::sp_wasm_interface::{Function, HostFunctionRegistry, HostFunctions};
910
pub use sc_executor::NativeElseWasmExecutor;
1011
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams};
@@ -240,7 +241,10 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
240241

241242
let role = config.role.clone();
242243
let force_authoring = config.force_authoring;
243-
let backoff_authoring_blocks: Option<()> = None;
244+
let backoff_authoring_blocks = Some(BackoffAuthoringOnFinalizedHeadLagging {
245+
unfinalized_slack: 6,
246+
..Default::default()
247+
});
244248
let name = config.network.node_name.clone();
245249
let enable_grandpa = !config.disable_grandpa;
246250
let prometheus_registry = config.prometheus_registry().cloned();

pallets/admin-utils/src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,24 @@ pub mod pallet {
931931
log::info!("TxMinDelegateTakeSet( tx_min_delegate_take: {:?} ) ", take);
932932
Ok(())
933933
}
934+
935+
/// The extrinsic sets the target stake per interval.
936+
/// It is only callable by the root account.
937+
/// The extrinsic will call the Subtensor pallet to set target stake per interval.
938+
#[pallet::call_index(47)]
939+
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
940+
pub fn sudo_set_target_stakes_per_interval(
941+
origin: OriginFor<T>,
942+
target_stakes_per_interval: u64,
943+
) -> DispatchResult {
944+
ensure_root(origin)?;
945+
T::Subtensor::set_target_stakes_per_interval(target_stakes_per_interval);
946+
log::info!(
947+
"TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
948+
target_stakes_per_interval
949+
);
950+
Ok(())
951+
}
934952
}
935953
}
936954

@@ -1023,4 +1041,5 @@ pub trait SubtensorInterface<AccountId, Balance, RuntimeOrigin> {
10231041
fn get_nominator_min_required_stake() -> u64;
10241042
fn set_nominator_min_required_stake(min_stake: u64);
10251043
fn clear_small_nominations();
1044+
fn set_target_stakes_per_interval(target_stakes_per_interval: u64);
10261045
}

pallets/admin-utils/tests/mock.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ impl pallet_admin_utils::SubtensorInterface<AccountId, Balance, RuntimeOrigin> f
450450
fn clear_small_nominations() {
451451
SubtensorModule::clear_small_nominations();
452452
}
453+
454+
fn set_target_stakes_per_interval(target_stakes_per_interval: u64) {
455+
SubtensorModule::set_target_stakes_per_interval(target_stakes_per_interval);
456+
}
453457
}
454458

455459
impl pallet_admin_utils::Config for Test {

0 commit comments

Comments
 (0)