fix: Increase fee limit to compensate for EIP-150 gas attenuation#1139
fix: Increase fee limit to compensate for EIP-150 gas attenuation#1139nvsriram wants to merge 5 commits into
Conversation
|
👋 nvsriram, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
Derivation for buffer
EIP-150 forwards at most Working backwards from Receiver to OffRamp: Therefore the additional gas required is: |
45cdeb7 to
335c17f
Compare
| // eip150ForwardingGasBuffer returns the extra gas needed to compensate for EIP-150 | ||
| // gas attenuation across the OffRamp -> Router -> Receiver call path. | ||
| // It computes ceil(((64^2 - 63^2) / 63^2) * L), where L is the ccipReceive gas limit. | ||
| func eip150ForwardingGasBuffer(ccipReceiveGasLimit uint32) uint64 { |
There was a problem hiding this comment.
Could we add a simple unit tests that asserts something like this?
ccipReceiveGasLimit := 200_000
withBuffer := eip150ForwardingGasBuffer(ccipReceiveGasLimit)
assert(floor(withBuffer / 64 * 63 / 64 * 63), ccipReceiveGasLimit)
All of the current tests don't test this code, just that the function is being called.
|
Code coverage report:
|
Description
The
executionGasLimitis currently used as the destination transaction fee limit. However, it does not account for EIP-150 forwarding at most ~63/64 gas with each external call.This PR compensates for this attenuation by adding a buffer ($\left\lceil{\frac{64}{63} \left\lceil{\frac{64}{63}L}\right\rceil}\right\rceil - L$ , where $L$ is the
ccipReceiveGasLimit) to account for the two external calls made by the OffRamp (Router -> Receiver).Testing
executionGasLimitandccipReceiveGasLimitdiffer