You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(l1): add --input_dir and --output_dir options to archive sync (#3962)
**Motivation**
Allow writing dump state to files while archive syncing and using them
for archive syncing without the need of an active archive node .
This PR adds the following flags:
* `--ipc_path`: replaces the previously required `archive_node_ipc`
required unnamed arg
* `--output_dir`: outputs the state data received during the sync to the
given directory
* `--input_dir`: allows fetching state data from a previous archive sync
execution instead of an archive node
* `--no_sync`: skips state rebuild, only usable with `--output_dir` to
speed up state data writing when syncing the current node is not needed
<!-- Why does this pull request exist? What are its goals? -->
**Description**
* Adds new CLI flags `--ipc_path`, `--input_dir`, `--output_dir`,
`--no_sync`
* Abstracts archive sync main behaviour into structs to accommodate new
features:
* DumpReader: Allows reading state data from either an ipc connection or
a directory
* DumpProcessor: Processes state data by either using it to rebuild the
state and/or writing it to a file
<!-- A clear and concise general description of the changes this PR
introduces -->
<!-- Link to issues: Resolves#111, Resolves#222 -->
Closes #issue_number
Copy file name to clipboardExpand all lines: tooling/archive_sync/README.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,9 +54,27 @@ This executable takes 3 arguments:
54
54
With these arguments you can run the following command from this directory:
55
55
56
56
```bash
57
-
cargo run --release IPC_PATH BLOCK_NUMBER
57
+
cargo run --release BLOCK_NUMBER --ipc_path IPC_PATH
58
58
```
59
59
60
60
And adding `--datadir DATADIR`if you want to use a custom directory
61
61
62
62
While archive sync is faster than the alternatives (snap, full) it can still take a long time on later blocks of large chains
63
+
64
+
## Usage without an active archive node connection
65
+
66
+
We can avoid relying on an active archive node connection once we have already performed the first sync by writing the state dump to a directory. Note that this will still require an active archive node for the first step.
67
+
68
+
### Step 1: Run the `archive_sync` executable as usual with `--output_dir` flag
69
+
70
+
```bash
71
+
cargo run --release BLOCK_NUMBER --ipc_path IPC_PATH --output_dir STATE_DUMP_DIR
72
+
```
73
+
74
+
If we don't need the node to be synced (for example if we plan to move the state dump to another server after the sync) we can also add the flag `--no_sync` to skip the state sync and only write the state data to files.
75
+
76
+
### Step 2: Run the `archive_sync` executable with `--input_dir` instead of `--ipc-path`
77
+
78
+
```bash
79
+
cargo run --release BLOCK_NUMBER --input_dir STATE_DUMP_DIR
0 commit comments