-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(da): add exec cmd for da chunks execution and verification (#3054)
## Summary 1. enhance DA commands with new namespace and exec logic: Added full hash output for namespace command and refined the exec command with optional executor handling and improved transaction verification logic. Updated documentation with new usage instructions and examples. 2. use loaded genesis instance for consistency as DA default namespace 3. add exec cmd for da chunks execution and verification 4. feat(statedb): make export path optional in re-genesis command
- Loading branch information
Showing
12 changed files
with
599 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,93 @@ | ||
## Rooch DA tool | ||
# Rooch DA tool | ||
|
||
Toolkits for RoochDA. | ||
|
||
### Usage | ||
## Usage | ||
|
||
1. Unpack tx list to human-readable format: | ||
### namespace | ||
|
||
Derive DA namespace from genesis file: | ||
|
||
```shell | ||
rooch da namespace --genesis-file-path {genesis-file} | ||
``` | ||
|
||
### unpack | ||
|
||
#### download segments | ||
|
||
the easiest way to download segments is using `getda` tool from [here](https://github.com/popcnt1/roh) for downloading | ||
segments from cloud storage. | ||
|
||
```shell | ||
getda --output={segment-dir} --url={da-cloud-storage-path} --last_chunk={max-chunk-id-expected} --max_goroutines={max-goroutines} | ||
``` | ||
|
||
#### unpack segments | ||
|
||
Unpack tx list from segments to human-readable format: | ||
|
||
```shell | ||
rooch da unpack --segment-dir {segment-dir} --batch-dir {batch-dir} | ||
``` | ||
|
||
If you want to verify tx list order, you can use `--verify-order` flag: | ||
|
||
```shell | ||
rooch da unpack --segment-dir {segment-dir} --batch-dir {batch-dir} --verify-order | ||
``` | ||
|
||
### exec | ||
|
||
Execute tx list with state root verification(compare with Rooch Network Mainnet/Testnet). | ||
It's a tool built for verification at development stage, not a full feature tool for sync states in production. | ||
|
||
Features includes: | ||
|
||
1. Execute tx list from segment dir and saving changes locally | ||
2. Compare state root with Rooch Network Mainnet/Testnet by tx_order:state_root list file | ||
3. We could collect performance data in execution process by tuning tools like `perf` if needed | ||
|
||
#### Prepare tx_order:state_root list file | ||
|
||
using [order_state.sh](https://github.com/popcnt1/roh/blob/main/scripts/order_state.sh) to generate tx_order:state_root | ||
list file: | ||
|
||
```shell | ||
rooch env switch -n {network} | ||
./order_state.sh {start_order} {end_order} {interval} | ||
``` | ||
|
||
#### Prepare genesis | ||
|
||
if you just import data by `rooch statedb genesis`, and will execute transaction from tx_order 1 (genesis tx is tx_order | ||
0). | ||
|
||
For ensuring everything works as expected, you should: | ||
|
||
clean dirty genesis states: | ||
|
||
```shell | ||
rooch statedb re-genesis -d {data_dir} -n {network} --mode remove | ||
``` | ||
|
||
genesis init(add builtin genesis back into db): | ||
|
||
```shell | ||
rooch genesis init -d {data_dir} -n {network} | ||
``` | ||
|
||
we assume it's builtin genesis, because the target we want to verify is Rooch Network Mainnet/Testnet, all the two | ||
Network are using builtin genesis. | ||
|
||
#### Execute tx list | ||
|
||
```shell | ||
rooch da exec --segment-dir {segment-dir} --order-state-path {order-state-path} -d {data-dir} -n {network} --btc-rpc-url {btc-rpc-url} --btc-rpc-user-name {btc-rpc-user-name} --btc-rpc-password {btc-rpc-password} | ||
``` | ||
|
||
If everything is ok, you will see this log in the end: | ||
|
||
```shell | ||
2024-12-16T05:48:26.924094Z INFO rooch::commands::da::commands::exec: All transactions execution state root are strictly equal to RoochNetwork: [0, {end_order}] | ||
``` |
Oops, something went wrong.