MCPcopy Create free account
hub / github.com/base/base / validate_batch

Method validate_batch

crates/execution/txpool/src/validity.rs:303–314  ·  view source on GitHub ↗

Validates a batch of predicates submitted at ingress. Rejects an empty batch, a batch larger than `max`, and any predicate whose parameters are internally inconsistent.

(predicates: &[Self], max: usize)

Source from the content-addressed store, hash-verified

301 /// Rejects an empty batch, a batch larger than `max`, and any predicate
302 /// whose parameters are internally inconsistent.
303 pub fn validate_batch(predicates: &[Self], max: usize) -> Result<(), ValidityPredicateError> {
304 if predicates.is_empty() {
305 return Err(ValidityPredicateError::Empty);
306 }
307 if predicates.len() > max {
308 return Err(ValidityPredicateError::TooMany { count: predicates.len(), max });
309 }
310 for (index, predicate) in predicates.iter().enumerate() {
311 predicate.validate_params(index)?;
312 }
313 Ok(())
314 }
315
316 /// Validates that a batch contains a `block_number` upper-bound predicate.
317 ///

Callers

nothing calls this directly

Calls 4

validate_paramsMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected