|
| 1 | +\begin{center} |
| 2 | + \boxed{% |
| 3 | + \text{The constraints presented below assume that } |
| 4 | + \left\{ \begin{array}{lcl} |
| 5 | + \peekScenario _{i} & = & 1 \\ |
| 6 | + \left[ \begin{array}{cr} |
| 7 | + + & \scenEcrecover _{i} \\ |
| 8 | + + & \scenPVerify _{i} \\ |
| 9 | + \end{array} \right] |
| 10 | + & = & 1 \\ |
| 11 | + \scenPrcSuccess _{i} & = & 1 \\ |
| 12 | + \end{array} \right. |
| 13 | + } |
| 14 | +\end{center} |
| 15 | +We are thus assuming that the present row is |
| 16 | +the first of the second phase of dealing with |
| 17 | +either the \instEcrecover{} precompile or |
| 18 | +either the \instPVerify{} precompile. |
| 19 | +We are also assuming that $\scenPrcSuccess \equiv 1$. |
| 20 | +We remind the reader that, for both \instEcrecover{} and \instPVerify{}, |
| 21 | +\textbf{success} only means that the precompile call was provided with sufficient gas. |
| 22 | +It does \textbf{not} mean, |
| 23 | +in the \instEcrecover{} case, that an address was effectively recovered, nor |
| 24 | +in the \instPVerify{} case, that signature verification was successful. |
| 25 | +\begin{description} |
| 26 | + \item[\underline{\underline{Miscellaneous-row $n^°(i + \prcStandardSuccessSecondMiscRowOffset)$: full transfer of return data:}}] --- |
| 27 | + \begin{description} |
| 28 | + \item[\underline{Defining \locTriggerMmuFullTransfer{}:}] |
| 29 | + we define |
| 30 | + \[ |
| 31 | + \locTriggerMmuFullTransfer |
| 32 | + \define |
| 33 | + \left[ \begin{array}{crcl} |
| 34 | + + & \locAddressRecoverySuccess & \cdot & \scenEcrecover _{i} \\ |
| 35 | + + & \locSignatureVerificationSuccess & \cdot & \scenPVerify _{i} \\ |
| 36 | + \end{array} \right] |
| 37 | + \] |
| 38 | + \saNote{} |
| 39 | + \locTriggerMmuFullTransfer{} is provably binary, |
| 40 | + see note~(\ref{hub: instruction handling: call: precompiles: common: generalities: ecrecover recovery success failure flags are provably binary}). |
| 41 | + \item[\underline{Setting lookup flags:}] |
| 42 | + we impose |
| 43 | + \[ |
| 44 | + \weightedMiscFlagSum { |
| 45 | + anchorRow = i , |
| 46 | + relOffset = \prcStandardSuccessSecondMiscRowOffset , |
| 47 | + } |
| 48 | + = |
| 49 | + \miscMmuWeight \cdot \locTriggerMmuFullTransfer |
| 50 | + % OK |
| 51 | + \] |
| 52 | + in other words |
| 53 | + \[ |
| 54 | + \left\{ \begin{array}{lclr} |
| 55 | + \miscExpFlag _{i + \prcStandardSuccessSecondMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 56 | + \miscMmuFlag _{i + \prcStandardSuccessSecondMiscRowOffset} & = & \locTriggerMmuFullTransfer & (\sanityCheck) \\ |
| 57 | + \miscMxpFlag _{i + \prcStandardSuccessSecondMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 58 | + \miscOobFlag _{i + \prcStandardSuccessSecondMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 59 | + \miscStpFlag _{i + \prcStandardSuccessSecondMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 60 | + \end{array} \right. |
| 61 | + \] |
| 62 | + \end{description} |
| 63 | + \saNote{} In other words the ``result transfer'' step of a call to the \instEcrecover{} only required if the call is |
| 64 | + (\emph{a}) is successful (i.e. is given sufficient gas) and |
| 65 | + (\emph{b}) is successful in recovering an address (as measured by $\locAddressRecoverySuccess \equiv 1$.) |
| 66 | + \begin{description} |
| 67 | + \item[\underline{Setting \mmuMod{}-instruction data:}] |
| 68 | + \If $\miscMmuFlag_{i + \prcStandardSuccessSecondMiscRowOffset} = 1$ \Then we impose |
| 69 | + \[ |
| 70 | + \setMmuInstructionParametersExoToRamTransplants { |
| 71 | + anchorRow = i , |
| 72 | + relOffset = \prcStandardSuccessSecondMiscRowOffset , |
| 73 | + sourceId = 1 + \hubStamp_{i} , |
| 74 | + targetId = 1 + \hubStamp_{i} , |
| 75 | + size = \evmWordSize , |
| 76 | + exoSum = \exoWeightEcdata , |
| 77 | + phase = \locMmuPhase , |
| 78 | + } |
| 79 | + \] |
| 80 | + where |
| 81 | + \[ |
| 82 | + \locMmuPhase |
| 83 | + \define |
| 84 | + \left[ \begin{array}{crcl} |
| 85 | + + & \phaseEcrecoverResult & \cdot & \scenEcrecover _{i} \\ |
| 86 | + + & \phasePVerifyResult & \cdot & \scenPVerify _{i} \\ |
| 87 | + \end{array} \right] |
| 88 | + \] |
| 89 | + \saNote{} |
| 90 | + Recall that the return data \textbf{o} |
| 91 | + of a successful call to the \instEcrecover{} precompile |
| 92 | + which successfully recovers an address is an $\evmWordSize$-byte string |
| 93 | + $\textbf{o} \in \mathbb{B}_{\evmWordSize}$ |
| 94 | + composed of 12 (leading) zero bytes |
| 95 | + followed by $\addressSize$ bytes making up |
| 96 | + the recovered \ethereum{} public address. |
| 97 | + |
| 98 | + \saNote{} |
| 99 | + The return data $\textbf{o}$ |
| 100 | + of a successful call to the \instPVerify{} precompile |
| 101 | + which successfully verifies a signature is the $\evmWordSize$-byte string |
| 102 | + $\utt{00}\, \utt{0x\,00}\, \cdots \, \utt{01} \in \mathbb{B}_{\evmWordSize}$. |
| 103 | + \end{description} |
| 104 | + \item[\underline{\underline{Miscellaneous-row $n^°(i + \prcStandardSuccessThirdMiscRowOffset)$: partial copy of return data:}}] --- |
| 105 | + \begin{description} |
| 106 | + \item[\underline{Defining \locTriggerMmuPartialCopy{}:}] |
| 107 | + we define |
| 108 | + \[ |
| 109 | + \locTriggerMmuPartialCopy |
| 110 | + \define |
| 111 | + \left[ \begin{array}{cl} |
| 112 | + \cdot & \locTriggerMmuFullTransfer \\ |
| 113 | + \cdot & \locOobResultNonzeroRac \\ |
| 114 | + \end{array} \right] |
| 115 | + \] |
| 116 | + \saNote{} |
| 117 | + \locTriggerMmuPartialCopy{} is provably binary. |
| 118 | + \item[\underline{Setting lookup flags:}] |
| 119 | + we impose |
| 120 | + \[ |
| 121 | + \weightedMiscFlagSum { |
| 122 | + anchorRow = i , |
| 123 | + relOffset = \prcStandardSuccessThirdMiscRowOffset , |
| 124 | + } |
| 125 | + = |
| 126 | + \miscMmuWeight |
| 127 | + \cdot |
| 128 | + \locTriggerMmuPartialCopy |
| 129 | + % OK |
| 130 | + \] |
| 131 | + in other words |
| 132 | + \[ |
| 133 | + \left\{ \begin{array}{lclc} |
| 134 | + \miscExpFlag _{i + \prcStandardSuccessThirdMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 135 | + \miscMmuFlag _{i + \prcStandardSuccessThirdMiscRowOffset} & = & \locTriggerMmuPartialCopy & (\sanityCheck) \\ |
| 136 | + \miscMxpFlag _{i + \prcStandardSuccessThirdMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 137 | + \miscOobFlag _{i + \prcStandardSuccessThirdMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 138 | + \miscStpFlag _{i + \prcStandardSuccessThirdMiscRowOffset} & = & \gZero & (\sanityCheck) \\ |
| 139 | + \end{array} \right. |
| 140 | + \] |
| 141 | + \end{description} |
| 142 | + \saNote{} |
| 143 | + In other words the ``(partial) copy of return data to the caller's \textsc{ram}'' |
| 144 | + step of a call to either the \instEcrecover{} or the \instPVerify{} precompile |
| 145 | + is only required if the call is |
| 146 | + (\emph{a}) is successful (i.e. is given sufficient gas) and |
| 147 | + (\emph{b}) is successful in recovering an address or verifiying a signature |
| 148 | + (\emph{c}) and the underlying call has a nonzero \RAC{}. |
| 149 | + \begin{description} |
| 150 | + \item[\underline{\mmuMod{} data:}] |
| 151 | + \If $\miscMmuFlag_{i + \prcStandardSuccessThirdMiscRowOffset} = 1$ \Then we impose |
| 152 | + \[ |
| 153 | + \setMmuInstructionParametersRamToRamSansPadding { |
| 154 | + anchorRow = i , |
| 155 | + relOffset = \prcStandardSuccessThirdMiscRowOffset , |
| 156 | + sourceId = 1 + \hubStamp _{i} , |
| 157 | + targetId = \cn _{i} , |
| 158 | + sourceOffsetLo = 0 , |
| 159 | + size = \evmWordSize , |
| 160 | + referenceOffset = \locPrcRao , |
| 161 | + referenceSize = \locPrcRac , |
| 162 | + } |
| 163 | + \] |
| 164 | + \end{description} |
| 165 | + \item[\underline{Context-row $n^°(i + \prcStandardSuccessCallerContextRowRowOffset)$:}] |
| 166 | + we impose |
| 167 | + \[ |
| 168 | + \provideReturnData { |
| 169 | + anchorRow = i , |
| 170 | + relOffset = \prcStandardSuccessCallerContextRowRowOffset , |
| 171 | + returnDataReceiver = \cn _{i} , |
| 172 | + returnDataProvider = 1 + \hubStamp _{i} , |
| 173 | + returnDataOffset = 0 , |
| 174 | + returnDataSize = \evmWordSize \cdot \locTriggerMmuFullTransfer , |
| 175 | + } |
| 176 | + \] |
| 177 | +\end{description} |
0 commit comments