Skip to content

Bump cardano-ledger-binary to >=1.9.1 to fix reversed relay IPv4 byte order - #1451

Merged
carbolymer merged 1 commit into
masterfrom
mgalazyn/fix/ipv4-relay-byte-order
Sep 25, 2026
Merged

carbolymer merged 1 commit into
masterfrom
mgalazyn/fix/ipv4-relay-byte-order

Conversation

@carbolymer

@carbolymer carbolymer commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Context

Fixes #1442 (cross-post of input-output-hk/ouroboros-leios#974).

Since cardano-cli 11.2.1.0, stake-pool registration-certificate --pool-relay-ipv4 writes the relay address into the certificate with its four bytes reversed, so 89.233.105.53 lands on chain as 53.105.233.89.
The decoder mirrors the mistake, so query pool-state and debug transaction view show correctly registered relays reversed while showing our own reversed certificates as correct.
IPv6 and DNS relays are not affected.

The fault is in cardano-ledger-binary 1.9.0.0, which switched the IPv4 codec from iproute's host-address conversion to the raw address word while keeping the little-endian serialiser (IntersectMBO/cardano-ledger#5611).
cardano-ledger-binary 1.9.1.0, published to CHaP on 2026-09-22, restores network byte order.
That fix currently lives only on the release/cardano-ledger-binary-1.9.1.0 branch; ledger master still carries the reversed codec.

This PR bumps the CHaP index-state and the CHaP flake input so the solver can see 1.9.1.0, and adds a lower bound as a cabal.project constraint.
The bound is not in build-depends because cardano-cli imports nothing from cardano-ledger-binary and the build uses -Wunused-packages.

No cardano-cli test covers the relay IPv4 bytes today; the only occurrences of --pool-relay-ipv4 under test/ are help goldens.
A golden test for the certificate CBOR is a sensible follow-up.

How to trust this PR

The affected byte sequence in the certificate is the port followed by the IPv4 bytestring.
With the released 11.2.3.1 the certificate contains 190bc2443569e959 (port 3010, then 35 69 e9 59).
With cardano-ledger-binary 1.9.1.0 it must contain 190bc24459e96935.

cardano-cli dijkstra stake-pool registration-certificate --testnet-magic 42 \
  --cold-verification-key-file cold.vkey --vrf-verification-key-file vrf.vkey \
  --pool-pledge 1000000000 --pool-cost 170000000 --pool-margin 0.05 \
  --pool-reward-account-verification-key-file stake.vkey \
  --pool-owner-stake-verification-key-file stake.vkey \
  --pool-relay-ipv4 89.233.105.53 --pool-relay-port 3010 \
  --metadata-url https://example.com/meta.json \
  --metadata-hash 0000000000000000000000000000000000000000000000000000000000000000 \
  --out-file cert.json
jq -r .cborHex cert.json | grep -o -E '190bc244[0-9a-f]{8}'

The same check against a certificate produced by cardano-cli 11.0.0.0 must render 89.233.105.53 in debug transaction view.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

@carbolymer carbolymer self-assigned this Sep 25, 2026
@carbolymer
carbolymer marked this pull request as ready for review September 25, 2026 09:15
Copilot AI lite review requested due to automatic review settings September 25, 2026 09:15
@carbolymer
carbolymer force-pushed the mgalazyn/fix/ipv4-relay-byte-order branch 2 times, most recently from 1511798 to bfd7463 Compare September 25, 2026 09:15

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

Add a regression fixture or assertion covering known IPv4 relay bytes.

Review effort: Lite
Findings: None

What changed in this PR

Updates Cardano package inputs to require cardano-ledger-binary >=1.9.1, fixing IPv4 relay byte-order handling.

Changes:

  • Updates CHaP lock and index state.
  • Adds the dependency constraint.
  • Adds a bugfix changelog fragment.
File Description
flake.lock Updates the CHaP revision and hash.
cabal.project Updates the package index state and dependency constraint.
.changes/​fix-ipv4-relay-byte-order.yml Documents the IPv4 relay fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@carbolymer carbolymer changed the title Update cardano-ledger-binary >=1.9.1 Bump cardano-ledger-binary to >=1.9.1 to fix reversed relay IPv4 byte order Sep 25, 2026

@palas palas 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.

Uncontroversial bump 👍

@carbolymer
carbolymer added this pull request to the merge queue Sep 25, 2026
Merged via the queue into master with commit 2fe2270 Sep 25, 2026
25 checks passed
@carbolymer
carbolymer deleted the mgalazyn/fix/ipv4-relay-byte-order branch September 25, 2026 11:25
Scitz0 added a commit to cardano-community/guild-operators that referenced this pull request Oct 20, 2026
## Description

cardano-cli 11.2.1.0 through 11.2.3.1 write a stake pool relay's IPv4
address into registration certificates with its four bytes reversed, so
`89.233.105.53` is registered on chain as `53.105.233.89`. `query
pool-state` and `debug transaction view` decode it the same wrong way:
correctly registered relays look reversed, and the reversed certificates
look correct. The fault is in cardano-ledger-binary 1.9.0.0. cardano-cli
11.3.0.0 fixed it by requiring cardano-ledger-binary 1.9.1.0
([cardano-cli#1442](IntersectMBO/cardano-cli#1442),
[cardano-cli#1451](IntersectMBO/cardano-cli#1451)).
DNS and IPv6 relays are not affected.

CNTools passes `--pool-relay-ipv4`
(`scripts/cnode-helper-scripts/cntools.sh`), so pool registrations and
updates with IPv4 relays built on the current deployment (cardano-cli
11.2.3.1) are affected.

- Deploy cardano-cli 11.4.0.0
(`files/docker/node/release-versions/cardano-cli-latest.txt`). The
change triggers the Docker image build.
- Use 11.4.0.0 as the `guild-deploy.sh` download fallback.
- Raise the `env` minimum to cardano-cli 11.4.0, so scripts stop running
with an affected release until the binaries are redeployed.

cardano-node stays at 11.1.3. No deployed configuration files are
changed.

### Compatibility: cardano-cli 11.2.3.1 → 11.4.0.0

- **Node-to-client:** node 11.1.3 and cli 11.4.0.0 both use
NodeToClientV_23; no newer version exists yet.
- **Breaking changes upstream:** 11.3.0.0 removes `node issue-pop-BLS`
and `node key-hash-BLS`. 11.4.0.0 removes
`--script-valid`/`--script-invalid` for the Dijkstra era only; Conway
keeps both. None of these are used by the scripts.
- **Release assets:**
`cardano-cli-11.4.0.0-{x86_64,aarch64}-linux.tar.gz` keep the
`cardano-cli-<arch>-linux` member that `guild-deploy.sh` extracts. Both
match the published `sha256sums.txt` and GitHub asset digests.

### Reviewer notes

- The higher `env` minimum also rejects hosts that build node 11.1.3
from source with `cabal-build-all.sh`, because its dependency plan
includes cardano-cli 11.2.3.0. Those hosts need the 11.4.0.0 binary
(`guild-deploy.sh -s d`), or a cli built at tag `cardano-cli-11.4.0.0`.
- Pools that already registered or updated IPv4 relays with cli
11.2.1.0–11.2.3.1 have a reversed address on chain and need to submit a
pool update with the fixed cli.
- This PR has not been run end to end on a Linux host; the deploy-path
check was syntax plus the release download URLs, which return HTTP 200
for both architectures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Scitz0 added a commit to cardano-community/guild-operators that referenced this pull request Nov 13, 2026
…relay IPv4 (#1926)

## Description

#1917 moved alpha to cardano-cli 11.4.0.0 on the basis that 11.3.0.0
fixed the reversed relay IPv4 bytes
([cardano-cli#1442](IntersectMBO/cardano-cli#1442)).
The fix did not work: 11.3.0.0, 11.3.1.0 and 11.4.0.0 still write the
four bytes reversed. 11.5.0.0 is the first release that writes them
correctly.

### Why the upstream fix did not work


[cardano-cli#1451](IntersectMBO/cardano-cli#1451)
(in 11.3.0.0) added `constraints: cardano-ledger-binary >=1.9.1`.
1.9.1.0 has the fix, but the solver chose cardano-ledger-binary
1.10.0.0. It was published to CHaP on 2026-10-01 from ledger `master`,
which still had the little-endian codec (`putWord32le . fromIPv4w`). The
1.10 series got the fix in 1.10.1.0
([cardano-ledger#6187](IntersectMBO/cardano-ledger#6187)),
and 11.5.0.0 is the first cardano-cli release whose CHaP index-state
(2026-10-21) includes it.

The symbol names in each release binary show the linked version:

| cardano-cli | cardano-ledger-binary | relay IPv4 |
|---|---|---|
| 10.16.0.0 | 1.8.0.0 | correct |
| 11.0.0.0 | 1.8.1.0 | correct |
| 11.2.1.0, 11.2.2.0, 11.2.3.0, 11.2.3.1 | 1.9.0.0 | reversed |
| 11.3.0.0, 11.3.1.0, 11.4.0.0 | 1.10.0.0 | reversed |
| 11.5.0.0, 11.6.0.0, 11.7.0.0 | 1.10.1.0 | correct |

11.1.0.0 and 11.2.0.0 are tags without release binaries.

### Changes

- Deploy cardano-cli 11.5.0.0
(`files/docker/node/release-versions/cardano-cli-latest.txt`). The
change triggers the Docker image build.
- Use 11.5.0.0 as the `guild-deploy.sh` download fallback.
- Raise the `env` minimum to cardano-cli 11.5.0, so scripts stop running
with 11.4.0.0 until the binaries are redeployed.

cardano-node stays at 11.1.3. No deployed configuration files change.

### Compatibility: cardano-cli 11.4.0.0 → 11.5.0.0

- **Changelog:** `debug check-node-configuration` is stricter and prints
its success message to stderr (breaking), and Dijkstra transaction views
show direct deposits. Alpha scripts use neither.
- **cntools-rebuild** already pins 11.5.0.0 next to node 11.1.3 (#1923),
so this matches what that branch deploys.
- **Release assets:**
`cardano-cli-11.5.0.0-{x86_64,aarch64}-linux.tar.gz` keep the
`cardano-cli-<arch>-linux` member that `guild-deploy.sh` extracts, and
both match the GitHub asset digests.

### Testing

Every x86_64 release asset from 10.16.0.0 to 11.7.0.0 (digests checked)
built the same registration certificate with an IPv4, an IPv6, a DNS and
an SRV relay. The relay arguments were passed in the order CNTools uses.
Each release then ran `transaction build-raw` and `transaction sign` on
its own certificate, and the relay bytes were read from the CBOR at each
step:

- IPv4 `65.21.107.182` should be `41156bb6`. 11.2.1.0 to 11.4.0.0 write
`b66b1541` into the certificate, and build-raw and sign keep it.
- IPv6, DNS and SRV relays are the same bytes in every release.
- Every release keeps the bytes when it signs a body built by 10.16.0.0,
so an offline signer on an affected release does not change the relays.
- Every release keeps the bytes when it builds a transaction from a
certificate made by 10.16.0.0.
- In `debug transaction view`, 11.2.1.0 to 11.4.0.0 show the correct
certificate as `182.107.21.65` and their own reversed one as correct.
11.5.0.0 and later show both as they are on chain.

Also:

- The `guild-deploy.sh` cardano-cli download and extract steps with
11.5.0.0 give a binary that writes `89.233.105.53` as `59e96935`. The
aarch64 binary links cardano-ledger-binary 1.10.1.0 too, but was not
run.
- The new minimum rejects 11.2.3.1, 11.3.1.0 and 11.4.0.0, and accepts
11.5.0.0 and later.
- `bash -n` and `shellcheck -S error` on `env` and `guild-deploy.sh`:
clean.
- Not run here: 11.5.0.0 queries against a running node 11.1.3. In an
earlier check against node 11.1.3 on preprod, 11.4.0.0 and 11.7.0.0
returned the same JSON for the queries CNTools runs.

### Reviewer notes

- Pools that registered or updated IPv4 relays with cardano-cli 11.2.1.0
to 11.4.0.0 have the address reversed on chain, including pools updated
with alpha since #1917. They need to submit a pool update with 11.5.0.0
or later.
- Those releases also show correctly registered relays reversed, so
checking a registration with them gives the wrong answer.
- cardano-node 11.1.3 links cardano-ledger-binary 1.9.1.0, so the node
itself reads relays correctly.
- As with #1917, hosts that build node 11.1.3 from source with
`cabal-build-all.sh` get cardano-cli 11.2.3.0 from the node's plan, and
the new minimum rejects it. They need the 11.5.0.0 binary
(`guild-deploy.sh -s d`).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

IPv4 address byte order appears reversed in cardano-cli 11.1.0.0 Dijkstra stake pool registration and pool-state query

3 participants