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

Disable all host functions which are not needed for launch #6720

Closed
athei opened this issue Dec 1, 2024 · 5 comments · Fixed by #6844
Closed

Disable all host functions which are not needed for launch #6720

athei opened this issue Dec 1, 2024 · 5 comments · Fixed by #6844
Assignees

Comments

@athei
Copy link
Member

athei commented Dec 1, 2024

We should reduce the attack surface as much as possible. This means any host function which is not available in revive at launch should be disabled. Later, we can re-enable them (if part of Solidity) or convert to a pre-compile.

@athei athei converted this from a draft issue Dec 1, 2024
@athei athei changed the title Remove all host functions which are not needed for launch Disable all host functions which are not needed for launch Dec 4, 2024
@davidk-pt
Copy link
Contributor

Can I take this?

@athei
Copy link
Member Author

athei commented Dec 11, 2024

Yes sure. You have to basically go through the recompiler and find out which functions are not used by it. You then just remove the #[version(0]] attribute to deactivate them. Please note that after #6759 the attribute name changes to #[stable].

@xermicus in which source file to find the list of used host functions?

@xermicus
Copy link
Member

xermicus commented Dec 11, 2024

https://github.com/paritytech/revive/blob/main/crates/runtime-api/src/polkavm_imports.c#L65

@athei
Copy link
Member Author

athei commented Dec 11, 2024

@davidk-pt Feel free to self assign the issue when you are about to start with it. Thanks :)

@davidk-pt
Copy link
Contributor

Let me know if I understood this correctly #6844 , I basically diffed two lists, from the C file and what is available in substrate/frame/contracts/src/wasm/runtime.rs file

github-merge-queue bot pushed a commit that referenced this issue Dec 12, 2024
Resolves #6720

List of used host functions in PolkaVM recompiler is here
https://github.com/paritytech/revive/blob/main/crates/runtime-api/src/polkavm_imports.c#L65

---------

Co-authored-by: DavidK <davidk@parity.io>
dudo50 pushed a commit to paraspell-research/polkadot-sdk that referenced this issue Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Minimal Feature Launch
Development

Successfully merging a pull request may close this issue.

3 participants