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

test: Assumeutxo: import snapshot in a node with a divergent chain #29996

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alfonsoromanz
Copy link
Contributor

This PR adds tests to cover two scenarios of loading a snapshot when the current chain tip is:

  • Not an ancestor of the snapshot block but has less work
  • Not an ancestor or a descendant of the snapshot block and has more work

In the second scenario, the snapshot block does not belong to the most-work chain anymore so I believe it covers this scenario too: TODO: Valid snapshot file and snapshot block, but the block is not on the most-work chain. Therefore I deleted that TODO as well.

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 29, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK naiyoma
Stale ACK rkrux

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30053 (test: added test coverage to loadtxoutset could not open file by kevkevinpal)
  • #29681 (test: loading assumeutxo snapshot start states by BrandonOdiwuor)
  • #29428 (test: Assumeutxo: snapshots with less work should not be loaded by hernanmarino)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@alfonsoromanz
Copy link
Contributor Author

I splitted the original commit into two commits (one for each test). The second test (af0f401) may be redundant with this one: #29428. The only difference is that my test is executed on a node that has a divergent chain after block 199. I did that to cover this scenario described in the comments

[...] Loading a snapshot when the current chain tip is: [...] Not an ancestor or a descendant of the snapshot block and has more work

If it's redundant I can delete the second commit. Thoughts?

@naiyoma
Copy link
Contributor

naiyoma commented Apr 30, 2024

Concept ACK, covers more tests scenarios for AssumeUTXO

test/functional/feature_assumeutxo.py Outdated Show resolved Hide resolved
test/functional/feature_assumeutxo.py Outdated Show resolved Hide resolved
test/functional/feature_assumeutxo.py Outdated Show resolved Hide resolved
Copy link

@rkrux rkrux left a comment

Choose a reason for hiding this comment

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

tACK ce80f7e

Make and tests successful, thanks for adding this test - it's easy to follow through.

test/functional/feature_assumeutxo.py Show resolved Hide resolved
test/functional/feature_assumeutxo.py Outdated Show resolved Hide resolved
test/functional/feature_assumeutxo.py Show resolved Hide resolved
test/functional/feature_assumeutxo.py Show resolved Hide resolved
@alfonsoromanz
Copy link
Contributor Author

Rebased. I also addressed some feedback from rkrux's comments: changed hardcoded value of nblocks from 99 to a dynamic value, i.e SNAPSHOT_BASE_HEIGHT-START_HEIGHT-1

@naiyoma
Copy link
Contributor

naiyoma commented May 16, 2024

Test passes for all three scenarios:

  • a7501f7 loading a snapshot when chain tip isn't ancestor but has less work
  • 3f03354 loading a snapshot when chain tip isn't ancestor/descendant, has more work and A valid snapshot file & snapshot block, but the block is not on the most-work chain

@naiyoma
Copy link
Contributor

naiyoma commented May 16, 2024

I splitted the original commit into two commits (one for each test). The second test (af0f401) may be redundant with this one: #29428. The only difference is that my test is executed on a node that has a divergent chain after block 199. I did that to cover this scenario described in the comments

[...] Loading a snapshot when the current chain tip is: [...] Not an ancestor or a descendant of the snapshot block and has more work

If it's redundant I can delete the second commit. Thoughts?

IMO you should not delete the second commit, both tests verify that the snapshot load fails but under different scenarios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants