{"id":"XE-7917","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":1790,"title":"statechain: delete-op Value is not committed by the block hash - two blocks differing only in a delete value share one hash and signature set","area":"dao-harness","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":true,"internal_ref":"#1102","internal_url":"https://github.com/xeprotocol/core/issues/1102","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-11T19:20:21.112645+00:00","updated_at":"2026-11-17T09:38:14.866004+00:00","source_created_at":null,"told_at":"2026-11-17T09:38:14.908885+00:00","status_changed_at":"2026-11-17T09:38:14.876585+00:00","url":"https://bounty.xe.network/XE-7917","body":"## Summary\r\n\r\n`MarshalCanonical` hashes a `set` op's value but writes four zero bytes for a `delete` op, ignoring `op.Value` entirely. Two statechain blocks differing only in a delete op's value therefore have the identical hash and verify under the same DAO/oracle signature set, so the hash is not a commitment to the full block content. In-node impact is bounded because no code path reads a delete op's value (`ApplyOps`, `validateEpochValue`, and `validateTransition` all ignore it), so this is a hash-identity and auditability break plus an uncommitted-data carrier under signed blocks, not a state forgery.\r\n\r\n## Impact\r\n\r\n- Two different blocks share one hash and one signature set. Any tooling, audit, or external verifier that identifies a block by its hash cannot distinguish them.\r\n- A delete op's value becomes uncommitted data carried under a signed block hash: a signer can sign one delete value while a different value is presented alongside the same hash.\r\n- Practical severity is low: since no in-node code path reads a delete op's value, the differing value cannot change node state today. The risk is to hash identity, auditability, and any future consumer that starts reading delete values.\r\n\r\n## Reproduction (unit test)\r\n\r\nTemporary test in package `statechain` (run on commit 89a542e, removed afterwards to keep the tree clean):\r\n\r\n```go\r\nb1 := &Block{Index: 1, PrevHash: <32 zero bytes hex>, Timestamp: 1700000000,\r\n    Ops: []Op{{Action: ActionDelete, Key: \"k\", Value: `\"aaa\"`}}}\r\nb2 := &Block{Index: 1, PrevHash: <32 zero bytes hex>, Timestamp: 1700000000,\r\n    Ops: []Op{{Action: ActionDelete, Key: \"k\", Value: `\"zzz-completely-different\"`}}}\r\nHashBlock(b1) == HashBlock(b2)\r\n// identical hash: 7ec86f3afcf579a3e41aee6905a5135593a0a916405f598bf0e589d1c3e06502\r\n```\r\n\r\nControl: the same two values under `ActionSet` hash differently, as expected — proving the delete branch is the only difference.\r\n\r\nTest output (also attached as a screenshot):\r\n\r\n```\r\nidentical hash for different delete values: 7ec86f3afcf579a3e41aee6905a5135593a0a916405f598bf0e589d1c3e06502\r\ncontrol: set-op hashes differ as expected\r\n```\r\n\r\n## Root cause (code)\r\n\r\n- `statechain/encoding.go` (`MarshalCanonical`): the `ActionSet` branch writes the value length plus the value bytes; the `else` (delete) branch writes `var zero [4]byte` instead of `op.Value`.\r\n- `statechain/crypto.go:12`: `HashBlock` hashes exactly what `MarshalCanonical` produces, so the hash inherits the omission.\r\n- `statechain/types.go:14-18`: `Op.Value` is `json.RawMessage` — the value exists on the op and is simply not committed for deletes.\r\n\r\n## Relationship to known tickets\r\n\r\nNo match was found in the visible portion of the public board. A keyword search for `delete` returned only XE-4589, XE-6742, XE-4590, and XE-4784 — certificate eviction, lease swap, vote removal, and conflict cleanup respectively, all unrelated. The duplicate check is partial (about 300 of ~757 open tickets are visible, and no separate GitHub-issues search was run for this candidate), so I leave the duplicate decision to triage.\r\n\r\n## Suggested fix\r\n\r\nCommit the delete op's value in `MarshalCanonical` the same way the set branch does (length-prefixed value bytes), or explicitly hash a domain-separated \"no value\" marker and reject non-empty delete values at block validation. Note this changes the block hash for any block containing a delete op, so it needs a coordinated rollout.\r\n\r\n## Environment\r\n\r\n- Commit: 89a542e (\"release: testnet-0005 quorum withhold fix\", 2026-11-10)\r\n- Evidence is a unit test on that commit; no public testnet nodes were involved.\r\n- Attachments: screenshot of the passing test output.","patch_refs":[],"thread":[{"id":9678,"source":"desk","source_ref":"reply:8116","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-7917 and says what differs; it is read like any other.","created_at":"2026-11-17T09:38:14.866004+00:00"}]}