From 9b221057d92d24fd4b7aafadbb88b7048d450753 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 23 Jun 2024 14:37:20 +0300 Subject: [PATCH 1/4] override default pages to 60k --- node/src/command.rs | 50 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/node/src/command.rs b/node/src/command.rs index 23674ad17..2423d1456 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -17,7 +17,7 @@ use sp_runtime::traits::HashingFor; use node_subtensor_runtime::Block; use sc_cli::SubstrateCli; -use sc_service::PartialComponents; +use sc_service::{Configuration, PartialComponents}; impl SubstrateCli for Cli { fn impl_name() -> String { @@ -209,8 +209,56 @@ pub fn run() -> sc_cli::Result<()> { None => { let runner = cli.create_runner(&cli.run)?; runner.run_node_until_exit(|config| async move { + let config = override_default_heap_pages(config, 60_000); service::new_full(config).map_err(sc_cli::Error::Service) }) } } } + +/// Override default heap pages +fn override_default_heap_pages(config: Configuration, pages: u64) -> Configuration { + Configuration { + default_heap_pages: Some(pages), + impl_name: config.impl_name, + impl_version: config.impl_version, + role: config.role, + tokio_handle: config.tokio_handle, + transaction_pool: config.transaction_pool, + network: config.network, + keystore: config.keystore, + database: config.database, + trie_cache_maximum_size: config.trie_cache_maximum_size, + state_pruning: config.state_pruning, + blocks_pruning: config.blocks_pruning, + chain_spec: config.chain_spec, + wasm_method: config.wasm_method, + wasm_runtime_overrides: config.wasm_runtime_overrides, + rpc_addr: config.rpc_addr, + rpc_max_connections: config.rpc_max_connections, + rpc_cors: config.rpc_cors, + rpc_methods: config.rpc_methods, + rpc_max_request_size: config.rpc_max_request_size, + rpc_max_response_size: config.rpc_max_response_size, + rpc_id_provider: config.rpc_id_provider, + rpc_max_subs_per_conn: config.rpc_max_subs_per_conn, + rpc_port: config.rpc_port, + rpc_message_buffer_capacity: config.rpc_message_buffer_capacity, + rpc_batch_config: config.rpc_batch_config, + rpc_rate_limit: config.rpc_rate_limit, + prometheus_config: config.prometheus_config, + telemetry_endpoints: config.telemetry_endpoints, + offchain_worker: config.offchain_worker, + force_authoring: config.force_authoring, + disable_grandpa: config.disable_grandpa, + dev_key_seed: config.dev_key_seed, + tracing_targets: config.tracing_targets, + tracing_receiver: config.tracing_receiver, + max_runtime_instances: config.max_runtime_instances, + announce_block: config.announce_block, + data_path: config.data_path, + base_path: config.base_path, + informant_output_format: config.informant_output_format, + runtime_cache_size: config.runtime_cache_size, + } +} From 43a23f46a9a7d480836398af9a6fdcff628424cd Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 24 Jun 2024 13:26:54 +0300 Subject: [PATCH 2/4] update doc --- docs/running-subtensor-locally.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/running-subtensor-locally.md b/docs/running-subtensor-locally.md index 4d827d858..089f4d30a 100644 --- a/docs/running-subtensor-locally.md +++ b/docs/running-subtensor-locally.md @@ -174,7 +174,7 @@ You can now run the public subtensor node either as a lite node or as an archive 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): ```bash title="With --sync=warp setting, for lite node" -./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 +./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 ``` ### Archive node on mainchain @@ -182,7 +182,7 @@ To run a lite node connected to the mainchain, execute the below command (note t 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): ```bash title="With --sync=full and --pruning archive setting, for archive node" -./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 +./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 ``` ### Lite node on testchain @@ -190,7 +190,7 @@ To run an archive node connected to the mainchain, execute the below command (no To run a lite node connected to the testchain, execute the below command: ```bash title="With bootnodes set to testnet and --sync=warp setting, for lite node." -./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 +./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 ``` ### Archive node on testchain @@ -198,8 +198,9 @@ To run a lite node connected to the testchain, execute the below command: To run an archive node connected to the testchain, execute the below command: ```bash title="With bootnodes set to testnet and --sync=full and --pruning archive setting, for archive node" -./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 +./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 ``` ## Running on cloud + 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. From 318eec817dcb5b7907ffb40f080336216e9768bd Mon Sep 17 00:00:00 2001 From: orriin <167025436+orriin@users.noreply.github.com> Date: Tue, 2 Jul 2024 17:04:29 +0200 Subject: [PATCH 3/4] Update running-subtensor-locally.md --- docs/running-subtensor-locally.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/running-subtensor-locally.md b/docs/running-subtensor-locally.md index a7aa8c217..bce806fcb 100644 --- a/docs/running-subtensor-locally.md +++ b/docs/running-subtensor-locally.md @@ -182,6 +182,7 @@ To run an archive node connected to the mainchain, execute the below command (no ```bash title="With --sync=full and --pruning archive setting, for archive node" ./target/production/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 +``` ### Lite node on testchain @@ -189,6 +190,7 @@ To run a lite node connected to the testchain, execute the below command: ```bash title="With bootnodes set to testnet and --sync=warp setting, for lite node." ./target/production/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 +``` ### Archive node on testchain @@ -196,6 +198,7 @@ To run an archive node connected to the testchain, execute the below command: ```bash title="With bootnodes set to testnet and --sync=full and --pruning archive setting, for archive node" ./target/production/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 +``` ## Running on cloud From 9051b4b65af8a765a5264de774d70141c6f7088a Mon Sep 17 00:00:00 2001 From: orriin <167025436+orriin@users.noreply.github.com> Date: Tue, 2 Jul 2024 17:04:45 +0200 Subject: [PATCH 4/4] Update running-subtensor-locally.md --- docs/running-subtensor-locally.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/running-subtensor-locally.md b/docs/running-subtensor-locally.md index bce806fcb..505fe2fb5 100644 --- a/docs/running-subtensor-locally.md +++ b/docs/running-subtensor-locally.md @@ -175,6 +175,7 @@ To run a lite node connected to the mainchain, execute the below command (note t ```bash title="With --sync=warp setting, for lite node" ./target/production/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 +``` ### Archive node on mainchain