Commit bccc710
authored
chore: improve/fix ledger tooling (#294)
## Summary
Fix: prevent account file deletion during ledger replay and ledger tool
access
Feat: genx supports many more accounts loaded into test-validator than
before
## Details
### Fix
When an `AppendVec` is dropped the underlying file is removed. This
results in an account file
being deleted each time we replay the ledger or access the accounts via
a ledger tool, i.e.
`ledger-stats` or `genx`.
After attempting to fix this by setting a flag to prevent the file from
being removed, I
resorted to just copying the account file before using it as underlying
storage for the
`AppendVec`.
This copy is cleaned up when the tool or ledger replay completes
### Feat
Instead of passing accounts to be loaded from chain as arguments when
starting the validator,
_genx_ now downloads the accounts into a directory (100 in parallel
which is the limit) and
provides that directory to the validator in the generated script
instead.
<!-- greptile_comment -->
## Greptile Summary
This PR improves ledger tooling by addressing account file persistence
and enhancing account loading capabilities in the test validator
environment.
- Added file copying mechanism in `load_most_recent_store` to prevent
account file deletion when `AppendVec` is dropped
- Implemented batch downloading of accounts (100 at a time) in
`tools/genx/src/test_validator.rs` to work within RPC limits
- Added JSON serialization support for account data storage with new
dependencies in `tools/genx/Cargo.toml`
- Modified test validator to use `--account-dir` instead of
`--maybe-clone` for more efficient account loading
- Introduced temporary directory management for storing downloaded
account data during validator operation
<!-- /greptile_comment -->1 parent a7fca91 commit bccc710
File tree
5 files changed
+92
-17
lines changed- magicblock-accounts-db/src/persist
- test-integration
- tools/genx
- src
5 files changed
+92
-17
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
319 | 330 | | |
320 | 331 | | |
321 | 332 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
5 | | - | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
| |||
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
19 | 28 | | |
20 | 29 | | |
21 | 30 | | |
| |||
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
0 commit comments