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
9 of 10 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)
ordian added a commit that referenced this pull request Oct 12, 2023
* master: (33 commits)
  ci: set CI_IMAGE back to (now updated) .ci-unified (#1854)
  ci: bump ci image to rust 1.73.0 (#1830)
  Refactor Identity to benchmark v2 (#1838)
  PVF worker: bump landlock, update ABI docs (#1850)
  Xcm emulator nits (#1649)
  Fixes path issue in derive-impl (#1823)
  upgrade to macro_magic 0.4.3 (#1832)
  Use safe math when pruning statuses (#1835)
  remote-ext: fix state download stall on slow connections and reduce memory usage (#1295)
  Update testnet bootnode dns name (#1712)
  [FRAME] Warn on unchecked weight witness (#1818)
  [xcm] Use `Weight::MAX` for `reserve_asset_deposited`, `receive_teleported_asset` benchmarks (#1726)
  Update bridges subtree (#1803)
  Check for parent of first ready block being on chain (#1812)
  Make CheckNonce refuse transactions signed by accounts with no providers (#1578)
  Fix Asset Hub collator crashing when starting from genesis (#1788)
  Mixnet integration (#1346)
  [xcm-emulator] Decouple the `AccountId` type from `AccountId32` (#1458)
  Treasury spends various asset kinds (#1333)
  chore: bump zombienter version (#1806)
  ...
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>
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