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

Static mode #194

Open
lrettig opened this issue Oct 28, 2024 · 2 comments
Open

Static mode #194

lrettig opened this issue Oct 28, 2024 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@lrettig
Copy link
Contributor

lrettig commented Oct 28, 2024

It would be nice to be able to switch on "static mode" for the VM, which basically just ensures that no state writes occur/that there are no side effects from a program execution. For now I think it's sufficient to make sure that in static mode we don't use certain host calls, such as write_storage and spawn. Ideally this could be switched on for a single execute() call, and it should be persistent: when switched on, all subsequent stack frames should be in static mode until we return to the place where it was switched on.

One place this would be useful is when the host calls certain methods, including Verify and MaxSpend, which it currently assumes are static--it would be good to have additional assurances of this from the VM.

It's also likely we'll want to introduce something like EVM's STATICCALL at some point.

@lrettig lrettig added this to the Testnet v2 milestone Oct 28, 2024
@poszu
Copy link
Collaborator

poszu commented Oct 29, 2024

Why not have this mode entirely in the host? I.e. the host would know the state (static/not static) and allow only certain operations depending on the mode.

@lrettig
Copy link
Contributor Author

lrettig commented Oct 29, 2024

I think that's fine. The only catch is that, if we introduce a STATICCALL opcode/host call in future, we'll need a way for the VM to signal to the host that it should enable static mode.

I take this back, the host call itself is the signal. There's nothing to do on the VM side other than implementing the host call.

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

2 participants