Skip to content

Conversation

@pdobacz
Copy link
Contributor

@pdobacz pdobacz commented Mar 5, 2024

@pdobacz pdobacz requested a review from eth-bot as a code owner March 5, 2024 13:38
@github-actions github-actions bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Mar 5, 2024
@eth-bot
Copy link
Collaborator

eth-bot commented Mar 5, 2024

✅ All reviewers have approved.

@eth-bot eth-bot added the a-review Waiting on author to review label Mar 5, 2024
EIPS/eip-7069.md Outdated
7. Calculate the gas available to callee as caller's remaining gas reduced by `max(floor(gas/64), MIN_RETAINED_GAS)`.
8. Fail with error if the gas available to callee at this point is less than `MIN_CALLEE_GAS`.
9. If `value` is non-zero, fail lightly if the balance of the current account is less than `value`.
10. Fail lightly if call stack depth equals `1024`.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "fail Lightly" mean? dose "Fail with error" mean revert and take all available gas and "fail lightly" mean fail consuming only already charged gas?

Copy link
Contributor Author

@pdobacz pdobacz Mar 5, 2024

Choose a reason for hiding this comment

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

yes (except "Fail with error" is not a revert but an exceptional abort, I presume this was the original intention), I'll specify these.

But you've uncovered an interesting issue - what should be pushed to stack in this case (i.e. light failure)? For a light failure in EOFCREATE/TXCREATE we return 0 (with a different meaning), same for CREATE/CREATE2, but for revamped calls that would mean success.

I also see that evmone would return 0, so making a self note to amend this (I'm working on that now in parallel).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Errata: there's many ways to name the "hard failure", this EIP has "halt with exceptional failure", I think consuming all gas is understood (EOF megaspec and other EIPs don't repeat this), so I'll leave it out.

For light failure I'll be specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Proposing a resolution (3 on stack for light failure) 54f6dcd to push the discussion forward. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

477e269 adheres to what we spoke about on the EOF implementers call - 1 as status code for light failure

EIPS/eip-7069.md Outdated
7. Calculate the gas available to callee as caller's remaining gas reduced by `max(floor(gas/64), MIN_RETAINED_GAS)`.
8. Halt with exceptional failure if the gas available to callee at this point is less than `MIN_CALLEE_GAS`.
9. If `value` is non-zero, fail lightly if the balance of the current account is less than `value` (push `3` on the stack, only consume gas charged until this point).
10. Fail lightly if call stack depth equals `1024` (push `3` on the stack, only consume gas charged until this point).
Copy link
Member

Choose a reason for hiding this comment

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

Call depth check is actually superseded by 63/64 rule, see Rationale.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought you questioned the correctness of that initial removal of call depth check.

Isn't it a compatibility problem, that call-stack-depth-checking calls can alternate with non-checking ones in the call stack?

Why wasn't the call depth check removed already in legacy calls, if superseded by the 63/64 rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for future reference - decided on the EOF Implementers call to keep it

  1. least change to legacy
  2. being cautious about the air-tightness of the (complex) gas-based 63/64 rule, and providing a simpler hard cap
  3. being open to gas limits which are huge for various use cases beyond mainnet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(also I've updated the Rationale section to cover this)

@pdobacz pdobacz requested a review from shemnon March 11, 2024 16:44
@pdobacz pdobacz marked this pull request as draft March 13, 2024 16:30
@pdobacz pdobacz requested review from axic and gumb0 March 14, 2024 12:52
EIPS/eip-7069.md Outdated
11c. `2` if the call has failed.
11. Gas not used by the callee is returned to the caller.
7. Calculate the gas available to callee as caller's remaining gas reduced by `max(floor(gas/64), MIN_RETAINED_GAS)`.
8. Halt with exceptional failure if the gas available to callee at this point is less than `MIN_CALLEE_GAS`.
Copy link
Member

Choose a reason for hiding this comment

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

Why is this exceptional failure? Seems could be light failure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The PR only changes the language on this one. And I see it as a sensible failure mode - consistent with an OOG. But light failure also makes sense on 2nd thought. @chfast @axic @shemnon any more opinions on this, any objections to changing to light failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed as suggested here: 743a3fb

3a. Fail with error if the current frame is in `static-mode`.
3b. Fail with error if the balance of the current account is less than `value`.
3c. Charge `CALL_VALUE_COST` gas.
2. Pop required arguments from stack, halt with exceptional failure on stack underflow.
Copy link
Member

Choose a reason for hiding this comment

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

It seems at this point EIP tries to maintain compatibility with both legacy and EOF, so maybe

Suggested change
2. Pop required arguments from stack, halt with exceptional failure on stack underflow.
2. Pop required arguments from stack, halt with exceptional failure on stack underflow.
- *Note: When implemented in EOF, stack underflow check is done during stack validation, and runtime check is omitted.*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is for this EIP to be fully legacy-complete and EOF-independent. EOF (Megaspec) lists the differences required it to be EOF-complete (which is lack of runtime stack underflow check and banning new opcodes in legacy).

Is there any other piece which is EOF-only in this EIP?

(this is just a question to your comment, I have no objections towards adding this note for completeness, and I'll add it)

@pdobacz pdobacz requested a review from gumb0 March 21, 2024 13:15
@pdobacz pdobacz marked this pull request as ready for review March 21, 2024 16:31
@eth-bot eth-bot enabled auto-merge (squash) March 22, 2024 07:56
Copy link
Collaborator

@eth-bot eth-bot left a comment

Choose a reason for hiding this comment

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

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit 30a52d0 into ethereum:master Mar 22, 2024
@pdobacz pdobacz deleted the update-eip-7069 branch March 22, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a-review Waiting on author to review c-update Modifies an existing proposal s-draft This EIP is a Draft t-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants