Frame bound tests: pad the widest-payload invocation past the minimum bound, tightness only at the longest ids

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-28 05:32:26 +01:00
commit 749a58985b
2 changed files with 10 additions and 5 deletions

View file

@ -462,10 +462,12 @@ mod tests {
assert!(real <= worst, "{real} > {worst}");
// Real ciphertext is random, so about half its bytes take two
// bytes: the worst case is not wildly above what is written.
assert!(
worst <= real + sealed.ciphertext.len() + 64,
"{worst} {real}"
);
if id.len() == MAX_IDENTITY_BYTES {
assert!(
worst <= real + sealed.ciphertext.len() + 64,
"{worst} {real}"
);
}
}
}
}

View file

@ -737,7 +737,10 @@ mod tests {
fn a_payload_at_the_widest_bound_its_frame_admits_is_carried_and_served() {
let store = TestStore::new();
let backend = CountingBackend::new(true);
let invocation = fresh(&"q".repeat(256));
let mut invocation = fresh(&"q".repeat(256));
invocation.request.instructions = "x".repeat(5_000);
invocation.provider_request_sha256 =
crate::contract::provider_request_sha256(&invocation.request).unwrap();
let key = crate::fixtures::security(KEY);
let sealed = crate::envelope::encrypt_invocation(&invocation, &key).unwrap();
let bound = sealed.ciphertext.len();