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

runtime-api: do not cache None SessionInfo #4706

Merged
merged 3 commits into from
Jan 13, 2022

Conversation

ordian
Copy link
Member

@ordian ordian commented Jan 12, 2022

(see the previous PR description)

@ordian
Copy link
Member Author

ordian commented Jan 12, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Jan 12, 2022
@ordian ordian added A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). 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 12, 2022
@ordian ordian force-pushed the ao-approval-voting-look-back branch from 42b27b0 to 7a195db Compare January 12, 2022 18:13
@ordian ordian force-pushed the ao-runtime-cache-session-info-fix branch from 65a5d4d to 8b36ba1 Compare January 12, 2022 18:13
@ordian ordian force-pushed the ao-approval-voting-look-back branch from 7a195db to c4b4d84 Compare January 12, 2022 19:24
@ordian ordian force-pushed the ao-runtime-cache-session-info-fix branch from 8b36ba1 to 143923d Compare January 12, 2022 19:24
@rphmeier
Copy link
Contributor

Nice catch

Base automatically changed from ao-approval-voting-look-back to master January 13, 2022 08:15
@ordian
Copy link
Member Author

ordian commented Jan 13, 2022

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 2ba377f into master Jan 13, 2022
@paritytech-processbot paritytech-processbot bot deleted the ao-runtime-cache-session-info-fix branch January 13, 2022 08:16
self.session_info.insert(key, ResidentSizeOf(value));
// only cache Some(SessionInfo)
if value.is_some() {
self.session_info.insert(key, ResidentSizeOf(value));
Copy link
Member

Choose a reason for hiding this comment

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

Why do we even cache Option<SessionInfo> if we only insert Some?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because of the macro it's used in. I've tried to change that, but couldn't figure out how to make it compile w/o changing the macro in 5 minutes, so gave up on that.

Copy link
Member

Choose a reason for hiding this comment

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

That should really not be the way to go. If you have problems with this things, you should ask and not release a half backed solution.

Any idea why were we request "invalid session info" aka with a not yet running session index?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you have problems with this things, you should ask and not release a half backed solution.

I don't view it as a half baked solution. It's possible to refactor the macro code to be more generic, but I'm not sure what would be the benefit of that. It will likely be less readable and this is only "nice to have". Besides that the fix is minimal and easy to backport if needed.

Any idea why were we request "invalid session info" aka with a not yet running session index?

Not sure why it happened on Kusama. Note that this was implemented as a response to Rococo issue when we failed to scale decode wrong SessionInfo definition, so it returned None.

@chevdor chevdor mentioned this pull request Jan 15, 2022
Wizdave97 pushed a commit to ComposableFi/polkadot that referenced this pull request Feb 3, 2022
* approval-voting: add more logs

* approval-voting: query finalized block on startup and increase look back

* runtime-api: do not cache None SessionInfo
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. A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). 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.

3 participants