open-standards/wai/http-conformance/falsify/fetch-unmemoised.patch
Transaction Science 8f89b25ed4 http receipts round 4: falsify the bounded reads and the key-log cap
Patches bytes-read-whole and key-log-uncapped; bytes-unchecked,
fetch-budget-unchecked and fetch-unmemoised regenerated against the new fetcher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 14:46:34 -04:00

15 lines
893 B
Diff

# must fail: receipts_items_fetch_each_name_once
# each name fetched again for every item and walk that names it (receipts::ReceiptFetcher::get)
diff --git a/wai/wai-rs/src/http_binding/receipts.rs b/wai/wai-rs/src/http_binding/receipts.rs
index bdec9436..f8e7ba27 100644
--- a/wai/wai-rs/src/http_binding/receipts.rs
+++ b/wai/wai-rs/src/http_binding/receipts.rs
@@ -291,7 +291,7 @@ impl<'f> ReceiptFetcher<'f> {
/// the bytes is refused (`receipt_fetch_bytes_exhausted`), since whether it ends
/// there is not read, and once they are spent no further file is fetched.
pub fn get(&mut self, h: &[u8; 32]) -> Result<Vec<u8>, ReceiptRefusal> {
- if !self.memo.contains_key(h) {
+ if !self.memo.contains_key(h) || self.fetched < usize::MAX {
if self.fetched >= self.budget {
return Err(ReceiptRefusal::BudgetExhausted);
}