rhi

Coordinated trade for connected markets
git clone https://radroots.dev/git/rhi.git
Log | Files | Refs | README | LICENSE

commit 8901cb8522ad92c5ce1d37f5dc8f9de06e8dce55
parent 1a68784649446c6cebdc3b4d3cadee55eccf0417
Author: triesap <tyson@radroots.org>
Date:   Thu, 21 May 2026 09:23:21 +0000

tests: cover remote http content length limit

- add oversized content-length regression
- assert remote http responses fail before publication
- keep proof verification and publish hooks unused on failure
- validate focused remote http and nix test lanes

Diffstat:
Msrc/features/trade_validation_receipt.rs | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/features/trade_validation_receipt.rs b/src/features/trade_validation_receipt.rs @@ -2377,6 +2377,40 @@ mod tests { #[cfg(feature = "sp1_proving")] #[tokio::test] + async fn remote_http_prove_rejects_oversized_content_length_before_publish() { + let endpoint = remote_http_local_response_url( + "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: 2\r\nConnection: close\r\n\r\n{}", + ); + let mut policy = remote_http_policy(); + { + let remote_http = policy.remote_http.as_mut().expect("remote config"); + remote_http.endpoint_url = endpoint; + remote_http.max_response_bytes = 1; + } + let error = run_remote_http_job_with_policy( + policy, + Vec::new(), + Vec::new(), + vec![Err(TradeValidationReceiptJobError::InvalidJobRequest)], + ) + .await + .expect_err("oversized content-length response"); + + assert!(matches!( + error, + TradeValidationReceiptJobError::RemoteHttpResponseTooLarge + )); + assert!( + trade_validation_receipt_test_hooks() + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .published_events + .is_empty() + ); + } + + #[cfg(feature = "sp1_proving")] + #[tokio::test] async fn remote_http_prove_rejects_oversized_http_response_before_publish() { let endpoint = remote_http_local_response_url( "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n2\r\n{}\r\n0\r\n\r\n",