Skip to content
Commit 3f4ce632 authored by Tsvetomir Dimitrov's avatar Tsvetomir Dimitrov Committed by GitHub
Browse files

Rework `dispute-coordinator` to use `RuntimeInfo` for obtaining session...


Rework `dispute-coordinator` to use `RuntimeInfo` for obtaining session information instead of `RollingSessionWindow` (#6968)

* Pass `SessionInfo` directly to `CandidateEnvironment::new` otherwise it should be an async function

* Replace calls to `RollingSessionWindow` with `RuntimeInfo`

Adjust `dispute-coordinator` initialization to use `RuntimeInfo`

* Modify `dispute-coordinator` initialization

* Pass `Hash` to `process_on_chain_votes` so that `RuntimeInfo` calls can be made

Remove some fixmes

* Pass `Hash` to `handle_import_statements` to perform `RuntimeInfo` calls

* remove todo comments

* Remove `error` from `Initialized`

Rework new session handling code

* Remove db code which is no longer used

* Update stale comment and remove unneeded type specification

* Cache SessionInfo on startup

* Use `DISPUTE_WINDOW` from primitives

* Fix caching in `process_active_leaves_update`

* handle_import_statements: leaf_hash -> block_hash

* Restore `ensure_available_session_info`

* Don't interrupt `process_on_chain_votes` if SessionInfo can't be fetched

* Small style improvements in logging

* process_on_chain_votes: leaf_hash -> block_hash

* Restore `note_earliest_session` - it is required to prune disputes and votes

* Cache new sessions only when there is an actual session change

* Fix tests

* `CandidateEnvironment::new` gets `session_idx` and fetches SessionInfo by itself to avoid the invariant where the input SessionIndex and SessionInfo parameters don't match

* Fix handling of missing session info

* Move sessions caching in `handle_startup` and fix tests

* Load `relay_parent` from db in `handle_import_statements` instead of passing it as a parameter via two functions

* Don't do two db reads

* Fix the twisted logic in `handle_import_statements`

* fixup

* Small style fix

* Decrease log levels for caching errors to debug and fix a typo

* Update outdated comment

* Remove `ensure_available_session_info`

* Load relay parent from db in `process_on_chain_votes`

* Revert "Load relay parent from db in `process_on_chain_votes`"

This reverts commit 978ad4f223d517faa7a7fbad96e3f8de4fa17501.

* Keep track of highest seen session and last session cached without gaps.

* Apply suggestions from code review

Co-authored-by: default avatarordian <[email protected]>

* Handle session caching failure on startup correctly

* Update node/core/dispute-coordinator/src/initialized.rs

Co-authored-by: default avatarordian <[email protected]>

* Simplify session caching retries

* Update stale comment

* Fix lower bound calculation for session caching

---------

Co-authored-by: default avatarordian <[email protected]>
parent a8d80532
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment