-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: state witness struct (#10934)
This PR is a preparation for introducing state witness compression as part of #10780. It addresses the following issues: * State witness is implicitly deserialised when it is received via network and then serialised again in order to verify signature. While this is not a big issue now, we can't afford doing that once compression is introduced. In this PR `ChunkStateWitness` is renamed to `SignedChunkStateWitness` and now it holds raw bytes of `ChunkStateWitnessInner` (now renamed to just `ChunkStateWitness`). * Duplicate validation in orphan witness handling and normal validation process. Currently we perform bunch of validations multiple times: first in `handle_orphan_state_witness` and then in `start_validating_chunk`, it would be nice to avoid that. This is addressed by introducing redundant fields as part of `ChunkStateWitness`: `chunk_producer` account id and `epoch_id`. This way we don't need to have previous block available in order to verify signature and perform a bunch of sanity checks (such as validity of `shard_id`), so duplicated logic is moved out of orphan witness handling to `partially_validate_state_witness_in_epoch`. * Currently we don't send state witness ack in case of orphan state witness because we cannot determine chunk producer account id. This is fixed by using newly introduced `chunk_producer` field of `ChunkStateWitness`.
- Loading branch information
Showing
17 changed files
with
319 additions
and
302 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
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
Oops, something went wrong.