-
Notifications
You must be signed in to change notification settings - Fork 9
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
Usability improvements to foundry-merge-node
#23
Comments
For now, the alternative that I'm using to |
I would call it a |
One potential complication that just occurred to me based on the current engagement: the point where we ideally want to merge can be inside the client code, in which case calling a cheatcode is not really possible. |
Oh, right, thanks @lucasmt. @ehildenb said the same thing — his suggestion is to let the user specify PCs in the contract being verified that we can use to generate some dummy rule that can behave as a cut rule (creating and saving relevant nodes into KCFG) and facilitating the merge, and/or add these PC to the @lucasmt do you think it would work? @ehildenb could you please check if I got it right? @nwatson22 please let me know if you have any suggestions or comments on this issue too. |
@palinatolmach Yeah, I think that could work. We would need to update the PC if the code changed, but that would be a relatively minor inconvenience compared with manually editing the KCFG every time to find the node we want. |
Another suggestion from @lisandrasilva is to allows specifying the desired place of merging using natspec comments in the client code — that would not entail any modification of the code itself, but would improve the interface for using the node merging functionality. |
I would also suggest to merge according to some condition, for instance:
At this point, all nodes that satisfy the condition |
With this PR, we can now use the
foundry-merge-nodes
command to merge two nodes in different branches into a single node that subsumes both. This lets us merge branches back after a split, for example after an if statement or a loop, continuing the execution as a single branch, which has the potential of greatly improving the scalability of the tool in code with many loops or if statements.However, this command has a few limitations in terms of usability:
We should think about ways to address these limitations to make this functionality easier to use. For example, suppose there was a cheatcode
kevm.mergePoint()
that denotes the point where we want to merge branches:If we could implement this cheatcode such that the point where it's called is always added as a node to the KCFG, this would take care of (1). Going one step further, if we had an option to automatically merge such nodes if they have the same PC, this would take care of (2) (but this heuristic might not always work, for example if the merge point itself is inside a loop or a function that is called multiple times). But I don't know if something like that could actually be implemented, because it is a cheatcode that would not be handled solely from inside
kevm
, instead needing to somehow communicate withpyk
.I'd like to hear people's thoughts on this and brainstorm possible options.
The text was updated successfully, but these errors were encountered: