-
Notifications
You must be signed in to change notification settings - Fork 98
Cross-chain Strategy #2715
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
base: master
Are you sure you want to change the base?
Cross-chain Strategy #2715
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2715 +/- ##
==========================================
+ Coverage 39.40% 43.81% +4.40%
==========================================
Files 126 133 +7
Lines 5789 6131 +342
Branches 1537 1636 +99
==========================================
+ Hits 2281 2686 +405
+ Misses 3506 3441 -65
- Partials 2 4 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| pragma solidity ^0.8.0; | ||
|
|
||
| /** | ||
| * @title OUSD Yearn V3 Remote Strategy Mock - the Mainnet part |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"- the Mainnet part" should probably be "- the L2 chain part"
contracts/contracts/mocks/crosschain/CrossChainRemoteStrategyMock.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/AbstractCCTPIntegrator.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/AbstractCCTPIntegrator.sol
Outdated
Show resolved
Hide resolved
* fix deploy files * minor rename * add calls to Morpho Vault into a try catch * refactor hook wrapper * don't revert if withdraw from underlying fails * use checkBalance for deposit/withdrawal acknowledgment * update message in remote strategy * remove unneeded functions
sparrowDom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea how to change message finality checks
sparrowDom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest batch of review comments
contracts/contracts/strategies/crosschain/CrossChainMasterStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/AbstractCCTPIntegrator.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/AbstractCCTPIntegrator.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/AbstractCCTPIntegrator.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/AbstractCCTPIntegrator.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/crosschain/CrossChainRemoteStrategy.sol
Outdated
Show resolved
Hide resolved
* use Strategizable * Add comment --------- Co-authored-by: Shahul Hameed <[email protected]>
| uint256 balance = checkBalance(usdcToken); | ||
| bytes memory message = CrossChainStrategyHelper | ||
| .encodeBalanceCheckMessage(lastTransferNonce, balance, false); | ||
| _sendMessage(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we emit a more generic "MessageTransmitted" here. It might be useful to also emit a separate BalanceCheck event here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why this would be necessary? As far as our offchain component is concerned it's not gonna care about the payload, it only needs to know if there's a pending transfer for it to poll CCTP API for attestation and relay it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if we add this here, we will need to emit this whenever we send the balance check as an acknowledgement as well to be consistent. It's not a big deal but I don't see any particular reason why this would be necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that it might be useful for an offchain analytics / Grafana to detect if a balanceUpdate messages are being triggered as expected and that the earnings from the Remote to Master are being reported.
sparrowDom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posting a couple more comments
contracts/contracts/strategies/crosschain/CrossChainMasterStrategy.sol
Outdated
Show resolved
Hide resolved
|
WIP - publishing partial review RequirementsPull request implements a strategy with a novel concept where the strategy contract is split into 2 parts each part residing on a different chain. The 2 strategy contracts use CCTP for USDC token transfer and message relaying between the 2 strategy components. One contract is called the master strategy and the other the remote strategy. Master strategy is the one receiving and sending funds from the vault. The remote strategy is responsible for deploying and withdrawing funds to the underlying platform. Easy ChecksAuthentication
Ethereum
Cryptographic code
Gas problems
Black magic
Overflow
License
Proxy
Events
Medium ChecksRounding and casts
Dependencies
External calls
Tests
Deploy
Strategy SpecificRemove this section if the code being reviewed is not a strategy. Strategy checks
Downstream
ThinkingLogicAre there bugs in the logic?
Deployment ConsiderationsAre there things that must be done on deploy, or in the wider ecosystem for this code to work. Are they done? Resource usage
Internal State
Does this code do that? AttackWhat could the impacts of code failure in this code be. What conditions could cause this code to fail if they were not true. Does this code successfully block all attacks. FlavorCould this code be simpler? Could this code be less vulnerable to other code behaving weirdly? |
Code Changes
Check readme: https://github.com/OriginProtocol/origin-dollar/blob/shah/cross-chain-strategy-cctpv2/contracts/contracts/strategies/crosschain/crosschain-strategy.md