Implement comprehensive XCM tests with native asset teleportation using static types#501
Conversation
Co-authored-by: akru <786394+akru@users.noreply.github.com>
Co-authored-by: akru <786394+akru@users.noreply.github.com>
tools/robonet/src/tests/xcm.rs
Outdated
|
|
||
| // Create a simple XCM message: DescendOrigin + ClearOrigin | ||
| // This is a basic message that will pass through UMP without requiring execution | ||
| let xcm_message = subxt::dynamic::Value::unnamed_composite([ |
There was a problem hiding this comment.
Please rewrite using static types instead of dynamic notation.
There was a problem hiding this comment.
Done! Rewrote all dynamic XCM construction to use static types from api::runtime_types::staging_xcm::v4. Now using type-safe Location, Junction, Junctions, Assets, and Fungibility types with api::tx().polkadot_xcm() calls. Commit: 2866834
- Replace dynamic subxt::dynamic::Value with static XCM types from api::runtime_types - Use api::tx().polkadot_xcm() static API instead of dynamic tx construction - Replace Unicode arrows (→) with simple ASCII (->) - Replace fancy box drawing characters (╔ ║ ╚) with simple "==" style - Use XCM v4 types: Location, Junction, Junctions, Assets, AssetId, Fungibility - All XCM construction now uses compile-time checked types Addresses review comments on lines 58 and 73 Co-authored-by: akru <786394+akru@users.noreply.github.com>
- Document use of static XCM v4 types - Add code examples showing static type construction - Update XCM message structure section with type-safe examples - Clarify compile-time safety benefits Co-authored-by: akru <786394+akru@users.noreply.github.com>
- Wait for MessageQueue::Processed event on relay chain after upward XCM send - Wait for MessageQueue::Processed event on parachain after downward XCM send - Subscribe to finalized blocks on destination chain and check for success - Add 30 second timeout for event monitoring - Log success/warning based on event detection Addresses review comments requesting validation of XCM message execution on destination chains Co-authored-by: akru <786394+akru@users.noreply.github.com>
|
@copilot let's refactor how to use Topology in tests, let's provide OnlineClient to tests directly, in this case let's topology contains OnlineClient instances for all chains. Let's use |
Update all test files and test runner to use Network<LocalFileSystem> instead of NetworkTopology: - Update test function signatures to accept &Network<LocalFileSystem> - Replace NetworkTopology and NetworkEndpoints with direct Network node access - Use network.get_node() to retrieve nodes by name (alice, bob, robonomics-collator, asset-hub-collator) - Use node.ws_uri() to get WebSocket URLs directly - Update test runner in mod.rs to pass network reference - Handle optional network in main.rs test command Files updated: - tools/robonet/src/tests/xcm.rs - tools/robonet/src/tests/claim.rs - tools/robonet/src/tests/cps.rs - tools/robonet/src/tests/network.rs - tools/robonet/src/tests/mod.rs - tools/robonet/src/main.rs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Done! Simplified architecture by passing |
XCM tests were disabled and incomplete. Required implementing foreign asset registration and teleportation tests per Polkadot docs. Runtime analysis revealed Robonomics lacks
pallet_assets(removed in migration), making foreign asset registration impossible. Pivoted to native asset (XRT) teleportation—the actual supported capability perxcm_config.rstrusted teleporter configuration.Changes
XCM Test Implementation (
tools/robonet/src/tests/xcm.rs)Three test suites covering cross-consensus messaging patterns using type-safe static XCM v4 types:
UMP (Upward): Parachain → Relay
api::tx().polkadot_xcm().send()Attempted,SentMessageQueue::Processedevent on relay chain withsuccess: YesDMP (Downward): Relay → Parachain
MessageQueue::Processedevent on parachain withsuccess: YesXCMP (Teleportation): Robonomics ↔ AssetHub
limited_teleport_assetsXcmpMessageSent,Attempted,SentTest Architecture Refactoring
Simplified test architecture to pass
Network<LocalFileSystem>directly to test functions:&Network<LocalFileSystem>parameter instead of topology enumsnetwork.get_node("node-name")(e.g., "alice", "robonomics-collator", "asset-hub-collator")node.ws_uri()OnlineClientconnections on-demandTest Runner Integration (
tools/robonet/src/tests/mod.rs)xcm_upward_message,xcm_downward_message,xcm_token_teleportDocumentation (
tools/robonet/XCM_TESTS.md)Technical reference covering:
Implementation Details
Type Safety
All XCM construction uses static types from
api::runtime_types::staging_xcm::v4:Location,Junction,Junctionsfor XCM locationsAsset,AssetId,Assets,Fungibilityfor asset representationVersionedLocation,VersionedAssets,VersionedXcmfor versioned typesCode Style
Consistent ASCII logging style throughout:
->arrows instead of Unicode→==separators instead of box drawing charactersEnd-to-End Validation
Both UMP and DMP tests now include complete end-to-end validation:
MessageQueue::Processedeventssuccessfield istrueRuntime Configuration Context
Usage
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.