-
Notifications
You must be signed in to change notification settings - Fork 515
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
EIP 101: big-int precompile #258
Conversation
because A implies B.
\begin{eqnarray} | ||
\Xi_{\mathtt{ID}} &\equiv& \Xi_{\mathtt{PRE}} \quad \text{where:} \\ | ||
g_r &=& 15 + 3\Big\lceil \dfrac{|I_\mathbf{d}|}{32} \Big\rceil\\ | ||
\mathbf{o} &=& I_\mathbf{d} | ||
\end{eqnarray} | ||
|
||
The fifth contract performs arbitrary-precision addition on non-negative integers. | ||
The first word in the input specifies the number of bytes that the first non-negative integer $X$ occupies. | ||
The result is represented in the smallest possible number of bytes. The first byte in the output is never zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...the first byte in the output, if it exists...
\Xi_{\mathtt{ADD}} &\equiv& \Xi_{\mathtt{PRE}} \quad \text{except:}\\ | ||
\Xi_{\mathtt{ADD}}(\boldsymbol{\sigma}, g, I) &\equiv& (\varnothing, 0, A^0, ()) \quad \text{if} \quad |I_\mathbf{d}| - 32 < I_\mathbf{d}[0..31] \\ | ||
g_r &=& G_{addsubbase} + G_{arithword} \Big\lceil \dfrac{|I_\mathbf{d}|}{32} \Big\rceil \\ | ||
\mathbf{o} &=& (X + Y) \in \mathbb{B}_\ell \\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use BE
or something similar to define integer -> bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- the symbol
\ell
is already taken - the number of bits should be
8 \ell
not\ell
.
|
||
\begin{eqnarray} | ||
\Xi_{\mathtt{ADD}} &\equiv& \Xi_{\mathtt{PRE}} \quad \text{except:}\\ | ||
\Xi_{\mathtt{ADD}}(\boldsymbol{\sigma}, g, I) &\equiv& (\varnothing, 0, A^0, ()) \quad \text{if} \quad |I_\mathbf{d}| - 32 < I_\mathbf{d}[0..31] \\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formalise conversion bytes -> integer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Maybe
I_\mathbf{d}[0..31]
can be assigned to a variable. - Or the common parsing logic should be factored out.
\end{cases} | ||
\end{eqnarray} | ||
|
||
The ninth contract performs arbitrary-precision exponentiation under modulo. Here, $0 ^ 0$ is taken to be one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mention how the arguments are encoded here.
To be reopend on |
|
||
\begin{eqnarray} | ||
\Xi_{\mathtt{SUB}} &\equiv& \Xi_{\mathtt{PRE}} \quad \text{except:}\\ | ||
\Xi_{\mathtt{SUB}}(\boldsymbol{\sigma}, g, I) &\equiv& (\varnothing, 0, A^0, ()) \quad \text{if} \quad |I_\mathbf{d}| - 32 < I_\mathbf{d}[0..31] \\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... if ...; ... if ...
should go intobegin{cases} \end{cases}
If merged, this would solve #235 as part of the Metropolis changes.
Merging this requires the community's consensus on ethereum/EIPs#101