<!-- XE-0083 · core/encoding: UnmarshalBlock silently drops the PoW nonce for multisig_open/multisig_update (tailOffset uses min keyset size) (Minor) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0083>. The page is the record; this is the same page for reading.*

XE-0083 · Bounty

# core/encoding: UnmarshalBlock silently drops the PoW nonce for multisig\_open/multisig\_update (tailOffset uses min keyset size) (Minor)

Accepted
claimed Minor
[xe#100](https://github.com/xeprotocol/xe/issues/100)
filed 2026-10-27 17:05 UTC
by BoomGone

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-10 11:38 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#118](https://github.com/xeprotocol/xe/pull/118) open by fangjian-bit
  core/encoding: compute tailOffset from repOffset to preserve PoWNonce on multisig blocks (#100)
- [xe#108](https://github.com/xeprotocol/xe/pull/108) open by arturbarszcz78
  fix(core): add BlockLeaseRenew unmarshaling and fix multisig PoW nonce tail offset (#84, #100)

### History

- [61409](https://bounty.xe.network/log/61409) 2026-11-10 00:15 UTC reply.mirrored
- [61366](https://bounty.xe.network/log/61366) 2026-11-10 00:15 UTC reply.sent
- [18235](https://bounty.xe.network/log/18235) 2026-11-07 16:10 UTC proposal.adopted
- [18234](https://bounty.xe.network/log/18234) 2026-11-07 16:10 UTC ticket.award
- [18232](https://bounty.xe.network/log/18232) 2026-11-07 16:10 UTC proposal.rejected
- [6907](https://bounty.xe.network/log/6907) 2026-11-05 13:45 UTC proposal.created
- [1837](https://bounty.xe.network/log/1837) 2026-11-02 19:16 UTC proposal.created
- [1487](https://bounty.xe.network/log/1487) 2026-11-02 10:11 UTC note.added
- [770](https://bounty.xe.network/log/770) 2026-10-29 14:22 UTC note.added
- [769](https://bounty.xe.network/log/769) 2026-10-29 14:22 UTC ticket.facts area, claimed\_tier
- [609](https://bounty.xe.network/log/609) 2026-10-29 14:05 UTC github.labels
- [526](https://bounty.xe.network/log/526) 2026-10-29 14:04 UTC ticket.status triaging → accepted

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

### Report

- Area: core/encoding.go `UnmarshalBlock`
- Found: 2026-10-27, repo master `9787859` (live node `xe/92d83d1`), via an in-process Go round-trip test
- Related: #84 (lease\_renew has no decode case); this is multisig and a silent-data-loss failure mode, distinct

## Summary

`UnmarshalBlock` does not round-trip `multisig_open` or `multisig_update` blocks: the PoW nonce is silently dropped (decoded as 0), even though the encoded bytes contain it.

Root cause: `minLen` for the two multisig types is `fixedHeaderSize + 8 + representativeSize`, where the `8` is the keyset HEADER only (threshold \+ count), i.e. a zero-key floor. `tailOffset` is then initialised to `minLen` and only corrected for `genesis` and `send`/`burn`, never for multisig. So for a real multisig block (keyset \= 8 \+ 32*numKeys), `tailOffset` is left pointing 32*numKeys bytes too early, and the nonce-presence check `len(data) == tailOffset+8` never matches. The 8 trailing nonce bytes after keyset\+representative are ignored.

## Evidence (in-process Go test against the cloned core package)

```
encoded 202 bytes; last 8 (LE nonce) = efbeadde00000000     # 0xDEADBEEF little-endian IS present in the bytes
in  PoWNonce = 3735928559 (0xdeadbeef)
out PoWNonce = 0 (0x0)                                        # dropped on decode
keyset threshold in/out = 2/2, keys in/out = 2/2             # the keyset itself survives; only the nonce is lost
```

A full round-trip test over all 14 block types shows every other type round-trips (re-encode equals encode), multisig\_open and multisig\_update mismatch only in the final 8 bytes (orig nonce vs 0), and lease\_renew fails to decode at all (that last one is #84).

## Impact

- `PoWNonce` is a real field: `ValidatePoW(hashBytes, b.PoWNonce, difficulty)` is called in core/ledger.go (x2) and core/quorum.go. A multisig block whose nonce is zeroed by a binary-codec round-trip would fail PoW re-verification.
- Honest scope: the binary codec (`MarshalBlock` / `UnmarshalBlock`) currently has NO caller anywhere in the repo. Blocks are stored and gossiped as JSON (store/badger\_store.go uses `json.Marshal`/`json.Unmarshal`), which preserves the nonce. So today this is a LATENT defect in an exported API function, not a live-path failure. It matters for any tool built on the exported codec, and it is the same codec and the same class of bug as the already-filed #84.
- The nonce is not part of the block hash (`HashBlock` uses `MarshalBlockCanonical`, which excludes the nonce), so there is no hash/consensus impact. No fund risk.

## Suggested fix

- Compute `tailOffset` from the real decoded structure for every variable-length type. For multisig, set `tailOffset = repOffset + representativeSize` after the keyset is parsed, as is already done implicitly for fixed-size types, instead of leaving it at `minLen`.
- Add a round-trip test over all 14 block types to the codec (there is currently none; the repo ships no `*_test.go`).

## Payout

XE address: `6591eab453dbd93b27e2cd674712f94b42d9e7e4d52980b966fa6da4ccd832dc`

### Thread

**fangjian-bit**2026-10-28 08:40 UTCgithub

Hey team \& @BoomGone, opened PR #118 addressing this issue:

1. In `core/encoding.go:unmarshalBlock`, updated `tailOffset` to be computed dynamically as `repOffset + representativeSize` rather than the static `minLen`. This accounts for the dynamic `ksLen = 8 + 32*numKeys` keyset bytes on multisig blocks (`multisig_open`, `multisig_update`) so `len(data) == tailOffset+8` evaluates correctly.
2. Added `core/encoding_test.go` with `TestMultisigPoWNonceRoundTrip` verifying exact parity of `PoWNonce` on multi-key multisig roundtrips, plus standard block types.

**XE desk**team2026-11-10 00:15 UTCgithub

Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is
updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0083.
