-
Notifications
You must be signed in to change notification settings - Fork 265
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
feat: Access chainid, block number, timestamp and version from noir #832
Comments
I wonder if this use case is common enough to warrant global variables:
There would need to be a standardisation effort around a user-deployed TimeStampContract contract. For apps to have strong 'function hiding' guarantees, most / all apps would need to call a single TimeStampContract instance, and it's unclear to me whether that would happen. Baking these globals into the protocol would ensure a larger 'anonymity set' for apps which want to use this functionality. |
I think it is unclear what these variables would mean. What is I would say no to having them as global variables, but yes to create a small library that people could use for some of the time functions. Essentially it will be different reads of historic data, so seems fine to put in app level. @iAmMichaelConnor, can you try giving some descriptions of what |
These might allow private contracts to make time-based assertions. |
If you are doing it in private, then I don't see how this would be enforceable, you mean private with a public call? Also, what stops the sequencer from including the tx and getting the fee with it reverting anyway? |
I mean private with an assertion at the protocol level (in the kernel or rollup circuit, or on L1; basically wherever the
I guess the failing check would need to revert the whole rollup (and so the tx shouldn't be included by a sequencer unless they're confident that the timestamp check will succeed). |
Think you could handle that in the base rollup. The rollup constants will have the current timestamp, and base can assert that One would need to account for the time constraints applied in #830, as there is some "slack". It is quite different from most blockchains to have such a thing at the protocol level. Not sure if I like it or not. |
I thought I'd sent this last week, but just found it (unsent) as I was closing tabs: I mean private with an assertion at the protocol level (in the kernel or rollup circuit, or on L1; basically the same place as wherever the
I guess the failing check would need to revert the whole rollup (and so the tx shouldn't be included by a sequencer unless they're confident that the timestamp check will succeed). |
Both public and private functions should be able to read:
version
chainid
From their context.
Only the public functions should be able to read:
timestamp
blocknumber
Timestamp and block number might bring more trouble than good if accessible from the private domain as users will expect them to be "current", which is an unknown at the time of proof generation by the user, and only available by the sequencer when executing public functions.
Note:
For the cases where blocknumber or timestamp is used as a deadline, it is possible to build a generic
TimeStampContract
that has public function constraining these values which a private function could call to enforce a deadline. It will leak the deadline, but making it enforceable.Meaning that you have
A calling B::afterDeadline(deadline)
whereafterDeadline
is a public function that will make the entire tx revert ifblock.timestamp < deadline
.The text was updated successfully, but these errors were encountered: