Skip to content

Investigate potentially underdeterministic tests #4122

@DelevoXDG

Description

@DelevoXDG

Select Tool

snforge

Foundry Version

master branch

What operating system are you using?

MacOS

What system architecture are you using?

arm

Issue Description

Some of the forge tests (i noticed this only wrt. backtrace tests) seem to fail locally sometime because the order of logs of the insta snapshots differs from who is sometimes actually produced.

Could potenitally be nice to fix it, e.g. by enforcing the order in which test results are reported or in which tests are ran in general

Command Line Output

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot file: crates/forge/tests/e2e/./snapshots/backtrace/main__e2e__backtrace__backtrace@2.15.1.snap
Snapshot: backtrace@2.15.1
Source: crates/forge/tests/e2e/backtrace.rs:52
────────────────────────────────────────────────────────────────────────────────
Expression: stdout
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
          1 │+
          2 │+
          3 │+[FAIL] backtrace_vm_error::Test::test_fork_unwrapped_call_contract_syscall
          4 │+
          5 │+Failure data:
          6 │+    Got an exception while executing a hint: Hint Error: Error at pc=0:86:
          7 │+Got an exception while executing a hint: Error at pc=0:86:
          8 │+Got an exception while executing a hint: Requested contract address 0x0000000000000000000000000000000000000000000000000000000000000123 is not deployed.
          9 │+
         10 │+
         11 │+
         12 │+error occurred in forked contract with class hash: 0x1a92e0ec431585e5c19b98679e582ebc07d43681ba1cc9c55dcb5ba0ce721a1
         13 │+
         14 │+error occurred in contract 'OuterContract'
         15 │+stack backtrace:
         16 │+   0: (inlined) backtrace_vm_error::IInnerContractDispatcherImpl::inner
         17 │+       at [..]lib.cairo:22:1
         18 │+   1: (inlined) backtrace_vm_error::OuterContract::OuterContract::outer
         19 │+       at [..]lib.cairo:17:13
         20 │+   2: backtrace_vm_error::OuterContract::__wrapper__OuterContract__outer
         21 │+       at [..]lib.cairo:13:5
         22 │+
    1    23 │ [FAIL] backtrace_vm_error::Test::test_unwrapped_call_contract_syscall
    2    24 │ 
    3    25 │ Failure data:
    4    26 │     Got an exception while executing a hint: Hint Error: Error at pc=0:86:
┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
   24    46 │        at [..]lib.cairo:17:13
   25    47 │    2: backtrace_vm_error::OuterContract::__wrapper__OuterContract__outer
   26    48 │        at [..]lib.cairo:13:5
   27    49 │ 
   28       │-[FAIL] backtrace_vm_error::Test::test_fork_unwrapped_call_contract_syscall
   29       │-
   30       │-Failure data:
   31       │-    Got an exception while executing a hint: Hint Error: Error at pc=0:86:
   32       │-Got an exception while executing a hint: Error at pc=0:86:
   33       │-Got an exception while executing a hint: Requested contract address 0x0000000000000000000000000000000000000000000000000000000000000123 is not deployed.
   34       │-
   35       │-
   36       │-
   37       │-error occurred in forked contract with class hash: 0x1a92e0ec431585e5c19b98679e582ebc07d43681ba1cc9c55dcb5ba0ce721a1
   38       │-
   39       │-error occurred in contract 'OuterContract'
   40       │-stack backtrace:
   41       │-   0: (inlined) backtrace_vm_error::IInnerContractDispatcherImpl::inner
   42       │-       at [..]lib.cairo:22:1
   43       │-   1: (inlined) backtrace_vm_error::OuterContract::OuterContract::outer
   44       │-       at [..]lib.cairo:17:13
   45       │-   2: backtrace_vm_error::OuterContract::__wrapper__OuterContract__outer
   46       │-       at [..]lib.cairo:13:5
   47       │-
   48    50 │ 
   49    51 │ Failures:
   50       │-    backtrace_vm_error::Test::test_unwrapped_call_contract_syscall
   51       │-    backtrace_vm_error::Test::test_fork_unwrapped_call_contract_syscall
         52 │+    backtrace_vm_error::Test::test_fork_unwrapped_call_contract_syscall
         53 │+    backtrace_vm_error::Test::test_unwrapped_call_contract_syscall
────────────┴───────────────────────────────────────────────────────────────────
To update snapshots run `cargo insta review`
Stopped on the first failure. Run `cargo insta test` to run all snapshots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew

    Type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions