Skip to content

Evo: handle validation failures gracefully - #1931

Open
navidR wants to merge 1 commit into
firoorg:masterfrom
navidR:dev/navidr/graceful-evo-validation-failures
Open

Evo: handle validation failures gracefully#1931
navidR wants to merge 1 commit into
firoorg:masterfrom
navidR:dev/navidr/graceful-evo-validation-failures

Conversation

@navidR

@navidR navidR commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Replace externally reachable Evo assertions with explicit validation failures. Add regression coverage for malformed coinbase payload and deterministic masternode state paths.

Upstream: Dash PR #3504.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 59 minutes.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cc96b0de-c4fc-4688-9b20-851cc02b68bd

📥 Commits

Reviewing files that changed from the base of the PR and between 4f0c771 and 398f677.

📒 Files selected for processing (4)
  • src/evo/cbtx.cpp
  • src/evo/deterministicmns.cpp
  • src/test/CMakeLists.txt
  • src/test/evo_validation_tests.cpp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T14:59:28.624911Z 398f677 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai

codeant-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 398f677 Aug 30, 2026 · 14:56 14:59

@codeant-ai

codeant-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 30, 2026
@codeant-ai

codeant-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown

User description

Replace externally reachable Evo assertions with explicit validation failures. Add regression coverage for malformed coinbase payload and deterministic masternode state paths.


CodeAnt-AI Description

Handle invalid Evo data as validation failures instead of crashing

What Changed

  • Malformed masternode and quorum transaction payloads are rejected with clear validation errors
  • Missing quorum commitments and excessive quorum entries now produce validation failures instead of triggering assertions
  • Added regression coverage for malformed payloads, missing commitments, and invalid quorum state

Impact

✅ No crashes on malformed Evo transactions
✅ Clearer invalid-block rejection reasons
✅ Safer quorum commitment processing

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 398f677a0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evo/cbtx.cpp
uint256 minedBlockHash;
bool found = llmq::quorumBlockProcessor->GetMinedCommitment(p.first, p2->GetBlockHash(), qc, minedBlockHash);
assert(found);
if (!found) return state.DoS(100, false, REJECT_INVALID, "commitment-not-found");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Treat missing stored commitments as internal errors

When the Evo DB's inverse-height index points to a missing commitment record—the exact local inconsistency constructed by the new regression test—this failure is unrelated to the candidate block or its sending peer. Returning state.DoS(100, ...) makes CheckCbTxMerkleRoots classify an otherwise valid block as consensus-invalid and allows BlockChecked to penalize the peer; it can also leave the block marked invalid until manual recovery. Report this as state.Error(...) so the node surfaces its local database failure without blaming network input.

Useful? React with 👍 / 👎.

@navidR

navidR commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

This not from upstream, but something we should address:

  diff --git a/src/evo/cbtx.cpp b/src/evo/cbtx.cpp
  @@ -227,7 +227,7 @@ bool CalcCbTxMerkleRootQuorums(
                   uint256 minedBlockHash;
                   bool found = llmq::quorumBlockProcessor->GetMinedCommitment(
                       p.first, p2->GetBlockHash(), qc, minedBlockHash);
  -                if (!found) return state.DoS(100, false, REJECT_INVALID, "commitment-not-found");
  +                if (!found) return state.Error("commitment-not-found");
                   v.emplace_back(::SerializeHash(qc));
                   hashCount++;
               }

  diff --git a/src/test/evo_validation_tests.cpp b/src/test/evo_validation_tests.cpp
  @@ -133,7 +133,7 @@ BOOST_FIXTURE_TEST_CASE(
       uint256 merkleRoot;
       CBlock block;
       BOOST_CHECK(!CalcCbTxMerkleRootQuorums(block, pindexPrev, merkleRoot, state));
  -    BOOST_CHECK(state.IsInvalid());
  +    BOOST_CHECK(state.IsError());
       BOOST_CHECK_EQUAL(state.GetRejectReason(), "commitment-not-found");
       dbTransaction->Rollback();
   }

@reubenyap reubenyap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the current head and traced the new failure paths through special-transaction validation, block processing, CValidationState, and peer scoring. The malformed-payload branches now fail cleanly, and the full CI matrix is green. The one remaining issue is already accurately covered by the existing review thread: a missing stored commitment is a local database error and should use state.Error rather than classify the peer block as invalid. I found no additional actionable issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants