-
Notifications
You must be signed in to change notification settings - Fork 84
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
LPv2: Add PalletAxelarRoutet #1955
Conversation
|
||
#[pallet::weight(Pallet::<T>::weight_for_set_method())] | ||
#[pallet::call_index(2)] | ||
pub fn set_outbound_config( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The router is configured here by chain_id
instead of domain because a router can never be a Centrifuge domain. The gateway will no longer configure routers, will only handle the routers id.
exit_status: ExitError::Other("payload conversion".into()), | ||
})?; | ||
|
||
T::Gateway::receive(origin, msg).map_err(|e| TryDispatchError::Substrate(e).into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably here we should add a router_id
parameter or append to the origin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, atm I have a T::Hash
for inbound routers but we can change to whatever.
let source_address_bytes = | ||
cfg_utils::decode_var_source::<EXPECTED_SOURCE_ADDRESS_SIZE>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've simplified this by removing the SourceConverter
type from the original axelar precompile pallet.
I did so, because the EXPECTED_SOURCE_ADDRESS_SIZE
is 20, which means that we always parse a 20bytes address. Makes sense because we should not expect a Centrifuge address coming from Evm.
/// The behavior of an entity that can send messages | ||
pub trait MessageSender { | ||
/// The originator of the message to be sent | ||
type Origin; | ||
|
||
///The destination of the message | ||
type Destination; | ||
|
||
/// Sends a message for origin to destination | ||
fn send( | ||
origin: Self::Origin, | ||
destination: Self::Destination, | ||
message: Vec<u8>, | ||
) -> DispatchResultWithPostInfo; | ||
} | ||
|
||
/// The behavior of an entity that can receive messages | ||
pub trait MessageReceiver { | ||
/// The maximum lenght for a message the implementor is able to receive. | ||
type MaxEncodedLen: Get<u32>; | ||
|
||
/// The originator of the message to be sent | ||
type Origin; | ||
|
||
/// Sends a message for origin to destination | ||
fn receive( | ||
origin: Self::Origin, | ||
message: BoundedVec<u8, Self::MaxEncodedLen>, | ||
) -> DispatchResult; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cosmin, this will be the new interface. Basically, the routers are no longer instances. They are pallet, but each pallet can have different configurations in they want.
I'm not fully sure yet, but my intention is that the Self::Origin will be a tuple (RouterId, Domain)
or similar. Still thinking about this, but somehow though the receive()/send() method you could determine the router.
Hopefully, it will require few changes in the gateway.
Also the router storage and configuration could be removed from the gateway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the router storage and configuration could be removed from the gateway.
OK, but then we need a way to somehow still "add" the routers to the gateway. Maybe add a tuple of all the available router pallets to the gateway config or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the way would be by adding a list of router ids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And from the gateway perspective, only router ids exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but then how would the gateway call router X to send an outbound message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send(router_id, domain, message)
something like that
Regarding this implementation, I'm still not sure if the whole axelar should be inside this new router pallet, because Axelar is supposed to be connected to other chains, so maybe the precompile logic itself is shared among different routers. |
Close in favor of: #1956 |
Description
pallet-axelar-router
, which is the union of the currentaxelar-gateway-precompile
androuters/axelar_evm
.Currently compiling as
cargo check -p pallet-axelar-router