Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@sandreim
Copy link
Contributor

@sandreim sandreim commented Jan 18, 2022

Fixes #4733

WIP

@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Jan 18, 2022
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
@sandreim sandreim added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Jan 18, 2022
Signed-off-by: Andrei Sandu <[email protected]>
Copy link
Contributor

@drahnr drahnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits, one item that requires explaining, other than that LGTM

Signed-off-by: Andrei Sandu <[email protected]>
@sandreim sandreim marked this pull request as ready for review January 19, 2022 17:02
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jan 19, 2022
@sandreim sandreim requested a review from eskimor January 19, 2022 17:20
Copy link
Member

@eskimor eskimor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far.

@eskimor
Copy link
Member

eskimor commented Jan 20, 2022

Here we are not actually using the SessionInfo for the leaf, but the SessionInfo for the leaf's child. Therefore, at session boundaries we will look up the backing group in the wrong session. 😬

So the comment is correct, but it does not matter as we don't lookup the leaf's session, but its child session. I am not 100% sure how to fix this properly. We could use the relay_parent as it is stored in the occupied core data, but this could break if relay_parent got already finalized and the state trie got cleared, then the SessionIndex lookup would fail for that reason.

What should work more reliably even with @slumber 's and asynchronous backing would be to just lookup the session for the leaf for real. An API in RuntimeInfo for fetching the block's session, instead of its child would make sense. The implementation could just use the chain api for looking up the parent and then fetch the session index for it's child. The chances of the direct parent of an active leaf to be already finalized should be negligible.

@ordian
Copy link

ordian commented Jan 20, 2022

but this could break if relay_parent got already finalized and the state trie got cleared, then the SessionIndex lookup would fail for that reason.

since we cache session info per index, this shouldn't happen in practice

@eskimor
Copy link
Member

eskimor commented Jan 20, 2022

since we cache session info per index, this shouldn't happen in practice

but the index lookup might fail.

@ordian
Copy link

ordian commented Jan 20, 2022

since we cache session info per index, this shouldn't happen in practice

but the index lookup might fail.

right, but it's also cached per relay_parent

Copy link

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked all the places where we fetch session index, but the ones modified in this PR look good.

@sandreim
Copy link
Contributor Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit f06e87e into master Jan 26, 2022
@paritytech-processbot paritytech-processbot bot deleted the sandreim/session_index branch January 26, 2022 15:17
ordian pushed a commit that referenced this pull request Jan 27, 2022
* master:
  Fix incomplete sorting. (#4795)
  Companion for better way to resolve `Phase::Emergency` via governance #10663 (#4757)
  Refactor and fix usage of `get_session_index()` and `get_session_info_by_index()` (#4735)
  `relay chain selection` and `dispute-coordinator` fixes and improvements (#4752)
  Fix tests (#4787)
  log concluded disputes (#4785)
  availability-distribution: look for leaf ancestors within the same session (#4596)
  Companion for Use proper bounded vector type for nominations #10601 (#4709)
  Fix release profile (#4778)
  [ci] remove publish-s3-release (#4779)
  Companion for substrate#10632 (#4689)
  [ci] pipeline chores (#4775)
  New changelog scripts (#4491)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check usage of get_session_index() and request_session_index_for_child()

6 participants