argotorg / argotorg/hevm

Move trace printing to prettyprinter

Open
#496 4 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
358
Forks
79
Avg merge
1d 1h
Merged PRs (30d)
6

Description

Currently the traces are printed with hardcoded escape codes which makes it hard to show in brick UI ([example](https://github.com/crytic/echidna/blob/bd90027726ca091f8d6755fec1fb17b13a562f14/lib/Echidna/UI/Widgets.hs#L307-L310)). We should update [showTrace](https://github.com/ethereum/hevm/blob/02c072f8d7c4e6f12ff0b5b8127a8a765691e32a/src/EVM/Format.hs#L198) to return a `Doc` structure and use ANSI terminal renderer to restore the current behavior. This will also make formatting traces a lot more flexible so we don't have to rewrite `showTrace` for each use case.

There are many pretty printing libraries in Haskell, [here](https://www.reddit.com/r/haskell/comments/8ilw75/comment/dytne13/) is some rationale for using [prettyprinter](https://hackage.haskell.org/package/prettyprinter).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/EVM/Format.hs at showTrace, then inspect its call sites and the trace display in the linked Echidna UI example. Check how the project currently renders ANSI output before changing the formatting boundary. Done means showTrace provides a reusable Doc structure while terminal rendering preserves the existing trace appearance and supports the Brick UI use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.