From 21dff8ab8c159c76016cbbaac0ae1ee1358646fa Mon Sep 17 00:00:00 2001 From: Sam Wilson <57262657+SamWilsn@users.noreply.github.com> Date: Wed, 3 Mar 2021 17:47:07 -0500 Subject: [PATCH] Automatically merged updates to draft EIP(s) 3074 (#3317) Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft, Review, or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing --- EIPS/eip-3074.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-3074.md b/EIPS/eip-3074.md index 7dfaf48eb7555b..d2459fa20d317a 100644 --- a/EIPS/eip-3074.md +++ b/EIPS/eip-3074.md @@ -29,7 +29,7 @@ While it is possible to emulate sponsored transactions (ex. [Gas Station Network An opcode, at `0xf9`, functions like a `CALL` instruction that additionally: - - sets the caller and origin addresses based on an ECDSA signature, and + - sets the caller addresses based on an ECDSA signature, and - optionally transfers Ether from the recovered account. ### Definitions @@ -129,7 +129,13 @@ Where `len(data)` is the length of the region of memory defined by `argsOffset` ### Two Return Values -It is important to differentiate between a failure in `TXCALL`'s preconditions versus a failure in the callee. Correctly implementing replay protection requires the invoker to change its state even if the callee fails (to burn the nonce) but doing so if, for example, the signature failed would be nonsensical. +It is important to differentiate between a failure in `TXCALL`'s preconditions versus a failure in the callee. Correctly implementing replay protection requires the invoker to change its state even if the callee fails (to burn the nonce) but doing so if, for example, the signature failed would be nonsensical. Several options exist for encoding these two failure cases: returning two stack elements, reserving a specific revert reason, or choosing different values in a single stack element. + +First, it's important to note that all three options are a deviation from the semantics of other `CALL` opcodes, but this deviation is unavoidable. + +Reserving a specific revert reason, for example `txcall failed`, is a large departure from other instructions. An invoker would need to inspect the revert reason to determine whether the callee reverted, or the `TXCALL` pre-conditions were invalidated, which implies reading and comparing memory values. Further, to remain sound when a callee reverts with `txcall failed`, `TXCALL` would need to replace the return data with some other value. + +Returning a single stack element with different values depending on the situation (ex. `0` on success, `1` when the pre-conditions are violated, and `2` when the callee reverts) introduces the opportunity for a subtle bug: it's trivially easy to misinterpret the return value (`CALL` returns non-zero on success), but it's much harder to ignore a whole new stack value. ### Sponsee in Arguments