-
Notifications
You must be signed in to change notification settings - Fork 10
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
[SC-452] Refactor forwarders and receivers #17
Conversation
… from the domains
…ections on every bridge
README.md
Outdated
@@ -1,5 +1,20 @@ | |||
# xchain-helpers | |||
|
|||
This repository contains tooling for multichain testing such as cross-chain e2e testing support. | |||
This repository three tools for use with multi-chain development. Domains refer to blockchains which are connected by bridges. Domains may have multiple bridges connecting them, for example both the Optimism Native Bridge and Circle CCTP connect Ethereum and Optimism domains. |
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.
has three
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.
fixed
|
||
## Receivers | ||
|
||
The most common pattern is to have an authorized contract forward a message to another "business logic" contract to abstract away bridge dependencies. Receivers are contracts which perform this generic translation - decoding the bridge-specific message and forwarding to another `target` contract. The `target` contract should have logic to restrict who can call it and permission this to one or more bridge receivers. |
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.
We should talk about how the receiver itself has the restrictions/requires specific to the bridge and talk about the use of fallbacks and how it routs the 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.
added another paragraph
test/CircleCCTPIntegration.t.sol
Outdated
|
||
// Use Optimism for failure tests as the code logic is the same | ||
|
||
function test_invalidSourceAuthority() public { |
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.
This one should be third
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.
fixed
|
||
function test_base() public { | ||
checkOptimismStyle(getChain("base").createFork()); | ||
function test_invalidSourceAuthority() public { |
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.
This should be second
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.
fixed
test/OptimismIntegration.t.sol
Outdated
function test_optimism() public { | ||
checkOptimismStyle(getChain("optimism").createFork()); | ||
} | ||
// Use Arbitrum One for failure test as the code logic is the same |
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.
Update 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.
fixed
[SC-437] Fixing coverage by adding unit tests
Coverage after merging SC-452-refactor-forwards-receivers into master will be
Coverage Report
|
This PR does two refactors:
XChainForwarders
into separate libraries for better organization. I've also added some missing L2 -> L1 messages on each forwarder.You can see concrete example of how these changes improve usage here: https://github.com/marsfoundation/spark-gov-relay/pull/18/files and here: https://github.com/marsfoundation/xchain-dsr-oracle/pull/20/files