Skip to content

Fix/errors#67

Closed
odyslam wants to merge 3 commits intomasterfrom
fix/errors
Closed

Fix/errors#67
odyslam wants to merge 3 commits intomasterfrom
fix/errors

Conversation

@odyslam
Copy link
Collaborator

@odyslam odyslam commented Dec 20, 2025

  1. Improve code quality
  2. Fix unknown evm revert reason
  3. Fix non-revert if mock transaction reverts (not it reverts w/ a message)
  4. Fix standard msg for no assertion execution
Ran 2 tests for assertions/test/PerpAssertions.t.sol:PerpAssertionsTest
[FAIL: Invalidating Call Reverted] testAssertion_OpeningLong() (gas: 43534)
Logs:
  Call Revert Reason: T1

Traces:
  [43534] PerpAssertionsTest::testAssertion_OpeningLong()
    ├─ [22314] TestPriceProvider::setPrice(10000000000 [1e10])
    │   └─ ← [Stop]
    ├─ [0] VM::assertion(PerpPair: [0xa0Cb889707d426A7A386870A03bc70d1b0697598], 0x6080806040523460155761041c908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c9081626005a3146100f7575080637bbb19dc146100c65763cb7db9251461003c575f80fd5b346100c2575f3660031901126100c25760405163fe290ccb60e01b81525f8160048183734461812e00718ff8d80929e3bf595aeaaa7b881e5af180156100b757610095575b634e487b7160e01b5f52601260045260245ffd5b6100b0903d805f833e6100a88183610149565b810190610197565b505f610081565b6040513d5f823e3d90fd5b5f80fd5b346100c2575f3660031901126100c2576100e663cb7db92560e01b61038b565b6100f5626005a360e01b61038b565b005b346100c2575f3660031901126100c25763fe290ccb60e01b81525f8160048183734461812e00718ff8d80929e3bf595aeaaa7b881e5af180156100b75761013a57005b6100f5903d805f833e6100a881835b601f909101601f19168101906001600160401b0382119082101761016c57604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b03811161016c5760051b60200190565b6020818303126100c25780516001600160401b0381116100c25782601f8284010112156100c25780820151906101cc82610180565b936101da6040519586610149565b82855260208501918160208560051b8388010101116100c257602081860101925b60208560051b838801010184106102155750505050505090565b83516001600160401b0381116100c257606087840182018503601f1901126100c25760405190610246606083610149565b8784018101602001516001600160401b0381116100c25785603f8284888d0101010112156100c25760208183878c010101015161028281610180565b916102906040519384610149565b81835260208301908860408d83888c8860051b930101010101116100c257604081868a8f01010101915b60408d83888c8860051b930101010101831061037b57505050908352508784018101604001516001600160401b0381116100c25781858a0101019085603f830112156100c25760208201516001600160401b03811161016c576040519061032b601f8201601f191660200183610149565b80825287604082860101116100c2576020815f926040606097018386015e8301015260208401528885010101516001600160a01b03811681036100c25760408201528152602093840193016101fb565b82518152602092830192016102ba565b7355bb9ad8dc1ee06d47279fc2b23cd755b7f2d32690813b156100c2575f906024604051809481936337f34f8f60e21b835263ffffffff60e01b1660048301525afa80156100b7576103da5750565b5f6103e491610149565b56fea26469706673582212203e89aa1a30e84dc28f66a77c6ac7a0219a49bf15990a0e38d3ac5dd1cfa0971764736f6c63430008190033, 0xcb7db925)
    │   └─ ← [Return]
    ├─ [0] PerpPair::trade(true, 1000000000000000000000 [1e21], 0, 0, 0x0000000000000000000000000000000000001234, 1, 0x)
    │   └─ ← [Revert] Invalidating Call Reverted
    └─ ← [Revert] Invalidating Call Reverted

[FAIL: panic: division or modulo by zero (0x12)] testAssertion_OpeningShort() (gas: 43668)
Logs:
  Transaction gas cost: 477765
  Assertion gas cost: 26227
  
  Assertion function reverted: Unknown Revert Reason

Traces:
  [43668] PerpAssertionsTest::testAssertion_OpeningShort()
    ├─ [22314] TestPriceProvider::setPrice(10000000000 [1e10])
    │   └─ ← [Stop]
    ├─ [0] VM::assertion(PerpPair: [0xa0Cb889707d426A7A386870A03bc70d1b0697598], 0x6080806040523460155761041c908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c9081626005a3146100f7575080637bbb19dc146100c65763cb7db9251461003c575f80fd5b346100c2575f3660031901126100c25760405163fe290ccb60e01b81525f8160048183734461812e00718ff8d80929e3bf595aeaaa7b881e5af180156100b757610095575b634e487b7160e01b5f52601260045260245ffd5b6100b0903d805f833e6100a88183610149565b810190610197565b505f610081565b6040513d5f823e3d90fd5b5f80fd5b346100c2575f3660031901126100c2576100e663cb7db92560e01b61038b565b6100f5626005a360e01b61038b565b005b346100c2575f3660031901126100c25763fe290ccb60e01b81525f8160048183734461812e00718ff8d80929e3bf595aeaaa7b881e5af180156100b75761013a57005b6100f5903d805f833e6100a881835b601f909101601f19168101906001600160401b0382119082101761016c57604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b03811161016c5760051b60200190565b6020818303126100c25780516001600160401b0381116100c25782601f8284010112156100c25780820151906101cc82610180565b936101da6040519586610149565b82855260208501918160208560051b8388010101116100c257602081860101925b60208560051b838801010184106102155750505050505090565b83516001600160401b0381116100c257606087840182018503601f1901126100c25760405190610246606083610149565b8784018101602001516001600160401b0381116100c25785603f8284888d0101010112156100c25760208183878c010101015161028281610180565b916102906040519384610149565b81835260208301908860408d83888c8860051b930101010101116100c257604081868a8f01010101915b60408d83888c8860051b930101010101831061037b57505050908352508784018101604001516001600160401b0381116100c25781858a0101019085603f830112156100c25760208201516001600160401b03811161016c576040519061032b601f8201601f191660200183610149565b80825287604082860101116100c2576020815f926040606097018386015e8301015260208401528885010101516001600160a01b03811681036100c25760408201528152602093840193016101fb565b82518152602092830192016102ba565b7355bb9ad8dc1ee06d47279fc2b23cd755b7f2d32690813b156100c2575f906024604051809481936337f34f8f60e21b835263ffffffff60e01b1660048301525afa80156100b7576103da5750565b5f6103e491610149565b56fea26469706673582212203e89aa1a30e84dc28f66a77c6ac7a0219a49bf15990a0e38d3ac5dd1cfa0971764736f6c63430008190033, 0xcb7db925)
    │   └─ ← [Return]
    ├─ [0] VM::prank(0x00000000000000000000000000000000000003e9)
    │   └─ ← [Return]
    ├─ [0] PerpPair::trade(false, 10000000000000000000 [1e19], 0, 0, 0x0000000000000000000000000000000000001234, 1, 0x)
    │   └─ ← [Revert] panic: division or modulo by zero (0x12)
    └─ ← [Revert] panic: division or modulo by zero (0x12)

Suite result: FAILED. 0 passed; 2 failed; 0 skipped; finished in 334.03ms (596.47ms CPU time)

Ran 1 test suite in 350.42ms (334.03ms CPU time): 0 tests passed, 2 failed, 0 skipped (2 total tests)

Failing tests:
Encountered 2 failing tests in assertions/test/PerpAssertions.t.sol:PerpAssertionsTest
[FAIL: Invalidating Call Reverted] testAssertion_OpeningLong() (gas: 43534)
[FAIL: panic: division or modulo by zero (0x12)] testAssertion_OpeningShort() (gas: 43668)

Encountered a total of 2 failing tests, 0 tests succeeded
../phoundry/target/debug/forge test -vvv  23.21s user 0.79s system 99% cpu 24.018 total

@CLAassistant
Copy link

CLAassistant commented Dec 20, 2025

CLA assistant check
All committers have signed the CLA.

@odyslam odyslam closed this Dec 22, 2025
@odyslam odyslam mentioned this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants