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

Pallet-Connectors-Gateway: Add Precompile for Axelar #1423

Merged

Conversation

mustermeiszer
Copy link
Collaborator

Description

Adding a precompile.

@cdamian this is my first approach for the precompile. LMKWYT.

cc @branan

@mustermeiszer
Copy link
Collaborator Author

@cdamian while doing that I noticed we need to nake the input of process_msg to a bounded BoundedVec. Just to note that here.

@mustermeiszer
Copy link
Collaborator Author

FYI @mikiquantum

@mustermeiszer mustermeiszer changed the title first draft Pallet-Connectors-Gateway: Add Precompile for Axelar Jun 30, 2023
handle: &mut impl PrecompileHandle,
command_id: U256,
source_chain: U256,
source_address: U256,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a H160 right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its a Solidity string which is represented as an bytes32 also. IIRC. See IAxelarForecallable.sol in the repo

fn forecall(
handle: &mut impl PrecompileHandle,
source_chain: U256,
sourceAddress: U256,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - H160?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its a Solidity string which is represented as an bytes32 also. IIRC. See IAxelarForecallable.sol in the repo

fn forecall_with_token(
handle: &mut impl PrecompileHandle,
source_chain: U256,
source_address: U256,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - H160?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its a Solidity string which is represented as an bytes32 also. IIRC. See IAxelarForecallable.sol in the repo

handle: &mut impl PrecompileHandle,
command_id: U256,
source_chain: U256,
source_address: U256,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - H160?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its a Solidity string which is represented as an bytes32 also. IIRC. See IAxelarForecallable.sol in the repo

core::marker::PhantomData<(Runtime, Gateway, MaxPayload)>,
);

#[precompile_utils::precompile]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need any other "EVM glue" for this to work or are these macro invocations enough to "register" this contract in the EVM?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are enough to impl Precompile and some glue around generating selectors and so for the pallet. But we should expand it at least once ^^


use fp_evm::PrecompileHandle;
use frame_support::dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo};
use pallet_connectors_gatway::GatwayOrigin;
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo ^^

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Haha. Always do that wrong. ^^

@cdamian cdamian merged commit 66639c0 into add-pallet-connectors-gateway Jul 3, 2023
2 of 11 checks passed
@cdamian cdamian deleted the feature/connectors-precompile branch July 3, 2023 09:58
cdamian pushed a commit that referenced this pull request Jul 11, 2023
cdamian pushed a commit that referenced this pull request Jul 13, 2023
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.

None yet

2 participants