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

halmos should not generate private keys that correspond to deployed contract addresses #413

Open
Tracked by #346
karmacoma-eth opened this issue Nov 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@karmacoma-eth
Copy link
Collaborator

karmacoma-eth commented Nov 14, 2024

re: igorganich/damn-vulnerable-defi-halmos#3

imagine a contract deployed at address x, halmos can come up with a counterexample with a message signed by private key y, such that vm.addr(y) = x

basically we need to add a constraint saying that there is no private key that matches a deployed contract address

Taking note of a good stopgap measure proposed by @daejunpark:

we currently assume hash images are non-zero, but i was thinking to also assume they are large enough, say, greater than 2**64. indeed, we already assume they are small enough, less than 2**256 - 2**64. would this help? i mean, our create/create2-deployed addresses are 0xaaaaNNNN or 0xbbbbNNNN, which are smaller than 2**64

pros: super simple and efficient because we only add O(1) constraints
cons: would not work for etched contracts at hardcoded addresses

👍 probably a good tradeoff for now

@karmacoma-eth karmacoma-eth added the enhancement New feature or request label Nov 14, 2024
@karmacoma-eth karmacoma-eth mentioned this issue Nov 14, 2024
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant