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

Add allowCalls cheatcode #926

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open

Add allowCalls cheatcode #926

wants to merge 40 commits into from

Conversation

palinatolmach
Copy link
Collaborator

@palinatolmach palinatolmach commented Jan 8, 2025

Blocked on: runtimeverification/kontrol-cheatcodes#19.
Closes #923.

This PR introduces a new cheatcode allowCalls(address, bytes calldata) that allows whitelisting calls to a specific address with specific calldata. The PR:

  • changes the <addressList> cell to <allowedCallsList> in <whitelist>
  • adds a CallToAddress production to facilitate representing whitelisted { address | calldata } pairs
  • modifies allowCallsToAddress(address) so it adds the following element to the list, * representing any possible calldata: ListItem({ALLOWEDACCOUNT|b"*"})
  • modifies the foundry.catchNonWhitelistedCalls rule so it gets applied before a call if the whitelist has been enable (it did not previously)
  • adds a rule for processing new allowCalls cheatcode
  • adds new tests for allowCalls and enables auxiliary-lemmas in end-to-end tests
  • adjusts existing tests for allowCallsToAddress(address) so they only check whether allowCallsToAddress is working
  • reduces the number of parallel processes in end-to-end tests from 8 to 6, since it frequently fails with OOM (we had to make a similar change in integration tests earlier)

In addition, this PR adds the simplifications required for checking List membership to the auxiliary Kontrol lemmas file. These lemmas are to be upstreamed to the K repo.

TODO: update expected output

@palinatolmach palinatolmach self-assigned this Jan 13, 2025
@palinatolmach palinatolmach marked this pull request as ready for review January 16, 2025 15:01
src/kontrol/kdist/cheatcodes.md Outdated Show resolved Hide resolved
src/kontrol/kdist/cheatcodes.md Outdated Show resolved Hide resolved
@lucasmt
Copy link
Contributor

lucasmt commented Jan 22, 2025

Cheatcode seems to be working on our test. Lisandra is just running some further checks but I think we should be fine to get this merged once we get around the CI issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add allowCalls — a calldata-specific version of allowCallsToAddress
3 participants