Ensures that all types in args are the same as expected by the signature
(sig: &[AbiParam], args: &[DataValue])
| 19 | |
| 20 | /// Ensures that all types in args are the same as expected by the signature |
| 21 | fn validate_signature_params(sig: &[AbiParam], args: &[DataValue]) -> bool { |
| 22 | args.iter() |
| 23 | .map(|r| r.ty()) |
| 24 | .zip(sig.iter().map(|r| r.value_type)) |
| 25 | .all(|(a, b)| match (a, b) { |
| 26 | // For these two cases we don't have precise type information for `a`. |
| 27 | // We don't distinguish between different bool types, or different vector types |
| 28 | // The actual error is in `Value::ty` that returns default types for some values |
| 29 | // but we don't have enough information there either. |
| 30 | // |
| 31 | // Ideally the user has run the verifier and caught this properly... |
| 32 | (a, b) if a.is_vector() && b.is_vector() => true, |
| 33 | (a, b) => a == b, |
| 34 | }) |
| 35 | } |
| 36 | |
| 37 | // Helper for summing a sequence of values. |
| 38 | fn sum_unsigned(head: DataValue, tail: SmallVec<[DataValue; 1]>) -> ValueResult<u128> { |