Skip to content

Update ValidateRejectCode from InvalidBlock to UnknownParent where appropriate and add additional reject codes #6027

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

Conversation

jferrant
Copy link
Contributor

No description provided.

@jferrant jferrant requested review from obycode and kantai April 18, 2025 19:23
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

This is good. Wish I had thought of this case when I originally made this change ☹️. Should we combine this with the discussed change to resubmit the proposal N times if it fails for certain reasons (like invalid parent block)?

@jferrant
Copy link
Contributor Author

jferrant commented Apr 18, 2025

This is good. Wish I had thought of this case when I originally made this change ☹️. Should we combine this with the discussed change to resubmit the proposal N times if it fails for certain reasons (like invalid parent block)?

I don't think we actually need to. I misread the code. Because you set prior_evaluation to None when it thinks it should_reevaluate_block, it won't hit the codepath that early exits. So its all good! You had it right, just missed this one spot! (EDIT: which also makes sense why your test worked. It was testing a same block being reproposed but it just didn't check for the specific InvalidParentBlock case)

Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

Actually, I think this still does not catch the case we're seeing. The block validation endpoint is responding with InvalidBlock in this case. I think it would require some changes in that endpoint to differentiate the different errors better.

@jferrant
Copy link
Contributor Author

Actually, I think this still does not catch the case we're seeing. The block validation endpoint is responding with InvalidBlock in this case. I think it would require some changes in that endpoint to differentiate the different errors better.

Great catch. This makes me think actually that maybe InvalidParentBlock should NOT be reevaluated. This happens when a miner is attempting to reorg actually. Not sure that should ever be reconsidered. definitely conflated this error code with the validateReject reason code which is different XD

…ure to find a parent block id as an UnknownParent error code

Signed-off-by: Jacinta Ferrant <[email protected]>
@jferrant jferrant requested a review from a team as a code owner April 21, 2025 17:43
@jferrant jferrant changed the title Reconsider blocks that were rejected with an InvalidParentBlock Update ValidateRejectCode from InvalidBlock to UnknownParent where appropriate and add additional reject codes Apr 21, 2025
@jferrant jferrant requested a review from obycode April 21, 2025 17:44
@jferrant jferrant moved this to Status: In Review in Stacks Core Eng Apr 21, 2025
obycode
obycode previously approved these changes Apr 21, 2025
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

Thanks for the update. Yes, I think this looks good, but the minor challenge here is that this requires signers to update their nodes at the same time as updating their signers. Updating the node and not the signer will result in deserialization errors.

kantai
kantai previously approved these changes Apr 21, 2025
@github-project-automation github-project-automation bot moved this from Status: In Review to Status: 💻 In Progress in Stacks Core Eng Apr 21, 2025
… into fix/reconsider-invalid-parent-block-proposals
@jferrant jferrant dismissed stale reviews from kantai and obycode via 6ed6cfe April 22, 2025 22:40
@jferrant jferrant requested review from kantai and obycode April 22, 2025 22:40
Signed-off-by: Jacinta Ferrant <[email protected]>
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

👍

@wileyj wileyj added this pull request to the merge queue Apr 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 23, 2025
@wileyj wileyj added this pull request to the merge queue Apr 28, 2025
Merged via the queue into stacks-network:develop with commit 58cab7d Apr 28, 2025
204 checks passed
@github-project-automation github-project-automation bot moved this from Status: 💻 In Progress to Status: ✅ Done in Stacks Core Eng Apr 28, 2025
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.79%. Comparing base (9a19b37) to head (aaabb90).
Report is 49 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6027      +/-   ##
===========================================
+ Coverage    79.64%   83.79%   +4.15%     
===========================================
  Files          528      528              
  Lines       385780   386301     +521     
  Branches       323      323              
===========================================
+ Hits        307247   323702   +16455     
+ Misses       78525    62591   -15934     
  Partials         8        8              
Files with missing lines Coverage Δ
stackslib/src/net/api/postblock_proposal.rs 79.31% <100.00%> (-5.71%) ⬇️
stackslib/src/net/api/tests/postblock_proposal.rs 41.11% <100.00%> (-47.06%) ⬇️
...net/stacks-node/src/tests/nakamoto_integrations.rs 87.40% <100.00%> (+0.03%) ⬆️
testnet/stacks-node/src/tests/signer/v0.rs 58.75% <ø> (-1.64%) ⬇️

... and 195 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e505550...aaabb90. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Successfully merging this pull request may close these issues.

4 participants