-
Notifications
You must be signed in to change notification settings - Fork 10
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
withdrawals, consolidations: return fee instead of excess requests from read operation #33
Open
fjl
wants to merge
7
commits into
lightclient:main
Choose a base branch
from
fjl:withdrawals-return-fee
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My main question is the cost of the fee return, won’t it be an order of magnitude higher than the potential refund? |
Note I'm just opening this PR to have a basis for discussion. We need to evaluate. |
fjl
force-pushed
the
withdrawals-return-fee
branch
from
October 29, 2024 17:21
f6e1eaa
to
6a0e190
Compare
fjl
changed the title
WIP: withdrawals: return extra fee
withdrawals, consolidations: return fee instead of excess requests from read operation
Oct 29, 2024
This has reached its final form now. |
fjl
added a commit
to fjl/EIPs
that referenced
this pull request
Nov 7, 2024
The get operation is meant to be used by contracts to compute the exact amount of ether required to add a withdrawal request. It does not return the fee directly though, but it returns the count of 'excess requests' instead. The caller has to compute the fee themselves by applying the fee formula. I think this is not great. The fee logic, while reasonably straightforward, is an implementation detail of the contract. Duplicating it into caller contracts could lead to a mismatch in the computed values, and it's not necessary. I propose we change the system contract to return the fee directly. This contract change has also been submitted in this PR: lightclient/sys-asm#33 The Rationale section of the EIP also had some outdated text about returning fee overage to the caller. The contract does not return overage, so I am removing that section here, and adding recommendations & example code for calling the contract.
fjl
added a commit
to fjl/EIPs
that referenced
this pull request
Nov 7, 2024
The get operation is meant to be used by contracts to compute the exact amount of ether required to add a withdrawal request. It does not return the fee directly though, but it returns the count of 'excess requests' instead. The caller has to compute the fee themselves by applying the fee formula. I think this is not great. The fee logic, while reasonably straightforward, is an implementation detail of the contract. Duplicating it into caller contracts could lead to a mismatch in the computed values, and it's not necessary. I propose we change the system contract to return the fee directly. This contract change has also been submitted in this PR: lightclient/sys-asm#33 The Rationale section of the EIP also had some outdated text about returning fee overage to the caller. The contract does not return overage, so I am removing that section here, and adding recommendations & example code for calling the contract.
fjl
added a commit
to fjl/EIPs
that referenced
this pull request
Nov 7, 2024
The get operation is meant to be used by contracts to compute the exact amount of ether required to add a request. It does not return the fee directly though, but it returns the count of 'excess requests' instead. The caller has to compute the fee themselves by applying the fee formula. I think this is not great. The fee logic, while reasonably straightforward, is an implementation detail of the contract. Duplicating it into caller contracts could lead to a mismatch in the computed values, and it's not necessary. I propose we change the system contract to return the fee directly. This contract change has also been submitted in this PR: lightclient/sys-asm#33 The Rationale section of the EIP also had some outdated text about returning fee overage to the caller. The contract does not return overage, so I am removing that section here, and adding recommendations & example code for calling the contract.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm proposing we change the contract to return the required fee instead of returning the excess requests count.
The contract now computes the fee first, and then goes on to check for calldata.
The reason is simple: the read operation is a part of the contract so that people can compute the exact required
fee that must be passed. The fee computation is not straightforward, using 'fake exponential' and some constants. Any wrapper contract would have to recompute the fee from the excess value in the same way as the system contract does. Returning the fee value directly makes the formula an implementation detail, and simplifies the wrapper:
Note this partially undoes the changes in #30 where I moved the read operation below write. After staring at it for a while, it seems better to have the read path first, especially since it is now so small.