Skip to content
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

Implement ethereum explicitly related currency swap logic to make Native-to-EVM Bridge transactions visible via Ethereum RPC #1449

Draft
wants to merge 63 commits into
base: master
Choose a base branch
from

Conversation

dmitrylavrenov
Copy link
Contributor

@dmitrylavrenov dmitrylavrenov commented Feb 19, 2025

Design thoughts

Tasks

  • pallet implementation
  • precompile implementation
  • runtime integration
  • runtime unit tests
  • unit tests for native to evm swap
  • unit tests for evm to native swap
  • e2e test

PoC of visibility

transaction itself

Screenshot 2025-02-19 at 23 01 35

transaction execution in explorer on Substrate RPC side

Screenshot 2025-02-19 at 23 02 22

transaction execution in explorer on Ethereum RPC side

Very tiny ethereum explorer is used to verify visibility via Ethereum RPC

Screenshot 2025-02-19 at 23 02 43

@dmitrylavrenov dmitrylavrenov force-pushed the pallet-visible-currency-swap branch from d203de1 to c7c315c Compare February 20, 2025 09:36
Copy link
Contributor

@MOZGIII MOZGIII left a comment

Choose a reason for hiding this comment

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

This looks good!

If we add the E2E tests to verify that the solution works overall, and unit tests with mock runtime (as we usually do) to test the niche cases (zero transfer, etc) and for tight regression control - I think we ship it pretty much right away

@dmitrylavrenov dmitrylavrenov force-pushed the pallet-visible-currency-swap branch from 4c9425c to 01e492c Compare February 20, 2025 11:57
@dmitrylavrenov dmitrylavrenov force-pushed the pallet-visible-currency-swap branch from f48f89e to 863a9aa Compare February 20, 2025 14:14
@MOZGIII
Copy link
Contributor

MOZGIII commented Feb 20, 2025

Thinking about this, we should explicitly test, among other things, that the pot doesn't pay the fee for any tx with this flow.

@dmitrylavrenov
Copy link
Contributor Author

Thinking about this, we should explicitly test, among other things, that the pot doesn't pay the fee for any tx with this flow.

Tested manually that pot doesn't pay the fee - confirmed. Additionally will implement some unit tests and add this check to e2e test.

@dmitrylavrenov dmitrylavrenov force-pushed the pallet-visible-currency-swap branch 9 times, most recently from b0e68a8 to 40e11f7 Compare February 24, 2025 15:09
@@ -76,6 +77,8 @@ pub mod precompiles_constants {
pub const NATIVE_CURRENCY: u64 = 2050;
/// `CurrencySwap` precompile constant.
pub const CURRENCY_SWAP: u64 = 2304;
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll have to eventually deprecate this one; how would we do it?

@MOZGIII MOZGIII self-requested a review February 24, 2025 19:43
@dmitrylavrenov dmitrylavrenov force-pushed the pallet-visible-currency-swap branch from 36923d3 to dc0ce50 Compare February 27, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants