This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
feat(cli): alternative compilation entrypoint #221
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a flag alternative-main
-m
--alt-main
which allows the user to define an alternative macro as their runtime bytecode entry point.Usage
Given a test huff file that looks like the following:
running
huffc --bin-runtime -m ALT_MAIN
will output6002
.If a macro name is provided that does not exist it will panic with a macro not found error.
Rational
I am beginning to look at seriously implementing a huff lsp, from this i would like there to be a way to have tags on a macro / huff test definitions in the IDE that would allow directly triggering an interactive debugger (similar to how test appears over rust test blocks). Having this behaviour within the compiler will greatly reduce the amount of code that would be required to enable macro level debugging.
Ideal use-case would be something like this:
Where this would launch the user immediately into an interactive debugger.
Even better would be integrating this with a test.
Where the test could be instantly compiled with the --calldata added as an arg to
forge/hevm debug
.Requested feedback points