Skip to content

Proper gas for setEnforcedOptions #6

@pegahcarter

Description

@pegahcarter

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions