-
Notifications
You must be signed in to change notification settings - Fork 91
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
connectors-gatway: Add integration tests #1478
Conversation
78a6be1
to
19df919
Compare
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.
@cdamian thanks a ton for the effort you put into this PR after all the other huges ones already 🙏
We need to work a bit on improving the structure of these new tests as well as in cleaning them up.
Namely:
-
I left a comment about the idea of testing setting the routers through governance and how that's adding a ton of complexity with the only added value (AFAIK) being that we are testing whether governance itself works. I really think we should drop all of this, use the root origin and focus the tests on testing our own code and setup.
-
We are adding a new directory to the
integration-tests
for theconnectors_gateway
with a nested directory for the routers which then hosts a newtest_net
andsetup
, artefacts of the xcm-simulator/emulator. My strong recommendation is to move theconnectors_gateway
directory toxcm/development/tests/connectors/gateway
() and reuse thesetup.rs
andtestnet.rs
machinery we already have there for thedevelopment
runtime ( this means we turn the currentxcm/development/tests/connectors.rs
file intoxcm/development/tests/connectors/mod.rs
) -
Drop a lot of the indirection functions created (left in comments) and either use the real values of certain objects (like using the real multilocation of a chain or of an asset) or leave comments making it explicit that it's just dummy data; I'd prefer the former option)
use crate::{ | ||
chain::centrifuge::{ | ||
AccountId, CouncilCollective, FastTrackVotingPeriod, MinimumDeposit, Runtime, RuntimeCall, | ||
RuntimeEvent, PARA_ID, |
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 am confused. This should be testing the development
runtime, where and only where connectors is published on. Above we import the CurrencyIdConvert
from development
but here we import all of these objects from the centrifuge runtime, which shouldn't even work.
We should have this now only using the development
runtime but we should also think about how we will be able to reuse or cleanly copy these tests to later use them to test centrifuge, keeping in mind we may have differences in the connectors config between runtimes at a later stage.
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 think that CurrencyIdConvert
is wrongly added here, currently double-checking that by re-running the whole suite.
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.
OK, that was an incorrect import, most likely a left over from my initial work on this while also figuring out how the re-exports in crate::chain::centrifuge
as set up.
However, the weird part is that this should have been caught when compiling these integration tests or am I missing something?
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.
If it all is under tests I might not see that.
let xcm_domain_location = MultiLocation { | ||
parents: 0, | ||
interior: Junctions::X1(Junction::Parachain(456)), | ||
}; | ||
|
||
let currency_id = CurrencyId::ForeignAsset(1); | ||
let currency_location = MultiLocation { | ||
parents: 0, | ||
interior: Junctions::X1(Junction::Parachain(123)), | ||
}; |
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 understand this is just dummy data but these values, particularly the currency_location
, doesn't really make much sense and can be confusing reading through this.
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 feel the same way regarding the dummy aspect and the actual values, what would you suggest as an improvement? Some different kind of Junction
?
let ethereum_xcm_router = EthereumXCMRouter::<Runtime> { | ||
router: XCMRouter { | ||
xcm_domain, | ||
_marker: Default::default(), |
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.
do we really need to specify these _marker:
s?
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.
Yes, otherwise we'll get an error due to missing fields.
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 think we can do
XCMRouter {
xcm_domain,
..Default::default()
}
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.
If we use that we'll run into:
the trait bound `XCMRouter<development_runtime::Runtime>: std::default::Default` is not satisfied
I don't see the issue with using the current approach tbh.
runtime/integration-tests/src/xcm/development/tests/connectors.rs
Outdated
Show resolved
Hide resolved
runtime/integration-tests/src/xcm/development/tests/connectors.rs
Outdated
Show resolved
Hide resolved
pub fn get_default_moonbeam_native_token_location() -> MultiLocation { | ||
MultiLocation { | ||
parents: 1, | ||
interior: X2(Parachain(PARA_ID_MOONBEAM), general_key(&[0, 1])), | ||
} | ||
} | ||
|
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 can also be confusing since that this is not actually GLMR's multilocation. Also, there's no "default" location of a token, as that sounds like it may have multiple but this is the default one.
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.
It's the same location that we use to have in the setup_pre_requirements
. Given that all the other const are prepended with DEFAULT
I thought it makes sense to do the same here, even though it would be clearer if they were named DEFAULT_TEST_*
runtime/integration-tests/src/connectors_gateway/routers/ethereum_xcm/router.rs
Outdated
Show resolved
Hide resolved
19df919
to
548f7a1
Compare
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 have no opinion on the structuring aspect. Regarding using democracy I left my opinion. But otherwise, SICK!
1312f1a
to
d1d4f3f
Compare
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.
Looks good, @cdamian!
7985f4d
7985f4d
to
da4eb31
Compare
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.
👏
da4eb31
to
ca0cef2
Compare
ca0cef2
to
069305c
Compare
Description
Part 4 of #1453
Changes and Descriptions
Connectors Gateway
pallet, routers.Connectors Gateway
pallet asOutboundQueue
forConnectors
pallet.Connectors
.Checklist: