Skip to content

stacked signatures - #88

Open
coot wants to merge 8 commits into
mainfrom
coot/stacked-signatures
Open

coot wants to merge 8 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 3 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 from 2f670b1 to 5d7900c Compare November 27, 2026 14:09
@coot
coot force-pushed the coot/stacked-signatures branch from 5d7900c to 2e3b807 Compare November 27, 2026 19:16

This branch has not been deployed

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Stacked signatures causes node-to-node disconnections

1 participant