Skip to content

Commit

Permalink
Warp sync state machine refactoring (#1060)
Browse files Browse the repository at this point in the history
* Use let-else construct

* Add sources_by_finalized_height

* Allow querying runtime and chain information from any source

* Add comment

* Implement Index<RequestId>

* Merge `DownloadFragments` and `PendingVerify` stages

* Bugfix with state inconsistency

* Download warp sync fragments in parallel of veryfing the previous batch

* Merge Phase::RuntimeDownload with Phase::ChainInformationDownload

* Remove `Phase` enum and move everything to base state machine

* Small comment tweaks

* Verify fragments even if source has disconnected

* Small refactor

* Implement correctly fetching from proof

* Fix wasm build

* Embed the verifier within warp_sync.rs

* Add TODO

* Also check the justification target number

* PR link and more changelog

* Polish the fragment verification error

* Add `Config::pause_if_blocks_gap_lower_than`

* `WarpSync` no longer stops after success

* Rename `start_chain_information`

* Move runtime calls to main state machine for parallelism

* CHANGELOG update

* Don't warp sync the same block if there's no point in doing that

* Remove `already_tried` system

* Move things around

* Store the header in scale-encoded form and cache some fields

* Docfix

* Small doc tweaks

* Don't download call proofs if there are fragments to verify

* Add TODO

* Add TODO

* Better reporting on fragment verification

* Make sure that headers are above the requested height

* Fix the calculation of the warp sync minimum gap

* Docfix

* Index requests by source to remove a `O(n)` operation

* Update the finalized block of the source when receiving a response

* Remove TODO

* Option<Error> to Result<(), Error>

* Add TODO

* Download the runtime and call proofs only once there's no fragment download

* Update warp sync state machine on commit message

* Fix `sources_by_finalized_height` state mismatch

* Add TODO

* Punish sources that send back invalid data

* Punish sources, part 2

* Adjust code that handles empty lists of fragments

* Add TODO

* Move things around

* Tweak error types
  • Loading branch information
tomaka authored Sep 21, 2023
1 parent d131772 commit f9fefae
Show file tree
Hide file tree
Showing 5 changed files with 1,594 additions and 1,488 deletions.
Loading

0 comments on commit f9fefae

Please sign in to comment.