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

Only CALL may actually transfer value #9

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,29 @@
{i}{\callFirstCallerAccountRowOffset}
\]
\item \If $\scenCallBalanceUpdateRequired _{i} = 1$ \Then
\begin{enumerate}
\item \If $\locIsCall = 1$ \Then
\[
\accDecrementBalance
{i}{\callFirstCallerAccountRowOffset}{\locValueLo}
\]
\item \If $\locIsCallcode + \locIsDelegatecall + \locIsStaticcall = 1$ \Then
\[
\accSameBalance
{i}{\callFirstCallerAccountRowOffset}
\]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I.e. every CALL-type instruction besides CALL.

\end{enumerate}
\saNote{} \label{hub: instruction handling: call: generalities: first account rows: value transfer subtleties}
The above may alternatively be implemented without case disjunction as
\[
\accDecrementBalance
{i}{\callFirstCallerAccountRowOffset}{\locValueLo}
{i}{\callFirstCallerAccountRowOffset}{\locIsCall \cdot \locValueLo}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is actually implemented, see commit Consensys/linea-constraints@2087e3f

\]
Either way the above reflects that fact that only \inst{CALL} may \emph{actually} transfer value.
The \inst{CALL}-type instruction \inst{CALLCODE} also has a ``\locValue'' argument but it doesn't set off a value transfer.
This ``\locValue'' becomes the ``call value'' of the child context.
It is noteworthy that while no \emph{actual} value transfer takes place,
\inst{CALLCODE} may nonetheless incur a value transfer cost.
\end{enumerate}
\item[\underline{First \calleee{} account-row $n^°(i + \callFirstCalleeAccountRowOffset)$:}]
we impose that
Expand Down Expand Up @@ -87,7 +106,27 @@
we impose that
\begin{enumerate}
\item \If $\scenCallBalanceUpdateNotRequired _{i} = 1$ \Then $\accSameBalance {i}{\callFirstCalleeAccountRowOffset}$
\item \If $\scenCallBalanceUpdateRequired _{i} = 1$ \Then $\accIncrementBalance {i}{\callFirstCalleeAccountRowOffset}{\locValueLo}$
\item \If $\scenCallBalanceUpdateRequired _{i} = 1$ \Then
\begin{enumerate}
\item \If $\locIsCall = 1$ \Then
\[
\accIncrementBalance
{i}{\callFirstCalleeAccountRowOffset}{\locValueLo}
\]
\item \If $\locIsCallcode + \locIsDelegatecall + \locIsStaticcall = 1$ \Then
\[
\accSameBalance
{i}{\callFirstCalleeAccountRowOffset}
\]
\end{enumerate}
\saNote{}
Echoing
note~(\ref{hub: instruction handling: call: generalities: first account rows: value transfer subtleties}),
the above may alternatively be implemented without case disjunction as
\[
\accIncrementBalance
{i}{\callFirstCalleeAccountRowOffset}{\locIsCall \cdot \locValueLo}
\]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is actually implemented, see commit Consensys/linea-constraints@2087e3f

\end{enumerate}
\item[\underline{Setting the \calleee{} warmth update on account-row $n^°(i + \callFirstCalleeAccountRowOffset)$:}]
we impose that
Expand Down