-
Notifications
You must be signed in to change notification settings - Fork 62
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
fix: concretize calldatacopy #364
Conversation
Co-authored-by: karmacoma <karma@coma.lol>
|
||
data = self.data | ||
# TODO: call substitute() only when the data contains variables to be substituted | ||
new_data = substitute(data, *substitution.items()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am slightly worried about the perf impact of substitute
always constructing a new object, but I guess we'll see how it looks like when I profile (not a blocker)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, proper profiling would be greatly helpful. based on my performance tests, it gets slower if data is a complex term, e.g., LibUint1024Test:testProveSubAdd().
i'm thinking applying this substitution to selected int_of()
only, rather than blindly applying to all calldatacopy. would be a separate pr though.
Co-authored-by: karmacoma <karma@coma.lol>
### 🕓 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>
there are two instructions that read calldata, and their concretization logic works as follows:
this behavior is based on typical calldata decoding logic, where the length of dynamic arguments is first read using calldataload, and their data is then read using either calldataload or calldatacopy. for example, see the test provided in #371.