Skip to content

Commit

Permalink
Only CALL may actually transfer value (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierBBB authored Nov 28, 2024
1 parent 5856c85 commit 8cbeaae
Showing 1 changed file with 41 additions and 2 deletions.
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}
\]
\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}
\]
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}
\]
\end{enumerate}
\item[\underline{Setting the \calleee{} warmth update on account-row $n^°(i + \callFirstCalleeAccountRowOffset)$:}]
we impose that
Expand Down

0 comments on commit 8cbeaae

Please sign in to comment.