{"id":"XE-16987","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"698","source_url":"https://github.com/xeprotocol/xe/issues/698","reporter_id":2920,"title":"[Low] Binary codec silently drops attestations/signatures — round-tripped attested lease blocks hash differently","area":"leasing-ledger","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T08:13:52.104558+00:00","updated_at":"2026-11-22T23:26:15.204097+00:00","source_created_at":"2026-11-17T08:12:26+00:00","told_at":"2026-11-22T23:26:15.290411+00:00","status_changed_at":"2026-11-22T23:26:15.270106+00:00","url":"https://bounty.xe.network/XE-16987","body":"## Summary\n\nThe 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.\n\n## Root Cause\n\n- `MarshalBlockCanonical` (`core/encoding.go:44`) never writes `Attestations`, `CertificateHash`, `Signatures`, `Signature`, or `Hash`.\n- `MarshalBlockAux` (`:302`) encodes attestations/cert-hash for hashing but has **no inverse decoder**, and `MarshalBlock`/`UnmarshalBlock` (`:341`/`:354`) never call it.\n- `HashBlock` (`core/crypto.go:85-97`) = sha256(networkID + canonical + aux), so attestations are hash inputs — losing them changes the hash.\n- Asymmetry: `MarshalBlock` loudly *errors* on a declared `PubKey` (`:342-344`) but *silently* drops these five fields.\n\n## Verification\n\nExecuted PoC:\n\n```\nin : attestations=2 cert_hash=\"fake-cert-hash-0123456789abcdef\" signatures=2 sig_len=128\nout: attestations=0 cert_hash=\"\" signatures=0 sig_len=0 hash=\"\"\nHashBlock(in)  = 8431c877058c189e… (64 hex chars)\nHashBlock(out) = c5179dff854a4bb7… (64 hex chars)\nHASH MATCH: false\nJSON control: attestations=2 cert_hash=\"fake-...\" signatures=2 sig_len=128 hash_match=true\n```\n\n## Note on related reports\n\nSearched `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.\n\n## Suggested fix\n\nEncode 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.\n","patch_refs":[],"thread":[{"id":18849,"source":"desk","source_ref":"reply:16526","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-16987 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:15.204097+00:00"}]}