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

feat: support for new cheatcode of generating calldata #360

Merged
merged 51 commits into from
Sep 13, 2024

Conversation

daejunpark
Copy link
Collaborator

@daejunpark daejunpark commented Sep 2, 2024

done:

  • createCalldata(string contractName)
  • createCalldata(string contractName, bool includeViewFunctions)
  • createCalldata(string filename, string contractName)
  • createCalldata(string filename, string contractName, bool includeViewFunctions)

note:

  • contractName can be either a contract or an interface name.
  • includeViewFunctions defaults to false, if not provided.

future work:

  • createCalldata(address contract)

@daejunpark daejunpark mentioned this pull request Sep 2, 2024
12 tasks
src/halmos/__main__.py Outdated Show resolved Hide resolved
src/halmos/cheatcodes.py Outdated Show resolved Hide resolved
@karmacoma-eth

This comment was marked as outdated.

@daejunpark

This comment was marked as outdated.

@daejunpark daejunpark marked this pull request as ready for review September 7, 2024 06:48
@daejunpark

This comment was marked as outdated.

src/halmos/cheatcodes.py Outdated Show resolved Hide resolved
src/halmos/cheatcodes.py Outdated Show resolved Hide resolved
src/halmos/cheatcodes.py Outdated Show resolved Hide resolved
src/halmos/mapper.py Outdated Show resolved Hide resolved
src/halmos/mapper.py Outdated Show resolved Hide resolved
src/halmos/calldata.py Outdated Show resolved Hide resolved
src/halmos/calldata.py Outdated Show resolved Hide resolved
src/halmos/sevm.py Show resolved Hide resolved
tests/regression/test/HalmosCheatCode.t.sol Outdated Show resolved Hide resolved
tests/regression/test/HalmosCheatCode.t.sol Outdated Show resolved Hide resolved
@daejunpark
Copy link
Collaborator Author

@karmacoma-eth i've addressed all your comments, and implemented some todo items. this should be enough for the scope of this pr. please take another look when you get a chance.

Copy link
Collaborator

@karmacoma-eth karmacoma-eth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great 💪

@daejunpark daejunpark merged commit d1dea3f into main Sep 13, 2024
77 checks passed
@daejunpark daejunpark deleted the feat/create-calldata-cheatcode branch September 13, 2024 22:48
pcaversaccio added a commit to pcaversaccio/snekmate that referenced this pull request Sep 19, 2024
### 🕓 Changelog

[`halmos`](https://github.com/a16z/halmos) has released support for the
following new cheat codes via PRs
[#360](a16z/halmos#360) and (small patch)
[#364](a16z/halmos#364):

```solidity
createCalldata(string contractName);
createCalldata(string contractName, bool includeViewFunctions);
createCalldata(string filename, string contractName);
createCalldata(string filename, string contractName, bool includeViewFunctions);
```

> Please note that `includeViewFunctions` defaults to `false`, if not
provided.

This PR refactors the `halmos`-based tests to capitalise on these new
cheat codes. To verify the correct behaviour of the Vyper compiler for
`view` and `pure` functions, we include read-only functions in the
calldata creation.

---------

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
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.

2 participants