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

Validate wasm at storage inclusion #1883

Closed
grarco opened this issue Sep 8, 2023 · 0 comments · Fixed by #1902
Closed

Validate wasm at storage inclusion #1883

grarco opened this issue Sep 8, 2023 · 0 comments · Fixed by #1902
Assignees
Labels

Comments

@grarco
Copy link
Contributor

grarco commented Sep 8, 2023

In #1327 we reworked the wasm validation at compile time to only validate the Code commitments instead of the Hash ones. This is because we need to validate the code that we receive from a transaction (even if the whitelist is in place the tx would be rejected by the VPs, so after it ran), but there's no need to validate the code that we retrieve from storage since that code should be validated when the code is written to storage in the first place (or on subsequent modifications).

This check though, is not done at the moment: we should include a call to validate_untrusted_wasm when initializing the storage (maybe in the pre_compile function?).

Wasm codes can also be added (or updated) through a governance proposal. In this case we could address this thing in two ways:

  • Protect the storage subspace of the wasm codes with a native vp running validation every time a write operation is performed
  • Provide a cli command to validate the wasm code

The second option seems to be more lightweight and easy to implement. Moreover, governance participants should check the content of a newly proposed wasm code anyway (to check what it does in practice and to validate the proposed whitelisted gas cost).

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

Successfully merging a pull request may close this issue.

1 participant