Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console.log functionality for debugging huff contracts #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AmadiMichael
Copy link
Contributor

Console.log functionalities for Huff contracts

Console.huff lets devs visualize the state of the stack, memory and calldata at any point while huffing simply by specifying what they wish to visualize all using foundry's native console logging functionality under the hood.

Huffors can

  • log out the stack (up to 16 items deep) as bytes32 values (similar to evm.codes)

  • log individual stack items as any variable type (uint256, int256, address, bool, bytes32)

  • log out an area of memory or calldata as bytes(dynamic) or as a string.

  • (experimental): log out an area in memory as a string and with styling (using foundry's new log styling feature)

src/test/contracts/HuffConsoleWrapper.huff has examples on how it can be used.

Run forge test -vvv to see how it displays.

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.

1 participant