-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Update EIP-7002: return fee from getter and add usage example #9024
Conversation
✅ All reviewers have approved. |
06d3775
to
c7a117c
Compare
The number of requests in the queue is very helpful to calculate when a request gets dequeued and processed by the consensus layer.. |
Thanks for bringing this up. My question is, do you really need to access the number of excess entries from within a contract? |
@pk910 I have discussed your concern with @lightclient. While I understand the change removes the ability for contracts to reason about potential inclusion time of the requests in the beacon chain, it's important to understand that such an estimate can never be reliable. The beacon chain processes the requests asynchonously, i.e. requests output by the system contract will be added into another queue in the beacon client, which it will then apply into future beacon blocks. See the beacon spec for the code. Since it is an unreliable estimate at best, I feel it's OK to lose this functionality, and proceed with this PR. |
@fjl can we return both values (excess and fee) from the call to the system contract? |
Yes we could, but I'm arguing here that it's not necessary. |
944e4ac
to
87116bf
Compare
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.
87116bf
to
cf2686d
Compare
This is true for partial withdrawals and consolidations, full withdrawals are instantly processed. I agree that it is very unlikely for smart contracts to need an access to the excess. Also if an app (including block explorers) wants to get that data it can use |
shouldn’t this PR also update the smart contract's code and its deployment info? |
@lightclient already merged my change to the code and updated it in the EIP in #9040. So there is no code change included here. |
There was a problem hiding this 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...
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.
Related change to EIP-7251: #9025