Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc v2: chainhead support multiple finalized block hashes in FollowEvent::Initialized #1476

Merged
merged 5 commits into from
Mar 12, 2024

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Mar 11, 2024

Companion for paritytech/polkadot-sdk#3445 where it's now possible that the initialized event
can contain multiple finalized block hashes.

@niklasad1 niklasad1 marked this pull request as ready for review March 11, 2024 14:45
@niklasad1 niklasad1 requested a review from a team as a code owner March 11, 2024 14:45
@niklasad1 niklasad1 changed the title WIP: chainhead rpc block_hash -> finalized_block_hashes chainhead rpc block_hash -> finalized_block_hashes Mar 11, 2024
@niklasad1 niklasad1 changed the title chainhead rpc block_hash -> finalized_block_hashes rpc v2: chainhead support multiple finalized block hashes in FollowEvent::Initialized Mar 11, 2024
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

LGTM, Just a couple of things!

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

LGTM!

this.pin_unpinnable_block_at(rel_block_num, *finalized_block);

finalized_block_hashes.push(block_ref);
rel_block_num += 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: would this.rel_block += 1 work here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good spot; now there are multiple we should increment this.rel_block_num here!

Copy link
Member Author

@niklasad1 niklasad1 Mar 12, 2024

Choose a reason for hiding this comment

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

the old code didn't increment that but sure lemme fix that..

For example if finalized_block_hashes == vec![one_hash] then it would increment this.rel_block_num which it didn't do before. Cool?

Copy link
Collaborator

@lexnv lexnv left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for fixing this 🙏

@jsdw jsdw merged commit dfd6e10 into master Mar 12, 2024
13 checks passed
@jsdw jsdw deleted the na-fix-substrate-tests branch March 12, 2024 17:42
@jsdw jsdw mentioned this pull request Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants