Skip to content

Commit 07dec3c

Browse files
committed
Recomputing the seed tables caused the fuzz test to fail
1 parent 3b519bc commit 07dec3c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/utils/512Math.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,8 +1485,8 @@ library Lib512MathArithmetic {
14851485
// Each entry is 10 bits and the entries are ordered from lowest `i` to
14861486
// highest. The seed is the value for `Y` for the midpoint of the bucket, rounded
14871487
// to 10 significant bits.
1488-
let table_hi := 0xb26b4a868f9fa6f9825391e3b8c22586e12826017e5f17a9e3771d573dc9
1489-
let table_lo := 0x70dbe6e5b36b9aa695a1671986519063188615815f97a5dd745c56e5ad68
1488+
let table_hi := 0xb26b4a8690a027198e559263e8ce2887e15832047f1f47b5e677dd974dcd
1489+
let table_lo := 0x71dc26f1b76c9ad6a5a46819c661946418c621856057e5ed775d1715b96b
14901490
let table := xor(table_hi, mul(xor(table_lo, table_hi), c))
14911491

14921492
// Index the table to obtain the initial seed of `Y`.

test/0.8.25/512Math.t.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ contract Lib512MathTest is Test {
219219
assertTrue(r == e);
220220
}
221221

222-
function test512Math_sqrt(uint256 x_hi, uint256 x_lo) external pure {
222+
function test512Math_sqrt(uint256 x_hi, uint256 x_lo) public pure {
223223
uint512 x = alloc().from(x_hi, x_lo);
224224
uint256 r = x.sqrt();
225225

@@ -238,4 +238,8 @@ contract Lib512MathTest is Test {
238238
assertTrue((r2_hi > x_hi) || (r2_hi == x_hi && r2_lo > x_lo), "sqrt too low");
239239
}
240240
}
241+
242+
function test512Math_sqrt_table() external pure {
243+
test512Math_sqrt(0x000000000000000000000000000000000000000580398dae536e7fe242efe66a, 0x0000000000000000001d9ad7c2a7ff6112e8bfd6cb5a1057f01519d7623fbd4a);
244+
}
241245
}

0 commit comments

Comments
 (0)