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

feat: implement layerzero adapter #149

Merged

Conversation

redlarva
Copy link
Contributor

@redlarva redlarva commented Oct 20, 2023

Description:

Commit Message

feat: implement layerzero adapter

see the guidelines for commit messages.

Changelog Entry

version: <log entry>

Checklist:

  • I have performed a self-review of my own code
  • I have documented my code in accordance with the documentation guidelines
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have run the unit tests
  • I only have one commit (if not, squash them into one commit).
  • I have a descriptive commit message that adheres to the commit message guidelines

Please review the CONTRIBUTING.md file for detailed contributing guidelines.

AntonAndell and others added 29 commits August 21, 2023 10:23
* remove msg encoding in encodeCSMessageResponse

* chore: forge init

* forge install: forge-std

v1.6.1

* initial foundry setup

* forge install: openzeppelin-contracts-upgradeable

v4.9.3

* forge install: openzeppelin-contracts

v4.9.3

* add contract setup script for Callservice for Xcall

* add initial test setup for Xcall
* add setAdmin testCases
- setAdmin by Owner
- setAdmin by unauthorized caller


---------

Co-authored-by: AntonAndell <[email protected]>
* add setProtocolFee and getProtocolFee testCases
- setProtocolFee by Owner
- setProtocolFee by added admin
- setProtocolFee by unauthrorized user

---------

Co-authored-by: AntonAndell <[email protected]>
* add setProtocolFeeHandler and getProtocolFeeHandler testCases
- setProtocolFeeHandler by Owner/Admin
- setProtocolFee by unauthrorized user

---------

Co-authored-by: AntonAndell <[email protected]>
* add defaultConnection check on sendCallMessage

* add defaultConnection setter for xCall

* add revert messages on require()
* update encodeCSMessageRequest with protocol encoded code
* add defaultConnection check on sendCallMessage

* add defaultConnection setter for xCall

* add revert messages on require()

* - add CallMessage eventLog for assertion
- Add Connection instances
- Add required const variables for netTo for NID and dstAccount for addr

* add testCase for HandleResponse
- DefaultProtocol with access
- DefaultProtocol with unauthorized access

* TestCases
- handleResponse with singleProtocol
- handleResponse with singleProtocol by unauthorized

* TestCases
- handleResponse with MultiProtocol

---------

Co-authored-by: AntonAndell <[email protected]>
* TestCases
- executeCall using singleProtocol

* Add `CallExecuted` eventlogs for assertions

* TestCases
- executeCall using defaultProtocol

* TestCases
- executeCall using multiProtocols
* fix: clearing out unused code

* fix: clearing out contract part in library

---------

Co-authored-by: AntonAndell <[email protected]>
* update solidity document to deploy tthe contract as well as getting ready with forge commands

* update solidity document to deploy tthe contract as well as getting ready with forge commands
* TestCases
- Rollback using singleProtocol

* TestCases
- Rollback using DefaultProtocol
- Rollback using DefaultProtocol NotAuthorized

* TestCases
- Rollback using MultiProtocol
- Rollback with SuccessMessage

* fix rollbackSuccess testcase to remove rollbackMessage eventlog

* remove rollbackMessage eventlogs from executeCall()
* - Fix variables
- Fix Imports
- TestCases
    - ExecuteRollback using SingleProtocol
    - ExecuteRollback with DefaultProtocol
    - ExecuteRollback using MultiProtocol

* fix executeRollack testcases
* fix sendCallMessageSingleProtocol testCase

* add `CallMessgeSent` eventLog for test

* add testCase for sendMessage using multiProtocol

* add testCase for sendMessage using defaultProtocol

* Fix expectCall on sendMessage TestCases

---------

Co-authored-by: AntonAndell <[email protected]>
* fix: deployment script updated

* fix: foundry.toml

* fix: nid taken from env

* update deployment script to add the setup params for xcall-multi

* update deploy script on shellScript file to deploy the contracts easily from CLI

* add .env example file to follow to deploy the xcall

---------

Co-authored-by: sdpbhandari <[email protected]>
* fix imports error after merge

* Fix verifySuccess()
Add assert on verifySuccess for rollback tests
Add assert on verifySuccess for executeRollback tests
* ci: add solidity coverage workflow

* ci: test codcov workflow

* ci: debug foundy setup issue

* ci: debug foundy setup issue

* ci: debug foundy setup issue

* ci: debug foundy setup issue

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: export foundryup PATH

* ci: fix build on forge

* ci: fix build on forge

* ci: fix build on forge

* ci: fix build on forge

* ci: fix build on forge

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build path on workflows

* ci: fix build paths on workflows

* ci: add workflow for solidity-tests

* ci: add env on workflow

* ci: update test workflow

* ci: update test workflow ignore libraries from coverage folder

* ci: install lcov

* ci: install lcov

---------

Co-authored-by: Deepak Bomjan <[email protected]>
@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

Merging #149 (e2c79a7) into feature/solidity-adapters (ad79118) will decrease coverage by 0.10%.
The diff coverage is 64.10%.

Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                       @@
##             feature/solidity-adapters     #149      +/-   ##
===============================================================
- Coverage                        68.95%   68.85%   -0.10%     
  Complexity                          54       54              
===============================================================
  Files                               33       34       +1     
  Lines                             1955     1994      +39     
  Branches                            33       33              
===============================================================
+ Hits                              1348     1373      +25     
- Misses                             591      605      +14     
  Partials                            16       16              
Flag Coverage Δ
solidity 70.81% <64.10%> (-1.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ntracts/evm/contracts/adapters/WormholeAdapter.sol 72.97% <ø> (ø)
contracts/evm/contracts/xcall/CallService.sol 81.42% <ø> (ø)
...tracts/evm/contracts/adapters/LayerZeroAdapter.sol 64.10% <64.10%> (ø)

@pragyanshrestha-ibriz pragyanshrestha-ibriz linked an issue Oct 20, 2023 that may be closed by this pull request
Base automatically changed from feature/add-evm-multi-protocol-xcall to main October 23, 2023 13:06
Copy link
Collaborator

@AntonAndell AntonAndell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, looks clean.
Would be good to create a joint staging branch with the wormhole adapted to organize everything.
Also same comment here would be interesting if we could add a configurable response fee here aswell via the adpater parameters

contracts/evm/contracts/adapters/LayerZeroAdapter.sol Outdated Show resolved Hide resolved
contracts/evm/contracts/adapters/LayerZeroAdapter.sol Outdated Show resolved Hide resolved
contracts/evm/contracts/adapters/LayerZeroAdapter.sol Outdated Show resolved Hide resolved
@redlarva redlarva changed the base branch from main to feature/solidity-adapters October 30, 2023 10:33
@redlarva redlarva added enhancement New feature or request feature labels Oct 31, 2023
Copy link
Collaborator

@AntonAndell AntonAndell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ready just minor changes/decisions to be made

contracts/evm/contracts/adapters/LayerZeroAdapter.sol Outdated Show resolved Hide resolved
contracts/evm/contracts/adapters/LayerZeroAdapter.sol Outdated Show resolved Hide resolved
contracts/evm/contracts/adapters/LayerZeroAdapter.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@AntonAndell AntonAndell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AntonAndell AntonAndell merged commit 0d761ba into feature/solidity-adapters Nov 2, 2023
11 of 14 checks passed
@AntonAndell AntonAndell deleted the feature/implement-layerzero-adapter branch November 2, 2023 06:00
redlarva added a commit that referenced this pull request Nov 8, 2023
* feat: added interface for layerzero and install dependencies

* feat: implement layerzero adapter

* fix: test for layer-zero and wormhole

* refactor: clean up

* feat: add method to update gas limit for layer zero

* fix: use contract as refund address

---------

Co-authored-by: AntonAndell <[email protected]>
redlarva added a commit that referenced this pull request Nov 10, 2023
* feat: added interface for layerzero and install dependencies

* feat: implement layerzero adapter

* fix: test for layer-zero and wormhole

* refactor: clean up

* feat: add method to update gas limit for layer zero

* fix: use contract as refund address

---------

Co-authored-by: AntonAndell <[email protected]>
redlarva added a commit that referenced this pull request Nov 10, 2023
* feat: added interface for layerzero and install dependencies

* feat: implement layerzero adapter

* fix: test for layer-zero and wormhole

* refactor: clean up

* feat: add method to update gas limit for layer zero

* fix: use contract as refund address

---------

Co-authored-by: AntonAndell <[email protected]>
redlarva added a commit that referenced this pull request Nov 10, 2023
* feat: added interface for layerzero and install dependencies

* feat: implement layerzero adapter

* fix: test for layer-zero and wormhole

* refactor: clean up

* feat: add method to update gas limit for layer zero

* fix: use contract as refund address

---------

Co-authored-by: AntonAndell <[email protected]>
redlarva added a commit that referenced this pull request Nov 10, 2023
* feat: implement wormhole adapter (#144)

* feat: implement wormhole adapter

* fix: removed event listener for request submitted

* tests: added rollback test for wormhole

* tests: added admin test

* fix: xcall test

* feat: add method to update gas limit

* feat: implement layerzero adapter (#149)

* feat: added interface for layerzero and install dependencies

* feat: implement layerzero adapter

* fix: test for layer-zero and wormhole

* refactor: clean up

* feat: add method to update gas limit for layer zero

* fix: use contract as refund address

---------

Co-authored-by: AntonAndell <[email protected]>

* fix: set sn to 0 if response not required

* feature: adapter fee airdrop (#176)

* feat: incorporate response fee for layerzero

* feat: incorporate response fee for wormhole

* refactor: remove duplicate dev docs

* feat: implement wormhole adapter (#144)

* feat: implement wormhole adapter

* fix: removed event listener for request submitted

* tests: added rollback test for wormhole

* tests: added admin test

* fix: xcall test

* feat: add method to update gas limit

* feat: implement layerzero adapter (#149)

* feat: added interface for layerzero and install dependencies

* feat: implement layerzero adapter

* fix: test for layer-zero and wormhole

* refactor: clean up

* feat: add method to update gas limit for layer zero

* fix: use contract as refund address

---------

Co-authored-by: AntonAndell <[email protected]>

* fix: set sn to 0 if response not required

---------

Co-authored-by: AntonAndell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
4 participants