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

Check for parent of first ready block being on chain #1812

Merged
merged 7 commits into from
Oct 10, 2023

Conversation

rahulksnv
Copy link
Contributor

@rahulksnv rahulksnv commented Oct 7, 2023

When retrieving the ready blocks, verify that the parent of the first ready block is on chain. If the parent is not on chain, we are downloading from a fork. In this case, keep downloading until we have a parent on chain (common ancestor

Resolves #493.

When retrieveing the ready blocks, verify that the parent
of the first ready block is on chain. If the parent is not
on chain, we are downloading from a fork. In this case,
keep downloading until we have a parent on chain (common
ancestor)
@rahulksnv rahulksnv mentioned this pull request Oct 7, 2023
2 tasks
@dmitry-markin dmitry-markin added R0-silent Changes should not be mentioned in any release notes T0-node This PR/Issue is related to the topic “node”. labels Oct 7, 2023
substrate/client/network/sync/src/blocks.rs Show resolved Hide resolved
substrate/client/network/sync/src/lib.rs Outdated Show resolved Hide resolved
substrate/client/network/sync/src/lib.rs Show resolved Hide resolved
substrate/client/network/sync/src/lib.rs Show resolved Hide resolved
substrate/client/network/sync/src/lib.rs Outdated Show resolved Hide resolved
@dmitry-markin
Copy link
Contributor

@rahulksnv looks really nice!

substrate/client/network/sync/src/blocks.rs Outdated Show resolved Hide resolved
substrate/client/network/sync/src/lib.rs Outdated Show resolved Hide resolved
substrate/client/network/sync/src/lib.rs Outdated Show resolved Hide resolved
@dmitry-markin
Copy link
Contributor

@rahulksnv Some tests are failing, could you look into that please? The important ones are in continuous-integration/gitlab-test-linux-stable, others are likely just a consequence of these failures.

@rahulksnv
Copy link
Contributor Author

@rahulksnv Some tests are failing, could you look into that please? The important ones are in continuous-integration/gitlab-test-linux-stable, others are likely just a consequence of these failures.

Looks like the first ready block is 1, and the parent (genesis block) is in InChainPruned state which was causing the test failure. Updated the check to include this state as well, which helps the test pass. But wanted to verify if the pruned state should indeed be included on the check?

@dmitry-markin
Copy link
Contributor

@rahulksnv Some tests are failing, could you look into that please? The important ones are in continuous-integration/gitlab-test-linux-stable, others are likely just a consequence of these failures.

Looks like the first ready block is 1, and the parent (genesis block) is in InChainPruned state which was causing the test failure. Updated the check to include this state as well, which helps the test pass. But wanted to verify if the pruned state should indeed be included on the check?

I think it's correct to include InChainPruned into the check, it just means that we don't store the state for that block, but the essential part is that the block is imported.

@rahulksnv
Copy link
Contributor Author

Please merge if all looks good

@dmitry-markin dmitry-markin merged commit 2b4b33d into paritytech:master Oct 10, 2023
110 of 111 checks passed
@dmitry-markin
Copy link
Contributor

Please merge if all looks good

All is done. Thanks for fixing this!

nazar-pc pushed a commit to autonomys/polkadot-sdk that referenced this pull request Oct 10, 2023
When retrieving the ready blocks, verify that the parent of the first
ready block is on chain. If the parent is not on chain, we are
downloading from a fork. In this case, keep downloading until we have a
parent on chain (common ancestor).

Resolves paritytech#493.

---------

Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
(cherry picked from commit 2b4b33d)
nazar-pc added a commit to autonomys/polkadot-sdk that referenced this pull request Oct 20, 2023
dmitry-markin added a commit that referenced this pull request Oct 20, 2023
bkchr pushed a commit that referenced this pull request Oct 20, 2023
…#1950)

This reverts #1812 until
we know why it causes syncing issues reported in
autonomys/subspace#2122.
rahulksnv added a commit to autonomys/polkadot-sdk that referenced this pull request Oct 24, 2023
dmitry-markin added a commit that referenced this pull request Oct 31, 2023
The change adds a test to show the failure scenario that caused #1812 to
be rolled back (more context:
#493 (comment))

Summary of the scenario:
1. Node has finished downloading up to block 1000 from the peers, from
the canonical chain.
2. Peers are undergoing re-org around this time. One of the peers has
switched to a non-canonical chain, announces block 1001 from that chain
3. Node downloads 1001 from the peer, and tries to import which would
fail (as we don't have the parent block 1000 from the other chain)

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
When retrieving the ready blocks, verify that the parent of the first
ready block is on chain. If the parent is not on chain, we are
downloading from a fork. In this case, keep downloading until we have a
parent on chain (common ancestor).

Resolves paritytech#493.

---------

Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
The change adds a test to show the failure scenario that caused paritytech#1812 to
be rolled back (more context:
paritytech#493 (comment))

Summary of the scenario:
1. Node has finished downloading up to block 1000 from the peers, from
the canonical chain.
2. Peers are undergoing re-org around this time. One of the peers has
switched to a non-canonical chain, announces block 1001 from that chain
3. Node downloads 1001 from the peer, and tries to import which would
fail (as we don't have the parent block 1000 from the other chain)

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Mar 26, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Mar 27, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
)

* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
bkchr pushed a commit that referenced this pull request Apr 10, 2024
* Create CLI tool for generating indirect runtimes code

* Use the generated runtime for rialto parachain

* Avoid autogenerated files when executing cargo spellcheck

* Fix clippy warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T0-node This PR/Issue is related to the topic “node”.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Node can't sync with the network
3 participants