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

Add mtimebase CSR to "decouple" mtime and mcycle #104

Open
diegonehab opened this issue Jul 14, 2023 · 2 comments
Open

Add mtimebase CSR to "decouple" mtime and mcycle #104

diegonehab opened this issue Jul 14, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@diegonehab
Copy link
Contributor

Context

When we move to lambda, when we move from one input to the next, we will restore the machine back to the template (and carry over the dapp state only). This includes restoring the value of mcycle, on which the value of mtime = rtc_cycle_to_time(mcycle) is based. This means that, from the point of view of the system running inside the machine, no time was elapsed at all. Every input starts processing at the same time. It is a bit odd.

Moreover, to simplify disputes, it might be good to have mcycle zeroed out before each input is processed. At the moment, if we do that, we will move time backwards. This is problematic for a running system.

Possible solutions

The idea is to add a new CSR, called mtimebase. Then, we set mtime = mtimebase + rtc_cycle_to_time(mcycle).
When we want to reset mcycle, all we have to do is first set mtimebase = mtimebase + rtc_cycle_to_time(mcycle), and then set mcycle = 0. Time will not move backwards anymore.

@diegonehab
Copy link
Contributor Author

@GCdePaula

@diegonehab
Copy link
Contributor Author

diegonehab commented Apr 18, 2024

I think we need to reevaluate our notion of cycle counter because of lambda and because of current discussions of the machine stack and alternatives to the machine stack. @miltonjonat

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
Status: Todo
Development

No branches or pull requests

1 participant