Skip to content

Commit 0f54b08

Browse files
committed
feat(wad_ray_math_tests): add overflow test for ray_mul_down
- Change: - Add `test_ray_mul_down_overflow`: `b = 1 RAY`, `a = U256_MAX / b + 1` - Expect abort `EOVERFLOW` (location = `aave_math::wad_ray_math`) - Preserve: - Existing tests and helpers - Public API and function names - Rationale: - Validate new overflow guard for `a*b` path - Align with existing overflow tests for `ray_mul`/`ray_mul_up` - Impact: - Test coverage improved - No behavior change in non-test code
1 parent 578da35 commit 0f54b08

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

aave-core/aave-math/tests/wad_ray_math_tests.move

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,4 +454,13 @@ module aave_math::wad_ray_math_tests {
454454
let b = 1;
455455
ray_div_down(a, b);
456456
}
457+
458+
#[test]
459+
#[expected_failure(abort_code = EOVERFLOW, location = aave_math::wad_ray_math)]
460+
fun test_ray_mul_down_overflow() {
461+
// a * b overflows at a = floor(U256_MAX / b) + 1 (choose b > 0)
462+
let b = 1000000000000000000000000000; // 1 RAY
463+
let a = get_u256_max_for_testing() / b + 1;
464+
ray_mul_down(a, b);
465+
}
457466
}

0 commit comments

Comments
 (0)