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

Added upgradeable variant of OApp #9

Closed
wants to merge 2 commits into from

Conversation

Zodomo
Copy link
Contributor

@Zodomo Zodomo commented Jan 2, 2024

We needed the ability to make an upgradeable OApp for our L0 V2 integration, so I refactored OApp to utilize OpenZeppelin's OwnableUpgradeable.sol and the initialize pattern in place of the non-upgradeable Ownable.sol variant.

@St0rmBr3w
Copy link
Contributor

Thank you for the contribution! I think this should live outside of this repo as a third-party extension of the OApp Standard.

In general, the LayerZero Labs team does not recommend creating an upgradeable OApp contract variant due to the complexity of maintaining upgradeable contracts on multiple chains, which can introduce potential race conditions in your development.

Ultimately it's up to teams to decide which approach works best for their project, but we choose not to endorse upgradeable OApps for that reason. Please feel free to maintain externally though!

@St0rmBr3w St0rmBr3w closed this Jan 4, 2024
@JorgeAtPaladin
Copy link

@Zodomo a potential middle ground for you could be to have a non-upgreadable "messenger" interface contract (the oapp) that plugs into your upgradeable app contract, then you could have a setMessenger() or something to upgrade it through redeployment.

@Zodomo
Copy link
Contributor Author

Zodomo commented Jan 7, 2024

@Zodomo a potential middle ground for you could be to have a non-upgreadable "messenger" interface contract (the oapp) that plugs into your upgradeable app contract, then you could have a setMessenger() or something to upgrade it through redeployment.

@JorgeAtPaladin thanks for the input! In our case, our core application is ownerless and nonupgradeable, so we've elected to externalize the bridge functionality into a separate upgradeable contract. For our setup, making OApp upgradeable seemed to be the best option. That being said, paring down our existing bridge endpoint to just acting as a messenger between the main protocol and the nonupgradeable OApp might be a worthwhile idea.

@e00dan
Copy link

e00dan commented Jan 9, 2024

@Zodomo I had very similar requirements as you did. I just noticed your pull request. Maybe if I noticed it earlier it would save me some work. : D

I created this starter kit repository with upgradeability out of the box and native Foundry approach: https://github.com/Kuzirashi/layerzero-starter-kit

I also have a weird feeling when cloning official LZ repository with all the protocol contracts just to deploy a counter or custom app. I feel like small external Foundry + LZ boilerplate repository could be easier to start development, but that's just my personal preference.


Edit:

I've decided to use these smart contracts in my starter kit repository, because I think this implementation looks a bit better than what I had originally.

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

Successfully merging this pull request may close these issues.

4 participants