<!-- XE-16987 · [Low] Binary codec silently drops attestations/signatures — round-tripped attested lease blocks hash differently · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16987>. The page is the record; this is the same page for reading.*

XE-16987 · Bounty

# \[Low\] Binary codec silently drops attestations/signatures — round-tripped attested lease blocks hash differently

Closed · duplicate
—
[xe#698](https://github.com/xeprotocol/xe/issues/698)
filed 2026-11-17 08:12 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770269](https://bounty.xe.network/log/770269) 2026-11-22 23:26 UTC reply.mirror\_failed
- [770005](https://bounty.xe.network/log/770005) 2026-11-22 23:26 UTC proposal.adopted
- [770004](https://bounty.xe.network/log/770004) 2026-11-22 23:26 UTC reply.sent
- [770003](https://bounty.xe.network/log/770003) 2026-11-22 23:26 UTC ticket.status new → closed
- [769086](https://bounty.xe.network/log/769086) 2026-11-22 23:25 UTC proposal.adopted
- [769085](https://bounty.xe.network/log/769085) 2026-11-22 23:25 UTC ticket.facts area
- [769084](https://bounty.xe.network/log/769084) 2026-11-22 23:25 UTC proposal.adopted
- [769083](https://bounty.xe.network/log/769083) 2026-11-22 23:25 UTC ticket.facts
- [769082](https://bounty.xe.network/log/769082) 2026-11-22 23:25 UTC proposal.adopted
- [769081](https://bounty.xe.network/log/769081) 2026-11-22 23:25 UTC ticket.facts
- [766315](https://bounty.xe.network/log/766315) 2026-11-22 23:17 UTC note.added
- [766308](https://bounty.xe.network/log/766308) 2026-11-22 23:17 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-16987) · [JSON](https://bounty.xe.network/v1/tickets/XE-16987) · [markdown](https://bounty.xe.network/XE-16987.md)

### Report

## Summary

The binary codec silently drops Attestations, CertificateHash, Signatures, Signature, and Hash on marshal — a binary round-trip of an attested lease block yields a block whose recomputed hash differs from the original, so it can no longer be identified or signature-verified. JSON preserves all of them. Latent (the codec has no callers outside `encoding.go` \+ `crypto.go`), same standing as accepted #100.

## Root Cause

- `MarshalBlockCanonical` (`core/encoding.go:44`) never writes `Attestations`, `CertificateHash`, `Signatures`, `Signature`, or `Hash`.
- `MarshalBlockAux` (`:302`) encodes attestations/cert-hash for hashing but has **no inverse decoder**, and `MarshalBlock`/`UnmarshalBlock` (`:341`/`:354`) never call it.
- `HashBlock` (`core/crypto.go:85-97`) \= sha256(networkID \+ canonical \+ aux), so attestations are hash inputs — losing them changes the hash.
- Asymmetry: `MarshalBlock` loudly *errors* on a declared `PubKey` (`:342-344`) but *silently* drops these five fields.

## Verification

Executed PoC:

```
in : attestations=2 cert_hash="fake-cert-hash-0123456789abcdef" signatures=2 sig_len=128
out: attestations=0 cert_hash="" signatures=0 sig_len=0 hash=""
HashBlock(in)  = 8431c877058c189e… (64 hex chars)
HashBlock(out) = c5179dff854a4bb7… (64 hex chars)
HASH MATCH: false
JSON control: attestations=2 cert_hash="fake-..." signatures=2 sig_len=128 hash_match=true
```

## Note on related reports

Searched `MarshalBlock encoding round-trip`, `binary codec signatures dropped`, `MarshalBlockAux aux decode`, `attestation binary codec MarshalBlock` — only #84 (lease\_renew decode case, fixed on HEAD) and #100 (multisig PoW nonce only). I read #100's full body: strictly about the decoder dropping the nonce (a field that IS in the bytes; tailOffset mechanism), and its round-trip test compared re-encode\=\=encode, which cannot detect encoder-side field loss — this report's fields are lost on the first encode. Distinct mechanism.

## Suggested fix

Encode the attestation/cert-hash/signature fields in the canonical or aux bytes (with a matching decoder), or make `MarshalBlock` error on blocks carrying fields it cannot round-trip.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-16987 and says what differs; it is read like any other.
