Skip to content

Commit ab6212a

Browse files
authored
Merge pull request #562 from opentensor/override-default-pages-devnet-ready
Override default pages to fix archive sync [devnet-ready]
2 parents 1692d24 + f5dff31 commit ab6212a

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

docs/running-subtensor-locally.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,33 @@ 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 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
177+
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --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 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
185+
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=full --pruning archive --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_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
193+
./target/release/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=warp --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_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
201+
./target/release/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=full --pruning archive --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
205+
205206
We have not tested these installation scripts on any cloud service. In addition, if you are using Runpod cloud service, then note that this service is already [containerized](https://docs.runpod.io/pods/overview). Hence, the only option available to you is to compile from the source, as described in the above [Method 2: Using Source Code](#method-2-using-source-code) section. Note that these scripts have not been tested on Runpod.

node/src/command.rs

+49-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use sp_runtime::traits::HashingFor;
1717

1818
use node_subtensor_runtime::Block;
1919
use sc_cli::SubstrateCli;
20-
use sc_service::PartialComponents;
20+
use sc_service::{Configuration, PartialComponents};
2121

2222
impl SubstrateCli for Cli {
2323
fn impl_name() -> String {
@@ -209,8 +209,56 @@ pub fn run() -> sc_cli::Result<()> {
209209
None => {
210210
let runner = cli.create_runner(&cli.run)?;
211211
runner.run_node_until_exit(|config| async move {
212+
let config = override_default_heap_pages(config, 60_000);
212213
service::new_full(config).map_err(sc_cli::Error::Service)
213214
})
214215
}
215216
}
216217
}
218+
219+
/// Override default heap pages
220+
fn override_default_heap_pages(config: Configuration, pages: u64) -> Configuration {
221+
Configuration {
222+
default_heap_pages: Some(pages),
223+
impl_name: config.impl_name,
224+
impl_version: config.impl_version,
225+
role: config.role,
226+
tokio_handle: config.tokio_handle,
227+
transaction_pool: config.transaction_pool,
228+
network: config.network,
229+
keystore: config.keystore,
230+
database: config.database,
231+
trie_cache_maximum_size: config.trie_cache_maximum_size,
232+
state_pruning: config.state_pruning,
233+
blocks_pruning: config.blocks_pruning,
234+
chain_spec: config.chain_spec,
235+
wasm_method: config.wasm_method,
236+
wasm_runtime_overrides: config.wasm_runtime_overrides,
237+
rpc_addr: config.rpc_addr,
238+
rpc_max_connections: config.rpc_max_connections,
239+
rpc_cors: config.rpc_cors,
240+
rpc_methods: config.rpc_methods,
241+
rpc_max_request_size: config.rpc_max_request_size,
242+
rpc_max_response_size: config.rpc_max_response_size,
243+
rpc_id_provider: config.rpc_id_provider,
244+
rpc_max_subs_per_conn: config.rpc_max_subs_per_conn,
245+
rpc_port: config.rpc_port,
246+
rpc_message_buffer_capacity: config.rpc_message_buffer_capacity,
247+
rpc_batch_config: config.rpc_batch_config,
248+
rpc_rate_limit: config.rpc_rate_limit,
249+
prometheus_config: config.prometheus_config,
250+
telemetry_endpoints: config.telemetry_endpoints,
251+
offchain_worker: config.offchain_worker,
252+
force_authoring: config.force_authoring,
253+
disable_grandpa: config.disable_grandpa,
254+
dev_key_seed: config.dev_key_seed,
255+
tracing_targets: config.tracing_targets,
256+
tracing_receiver: config.tracing_receiver,
257+
max_runtime_instances: config.max_runtime_instances,
258+
announce_block: config.announce_block,
259+
data_path: config.data_path,
260+
base_path: config.base_path,
261+
informant_output_format: config.informant_output_format,
262+
runtime_cache_size: config.runtime_cache_size,
263+
}
264+
}

0 commit comments

Comments
 (0)