Skip to content

Commit 735930e

Browse files
committed
Apply review suggestions
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
1 parent febf5a0 commit 735930e

File tree

7 files changed

+83
-87
lines changed

7 files changed

+83
-87
lines changed

bin/node-template-archive/archive.toml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
[chain]
22
# Must be an absolute path to chain data db (no ~/)
33
# Can also be specified via the `CHAIN_DATA_DB` environment variable
4-
data_path = "/home/insipx/.local/share/node-template/chains/dev/db"
4+
data_path = "/.local/share/node-template/chains/dev/db"
55

66
# How much should the read-only database keep in cache (MB)
77
# Optional, default: 128
88
cache_size = 128
99

10-
# RocksDB secondary directory, output will be `./output/rocksdb_secondary/`
10+
# RocksDB secondary directory
1111
# Optional, default: /<local>/substrate_archive/rocksdb_secondary/
12-
rocksdb_secondary_path = "./output/"
12+
rocksdb_secondary_path = "./substrate_archive/rocksdb_secondary"
1313

1414
[runtime]
1515
# Specification of different methods of executing the runtime Wasm code.
16-
# Optional, "Interpreted" or "Compiled", default: "Interpreted"
16+
# Optional, "Interpreted" or "Compiled", default: "Interpreted".
1717
#exec_method = "Interpreted"
1818

1919
# Number of threads to dedicate for executing blocks
20-
# Optional, default: the number of logical system threads
20+
# Optional, default: the number of logical system threads.
2121
block_workers = 4
2222

2323
# Number of 64KB Heap Pages to allocate for WASM execution
24-
# Optional, default: 64 * the number of logical system threads
25-
wasm_pages = 512
24+
# Optional, default: 1024.
25+
wasm_pages = 256
2626

2727
[database]
2828
# Database url.
29-
# Can also be specified via the `DATABASE_URL` environment variable
30-
# More info on the wiki: https://github.com/paritytech/substrate-archive/wiki/1.)-Requirements
29+
# Each chain needs it's own PostgreSQL database
30+
# Can also be specified via the `DATABASE_URL` environment variable.
31+
# For production use, using `DATABASE_URL` is preferable.
32+
# More info on the wiki: https://github.com/paritytech/substrate-archive/wiki/1.)-Requirements.
3133
url = "postgres://user:pass@localhost:5432/archive"
3234

3335
[log]
@@ -43,6 +45,9 @@ std = "DEBUG"
4345
# Optional log file name, default: "archive.log"
4446
#name = "archive.log"
4547

48+
# Advanced options
49+
#
50+
# Changing these may lead to unexpected results.
4651
[control]
4752
# Number of database actors to be spawned.
4853
# Optional, default: 4

bin/polkadot-archive/archive.toml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[chain]
22
# Must be an absolute path to the folder where polkadot/kusama/and westend chain data is stored
33
# Can also be specified via the `CHAIN_DATA_DB` environment variable
4-
data_path = "/home/insipx/.local/share/polkadot/chains/polkadot/db"
4+
data_path = "/.local/share/polkadot/chains/polkadot/db"
55

66
# How much should the read-only database keep in cache (MB)
77
# Optional, default: 128
88
cache_size = 128
99

10-
# RocksDB secondary directory, output will be `./output/rocksdb_secondary/`
10+
# RocksDB secondary directory
1111
# Optional, default: /<local>/substrate_archive/rocksdb_secondary/
12-
rocksdb_secondary_path = "./output/"
12+
rocksdb_secondary_path = "./substrate_archive/rocksdb_secondary"
1313

1414
[runtime]
1515
# Specification of different methods of executing the runtime Wasm code.
@@ -25,16 +25,15 @@ rocksdb_secondary_path = "./output/"
2525
block_workers = 8
2626

2727
# Number of 64KB Heap Pages to allocate for WASM execution
28-
# Optional, default: 64 * the number of logical system threads
29-
wasm_pages = 2048
28+
# Optional, default: 1024.
29+
wasm_pages = 512
3030

3131
[database]
3232
# Database url.
3333
# Each chain needs it's own PostgreSQL database
34-
# A fully synced Kusama PostgreSQL database (~2.8Million blocks) takes up around 70GB
35-
# These variables can also be exposed with DB_NAME environment variable
36-
# Can also be specified via the `DATABASE_URL` environment variable
37-
# More info on the wiki: https://github.com/paritytech/substrate-archive/wiki/1.)-Requirements
34+
# Can also be specified via the `DATABASE_URL` environment variable.
35+
# For production use, using `DATABASE_URL` is preferable.
36+
# More info on the wiki: https://github.com/paritytech/substrate-archive/wiki/1.)-Requirements.
3837
url = "postgres://postgres:123@localhost:5432/polkadot-archive"
3938

4039
[log]
@@ -50,6 +49,9 @@ std = "DEBUG"
5049
# Optional log file name, default: "archive.log"
5150
#name = "archive.log"
5251

52+
# Advanced options
53+
#
54+
# Changing these may lead to unexpected results.
5355
[control]
5456
# Number of database actors to be spawned.
5557
# Optional, default: 4

examples/simple.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use polkadot_service::{kusama_runtime::RuntimeApi, Block, KusamaExecutor};
44
use substrate_archive::{Archive, ArchiveBuilder};
55

66
pub fn main() {
7-
substrate_archive::logger::init(Default::default());
8-
97
// get spec/runtime from node library
108
let spec = polkadot_service::chain_spec::kusama_config().unwrap();
119

substrate-archive-backend/src/frontend.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ impl From<ExecutionMethod> for WasmExecutionMethod {
6363

6464
#[derive(Clone, Debug, Deserialize)]
6565
pub struct RuntimeConfig {
66-
/// Specification of different methods of executing the runtime Wasm code.
66+
/// How to execute the runtime code: interpreted (default) or JIT compiled.
6767
#[serde(default)]
6868
pub exec_method: ExecutionMethod,
69-
/// number of threads to spawn for block execution.
69+
/// Number of threads to spawn for block execution.
7070
#[serde(default = "default_block_workers")]
7171
pub block_workers: usize,
7272
/// Number of 64KB Heap pages to allocate for wasm execution.
73-
#[serde(default = "default_wasm_pages")]
74-
pub wasm_pages: u64,
75-
/// Path where WASM files exist to override the on-chain WASM.
73+
pub wasm_pages: Option<u64>,
74+
/// Path to WASM blobs to override the on-chain WASM with (required for state change tracing).
7675
pub wasm_runtime_overrides: Option<PathBuf>,
7776
}
7877

@@ -81,7 +80,7 @@ impl Default for RuntimeConfig {
8180
Self {
8281
exec_method: ExecutionMethod::Interpreted,
8382
block_workers: default_block_workers(),
84-
wasm_pages: default_wasm_pages(),
83+
wasm_pages: None,
8584
wasm_runtime_overrides: None,
8685
}
8786
}
@@ -92,11 +91,6 @@ fn default_block_workers() -> usize {
9291
num_cpus::get()
9392
}
9493

95-
// 64 * (number of logic cpu's)
96-
fn default_wasm_pages() -> u64 {
97-
64 * num_cpus::get() as u64
98-
}
99-
10094
impl From<RuntimeConfig> for ClientConfig {
10195
fn from(config: RuntimeConfig) -> ClientConfig {
10296
ClientConfig {
@@ -123,8 +117,7 @@ where
123117
{
124118
let backend = Arc::new(ReadOnlyBackend::new(db, true));
125119

126-
let executor =
127-
NativeExecutor::<Dispatch>::new(config.exec_method.into(), Some(config.wasm_pages), config.block_workers);
120+
let executor = NativeExecutor::<Dispatch>::new(config.exec_method.into(), config.wasm_pages, config.block_workers);
128121
let executor = LocalCallExecutor::new(backend.clone(), executor, Box::new(TaskExecutor::new()), config.into())?;
129122
let client = Client::new(backend, executor, ExecutionExtensions::new(execution_strategies(), None))?;
130123
Ok(client)

substrate-archive/src/actors.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ where
8181

8282
#[derive(Copy, Clone, Debug, Deserialize)]
8383
pub struct ControlConfig {
84-
/// number of database actors to be spawned in the actor pool.
84+
/// Number of database actors to be spawned in the actor pool.
8585
#[serde(default = "default_db_actor_pool_size")]
8686
pub(crate) db_actor_pool_size: usize,
87-
/// number of threads to spawn for task execution.
87+
/// Number of threads to spawn for task execution.
8888
#[serde(default = "default_task_workers")]
8989
pub(crate) task_workers: usize,
90-
/// maximum amount of time coil will wait for a task to begin.
91-
/// times out if tasks don't start execution in the threadpool within `task_timeout` seconds.
90+
/// Maximum amount of time coil will wait for a task to begin.
91+
/// Times out if tasks don't start execution in the threadpool within `task_timeout` seconds.
9292
#[serde(default = "default_task_timeout")]
9393
pub(crate) task_timeout: u64,
94-
/// maximum tasks to queue in the threadpool.
94+
/// Maximum tasks to queue in the threadpool.
9595
#[serde(default = "default_task_workers")]
9696
pub(crate) max_tasks: usize,
97-
/// maximum amount of blocks to index at once
97+
/// Maximum amount of blocks to index at once.
9898
#[serde(default = "default_max_block_load")]
9999
pub(crate) max_block_load: u32,
100100
}

0 commit comments

Comments
 (0)