From cff7507918e6975f7779bf48f3cf52372bc5865f Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Mon, 16 Mar 2026 12:31:14 -0700 Subject: [PATCH] fix(mempool): use dyn-encoded Branch for PendingOperationsListWithError TallinN (proto_024) changed the wire encoding for refused, outdated, branch_refused, and branch_delayed operations to use a dyn-prefixed Branch field (4-byte big-endian uint32 length + 32 bytes) instead of the raw 32-byte Branch used by validated ops. PendingOperationsListWithError was embedding PendingOperationsList which uses raw Branch encoding, causing the 4-byte dyn prefix to be misinterpreted as part of the Branch hash. The subsequent 4 bytes were then read as the Contents dyn length, producing enormous values like 3,681,343,224 and the "buffer is too short" error. Fix by inlining the fields from PendingOperationsList and adding tz:"dyn" to the Branch field. PendingOperationsList itself is unchanged since validated ops still use raw Branch encoding. UnprocessedPendingOperationsList already had tz:"dyn" on Branch and is unaffected. --- clientv2/mempool/mempool.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clientv2/mempool/mempool.go b/clientv2/mempool/mempool.go index 7ba1af9..2f00fa7 100644 --- a/clientv2/mempool/mempool.go +++ b/clientv2/mempool/mempool.go @@ -24,8 +24,10 @@ type PendingOperationsList struct { } type PendingOperationsListWithError struct { - PendingOperationsList - Error []byte `tz:"dyn" json:"error"` + Hash *tz.OperationHash `json:"hash"` + Branch *tz.BlockHash `tz:"dyn" json:"branch"` + Contents []*core.OperationWithoutMetadata[latest.OperationContents] `tz:"dyn" json:"contents"` + Error []byte `tz:"dyn" json:"error"` } type UnprocessedPendingOperationsList struct {