crytic / echidna

Ethereum smart contract fuzzer
GNU Affero General Public License v3.0
2.65k stars 346 forks source link

[Bug-Candidate]: no fore color support for terminal xterm-256color #1240

Open aviggiano opened 2 months ago

aviggiano commented 2 months ago

Describe the issue:

In some cases, Echidna fails to run because of the error attached. I can't confirm, but I am under the impression that this happens when I minimize my terminal.

Code example to reproduce the issue:

The codebase is private

Version:

Echidna 2.2.3 Slither 0.9.3

Relevant log output:

[I] ➜ echidna . --contract CryticTester --config echidna.yaml --test-mode assertion --corpus-dir echidna --test-limit 500000
[2024-04-18 18:25:18.86] Compiling .... itDone! (83.459169s)
Analyzing contract: CryticTester.sol:CryticTester
[2024-04-18 18:26:44.47] Running slither on .... Done! (126.154415s)
Loaded 23 transaction sequences from echidna/reproducers
Loaded 72 transaction sequences from echidna/coverage
echidna: no fore color support for terminal xterm-256color
CallStack (from HasCallStack):
  error, called at src/Graphics/Vty/Output/TerminfoBased.hs:119:39 in vty-5.38-IjxqNDNH7C1mXkr8nIcBw:Graphics.Vty.Output.TerminfoBased
aviggiano commented 2 months ago

Hey

Giving more info about this bug.

I'm pretty confident that this happens when I "alt+tab" from my terminal window. Here are more logs showing what happened:

[I] ➜ echidna . --contract CryticTester --config echidna.yaml --test-mode property
[2024-05-03 12:07:09.98] Compiling .... Done! (13.71722s)
Analyzing contract: src/invariants/CryticTester.sol:CryticTester
[2024-05-03 12:07:24.32] Running slither on .... Done! (1.328662s)
WARNING: Running slither failed. Echidna will continue, however fuzzing will likely be less effective.

Loaded 0 transaction sequences from echidna/reproducers
Loaded 58 transaction sequences from echidna/coverage
echidna: no fore color support for terminal xterm-256color
CallStack (from HasCallStack):
  error, called at src/Graphics/Vty/Output/TerminfoBased.hs:119:39 in vty-5.38-IjxqNDNH7C1mXkr8nIcBw:Graphics.Vty.Output.TerminfoBased

size-solidity on  invariant-tests [$!?] via ⬢ v20.10.0 via slither took 17s
[I] ➜ forge fmt

size-solidity on  invariant-tests [$!?] via ⬢ v20.10.0 via slither
[I] ➜ echidna . --contract CryticTester --config echidna.yaml --test-mode property
[2024-05-03 12:08:37.69] Compiling .... Done! (13.699916s)
Analyzing contract: src/invariants/CryticTester.sol:CryticTester
[2024-05-03 12:08:51.96] Running slither on .... Done! (1.761485s)
WARNING: Running slither failed. Echidna will continue, however fuzzing will likely be less effective.

Loaded 0 transaction sequences from echidna/reproducers
Loaded 58 transaction sequences from echidna/coverage
echidna: no fore color support for terminal xterm-256color
CallStack (from HasCallStack):
  error, called at src/Graphics/Vty/Output/TerminfoBased.hs:119:39 in vty-5.38-IjxqNDNH7C1mXkr8nIcBw:Graphics.Vty.Output.TerminfoBased

size-solidity on  invariant-tests [$!?] via ⬢ v20.10.0 via slither took 17s
[I] ➜ echidna . --contract CryticTester --config echidna.yaml --test-mode property
[2024-05-03 12:10:21.21] Compiling .... Done! (13.940606s)
Analyzing contract: src/invariants/CryticTester.sol:CryticTester
[2024-05-03 12:10:35.78] Running slither on .... Done! (1.150923s)
WARNING: Running slither failed. Echidna will continue, however fuzzing will likely be less effective.

Loaded 0 transaction sequences from echidna/reproducers
Loaded 58 transaction sequences from echidna/coverage
echidna: no fore color support for terminal xterm-256color
CallStack (from HasCallStack):
  error, called at src/Graphics/Vty/Output/TerminfoBased.hs:119:39 in vty-5.38-IjxqNDNH7C1mXkr8nIcBw:Graphics.Vty.Output.TerminfoBased

size-solidity on  invariant-tests [$!?] via ⬢ v20.10.0 via slither took 16s
[I] ➜ echidna . --contract CryticTester --config echidna.yaml --test-mode property
[2024-05-03 12:11:20.55] Compiling .... Done! (13.726327s)
Analyzing contract: src/invariants/CryticTester.sol:CryticTester
[2024-05-03 12:11:34.85] Running slither on .... Done! (1.081459s)
WARNING: Running slither failed. Echidna will continue, however fuzzing will likely be less effective.

Loaded 0 transaction sequences from echidna/reproducers
Loaded 58 transaction sequences from echidna/coverage
invariant_TOKENS_01: passing
invariant_UNDERWATER_01: passing
invariant_LOAN_01: passing
invariant_SOLVENCY: passing

Unique instructions: 41401
Unique codehashes: 32
Corpus size: 1
Seed: 7489732621172236028

[2024-05-03 12:11:38.66] Saving test reproducers... Done! (0s)
[2024-05-03 12:11:38.66] Saving corpus... Done! (0.067842s)

I started Echidna, switched windows, went to do something else, got back, and it had crashed. Then started again, switched windows, went to do something else, and it crashed again. I repeated this process until I decided to just wait for it to start (it's so slow 🥲 🥲 🥲 ) and the bug stopped happening!

Please let me know if I can provide more information

ggrieco-tob commented 2 months ago

@elopez any idea about this? :thinking:

elopez commented 2 months ago

hm no idea here, it seems to be an error from vty. What OS / terminal emulator are you using @aviggiano? does it happen if you use a different terminal app?

If you can try to reproduce it with the binaries from the GHC 9.6 PR that would be nice as well; that branch uses a newer version of the UI stack (brick, vty) so it may fix things. You can get binaries from the CI run here: https://github.com/crytic/echidna/actions/runs/8915729894

aviggiano commented 2 months ago

I'm using macOS with iTerm 2. I haven't tried switching terminal apps yet. Another (probably related) UI bug just happened:

[I] ➜ echidna . --contract CryticTester --config echidna.yaml --test-mode property
[2024-05-03 12:38:47.73] Compiling .... Done! (16.033369s)
Analyzing contract: src/invariants/CryticTester.sol:CryticTester
[2024-05-03 12:39:04.52] Running slither on .... Done! (1.340301s)
WARNING: Running slither failed. Echidna will continue, however fuzzing will likely be less effective.

Loaded 0 transaction sequences from echidna/reproducers
Loaded 58 transaction sequences from echidna/coverage
echidna: user error (Terminal does not define required capability "cup")

I'll try to update my binaries, thanks!