Skip to content

stacked signatures - #88

Merged
coot merged 9 commits into
mainfrom
coot/stacked-signatures
Dec 4, 2026
Merged

coot merged 9 commits into
mainfrom
coot/stacked-signatures

Conversation

@coot

@coot coot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

List of changes

Fixes #82

Checklist

  • related issue
  • My changes generate no new warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

coot added 4 commits November 27, 2026 09:48
`SigSpacing` allow us to track sigExpiresAt per `key ~ PoolId`.
A signature is refused if it's `sigExpiresAt` is too close to any other
already accepted signature.  That is for all `s` in the mempool we check
that:

  ∀(s: sigPoolId s = sigPoolId candidate) |sigExpiresAt s - sigExpiresAt candidate| >= minSigDelay

If a peer has a burst of signatures that are well-spaced, the other side
will accept them (unless there was a conflicting signature in its
mempool).

Ill-spaced signatures are not accepted by the mempool with `SigTooFrequent`
validation error.  Connection is still preserved, since the upstream might
not be at fault - this will be the case when a malicious peer is
distributing conflicting signatures to different peers to weaken the
connectivity.

The spacing check runs now after crypto checks now, so the connection is
still closed if any crypt checks didn't pass.
Use explicit pattern matches, rather than a catch all pattern.  If we
introduce another validation error, we're forced to think whether the
node should drop the connection or not.
We might receive a signature produced with a smaller OCert counter if it
was delayed on that path.  The upstream peer might not be at fault here,
so don't punish it for that by closing the connection.  However, we now
need to do the crypto checks before we check the OCert number, so if
crypto is wrong the connection is shut down.
Writers sample UTC before entering STM and can commit out of order.
Store the latest pruning time with the spacing history so an older
sample cannot admit a signature that conflicts with a pruned expiry.
@coot
coot force-pushed the coot/stacked-signatures branch from c86eef4 to 6279001 Compare November 27, 2026 09:09
coot added 2 commits November 27, 2026 15:09
Legacy nodes check signature spacing by receipt time and can disconnect
when catching up on signatures from one pool. On NodeToNodeV_{1,2}
connections, wait minSigDelay after the peer acknowledges a signature ID
before announcing the next ID from that pool.

Introduced NodeToNodeV_3 for unpaced announcements over SigSubmissionV2.
Upgraded nodes apply the same signature validation rules on all
versions.

A mainnet Mithril signer publishes roughly once every ten minutes, and
its DMQ messages expire after 30 minutes. With the default 60-second
delay and prompt acknowledgements, a peer can receive announcements
for three signatures from one pool in about two minutes.
@coot
coot force-pushed the coot/stacked-signatures branch 2 times, most recently from 5d7900c to 2e3b807 Compare November 27, 2026 19:16
@coot coot self-assigned this Dec 1, 2026
@coot coot moved this from In Progress to In Review in Ouroboros Network Dec 1, 2026

@crocodile-dentist crocodile-dentist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

coot added 2 commits December 3, 2026 17:50
The server is not supposed to send a duplicate signatures when we
request specific `SigId`s.
@coot
coot force-pushed the coot/stacked-signatures branch from a872a81 to 62b237d Compare December 3, 2026 16:52
@coot
coot enabled auto-merge December 3, 2026 16:52
@coot
coot force-pushed the coot/stacked-signatures branch from 62b237d to 1547300 Compare December 3, 2026 19:53
@coot
coot added this pull request to the merge queue Dec 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Dec 3, 2026
@coot
coot added this pull request to the merge queue Dec 4, 2026
@coot
coot removed this pull request from the merge queue due to a manual request Dec 4, 2026
@coot
coot force-pushed the coot/stacked-signatures branch from 1547300 to d8be008 Compare December 4, 2026 08:18
@coot
coot enabled auto-merge December 4, 2026 08:18
@coot
coot added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 7992110 Dec 4, 2026
9 of 10 checks passed
@coot
coot deleted the coot/stacked-signatures branch December 4, 2026 09:31
@github-project-automation github-project-automation Bot moved this from In Review to Done in Ouroboros Network Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Stacked signatures causes node-to-node disconnections

2 participants