Skip to content

[MD-1066] Container chain sending tokens to Ethereum #1100

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

Open
wants to merge 37 commits into
base: jeremy-send-tokens-to-ethereum
Choose a base branch
from

Conversation

evgeny-s
Copy link
Contributor

@evgeny-s evgeny-s commented Jun 18, 2025

Description:
This PR provides a functionality for container chains to send tokens to Ethereum via the Relay chain

NOTE:
Should be merged after #1054

The plan:

  • Implement XCM Router on the container chain side
  • Cover container chains with dev tests
  • Implement/Re-use XCM Message Exporter on the relay chain side
  • E2E test
  • Documentation
  • Cover relay chain with dev tests
  • Cover corner cases with tests
  • Add more tests for potential vulnerabilities exposing

@evgeny-s evgeny-s changed the title [MD-1066] Container chain sending tokens to Ethereum(3) md 1066 evgeny container to eth xcm [MD-1066] Container chain sending tokens to Ethereum Jun 18, 2025
/// to is the Ethereum mainnet, with chain ID 1.
/// <https://chainlist.org/chain/1>
/// <https://ethereum.org/en/developers/docs/apis/json-rpc/#net_version>
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 11155111 };
Copy link
Contributor Author

@evgeny-s evgeny-s Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to find a way to pull it from the relay chain, because it should work for both: dancelight/stagelight runtimes.
Or maybe add here EthTestnet and EthMainnet and check for OR

Copy link
Contributor Author

@evgeny-s evgeny-s Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add the runtime api to relay chain that will return the ETH NetworkId of the relay chain and then call this api before the validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or fetch it via the XCM message

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe having a testnet/mainnet flag could be useful for other things. But it adds an extra step to the deploy process... How can we make it automatic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea: we could also have this EthereumNetwork as a param of pallet_parameters, and that way we would be able to modify it accordingly. This wouldn't be automatic tho, we can set a default value (e.g the testnet one) but if we want to change it in a mainnet environment, it should be done by calling the extrinsic.

@evgeny-s evgeny-s marked this pull request as draft June 18, 2025 14:26
@evgeny-s evgeny-s marked this pull request as draft June 18, 2025 14:26
- Added template impl for the MessageExporter
- Removed failing test for MessageExporter
-
@evgeny-s evgeny-s added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Jun 20, 2025
- Extended e2e tests
- Mocked the barrier
- Added documentation
@evgeny-s evgeny-s marked this pull request as ready for review June 24, 2025 13:01
@evgeny-s evgeny-s added the not-breaking Does not need to be mentioned in breaking changes label Jun 25, 2025
@@ -327,6 +327,30 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 1_199_000 picoseconds.
Weight::from_parts(1_243_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took it from BridgeHub for now, we will need to re-generate it on our side.

Copy link
Contributor

@Agusrodri Agusrodri Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -52,25 +51,3 @@ fn test_message_exporter_disabled_for_origin_account() {
);
});
}

#[test]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this test, because we now using the MessageExporter

@evgeny-s evgeny-s added the A8-mergeoncegreen Pull request is reviewed well. label Jun 25, 2025
evgeny-s added 5 commits June 30, 2025 10:52
…into (3)-MD-1066-evgeny-container-to-eth-xcm

# Conflicts:
#	primitives/bridge/src/lib.rs
…-container-to-eth-xcm

# Conflicts:
#	chains/orchestrator-relays/runtime/dancelight/src/xcm_config.rs
Copy link
Contributor

github-actions bot commented Jul 7, 2025

WASM runtime size check:

Compared to target branch

dancebox runtime: 1500 KB (no changes) ✅

flashbox runtime: 884 KB (no changes) ✅

dancelight runtime: 2408 KB (+4 KB) 🚨

starlight runtime: 2312 KB (+4 KB) ⚠️

container chain template simple runtime: 1160 KB (-4 KB) ✅

container chain template frontier runtime: 1448 KB (+4 KB) ⚠️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A8-mergeoncegreen Pull request is reviewed well. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants