happenstance_sync_testkit/fixture.rs
1//! What an adapter hands the suite, and the reference implementation of it.
2
3use alloc::format;
4use alloc::sync::Arc;
5use alloc::vec;
6use alloc::vec::Vec;
7use core::future::Future;
8
9use happenstance_core::{Event, EventId, EventType, RecordedAt, SequencePosition, StoreId};
10use happenstance_sync::{
11 Ack, EventGroup, FailureClass, MemoryPeerError, MemoryResume, MemorySyncPeer, PeerLimits,
12 Pulled, PushBatch, ReplicatedEvent, SendSyncPeer,
13};
14
15use happenstance_testkit::{Capability, Reopened};
16
17use crate::violation::{Violation, ensure};
18
19/// The clause a fixture's own failure to build a provocation is reported
20/// under: the rule that asked for it.
21const SY_36: &str = "SY-36";
22
23/// The clause a fixture's failure to compact is reported under.
24const SY_32: &str = "SY-32";
25
26/// One isolated far side, and a way to reach it.
27///
28/// One fixture instance is one isolated backing peer, and each
29/// [`connect`](Self::connect) is one handle onto it — the event-store family's
30/// contract, one port over. A rule calls the opener it is given for a fresh
31/// instance, so no rule sees another's events.
32///
33/// # No `Send`, on purpose
34///
35/// Not `trait_variant`-derived and bounded on the bare
36/// [`SyncPeer`](happenstance_sync::SyncPeer), so a `!Send` peer — the Durable
37/// Object's, which holds its transport behind an `Rc` — is a valid fixture.
38/// That is SY-17's rule: the suite compiles against a `!Send` fixture peer,
39/// which this crate's `tests/local_sync_conformance.rs` does.
40///
41/// # One peer handle per rule
42///
43/// A fixture yields peers, never a peer set, and every rule in
44/// [`rules`](crate::rules) holds exactly one (SY-8). A rule that needed two
45/// would be testing the runner. The model family (`sync_model`, behind the
46/// `proptest` feature) is the exception, and says so: it plays the runner
47/// itself over one fixture **per node**, so each call of the opener it is given
48/// must build a fresh, isolated peer.
49pub trait SyncFixture {
50 /// The peer adapter under test.
51 type Peer: happenstance_sync::SyncPeer;
52
53 /// A handle onto this fixture's backing peer.
54 fn connect(&self) -> impl Future<Output = Self::Peer>;
55
56 /// Drives `peer` into every refusal it can produce, and declares the
57 /// [`FailureClass`] each one is (SY-36).
58 ///
59 /// Only the adapter knows which of its failures can be provoked and what
60 /// each calls for, so the fixture both provokes and declares, and the rule
61 /// [`every_refusal_states_its_class`](crate::rules::every_refusal_states_its_class)
62 /// compares what the error says against what the fixture said. A required
63 /// method rather than a default returning nothing, because a fixture that
64 /// declined it silently would pass that rule against nothing.
65 ///
66 /// # Errors
67 ///
68 /// A [`Violation`] if the fixture cannot build a provocation — its own
69 /// failure, reported under SY-36 because that is the rule that asked.
70 fn refusals(&self, peer: &Self::Peer) -> impl Future<Output = RefusalsOf<Self::Peer>>;
71
72 /// Whether this fixture can make its peer forget a prefix of its log, as
73 /// a peer with a retention window does. SY-32's rule,
74 /// [`retention_gap_is_reported_not_silent`](crate::rules::retention_gap_is_reported_not_silent),
75 /// needs it, and reports [`Skipped`](happenstance_testkit::RuleOutcome::Skipped)
76 /// with the stated reason when it is declined.
77 ///
78 /// Nothing in the port compacts, so the operation is the adapter's.
79 const COMPACTION: Capability = Capability::declined(UNSTATED_COMPACTION);
80
81 /// Makes `peer` forget the longest prefix of its log, in its forwarding
82 /// order, in which every event was recorded before `cutoff`, as the
83 /// fixture's adapter compacts on a retention window (SY-32).
84 ///
85 /// `cutoff` is a window predicate on each event's
86 /// [`RecordedAt`], never an order: `RecordedAt` orders nothing. A fixture
87 /// that declares [`COMPACTION`](Self::COMPACTION) supported overrides this.
88 ///
89 /// # Errors
90 ///
91 /// The provided body always returns a [`Violation`] of SY-32 naming the
92 /// two ways to reach it: a fixture that declares the capability and does
93 /// not compact, or a rule that compacts without checking it.
94 fn compact_recorded_before(
95 &self,
96 _peer: &Self::Peer,
97 cutoff: RecordedAt,
98 ) -> impl Future<Output = Result<(), Violation>> {
99 core::future::ready(Err(Violation::new(
100 SY_32,
101 format!(
102 "`SyncFixture::compact_recorded_before({})` was called and not overridden: \
103 either this fixture declares COMPACTION supported and does not compact, or \
104 a rule compacted without checking the capability",
105 cutoff.as_millis()
106 ),
107 )))
108 }
109
110 /// Whether this fixture can close and reopen its backing peer, discarding
111 /// every handle's process-level state.
112 ///
113 /// `happenstance_testkit::ProjectionFixture::REOPEN` for the peer port, and
114 /// CF-17 governs it in the same words: a fixture declaring it supported
115 /// MUST make [`reopen`](Self::reopen) discard that state **over a medium
116 /// that outlives the process's hold on it**, and MUST state the mechanism —
117 /// which pool is closed, which client is rebuilt. A fixture over a peer
118 /// with no medium outside the process MUST decline it, with that as its
119 /// stated reason.
120 ///
121 /// It is read by exactly one rule,
122 /// [`ack_never_confirms_a_non_durable_event`](crate::rules::ack_never_confirms_a_non_durable_event),
123 /// which reads SY-31's *durably seen* across a reopen. Without one the rule
124 /// can only drop the acking handle and connect another, so a peer that
125 /// keeps what it acknowledged in memory every handle shares passes it.
126 ///
127 /// # Defaulted, and checked
128 ///
129 /// Defaulted to a declension, in [`UNSTATED_SYNC_REOPEN`]'s words, so the
130 /// item is additive to every fixture written before it: a default may
131 /// decline on an author's behalf, never declare. A fixture that inherits
132 /// it is told so in its own CI by [`sync_declensions_are_stated`], which
133 /// [`sync_peer_conformance!`](crate::sync_peer_conformance) emits.
134 ///
135 /// # What declaring it does not prove
136 ///
137 /// An override that answers [`Reopened::Discarded`] and discards nothing is
138 /// indistinguishable, through the port, from an honest one. So the rule
139 /// rejects a *peer* that loses a confirmed event across a reopen, and
140 /// cannot reject a *fixture* that only claims to reopen; the declaration
141 /// MUST above carries that hazard, as it does for the projection port.
142 const REOPEN: Capability = Capability::declined(UNSTATED_SYNC_REOPEN);
143
144 /// Closes and reopens the backing peer, discarding every outstanding
145 /// handle's process-level state, and says whether it did.
146 ///
147 /// After an override returns [`Reopened::Discarded`], a fresh
148 /// [`connect`](Self::connect) must observe exactly what the peer durably
149 /// holds. Handles obtained before the call may stop working; a rule drops
150 /// every one before it calls this.
151 ///
152 /// # The provided body says it reopened nothing
153 ///
154 /// It returns [`Reopened::Nothing`], and the rule reports a violation on
155 /// that answer before it reads anything back. A fixture that declares
156 /// [`REOPEN`](Self::REOPEN) supported and forgets this override therefore
157 /// fails on every run, with a message naming this method: the projection
158 /// port's shape, not the event-store port's panicking one, so the failure
159 /// lands in the rule and no panic is in this crate's library code.
160 fn reopen(&self) -> impl Future<Output = Reopened> {
161 core::future::ready(Reopened::Nothing)
162 }
163}
164
165/// What [`SyncFixture::REOPEN`] says when a fixture says nothing.
166///
167/// `pub` so an adapter author can read what their silence says. A fixture
168/// cannot agree with it by naming it: [`sync_declensions_are_stated`] compares
169/// the text, so the constant named is the constant inherited.
170pub const UNSTATED_SYNC_REOPEN: &str = "this fixture has not said whether its peer can be reopened; a peer with \
171 no medium outside the process has nothing a reopen could read back, and this \
172 is that answer given by default rather than by its author";
173
174/// CF-18's machine-checked half for the sync-peer family, for
175/// [`SyncFixture::REOPEN`] only: `F` must not decline it with the reason it
176/// would inherit by saying nothing.
177///
178/// [`SyncFixture::COMPACTION`] is not checked. Its inherited
179/// [`UNSTATED_COMPACTION`] is accepted for now because every adapter fixture
180/// in this workspace (Postgres, Neon, Cloudflare and the workerd harness)
181/// inherits it today, so checking it here would turn every mounted sync suite
182/// red in the change that added the capability. Requiring a stated reason for
183/// it is follow-up issue #480.
184///
185/// [`ingest_declensions_are_stated`](crate::ingest_declensions_are_stated)'s
186/// twin. Emitted once per mounted suite by
187/// [`sync_peer_conformance!`](crate::sync_peer_conformance), not by the
188/// emitter, so a third-party emitter cannot drop it. It cannot see a reason
189/// that is merely bad.
190///
191/// The opener is taken, and never called, so `F` is inferred from the
192/// macro's hoisted fixture function.
193///
194/// # Errors
195///
196/// A [`Violation`] of CF-18 if `F` declines [`SyncFixture::REOPEN`] with the
197/// inherited reason.
198pub fn sync_declensions_are_stated<F: SyncFixture>(
199 _opener: impl AsyncFn() -> F,
200) -> Result<(), Violation> {
201 let declared = [("REOPEN", F::REOPEN, UNSTATED_SYNC_REOPEN)];
202 let unstated: Vec<&str> = declared
203 .iter()
204 .filter(|(_, capability, default)| capability.reason() == Some(*default))
205 .map(|(name, _, _)| *name)
206 .collect();
207 ensure(unstated.is_empty(), "CF-18", || {
208 format!(
209 "this fixture declines {} without saying why: the reason printed on every run is \
210 this crate's words, not the adapter's account of its peer. Write the constant on \
211 the `impl`, with the reason this peer cannot co-operate, in your own words",
212 unstated.join(", ")
213 )
214 })
215}
216
217/// What [`SyncFixture::COMPACTION`] says when a fixture says nothing.
218///
219/// `pub` so an adapter author can read what their silence says. Unlike
220/// [`UNSTATED_SYNC_REOPEN`], it is not checked: [`sync_declensions_are_stated`]
221/// accepts a fixture that inherits it, until #480.
222pub const UNSTATED_COMPACTION: &str = "this fixture cannot make its peer forget a prefix of its log; nothing \
223 in the port compacts, so compaction has to come from the adapter and this one has none to \
224 offer";
225
226/// What [`SyncFixture::refusals`] resolves to for a peer `P`.
227///
228/// An alias only to keep the trait's signature readable: the error type is
229/// reached through the peer's associated type, which spelled out in place is
230/// three levels of angle brackets.
231pub type RefusalsOf<P> = Result<Vec<Refusal<<P as happenstance_sync::SyncPeer>::Error>>, Violation>;
232
233/// One refusal a fixture drove its peer into, and the class it declares for it.
234///
235/// Plain data with public fields: a fixture builds one per refusal and the rule
236/// only reads it.
237#[derive(Debug)]
238pub struct Refusal<E> {
239 /// What was done to the peer, for the violation message: `"a push one byte
240 /// over max_batch_bytes"`.
241 pub provoked_by: &'static str,
242 /// The class the fixture says this refusal is.
243 pub declared: FailureClass,
244 /// What the peer returned. `Ok` is a provocation the peer accepted, which
245 /// the rule reports rather than skips.
246 pub outcome: Result<(), E>,
247}
248
249/// The largest `max_batch_bytes` [`batch_over_the_limit`] will build a batch
250/// over: 64 MiB.
251///
252/// A ceiling because the batch is allocated whole, and the limit it is sized
253/// from is the peer's own declaration — a value the suite does not control
254/// (H-13). 64 MiB is three orders of magnitude above the minimum conformant
255/// limit and well inside what a test process can hold.
256pub const MAX_PROVOKED_BATCH_BYTES: usize = 64 * 1024 * 1024;
257
258/// The most events one push a rule builds will carry: 4,096.
259///
260/// A ceiling for the reason [`MAX_PROVOKED_BATCH_BYTES`] is one: SY-18's batch
261/// rule sizes its pushes from the peer's declared `max_batch_events`, a value
262/// the suite does not control, and builds each push whole (H-13). 4,096 is
263/// thirty-two times the minimum conformant limit, and above the 257 events the
264/// largest push of SY-37's count-cut log carries, so a peer whose limits
265/// refuse that push refuses the batch rule's corner too.
266pub const MAX_PROVOKED_BATCH_EVENTS: usize = 4_096;
267
268/// The oversized-push refusal, provoked on `peer` and declared
269/// [`FailureClass::Split`].
270///
271/// The body every fixture whose peer honours its own [`PeerLimits`] would
272/// otherwise write out: build [`batch_over_the_limit`] from what the peer
273/// declares, push it, and record what came back. A fixture whose peer classifies
274/// an oversized push as something other than `Split` declares its refusal by
275/// hand instead.
276///
277/// # Errors
278///
279/// A [`Violation`] of SY-36 if [`batch_over_the_limit`] cannot build the batch.
280pub async fn oversized_push_refusal<P: happenstance_sync::SyncPeer>(peer: &P) -> RefusalsOf<P> {
281 let oversized = batch_over_the_limit(&peer.limits())?;
282 Ok(vec![Refusal {
283 provoked_by: "a push one byte over max_batch_bytes",
284 declared: FailureClass::Split,
285 outcome: peer.push(&oversized).await.map(drop),
286 }])
287}
288
289/// A batch one byte over `limits.max_batch_bytes`, built from events no larger
290/// than `limits.max_event_bytes`, so a peer that checks both refuses it for
291/// the batch and not for any one event.
292///
293/// For a fixture whose peer refuses an oversized push, which is the one refusal
294/// every peer that honours its own [`PeerLimits`] can be driven into. The
295/// payloads are zero bytes and are never parsed (SY-35).
296///
297/// # Errors
298///
299/// A [`Violation`] of SY-36 if `limits.max_batch_bytes` is above
300/// [`MAX_PROVOKED_BATCH_BYTES`]. The batch is built in memory, so a peer that
301/// declares more than that would have the suite allocate whatever it claimed;
302/// such a peer's fixture must provoke its own oversized refusal, by a route
303/// that does not materialise the whole batch.
304///
305/// A [`Violation`] of SY-36 if the batch would need more events than one origin
306/// can number. Unreachable under the ceiling.
307pub fn batch_over_the_limit(limits: &PeerLimits) -> Result<PushBatch, Violation> {
308 const ORIGIN: StoreId = StoreId::from_bytes([0x0B; 16]);
309 const OVERSIZED: EventType = EventType::from_static("Oversized");
310
311 if limits.max_batch_bytes > MAX_PROVOKED_BATCH_BYTES {
312 return Err(Violation::new(
313 SY_36,
314 format!(
315 "the peer declares max_batch_bytes of {}, above the {MAX_PROVOKED_BATCH_BYTES} \
316 bytes this helper will allocate; its fixture must provoke an oversized \
317 refusal of its own",
318 limits.max_batch_bytes
319 ),
320 ));
321 }
322
323 let chunk = limits.max_event_bytes.max(1);
324 let mut remaining = limits.max_batch_bytes.saturating_add(1);
325 let mut position = SequencePosition::FIRST;
326 let mut events = Vec::new();
327 while remaining > 0 {
328 let size = remaining.min(chunk);
329 let event = Event::new(OVERSIZED, vec![0_u8; size]).map_err(|error| {
330 Violation::new(
331 SY_36,
332 format!("the fixture's own event is invalid: {error}"),
333 )
334 })?;
335 events.push(ReplicatedEvent::new(
336 EventId::new(ORIGIN, position),
337 RecordedAt::from_millis(1_800_000_000_000),
338 event,
339 ));
340 remaining -= size;
341 position = position
342 .next()
343 .ok_or_else(|| Violation::new(SY_36, "the oversized batch ran out of positions"))?;
344 }
345 Ok(PushBatch::new(vec![EventGroup::new(None, events)]))
346}
347
348/// The reference [`SyncFixture`], over [`MemorySyncPeer`].
349///
350/// Every rule is proven against this before it is allowed to fail an adapter:
351/// a rule red here is a wrong rule, not a wrong peer. Each instance owns one
352/// in-memory peer and each [`connect`](SyncFixture::connect) is a new handle
353/// onto it.
354#[derive(Debug, Clone)]
355pub struct MemorySyncFixture {
356 /// Shared by every handle, so a handle dropped and reconnected sees the same
357 /// log (SY-16's precondition, for the rule that will check it).
358 peer: Arc<MemorySyncPeer>,
359}
360
361impl MemorySyncFixture {
362 /// A fixture over a fresh in-memory peer with the minimum conformant
363 /// limits.
364 #[must_use]
365 pub fn new() -> Self {
366 Self {
367 peer: Arc::new(MemorySyncPeer::new(StoreId::from_bytes([0xA5; 16]))),
368 }
369 }
370}
371
372impl Default for MemorySyncFixture {
373 fn default() -> Self {
374 Self::new()
375 }
376}
377
378impl SyncFixture for MemorySyncFixture {
379 type Peer = MemorySyncHandle;
380
381 /// Declined, by incapacity: the reference peer's log is process memory,
382 /// so a reopen would read back nothing or everything, never what was
383 /// durable. `tests/wrong_reopens.rs` proves the rule's reopen half instead.
384 const REOPEN: Capability = Capability::declined(
385 "the reference peer keeps its log in process memory and has no medium outside the \
386 process a reopen could read back; SY-31's reopen half is proven against the wrong \
387 peers in tests/wrong_reopens.rs and run against the Postgres and Neon peers",
388 );
389
390 async fn connect(&self) -> Self::Peer {
391 MemorySyncHandle {
392 peer: Arc::clone(&self.peer),
393 }
394 }
395
396 /// The one refusal the reference peer can be driven into from outside.
397 ///
398 /// [`MemoryPeerError::Poisoned`] is its other, and provoking it takes a
399 /// thread that panics while holding the peer's lock: not something a
400 /// fixture should do to the peer a suite is about to use.
401 async fn refusals(&self, peer: &Self::Peer) -> RefusalsOf<Self::Peer> {
402 oversized_push_refusal(peer).await
403 }
404
405 const COMPACTION: Capability = Capability::SUPPORTED;
406
407 /// [`MemorySyncPeer::compact_recorded_before`] on the peer behind `peer`.
408 async fn compact_recorded_before(
409 &self,
410 peer: &Self::Peer,
411 cutoff: RecordedAt,
412 ) -> Result<(), Violation> {
413 compact_memory_peer(&peer.peer, cutoff)
414 }
415}
416
417/// [`MemorySyncPeer::compact_recorded_before`], its one failure reported as a
418/// violation of SY-32: the body of every fixture here over the reference peer.
419pub(crate) fn compact_memory_peer(
420 peer: &MemorySyncPeer,
421 cutoff: RecordedAt,
422) -> Result<(), Violation> {
423 peer.compact_recorded_before(cutoff)
424 .map(drop)
425 .map_err(|error| {
426 Violation::new(
427 SY_32,
428 format!("the reference peer could not compact: {error}"),
429 )
430 })
431}
432
433/// One handle onto a [`MemorySyncFixture`]'s peer.
434///
435/// A handle rather than the peer itself because a fixture hands out many and
436/// they must share one log; `Arc` because the reference peer is `Send + Sync`
437/// and the handle keeps it so, which is what lets it run under the tokio
438/// emitter.
439#[derive(Debug, Clone)]
440pub struct MemorySyncHandle {
441 peer: Arc<MemorySyncPeer>,
442}
443
444impl SendSyncPeer for MemorySyncHandle {
445 type Error = MemoryPeerError;
446 type Resume = MemoryResume;
447
448 async fn pull(&self, from: Option<&Self::Resume>) -> Result<Pulled<Self::Resume>, Self::Error> {
449 SendSyncPeer::pull(&*self.peer, from).await
450 }
451
452 async fn push(&self, batch: &PushBatch) -> Result<Ack, Self::Error> {
453 SendSyncPeer::push(&*self.peer, batch).await
454 }
455
456 fn limits(&self) -> PeerLimits {
457 SendSyncPeer::limits(&*self.peer)
458 }
459}
460
461#[cfg(test)]
462mod tests {
463 use happenstance_core::RecordedAt;
464 use happenstance_sync::PeerLimits;
465 use happenstance_testkit::{Capability, Reopened, block_on};
466
467 use super::{
468 MAX_PROVOKED_BATCH_BYTES, MemorySyncFixture, MemorySyncHandle, RefusalsOf, SyncFixture,
469 UNSTATED_COMPACTION, batch_over_the_limit, oversized_push_refusal,
470 sync_declensions_are_stated,
471 };
472
473 /// A fixture over the reference peer whose `REOPEN` is `$reopen`, or the
474 /// trait's default when none is given.
475 macro_rules! over_the_reference {
476 ($name:ident $(, $reopen:expr)?) => {
477 struct $name(MemorySyncFixture);
478
479 impl SyncFixture for $name {
480 type Peer = MemorySyncHandle;
481 $(const REOPEN: Capability = $reopen;)?
482
483 async fn connect(&self) -> Self::Peer {
484 self.0.connect().await
485 }
486
487 async fn refusals(&self, peer: &Self::Peer) -> RefusalsOf<Self::Peer> {
488 oversized_push_refusal(peer).await
489 }
490 }
491 };
492 }
493
494 over_the_reference!(Silent);
495 over_the_reference!(Supports, Capability::SUPPORTED);
496 over_the_reference!(
497 States,
498 Capability::declined("a test fixture over the reference peer, which keeps no medium")
499 );
500
501 /// A fixture that says nothing declines compaction in this crate's words,
502 /// and its provided compaction is a violation of SY-32, never a silent
503 /// no-op a rule could mistake for a compaction that dropped nothing.
504 #[test]
505 fn a_silent_fixture_declines_compaction_and_cannot_compact() {
506 let fixture = Silent(MemorySyncFixture::new());
507 let peer = block_on(fixture.connect());
508
509 let compacted =
510 block_on(fixture.compact_recorded_before(&peer, RecordedAt::from_millis(0)));
511
512 assert_eq!(Silent::COMPACTION.reason(), Some(UNSTATED_COMPACTION));
513 let violation = compacted.expect_err("the provided body never compacts");
514 assert_eq!(violation.clause(), "SY-32");
515 }
516
517 #[test]
518 fn a_fixture_that_inherits_the_default_reopen_declension_is_rejected() {
519 let checked = sync_declensions_are_stated(async || Silent(MemorySyncFixture::new()));
520
521 assert_eq!(
522 checked.map_err(|violation| violation.clause()),
523 Err("CF-18")
524 );
525 }
526
527 #[test]
528 fn a_supported_or_stated_reopen_passes() {
529 assert_eq!(
530 sync_declensions_are_stated(async || Supports(MemorySyncFixture::new())),
531 Ok(())
532 );
533 assert_eq!(
534 sync_declensions_are_stated(async || States(MemorySyncFixture::new())),
535 Ok(())
536 );
537 }
538
539 /// The provided body answers that it reopened nothing, which is what the
540 /// rule reports a declared-and-forgotten override by.
541 #[test]
542 fn the_default_reopen_reopens_nothing() {
543 let reopened = block_on(Silent(MemorySyncFixture::new()).reopen());
544
545 assert_eq!(reopened, Reopened::Nothing);
546 }
547
548 /// The reference fixture states its declension, so its own mount passes.
549 #[test]
550 fn the_reference_fixture_states_its_reopen_declension() {
551 assert_eq!(
552 sync_declensions_are_stated(async || MemorySyncFixture::new()),
553 Ok(())
554 );
555 }
556
557 /// A peer declaring more than the ceiling is told to provoke its own
558 /// refusal, and nothing is allocated for it.
559 #[test]
560 fn a_limit_above_the_ceiling_is_refused_before_anything_is_allocated() {
561 let mut limits = PeerLimits::minimum();
562 limits.max_batch_bytes = MAX_PROVOKED_BATCH_BYTES + 1;
563 let violation =
564 batch_over_the_limit(&limits).expect_err("a limit over the ceiling builds no batch");
565 assert_eq!(violation.clause(), "SY-36");
566 }
567
568 /// At the ceiling itself the batch is still built, one byte over the limit.
569 #[test]
570 fn a_limit_at_the_ceiling_is_built_one_byte_over() {
571 let mut limits = PeerLimits::minimum();
572 limits.max_batch_bytes = MAX_PROVOKED_BATCH_BYTES;
573 let batch = batch_over_the_limit(&limits).expect("the ceiling itself is in range");
574 assert_eq!(batch.payload_len(), MAX_PROVOKED_BATCH_BYTES + 1);
575 assert!(!limits.admits(&batch));
576 }
577}