Skip to content
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

Proper gas for setEnforcedOptions #6

Open
pegahcarter opened this issue Jun 17, 2024 · 0 comments
Open

Proper gas for setEnforcedOptions #6

pegahcarter opened this issue Jun 17, 2024 · 0 comments
Assignees

Comments

@pegahcarter
Copy link
Collaborator

pegahcarter commented Jun 17, 2024

Introduction

Frax OFTs require a minimum amount of gas to be forwarded to the destination chain to enable destination execution. We are currently using a default value from tests and need to migrate to a proven minimum value.

Description

In setting up an OFT, we set the enforced options on both the source and destination chain. Currently, these are set as default values as found in the tests:

// https://github.com/FraxFinance/LayerZero-v2-upgradeable/blob/e1470197e0cffe0d89dd9c776762c8fdcfc1e160/oapp/test/OFT.t.sol#L417
bytes memory optionsTypeOne = OptionsBuilder.newOptions().addExecutorLzReceiveOption(200_000, 0);
bytes memory optionsTypeTwo = OptionsBuilder.newOptions().addExecutorLzReceiveOption(250_000, 0);

It has been recommended by the L0 team to decrease the amount of gas forwarded as a simple non-upgradeable transfer should require less than 6k gas. What you can use is the suggested tenderly gas profiler to determine the amount spent of an upgradeable OFT transfer. With this knowledge, we can:

  • Decrease execution options on source to legacy chains to ~ 50k (should be chain-unique)
  • Decrease execution options on source to proxy chains to X (can start as a universal value)
  • Decrease execution options on destination to proxy chains to X (can start as a universal value)

Requirements

  • Addition of base gas costs to L0Config
  • New deployment dir and script to re-write currently configured enforced values (should create json txs similar to DeployFraxOFTProtocol/txs as the txs are required to be sent through msig)
  • Modification of DeployFraxOFTProtocol.s.sol to push options based on the gas value of the _config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants