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 wormhole adapter #144

Merged

Conversation

redlarva
Copy link
Contributor

@redlarva redlarva commented Oct 13, 2023

Description:

Commit Message

feat: implement wormhole 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 28 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 13, 2023

Codecov Report

Merging #144 (a40b45a) into feature/solidity-adapters (6779754) will increase coverage by 4.01%.
The diff coverage is 77.27%.

Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                       @@
##             feature/solidity-adapters     #144      +/-   ##
===============================================================
+ Coverage                        68.00%   72.01%   +4.01%     
===============================================================
  Files                               32        4      -28     
  Lines                             1919      218    -1701     
  Branches                            33        0      -33     
===============================================================
- Hits                              1305      157    -1148     
+ Misses                             598       61     -537     
+ Partials                            16        0      -16     
Flag Coverage Δ
java ?
rust ?
solidity 72.01% <77.27%> (+9.38%) ⬆️

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

Files Coverage Δ
...ks/multi-protocol-dapp/MultiProtocolSampleDapp.sol 72.72% <100.00%> (+72.72%) ⬆️
contracts/evm/contracts/xcall/CallService.sol 81.42% <100.00%> (+0.57%) ⬆️
...vm/contracts/adapters/wormhole/WormholeAdapter.sol 72.97% <72.97%> (ø)

... and 29 files with indirect coverage changes

@redlarva redlarva linked an issue Oct 16, 2023 that may be closed by this pull request
@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.

Due to me merging and chaning minor things there are now many conflicts. Otherwise this looks amazing, good work!

Also want to discuss with you about adding a configurable response fee where we use reciver value to define that. Would give us the option to add automatic payment for reponses.

@redlarva redlarva changed the base branch from main to feature/solidity-adapters October 30, 2023 03:39
…ole-adapter

# Conflicts:
#	.github/workflows/solidity-cov.yml
#	.gitmodules
#	contracts/evm/contracts/adapters/wormhole/WormholeAdapter.sol
#	contracts/evm/contracts/mocks/multi-protocol-dapp/MultiProtocolSampleDapp.sol
#	contracts/evm/contracts/xcall/CallService.sol
#	contracts/evm/foundry.toml
#	contracts/evm/library/utils/Types.sol
#	contracts/evm/test/adapters/wormhole/WormholeAdapter.t.sol
#	contracts/evm/test/xcall/CallService.t.sol
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 good, additional review on structure can be made in solidity adapters branch ones both are merged

@AntonAndell AntonAndell merged commit ad79118 into feature/solidity-adapters Oct 30, 2023
12 of 14 checks passed
@AntonAndell AntonAndell deleted the feature/implement-wormhole-adapter branch October 30, 2023 10:27
redlarva added a commit that referenced this pull request Nov 8, 2023
* 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
redlarva added a commit that referenced this pull request Nov 10, 2023
* 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
redlarva added a commit that referenced this pull request Nov 10, 2023
* 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
redlarva added a commit that referenced this pull request Nov 10, 2023
* 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
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
Projects
None yet
4 participants