Skip to content

Commit 7d13b76

Browse files
authored
Merge pull request #3318 from input-output-hk/jpraynaud/3303-dmq-node-ledger-peer-support
feat: ledger peers support for DMQ node
2 parents 905fe2c + 29a43ec commit 7d13b76

10 files changed

Lines changed: 120 additions & 24 deletions

File tree

.github/workflows/actions/deploy-terraform-infrastructure/action.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,23 @@ inputs:
6767
description: Google Cloud VM SSH keys environment (`testing` or `production`).
6868
required: true
6969
mithril_use_p2p_network:
70-
description: Mithril use P2P network (experimental, for test only).
70+
description: Mithril use P2P network (experimental).
7171
required: false
7272
default: "false"
7373
mithril_p2p_use_dmq_protocol:
74-
description: Mithril P2P network use DMQ protocol (experimental, for test only).
74+
description: Mithril P2P network use DMQ protocol (experimental).
7575
required: false
7676
default: "false"
7777
mithril_p2p_use_real_dmq_node:
78-
description: Use the real Decentralized Message Queue (DMQ) node (experimental, for test only).
78+
description: Use the real Decentralized Message Queue (DMQ) node (experimental).
79+
required: false
80+
default: "false"
81+
mithril_p2p_dmq_use_ledger_peers:
82+
description: Use ledger peers declared with SRV records (CIP-155) for DMQ nodes (experimental).
7983
required: false
8084
default: "false"
8185
mithril_p2p_network_bootstrap_peer:
82-
description: Mithril P2P network bootstrap peer (experimental, for test only).
86+
description: Mithril P2P network bootstrap peer (experimental).
8387
required: false
8488
default: ""
8589
mithril_p2p_signer_relay_signer_registration_mode:
@@ -282,6 +286,7 @@ runs:
282286
mithril_use_p2p_network = "${{ inputs.mithril_use_p2p_network }}"
283287
mithril_p2p_use_dmq_protocol = "${{ inputs.mithril_p2p_use_dmq_protocol }}"
284288
mithril_p2p_use_real_dmq_node = "${{ inputs.mithril_p2p_use_real_dmq_node }}"
289+
mithril_p2p_dmq_use_ledger_peers = "${{ inputs.mithril_p2p_dmq_use_ledger_peers }}"
285290
mithril_p2p_network_bootstrap_peer = "${{ inputs.mithril_p2p_network_bootstrap_peer }}"
286291
mithril_p2p_signer_relay_signer_registration_mode = "${{ inputs.mithril_p2p_signer_relay_signer_registration_mode }}"
287292
mithril_p2p_signer_relay_signature_registration_mode = "${{ inputs.mithril_p2p_signer_relay_signature_registration_mode }}"

.github/workflows/pre-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ jobs:
210210
mithril_use_p2p_network: true
211211
mithril_p2p_use_dmq_protocol: true
212212
mithril_p2p_use_real_dmq_node: true
213+
mithril_p2p_dmq_use_ledger_peers: true
213214
mithril_api_domain: api.mithril.network
214215
mithril_protocol_parameters: |
215216
{
@@ -280,6 +281,7 @@ jobs:
280281
mithril_use_p2p_network: ${{ matrix.mithril_use_p2p_network }}
281282
mithril_p2p_use_dmq_protocol: ${{ matrix.mithril_p2p_use_dmq_protocol }}
282283
mithril_p2p_use_real_dmq_node: ${{ matrix.mithril_p2p_use_real_dmq_node }}
284+
mithril_p2p_dmq_use_ledger_peers: ${{ matrix.mithril_p2p_dmq_use_ledger_peers }}
283285
mithril_p2p_network_bootstrap_peer: ${{ vars.MITHRIL_P2P_NETWORK_BOOTSTRAP_PEER }}
284286
mithril_api_domain: ${{ matrix.mithril_api_domain }}
285287
mithril_image_id: ${{ env.DOCKER_IMAGE_ID }}

.github/workflows/release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ jobs:
107107
- environment: release-preprod
108108
environment_prefix: release
109109
cardano_network: preprod
110+
mithril_use_p2p_network: true
111+
mithril_p2p_use_dmq_protocol: true
112+
mithril_p2p_use_real_dmq_node: true
113+
mithril_p2p_dmq_use_ledger_peers: true
110114
mithril_api_domain: api.mithril.network
111115
mithril_protocol_parameters: |
112116
{
@@ -132,6 +136,10 @@ jobs:
132136
- environment: release-mainnet
133137
environment_prefix: release
134138
cardano_network: mainnet
139+
mithril_use_p2p_network: true
140+
mithril_p2p_use_dmq_protocol: true
141+
mithril_p2p_use_real_dmq_node: true
142+
mithril_p2p_dmq_use_ledger_peers: true
135143
mithril_api_domain: api.mithril.network
136144
mithril_protocol_parameters: |
137145
{
@@ -193,6 +201,11 @@ jobs:
193201
google_compute_instance_data_disk_snapshot: ${{ vars.GOOGLE_COMPUTE_INSTANCE_DATA_DISK_SNAPSHOT }}
194202
google_compute_instance_ssh_keys_environment: production
195203
google_application_credentials: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
204+
mithril_use_p2p_network: ${{ matrix.mithril_use_p2p_network }}
205+
mithril_p2p_use_dmq_protocol: ${{ matrix.mithril_p2p_use_dmq_protocol }}
206+
mithril_p2p_use_real_dmq_node: ${{ matrix.mithril_p2p_use_real_dmq_node }}
207+
mithril_p2p_dmq_use_ledger_peers: ${{ matrix.mithril_p2p_dmq_use_ledger_peers }}
208+
mithril_p2p_network_bootstrap_peer: ${{ vars.MITHRIL_P2P_NETWORK_BOOTSTRAP_PEER }}
196209
mithril_api_domain: ${{ matrix.mithril_api_domain }}
197210
mithril_image_id: ${{ env.DOCKER_IMAGE_ID }}
198211
mithril_protocol_parameters: ${{ toJSON(matrix.mithril_protocol_parameters) }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ As a minor extension, we have adopted a slightly different versioning convention
2424
- Implemented new message id format for the DMQ message to follow specification of the [CIP-0137](https://cips.cardano.org/cip/CIP-0137).
2525
- Added support for the DMQ node `0.6.0.0` stable version.
2626
- Promoted the DMQ node as stable (beta) on `release-mainnet` and `release-preprod` networks.
27+
- Added optional support for ledger peers declared with `SRV` records ([CIP-155](https://cips.cardano.org/cip/CIP-0155)).
2728

2829
- Gracefully handle unknown signed entity types across Mithril nodes for improved forward compatibility.
2930

docs/website/root/manual/operate/run-aggregator-node.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -906,16 +906,11 @@ Make sure your domain name points to your server's public IP address and that po
906906
907907
:::
908908
909-
## Set up the DMQ node (unstable)
909+
## Set up the DMQ node (beta)
910910
911-
:::danger
912-
913-
The DMQ node setup is currently **unstable** and not suitable for production use.
914-
915-
During the stabilization and ramp-up phase of the DMQ network:
911+
:::info
916912
917-
- Signatures are still sent to the central aggregator (using the DMQ node is harmless)
918-
- This section is subject to frequent changes.
913+
The DMQ node setup is currently **beta**. During the stabilization and ramp-up phase of the DMQ network, signatures received through it may not be enough to reach the quorum and thus produce valid certificates.
919914
920915
:::
921916

docs/website/root/manual/operate/run-signer-node.md

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -893,16 +893,13 @@ sudo service netfilter-persistent save
893893
894894
:::
895895
896-
## Set up the DMQ node (unstable)
896+
## Set up the DMQ node (beta)
897897
898-
:::danger
899-
900-
The DMQ node setup is currently **unstable** and not suitable for production use.
898+
:::info
901899
902-
During the stabilization and ramp-up phase of the DMQ network:
900+
The DMQ node setup is currently **beta** and suitable for production use by SPOs.
903901
904-
- Signatures are still sent to the central aggregator (using the DMQ node is harmless)
905-
- This section is subject to frequent changes.
902+
During the stabilization and ramp-up phase of the DMQ network, signatures are still sent to the leader aggregator (using the DMQ node is harmless).
906903
907904
:::
908905
@@ -1486,6 +1483,69 @@ More information about the recommended firewall configuration of the Cardano nod
14861483
14871484
:::
14881485
1486+
### Declare your DMQ node as a ledger peer (CIP-155)
1487+
1488+
:::info
1489+
1490+
This step is **optional** but **recommended**. It allows other DMQ nodes of the Mithril network to discover your relay automatically through the Cardano ledger, instead of relying solely on the bootstrap peer.
1491+
1492+
:::
1493+
1494+
[CIP-155](https://cips.cardano.org/cip/CIP-0155) defines a registry of `SRV` record prefixes that decentralized protocols can use to publish their service endpoints on the Cardano ledger. By declaring an `SRV` record with the `_mithril._tcp` prefix on your pool relay domain, your DMQ relay node becomes discoverable as a **ledger peer** by any DMQ node that uses ledger peers.
1495+
1496+
The declaration requires two steps:
1497+
1498+
1. Publish an `SRV` record for your **relay** DMQ node under the `_mithril._tcp` prefix of your pool domain.
1499+
2. Register your pool domain as a multi-host relay in your stake pool registration certificate.
1500+
1501+
:::caution
1502+
1503+
Only the **relay** DMQ node must be published as a ledger peer. The **block producer** DMQ node must **never** be exposed.
1504+
1505+
Here is the needed information to declare your DMQ node as a ledger peer:
1506+
1507+
- `**YOUR_SPO_DOMAIN_NAME**`: replace with the domain name registered as a multi-host relay in your stake pool registration certificate (for example `example.com`)
1508+
- `**YOUR_DMQ_NODE_RELAY_PUBLIC_HOSTNAME**`: replace with the public hostname (A or AAAA record) of your DMQ relay node
1509+
- `**YOUR_DMQ_NODE_RELAY_PORT**`: replace with the listening port of your DMQ relay node.
1510+
1511+
:::
1512+
1513+
#### Publish the SRV record
1514+
1515+
Add an `SRV` record to the DNS zone of your pool domain so that `_mithril._tcp.**YOUR_SPO_DOMAIN_NAME**` points to your DMQ relay node:
1516+
1517+
```
1518+
_mithril._tcp.**YOUR_SPO_DOMAIN_NAME**. 86400 IN SRV 10 5 **YOUR_DMQ_NODE_RELAY_PORT** **YOUR_DMQ_NODE_RELAY_PUBLIC_HOSTNAME**.
1519+
```
1520+
1521+
:::tip
1522+
1523+
Here is an example for the pool domain `example.com`, with the DMQ relay node reachable at `cardano.example.com` on port `6161`:
1524+
1525+
```
1526+
_mithril._tcp.example.com. 86400 IN SRV 10 5 6161 cardano.example.com.
1527+
```
1528+
1529+
The values after `SRV` are the standard priority (`10`), weight (`5`), port (`6161`), and target hostname (`cardano.example.com`). More information is available in [RFC 2782](https://datatracker.ietf.org/doc/html/rfc2782).
1530+
1531+
:::
1532+
1533+
#### Register the pool domain as a multi-host relay
1534+
1535+
Register `**YOUR_SPO_DOMAIN_NAME**` as a multi-host relay of your stake pool so that it is published on the Cardano ledger:
1536+
1537+
```bash
1538+
cardano-cli latest stake-pool registration-certificate \
1539+
... \
1540+
--multi-host-pool-relay **YOUR_SPO_DOMAIN_NAME**
1541+
```
1542+
1543+
:::info
1544+
1545+
The `_cardano._tcp` prefix is used by the Cardano node to discover Cardano relays on the same domain, while the `_mithril._tcp` prefix is used by the DMQ node to discover Mithril DMQ relays. Both prefixes can coexist on the same pool domain.
1546+
1547+
:::
1548+
14891549
## Verify the Mithril signer deployment
14901550
14911551
:::tip

mithril-infra/assets/infra.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
0.5.16
1+
0.5.17
22

mithril-infra/mithril.aggregator.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ if [ "${var.mithril_use_p2p_network}" = "true" ] && [ "${var.mithril_p2p_use_dmq
123123
cat $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json | jq '.localRoots[0].advertise = true' | jq '.localRoots[0].valency = (.localRoots[0].accessPoints | length)' > $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json.new
124124
rm -f $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json
125125
mv $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json.new $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json
126+
127+
# Enable dmq node ledger peers (CIP-155 SRV records)
128+
if [ "${var.mithril_p2p_dmq_use_ledger_peers}" = "true" ]; then
129+
cat $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json | jq '. + {"useLedgerAfterSlot": 0}' > $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json.new
130+
rm -f $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json
131+
mv $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json.new $AGGREGATOR_CONFIG_DIRECTORY/config/topology.json
132+
fi
126133
fi
127134
fi
128135
EOT

mithril-infra/mithril.signer.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ if [ "${var.mithril_use_p2p_network}" = "true" ] && [ "${var.mithril_p2p_use_dmq
174174
rm -f $DMQ_RELAY_CONFIG_DIRECTORY/topology.json
175175
mv $DMQ_RELAY_CONFIG_DIRECTORY/topology.json.new $DMQ_RELAY_CONFIG_DIRECTORY/topology.json
176176
177+
# Enable DMQ relay ledger peers (CIP-155 SRV records)
178+
if [ "${var.mithril_p2p_dmq_use_ledger_peers}" = "true" ]; then
179+
cat $DMQ_RELAY_CONFIG_DIRECTORY/topology.json | jq '. + {"useLedgerAfterSlot": 0}' > $DMQ_RELAY_CONFIG_DIRECTORY/topology.json.new
180+
rm -f $DMQ_RELAY_CONFIG_DIRECTORY/topology.json
181+
mv $DMQ_RELAY_CONFIG_DIRECTORY/topology.json.new $DMQ_RELAY_CONFIG_DIRECTORY/topology.json
182+
fi
183+
177184
# Update DMQ block-producer topology valency
178185
cat $DMQ_BP_CONFIG_DIRECTORY/topology.json | jq '.localRoots[0].valency = (.localRoots[0].accessPoints | length)' > $DMQ_BP_CONFIG_DIRECTORY/topology.json.new
179186
rm -f $DMQ_BP_CONFIG_DIRECTORY/topology.json

mithril-infra/variables.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,19 @@ variable "mithril_container_logging_max_file" {
212212

213213
variable "mithril_use_p2p_network" {
214214
type = bool
215-
description = "Use the P2P network layer (experimental, for test only)"
215+
description = "Use the P2P network layer (experimental)"
216216
default = false
217217
}
218218

219219
variable "mithril_p2p_use_dmq_protocol" {
220220
type = bool
221-
description = "Use the Decentralized Message Queue protocol (DMQ) (experimental, for test only)"
221+
description = "Use the Decentralized Message Queue protocol (DMQ) (experimental)"
222222
default = false
223223
}
224224

225225
variable "mithril_p2p_use_real_dmq_node" {
226226
type = bool
227-
description = "Use the real Decentralized Message Queue (DMQ) node (experimental, for test only)"
227+
description = "Use the real Decentralized Message Queue (DMQ) node (experimental)"
228228
default = false
229229
}
230230

@@ -234,6 +234,12 @@ variable "mithril_p2p_dmq_dense_topology" {
234234
default = false
235235
}
236236

237+
variable "mithril_p2p_dmq_use_ledger_peers" {
238+
type = bool
239+
description = "Use ledger peers declared with SRV records (CIP-155) for DMQ nodes. When true, the public facing DMQ nodes (aggregator and signer relays) discover peers from the Cardano ledger. Disabled by default to isolate Mithril networks sharing the same Cardano network. (experimental)"
240+
default = false
241+
}
242+
237243
variable "dmq_image_id" {
238244
type = string
239245
description = "The DMQ image tag of service to deploy"
@@ -248,7 +254,7 @@ variable "dmq_image_registry" {
248254

249255
variable "mithril_p2p_network_bootstrap_peer" {
250256
type = string
251-
description = "The dial to address of a bootstrap peer of the P2P network layer. Useful when setting-up a follower aggregator and signers in a different VM. (experimental, for test only)"
257+
description = "The dial to address of a bootstrap peer of the P2P network layer. Useful when setting-up a follower aggregator and signers in a different VM. (experimental)"
252258
default = ""
253259
}
254260

0 commit comments

Comments
 (0)