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

EIP 101: big-int precompile #258

Closed
wants to merge 7 commits into from
Closed

Conversation

pirapira
Copy link
Member

@pirapira pirapira commented Mar 3, 2017

If merged, this would solve #235 as part of the Metropolis changes.

Merging this requires the community's consensus on ethereum/EIPs#101

@pirapira pirapira mentioned this pull request Mar 9, 2017
12 tasks
\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.
Copy link
Contributor

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 \\
Copy link
Contributor

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.

Copy link
Member Author

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] \\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formalise conversion bytes -> integer

Copy link
Member Author

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.
Copy link
Contributor

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.

@pirapira
Copy link
Member Author

To be reopend on metropolis branch.

@pirapira pirapira closed this Mar 14, 2017

\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] \\
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ... if ...; ... if ... should go into begin{cases} \end{cases}

pirapira added a commit to pirapira/yellowpaper that referenced this pull request Mar 22, 2017
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Mar 22, 2017
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Jan 17, 2018
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants