firoorg / solidity-BigNumber

Full BigNumber library implementation for Solidity.
MIT License
92 stars 23 forks source link

[FAIL. Reason: Arithmetic over/underflow] testRSA() (gas: 6003) #13

Closed Soda7592 closed 7 months ago

Soda7592 commented 1 year ago

Hello, There was a error after I execute the command. forge test --mc BigNumbersTest

In total I executed the following commands

git clone https://github.com/firoorg/solidity-BigNumber.git cd solidity-BigNumber forge build forge test --mc BigNumbersTest

And this is all of the message

[⠑] Compiling...
No files changed, compilation skipped

Running 11 tests for test/BigNumbers.t.sol:BigNumbersTest
[PASS] testDiv() (gas: 27532)
[PASS] testFailVerifyBitlen() (gas: 668)
[PASS] testFailVerifyLength() (gas: 499)
[PASS] testInit() (gas: 31180)
[PASS] testLengths() (gas: 11256)
[PASS] testModMul() (gas: 24026)
[PASS] testMul() (gas: 83697)
[FAIL. Reason: Arithmetic over/underflow] testRSA() (gas: 6003)
[PASS] testShiftLeft() (gas: 153374)
[PASS] testShiftRight() (gas: 59236)
[PASS] testVerify() (gas: 733)
Test result: FAILED. 10 passed; 1 failed; 0 skipped; finished in 1.98ms
Ran 1 test suites: 10 tests passed, 1 failed, 0 skipped (11 total tests)

Failing tests:
Encountered 1 failing test in test/BigNumbers.t.sol:BigNumbersTest
[FAIL. Reason: Arithmetic over/underflow] testRSA() (gas: 6003)

Encountered a total of 1 failing tests, 10 tests succeeded
riordant commented 7 months ago

hi, this was in fact due to a bug in the verify() function, is has been patched: https://github.com/firoorg/solidity-BigNumber/blame/master/src/BigNumbers.sol#L38