You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(tap-agent): derive allocation_id from V2 collection_id in AllocationId check
- Accept Horizon (V2) receipts that only provide collection_id by mapping the 32‑byte value to an Address
(last 20 bytes, right‑aligned).
- Preserve V1 behavior (use allocation_id() when present).
- Validate collection_id length and return a clear error when invalid.
- Add a small debug log comparing the resolved allocation_id to the expected one.
// V2: collection_id is 32 bytes with the 20-byte address right-aligned (left-padded zeros).
63
+
let bytes = cid.as_slice();
64
+
if bytes.len() != 32{
65
+
returnErr(CheckError::Failed(anyhow!(
66
+
"Invalid collection_id length: {} (expected 32)",
67
+
bytes.len()
68
+
)));
69
+
}
70
+
Address::from_slice(&bytes[12..32])
71
+
}else{
72
+
returnErr(CheckError::Failed(anyhow!(
73
+
"Receipt does not have an allocation_id or collection_id"
74
+
)));
75
+
};
61
76
// TODO: Remove the if block below? Each TAP Monitor is specific to an allocation
62
77
// ID. So the receipts that are received here should already have been filtered by
63
78
// allocation ID.
79
+
tracing::debug!(
80
+
"Checking allocation_id: {:?} against expected_allocation_id: {}",
81
+
allocation_id,
82
+
self.allocation_id
83
+
);
64
84
if allocation_id != self.allocation_id{
65
85
returnErr(CheckError::Failed(anyhow!("Receipt allocation_id different from expected: allocation_id: {:?}, expected_allocation_id: {}", allocation_id,self.allocation_id)));
0 commit comments