Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,24 @@ documentation][topology-file]. However, the fields: `bootstrapPeers` and

### Ledger Peers

To use ledger peers, as `cardano-node` does there are additional requrements:
`dmq-node` requires node-to-client V23, available since `cardano-node` 10.7,
to fetch stake data for signature validation. By default, it also fetches a
ledger peer snapshot on each stake refresh. Set `"LedgerPeers": false` in the
DMQ configuration file to skip the snapshot query.

* You need `cardano-node-10.7` or newer to support ledger peer snapshot query
over `cardano-node`'s node-to-client protocol.
* You need to configure `cardano-node` & `dmq-node` to use SRV records according to [CIP#155]
* You need to set `LedgerPeers: true` in the configuration file.
The topology field `useLedgerAfterSlot` controls when DMQ uses ledger peers.
Set it to `0` to allow them immediately, or to a positive slot number to use
snapshots from that slot onward. Set it to `-1` or omit it to disable ledger
peer selection.

Currently ledger peers are disabled by default, but in a near future we will
enable them by default.
To advertise a DMQ relay, publish a DNS SRV record at
`_dmq._mithril._cardano._tcp.<domain>`, where `<domain>` is registered as an
SRV relay for your stake pool. See [CIP#155].

With a positive `useLedgerAfterSlot`, DMQ currently uses the big ledger peer
snapshot even for ordinary peer requests. To bootstrap when only smaller
pools advertise DMQ relays, add a reachable DMQ relay to the `localRoots`
group in your topology. See the [example topology](./dmq-node/topology.json).

### Tracing

Expand All @@ -128,14 +137,11 @@ the new tracing system for `cardano-node`).

### Configuration example

Note: it requires `cardano-node-10.7.x` for `LedgerPeers`, if you're running it
against an earlier `cardano-node` turn the option off.

The `Prometheus` requires a different port number than `cardano-node`'s
`Prometheus`.

```json
{ "LedgerPeers": true,
{
"CardanoNodeSocket": "/var/run/cardano-node.socket",
"TraceOptions": {
"": {
Expand Down
56 changes: 56 additions & 0 deletions dmq-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,62 @@

<!-- scriv-insert-here -->

<a id='changelog-0.8.0.0'></a>
## 0.8.0.0 -- 2026-11-27

### Breaking

- Signatures issued by the same pool are rate limited by their `sigExpiresAt`
rather than by the time they were received: `sigExpiresAt` of any two
signatures of a pool must be at least `minSigDelay` apart
(`DMQ.Protocol.SigSubmission.SigSpacing`). A burst of well-spaced signatures
passes the spacing check in any order if none of its signed expiries conflicts
with the receiver's history for that pool. A node can still reject a
signature whose OCert counter is below one it already accepted.
Previously a burst of signatures which accumulated in a node's mempool was
rejected with `SigTooFrequent` by its peers, which disconnected them
(issue #82).
- `NodeToNodeV_3` supports sending these bursts over `SigSubmissionV2`.
On V1 and V2 connections, the sender waits `minSigDelay` after the peer
acknowledges a signature ID before announcing another from the same pool.
Upgraded nodes apply the same signature validation rules on every connection.
- `SigTooFrequent` is checked after the cryptographic checks, and it no
longer disconnects a node-to-node peer: the pool might have sent conflicting
signatures to different nodes, which is not the peer's fault.
- `PoolValidationCtx`: removed `vctxNow`, `vctxLastSigByPoolId` was replaced
with `vctxSigSpacing`; `withPoolValidationCtx` takes only `UTCTime`.
- `NodeKernel`: `lastSigByPoolIdVar` was replaced with `sigSpacingVar`.
- `DMQ.Mempool` re-exports `getWriter` from `ouroboros-network`.

### Non-Breaking

- Define directional mux ingress limits for signature submission and peer sharing in DMQ's policy.
Signature replies use the larger queue on the V1 responder and the V2 initiator.
- Trace node-wide mux counters under `Net.Mux.Counters` at the diffusion default interval.
- LedgerPeers are now enabled by default.

### Patch

- Updated `ouroboros-consensus` to version `5.1.0.1`.

- Updated `ouroboros-consensus` to version `5.2`, `ouroboros-network` to version `2.0` and `network-mux` to version `1.0`.

- The first sig a node accepted was never diffused nor delivered over
`LocalMsgNotification`: `Mempool.empty` gave it index -1, the same as
`mempoolZeroIdx`. The mempool now starts at index 0.
- `LocalMsgNotification` sent messages again on the next request: the server
kept the index of the first message of a reply, not of the last.

- `InvalidOCertCounter` no longer disconnects a node-to-node peer: whether it
fails depends on the order in which a node received signatures signed with
different operational certificates, so the peer might have accepted the
signature legitimately. The counter is now checked after the cryptographic
checks, so a forged signature is still rejected with an error which
disconnects the peer.

- Update to `ouroboros-network-2.1.0.0`, `cardano-diffusion-1.4.0.0`,
`network-mux-1.1.0.0` and the compatible `ouroboros-consensus-5.4.0.1` revision.

<a id='changelog-0.7.2.1'></a>
## 0.7.2.1 -- 2026-10-12

Expand Down
34 changes: 26 additions & 8 deletions dmq-node/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,16 @@ runDMQ commandLineConfig = do

let sigSize :: Sig StandardCrypto -> SizeInBytes
sigSize = fromIntegral . BSL.length . sigRawBytes
mempoolReader = Mempool.getReader sigId sigSize (mempool nodeKernel)
ntcMempoolReader = Mempool.getReader sigId sigSize (mempool nodeKernel)
ntnMempoolReader = Mempool.getIndexedReader sigId sigSize (mempool nodeKernel)
dmqNtNApps =
let ntnMempoolWriter =
Mempool.getWriter SigDuplicate
sigId
(\(utcNow, now) sigs ->
(\utcNow sigs ->
withPoolValidationCtx
(stakePools nodeKernel)
utcNow
now
(validateSig validationCfg sigs)
)
(traverse_ $ \(sigid, reason) -> do
Expand All @@ -218,12 +218,31 @@ runDMQ commandLineConfig = do
NotInitialized -> return ()
PoolNotEligible -> return ()
UnrecognizedPool -> return ()
err -> throwIO (SigValidationException sigid err)
-- the signature might conflict
-- with a signature received from
-- another peer, if the pool sent
-- conflicting signatures to
-- different nodes; this is not
-- the peer's fault.
SigTooFrequent {} -> return ()
-- the peer might have received
-- the signature before one signed
-- with a newer operational
-- certificate.
InvalidOCertCounter {} -> return ()
err@InvalidSigId -> throwIO (SigValidationException sigid err)
err@InvalidKESSignature {} -> throwIO (SigValidationException sigid err)
err@InvalidSignatureOCERT {} -> throwIO (SigValidationException sigid err)
err@KESBeforeStartOCERT {} -> throwIO (SigValidationException sigid err)
err@KESAfterEndOCERT {} -> throwIO (SigValidationException sigid err)
err@SigExpiresAtTooFarInTheFuture {}
-> throwIO (SigValidationException sigid err)
err@SigResultOther {} -> throwIO (SigValidationException sigid err)
)
(mempool nodeKernel)
in ntnApps dmqTracers
dmqConfig
mempoolReader
ntnMempoolReader
ntnMempoolWriter
sigSize
nodeKernel
Expand All @@ -236,19 +255,18 @@ runDMQ commandLineConfig = do
let ntcMempoolWriter =
Mempool.getWriter SigDuplicate
sigId
(\(utcNow, now) sigs ->
(\utcNow sigs ->
withPoolValidationCtx
(stakePools nodeKernel)
utcNow
now
(validateSig validationCfg sigs)
)
(traverse_ $ \(sigid, reason) ->
traceWith localSigValidationTracer $ InvalidSignature sigid reason
)
(mempool nodeKernel)
in NtC.ntcApps dmqTracers dmqConfig
mempoolReader ntcMempoolWriter
ntcMempoolReader ntcMempoolWriter
NtC.dmqCodecs
dmqDiffusionArguments =
diffusionArguments nullTracer
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions dmq-node/changelog.d/20261124_171500_network_2_1.md

This file was deleted.

8 changes: 7 additions & 1 deletion dmq-node/dmq-node.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.4
name: dmq-node
version: 0.7.2.2
version: 0.8.0.0
synopsis: Decentralised Message Queue Node
description:
Decentralised Message Queue Node based on Cardano Diffusion
Expand Down Expand Up @@ -76,6 +76,7 @@ library
DMQ.NodeToClient.LocalStateQueryClient.Types
DMQ.NodeToClient.Version
DMQ.NodeToNode
DMQ.NodeToNode.SigSubmission
DMQ.NodeToNode.Version
DMQ.Policy
DMQ.Protocol.LocalMsgNotification.Client
Expand All @@ -87,6 +88,7 @@ library
DMQ.Protocol.LocalMsgSubmission.Server
DMQ.Protocol.LocalMsgSubmission.Type
DMQ.Protocol.SigSubmission.Codec
DMQ.Protocol.SigSubmission.SigSpacing
DMQ.Protocol.SigSubmission.Type
DMQ.Protocol.SigSubmission.Validate
DMQ.Protocol.SigSubmissionV2.Codec
Expand Down Expand Up @@ -200,15 +202,18 @@ test-suite dmq-tests
DMQ.Protocol.SigSubmissionV2.Test
Test.DMQ.NodeToClient
Test.DMQ.NodeToNode
Test.DMQ.NodeToNode.SigSubmission
Test.DMQ.PeerSelection.PeerMetric
Test.DMQ.SigSubmission.App
Test.DMQ.SigSubmission.SigSpacing
Test.DMQ.SigSubmission.Types

type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
build-depends:
QuickCheck,
aeson,
base >=4.14 && <4.23,
bytestring,
cardano-binary,
Expand All @@ -227,6 +232,7 @@ test-suite dmq-tests
psqueues,
quickcheck-instances,
serialise,
singletons,
tasty,
tasty-quickcheck,
time,
Expand Down
5 changes: 3 additions & 2 deletions dmq-node/src/DMQ/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ data Configuration' f =
dmqcTargetOfEstablishedBigLedgerPeers :: f Int,
dmqcTargetOfActiveBigLedgerPeers :: f Int,

-- | Minimal delay between signatures from the same peer.
-- | Minimal distance between `sigExpiresAt` of two signatures issued by
-- the same pool, see `DMQ.Protocol.SigSubmission.SigSpacing`.
--
dmqcMinSigDelay :: f DiffTime,

Expand Down Expand Up @@ -221,7 +222,7 @@ defaultConfiguration = Configuration {
dmqcProtocolIdleTimeout = I defaultProtocolIdleTimeout,
dmqcChurnInterval = I defaultDeadlineChurnInterval,
dmqcPeerSharing = I PeerSharingEnabled,
dmqcLedgerPeers = I False,
dmqcLedgerPeers = I True,

dmqcMinSigDelay = I Policy.minSigDelay,

Expand Down
Loading
Loading