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

P 1275 omni bridge precompile #3254

Merged
merged 28 commits into from
Feb 14, 2025
Merged

P 1275 omni bridge precompile #3254

merged 28 commits into from
Feb 14, 2025

Conversation

wangminqi
Copy link
Member

omni bridge precompile

Copy link

linear bot commented Feb 12, 2025

@wangminqi wangminqi requested review from Kailai-Wang, 0xverin, kziemianek and a team February 13, 2025 06:56
@wangminqi
Copy link
Member Author

only ts-test require small adjust. All other code should be ready fro review.

fn pay_in(
handle: &mut impl PrecompileHandle,
amount: U256,
dest_id: u8,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can live with it for now - is there a more general way of mapping the ChainType in pallet code?

Imagine we want to bridge to some non-evm chain later

Copy link
Member Author

Choose a reason for hiding this comment

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

Then we should define the type id for all different types of chain category, and hard code mapping it in precompile.

Copy link
Member Author

Choose a reason for hiding this comment

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

for evm interface, adding one extra parameter by that time.

amount: U256,
dest_id: u8,
native: bool,
asset_id: U256,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually the same problem:

we either have native == true, or non-native with asset_id, it's actually an enum

Copy link
Member Author

@wangminqi wangminqi Feb 14, 2025

Choose a reason for hiding this comment

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

in evm contract, there is no ethereum struct can 100% consistently support rust enum.
we have { native, id(u32) }, this enum in rust carry extra parameter u32.

Copy link
Member Author

Choose a reason for hiding this comment

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

dest_id share this problem too.
{ heima, Ethereum(chain_id) } carry extra chain_id info.

@Kailai-Wang
Copy link
Collaborator

@0xverin ideally you could take a look at the test too

@Kailai-Wang Kailai-Wang enabled auto-merge (squash) February 13, 2025 18:32
Copy link
Contributor

@0xverin 0xverin left a comment

Choose a reason for hiding this comment

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

Ts tests part looks good!

@wangminqi wangminqi disabled auto-merge February 14, 2025 07:43
@wangminqi
Copy link
Member Author

Still confirming ts-test, let me merge manually later.

@wangminqi
Copy link
Member Author

Yes, it is caused by failed to decode event data.

ready to merge. TODO fix in future.

@wangminqi wangminqi enabled auto-merge (squash) February 14, 2025 09:04
@wangminqi wangminqi merged commit 4a5e812 into dev Feb 14, 2025
20 checks passed
@wangminqi wangminqi deleted the p-1275-omni-bridge-precompile branch February 14, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants