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 new precompile PrecompileRegistry #2138
Conversation
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.
Looks good, I think... I am unclear about a couple things:
- Anyone can insert the dummy code as long as the precompile is active? I thought we sometimes used this
bugfeature to control whether a contract could call a precompile, allowing cases where only an EOA can call. - There is no removing the dummy code, but a precompile could be modified (via runtime upgrade) to become inactive, which would cause it to always revert when called -- right?
This only prevents code written in Solidity that uses interfaces, which automatically appends codesize checks.
Precompile should be replaced with |
* add IsActivePrecompile trait in utils * PrecompileRegistry precompile * toml-sort * record 1 db read cost * add registry to moonbase * typo * update precompiles tests in basebase * separate RevertPrecompile and RemovedPrecompileAt
What does it do?
Implements this proposal: https://forum.moonbeam.foundation/t/proposal-status-idea-precompile-to-check-active-precompiles/384
It also allows for any user to set the "dummy code" of precompiles to make them callable from Solidity (which adds an empty code check). This is currently done through democracy with set_storage, which is far from ideal.
For audit
Ensure that it is not possible to change the code of non-precompile addresses.