-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stateless validation jobs in test mode (#10248)
This is a next step for #9982. Here I introduce jobs which will perform stateless validation of newly received chunk by executing txs and receipts. Later they should be executed against state witness, but for now I just set a foundation by running these jobs against state data in DB. All passing tests verify that old and new jobs generate the same result. The final switch will happen when stateful jobs will be replaced with stateless ones. ### Details This doesn't introduce any load on stable version. On nightly version there will be `num_shards` extra jobs which will check that stateless validation results are consistent with stateful execution. But as we use nightly only for testing, it shouldn't mean much overhead. I add more fields to `ShardContext` structure to simplify code. Some of them are needed to break early if there is resharding, and the logic is the same for both kinds of jobs. `StorageDataSource::DbTrieOnly` is introduced to read data only from trie in stateless jobs. This is annoying but still needed if there are a lot of missing chunks and flat storage head moved above the block at which previous chunk was created. When state witness will be implemented, `Recorded` will be used instead. ## Testing * Failure to update current_chunk_extra on the way leads to >20 tests failing in process_blocks, with errors like `assertion `left == right` failed: For stateless validation, chunk extras for block CMV88CBcnKoxa7eTnkG64psLoJzpW9JeAhFrZBVv6zDc and shard s3.v2 do not match...` * If I update current_chunk_extra only once, `tests::client::resharding::test_latest_protocol_missing_chunks_high_missing_prob` fails which was specifically introduced for that. Actually this helped to realize that `validate_chunk_with_chunk_extra` is still needed but I will introduce it later. * Nayduck: ~https://nayduck.near.org/#/run/3293 - +10 nightly tests failing, will take a look~ https://nayduck.near.org/#/run/3300 --------- Co-authored-by: Longarithm <the.aleksandr.logunov@gmail.com>
- Loading branch information
1 parent
5ce0d8a
commit 5595df6
Showing
9 changed files
with
512 additions
and
114 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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