Skip to content

fix(block): use parent state for witness validation - #61

Closed
Federico2014 wants to merge 2 commits into
release_v4.8.3from
fix/block-witness-parent-state-release-v4.8.3
Closed

Federico2014 wants to merge 2 commits into
release_v4.8.3from
fix/block-witness-parent-state-release-v4.8.3

Conversation

@Federico2014

@Federico2014 Federico2014 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Validate block witness signatures in Manager after selecting the candidate-parent state, for direct application and fork switching.

  • Defer competing branches and retain up to four normalized signature candidates per block. Preserve the original signature and roll the remaining candidates so a later valid signature can still be used when the block becomes a fork ancestor or is applied directly after rollback.
  • Return explicit processing results so forwarding, application metrics and peer-failure attribution follow the actual block outcome.
  • Refresh receive timestamps for deferred broadcast blocks, clear only the restarting peer's pending sync payloads and requests, and share missing-parent/invalid-ancestor classification across both ingress paths.
  • Preserve KhaosDatabase graph nodes and serialized storage of unprocessed blocks. Retain authenticated capsules only after execution commits.

The database and network changes address one validation problem and must land together: forwarding, retries and peer-failure attribution depend on the result returned by Manager.

Why are these changes required?

After a witness-key rotation or strict-ECDSA activation, validation against the local head can disagree with validation against a block's own parent. The selected parent state must govern witness recovery, permissions and scheduling.

This PR has been tested by:

  • Focused tests on x86_64 / JDK 8: 141 tests across 11 framework classes covering parent-state validation, activation, fork rollback/recovery, signature overflow, direct application after rollback, storage, broadcast, duplicate metrics and synchronization.
  • The broadcast and synchronization fifth-signature regression tests fail against the original PR implementation and pass with this fix.
  • Checkstyle: ./gradlew :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain --max-workers=2.
  • bash .github/scripts/check_math_usage.sh and git diff --check.

Full-suite validation remains incomplete. ARM64 / JDK 17, multi-node convergence and historical replay have not been verified locally.

Follow up

Verify multi-node convergence and historical replay, measure propagation and validation costs, and determine rollout and activation requirements before deployment.

Extra details

Target: release_v4.8.3. This changes consensus-relevant block acceptance around witness-permission updates and strict-ECDSA activation. Existing and updated nodes may disagree on affected blocks. The supported mixed-version window and the node versions requiring a coordinated upgrade have not yet been established; these tests do not establish safe rolling-upgrade or hard-fork compatibility.

No dependency, configuration, protobuf or persistent database schema changes are introduced. The release branch's KhaosDatabase memory and commit lifecycle are preserved.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8160bcd7-e3cc-4e79-a272-0e8f907c5daa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 11 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@Federico2014 Federico2014 changed the title fix(block): validate witnesses against candidate-parent state fix(block): use parent state for witness validation Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant