Registry Mirror
Skip to content

Conversation

@shuplenkov

@shuplenkov shuplenkov commented Jun 2, 2023 •

Copy link
Copy Markdown

Issue being fixed or feature implemented

Update Proto file to use either proofs for direct result, but not both.

What was done?

Changed proto file and all code that uses it

How Has This Been Tested?

With tests

Breaking Changes

No

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@shuplenkov shuplenkov added this to the v0.25.0 milestone Jun 2, 2023
@shuplenkov
shuplenkov marked this pull request as ready for review June 5, 2023 15:33
shumkov
shumkov previously approved these changes Jun 7, 2023

@shumkov shumkov left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good but you need to fix tests 👍

@shumkov shumkov changed the title feat: update proto file to use either proofs or result refactor: update proto file to use either proofs or result Jun 7, 2023
@shumkov shumkov changed the title refactor: update proto file to use either proofs or result refactor: update dapi proto file to use either proofs or result Jun 7, 2023
@shuplenkov
shuplenkov merged commit 0d4a993 into v0.25-dev Jun 8, 2023
@shuplenkov
shuplenkov deleted the feat/proof branch June 8, 2023 16:20
shumkov added a commit that referenced this pull request Oct 15, 2026
…rifychainlock (PV14)

A chain lock that verify_chain_lock_locally v1 leaves to Core (None) went
straight to Core's submitchainlock. Dash Core returns its best chain lock
height from submitchainlock without checking the signature when that height
is at or above the submitted one (rpc/quorums.cpp, v23.1.8), and Drive turns
that answer into "Core is synced". So a Byzantine proposer's forged chain
lock at an already chain-locked height was accepted by every validator whose
Core had a chain lock at or above it.

verify_chain_lock_locally v1 now asks Core's verifychainlock whenever the
check against the quorums Platform holds cannot decide, on every such path:

- false: Some(false), the proposal is rejected and submitchainlock is not
  called;
- true: None, unchanged: submitchainlock still decides whether Core is synced;
- RPC error: Err(CoreRpc), which run_block_proposal turns into
  InvalidChainLock, as it already does for a submitchainlock error there.

The check against the held quorums moves unchanged into
verify_chain_lock_with_held_quorums, which the local-logic tests call. A
false from Core is logged as a warning naming both causes (an invalid
signature, or Core missing the block at H - 8); the proposal error is the
existing local-rejection one.

Both RPCs run the same chainlock::VerifyChainLock. For a genuine chain lock
above Core's best they give the same verdict; at or below it, Core's tip is at
least H - 8 (Core only keeps a best chain lock it verified), so the signing
quorum is selectable and verifychainlock accepts it. A Core more than 8 blocks
behind answers false instead of throwing "No quorum found": rejected before
and after. So genuine chain locks are rejected in no new case, and forged ones
are now rejected by every honest validator instead of depending on each
validator's Core. A committed protocol 14 block with a genuine chain lock,
which every honest proposer proposes, replays the same way. A block whose forged chain lock v0 accepted through the early return (a
Byzantine proposer with rc.1..rc.3 validators holding 2/3) can never be
applied by this version; only pre-release protocol 14 networks can hold one.

verifychainlock gets the block hash in display order: Drive builds the
argument with BlockHash's Display, so the internal-order bug of the pinned
rust-dashcore submit_chain_lock (rust-dashcore #1148) does not apply. A test
against the mock JSON-RPC Core pins the wire arguments with mainnet chain
lock 2555653.

Protocol 14 only, in place: v1 is not in any release (5.0.0-rc.1..rc.3 run
v0 at protocol 14), testnet and mainnet run protocol 13. No version table
changes; item 96 of v14.rs and the V10 table docs describe the Core check.
Mixed rc.3/rc.4 validators now also disagree on a forged chain lock in v0's
deferred range at a height the validator's Core already has a chain lock
for: rc.3 accepts it through the early return, rc.4 rejects it. Only a
Byzantine proposer can produce one. Drive now calls verifychainlock on the
consensus path: dashmate's drive_consensus RPC whitelist has always allowed
it; a deployment without dashmate must allow it too.

The strategy tests' mock Core accepts verifychainlock as it accepts
submitchainlock; run_chain_lock_update_quorums_not_changing defers a chain
lock and needs it.

Addresses thepastaclaw's review on #5454. Refs #5438.

Test would have caught this: verify_chain_lock with a forged chain lock at
1122 (newly deferred by v1) and 1136 (past the DKG interval end, deferred by
v0 too), mock Core best chain lock 1140: ✖ before fix (accepted, Core synced),
✔ after (rejected, submitchainlock not asked). The byte order test fails
when the wrapper sends hex::encode(block_hash). The v0/v1 differential test
now also runs v1 through the dispatcher against a Core that fails every
chain lock: exactly the chain locks the held quorums leave to Core are asked
about and rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shumkov added a commit that referenced this pull request Oct 15, 2026
…rifychainlock (PV14)

A chain lock that verify_chain_lock_locally v1 leaves to Core (None) went
straight to Core's submitchainlock. Dash Core returns its best chain lock
height from submitchainlock without checking the signature when that height
is at or above the submitted one (rpc/quorums.cpp, v23.1.8), and Drive turns
that answer into "Core is synced". So a Byzantine proposer's forged chain
lock at an already chain-locked height was accepted by every validator whose
Core had a chain lock at or above it.

verify_chain_lock_locally v1 now asks Core's verifychainlock whenever the
check against the quorums Platform holds cannot decide, on every such path:

- false: Some(false), the proposal is rejected and submitchainlock is not
  called;
- true: None, unchanged: submitchainlock still decides whether Core is synced;
- RPC error: Err(CoreRpc), which run_block_proposal turns into
  InvalidChainLock, as it already does for a submitchainlock error there.

The check against the held quorums moves unchanged into
verify_chain_lock_with_held_quorums, which the local-logic tests call. A
false from Core is logged as a warning naming both causes (an invalid
signature, or Core missing the block at H - 8); the proposal error is the
existing local-rejection one.

Both RPCs run the same chainlock::VerifyChainLock. For a genuine chain lock
above Core's best they give the same verdict; at or below it, Core's tip is at
least H - 8 (Core only keeps a best chain lock it verified), so the signing
quorum is selectable and verifychainlock accepts it. A Core more than 8 blocks
behind answers false instead of throwing "No quorum found": rejected before
and after. So genuine chain locks are rejected in no new case, and forged ones
are now rejected by every honest validator instead of depending on each
validator's Core. A committed protocol 14 block with a genuine chain lock,
which every honest proposer proposes, replays the same way. A block whose forged chain lock v0 accepted through the early return (a
Byzantine proposer with rc.1..rc.3 validators holding 2/3) can never be
applied by this version; only pre-release protocol 14 networks can hold one.

verifychainlock gets the block hash in display order (BlockHash's Display),
as Core parses it; this branch's rust-dashcore pin also sends display order to
submitchainlock (rust-dashcore #1148). The wire-level byte order test is on
v5.0-dev, whose pin still has the submitchainlock bug; its mock JSON-RPC Core
is not on this branch.

Protocol 14 only, in place: v1 is not in any release (5.0.0-rc.1..rc.3 run
v0 at protocol 14), testnet and mainnet run protocol 13. No version table
changes; item 96 of v14.rs and the V10 table docs describe the Core check.
Mixed rc.3/rc.4 validators now also disagree on a forged chain lock in v0's
deferred range at a height the validator's Core already has a chain lock
for: rc.3 accepts it through the early return, rc.4 rejects it. Only a
Byzantine proposer can produce one. Drive now calls verifychainlock on the
consensus path: dashmate's drive_consensus RPC whitelist has always allowed
it; a deployment without dashmate must allow it too.

The strategy tests' mock Core accepts verifychainlock as it accepts
submitchainlock; run_chain_lock_update_quorums_not_changing defers a chain
lock and needs it.

Same change as on v5.0-dev (#5459), so the forward merge sees identical
edits apart from the BLS API lines. Addresses thepastaclaw's review on #5454.
Refs #5438.

Test would have caught this: verify_chain_lock with a forged chain lock at
1122 (newly deferred by v1) and 1136 (past the DKG interval end, deferred by
v0 too), mock Core best chain lock 1140: ✖ before fix (accepted, Core synced),
✔ after (rejected, submitchainlock not asked). The v0/v1 differential test
now also runs v1 through the dispatcher against a Core that fails every
chain lock: exactly the chain locks the held quorums leave to Core are asked
about and rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants