-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Prepare (re)genesis for off chain tables (#1771)
Mostly refactoring to allow for #1619 . Not final but close. Some cleanup remains here or there. That will be bundled with the actual feature itself. The `SnapshotReader` and `SnapshotWriter` (previously the `StateReader` and `StateWriter`) now: * have a single `read` (or `write`) method generic over the table type * no longer use `*Config` structs in the interface -- all reading and writing is to be done over tables * `ChainConfig` is now written and read by the `SnapshotWriter` and `SnapshotReader` (since it is actually part of the snapshot). The genesis progress is now a generic `String` -> `u64` mapping with no enumerations for the key (previously we had an enum with a variant for each table). Every table gets its own parquet file. Json is still in a single file with the `StateConfig` schema. Depending on whether we want the offchain tables in the `StateConfig` we can either drop them or include them in the next PR. I avoided enumerating the tables as much as possible to lessen coupling. A new table should ideally require: 1. a call to write::<NewTable> when generating the snapshot 2. an implementation of `ProcessState<NewTable>` to describe how to import it on regenesis 3. an implementation of `AsTable` to describe how (if at all) this table can be extracted from a in-memory `StateConfig` 4. a call to `workers.spawn::<NewTable>` to run a worker to import it from the snapshot. After this PR we'll add in the off-chain tables and identify and regenerate dependent tables (ideally with batching + resumability). --------- Co-authored-by: xgreenx <xgreenx9999@gmail.com>
- Loading branch information
1 parent
951308e
commit 099853c
Showing
75 changed files
with
121,154 additions
and
150,555 deletions.
There are no files selected for viewing
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
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
4 changes: 2 additions & 2 deletions
4
bin/e2e-test-client/src/tests/test_data/large_state/metadata.json
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,8 +1,8 @@ | ||
{ | ||
"chain_config": "chain_config.json", | ||
"state_encoding": { | ||
"table_encoding": { | ||
"Json": { | ||
"filepath": "state_config.json" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.