-
Notifications
You must be signed in to change notification settings - Fork 973
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
Introduce reasonable boundaries on field values #192
Comments
I'd say "acceptable" is subjective in the sense that in theory different clients can have different acceptable bounds. Do you want your implementation to be relevant for 10 years, 100 years, 1000 years? Some quick calculations:
In terms of underflows, the main one to look out for is when when substracting from a balance, i.e. applying a penalty. The spec has the following:
|
Thanks Jacek for all your bug reports :) Do you still have concerns regarding reasonable upper bounds on field values? In short, the spec uses Regarding overflows, there's a issue dedicated to that here. |
Specifying the |
A motivating rationale for this exercise is to allow the establishment of a formal specification, and later to prove properties about the system that will help client implementers make good choices and produce clients that are more safe against certain categories of exploits:
From a practical point of view, establishing or describing bounds means that clients can forgo certain checks and focus on others - for example, if the spec is proven to be undeflow-free as a design property, there is no need to explicitly check for underflows at various stages. For the network as a whole, it's also nice to be able to say that all clients support at least X years of slot time as a requirement - though there are good arguments to keep this an implementation-defined detail as well. |
There's a relevant discussion here.
I think that's the status quo. One idea is to document reasonable bounds in the validator doc or an implementer doc. Feel free to reopen :) |
As soon as we already have 'dedicated'
I would stick to the same |
We've actually settled to use |
Sounds reasonable |
Validator indices are now |
With the new spec defaulting to
uint64
for serialization, it would be useful to introduce the notion of minimally supported values or bounds on acceptable values, so as to separate serialization from execution.As an example,
uint24
is used because occasionally by design it is safe to do so, based on maximum possible validator counts.Other values might not be bounded the same way, but it remains essential that they get treated the same way by clients - for example, what is an upper bound on the slot number that we realistically want to support?
Introducing this in the spec will help ensure that implementations are conforming both in theory and in practice:
uint64
support, and in many languages, indexing is done with a smaller or signed type - the mechanical alignment between spec and reality suffers encouraging compromisesuint256
being specified but there being no practical uses for such a wide range - addressing this early on in the design would be beneficialThe text was updated successfully, but these errors were encountered: