Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Aug 14, 2024
1 parent a59c6aa commit 81480f3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
12 changes: 7 additions & 5 deletions pallets/axelar-router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub mod pallet {
#[pallet::error]
pub enum Error<T> {
/// Emit when the router configuration is not found.
RouterNotFound,
RouterConfigurationNotFound,

/// Emit when the evm account code is not registered
ContractCodeMismatch,
Expand Down Expand Up @@ -222,7 +222,8 @@ pub mod pallet {
.try_into()
.map_err(|_| Error::<T>::SourceChainTooLong)?;

let config = Configuration::<T>::get(chain_name).ok_or(Error::<T>::RouterNotFound)?;
let config = Configuration::<T>::get(chain_name)
.ok_or(Error::<T>::RouterConfigurationNotFound)?;

ensure!(
caller == config.liquidity_pools_contract_address,
Expand Down Expand Up @@ -316,9 +317,10 @@ pub mod pallet {
type Origin = DomainAddress;

fn send(axelar_id: AxelarId, origin: Self::Origin, message: Vec<u8>) -> DispatchResult {
let chain_name =
ChainNameById::<T>::get(axelar_id).ok_or(Error::<T>::RouterNotFound)?;
let config = Configuration::<T>::get(&chain_name).ok_or(Error::<T>::RouterNotFound)?;
let chain_name = ChainNameById::<T>::get(axelar_id)
.ok_or(Error::<T>::RouterConfigurationNotFound)?;
let config = Configuration::<T>::get(&chain_name)
.ok_or(Error::<T>::RouterConfigurationNotFound)?;

match config.domain {
DomainConfig::Evm(evm_config) => {
Expand Down
4 changes: 2 additions & 2 deletions pallets/axelar-router/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ mod send {
new_test_ext().execute_with(|| {
assert_err!(
Router::send(AxelarId::Evm(CHAIN_ID), SENDER, MESSAGE.to_vec()),
Error::<Runtime>::RouterNotFound,
Error::<Runtime>::RouterConfigurationNotFound,
);
});
}
Expand Down Expand Up @@ -167,7 +167,7 @@ mod receive {
&SOURCE_ADDRESS.0,
MESSAGE
),
Error::<Runtime>::RouterNotFound
Error::<Runtime>::RouterConfigurationNotFound
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/liquidity-pools-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub mod pallet {
UnknownInstance,

/// Router not found.
RouterNotFound,
RouterConfigurationNotFound,

/// Emitted when you call `start_batch_messages()` but that was already
/// called. You should finalize the message with `end_batch_messages()`
Expand Down
8 changes: 5 additions & 3 deletions runtime/common/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ use sp_core::{H160, H256};
use sp_runtime::traits::{BlakeTwo256, Hash};
use sp_std::{marker::PhantomData, vec, vec::Vec};

/// Identification of the router where the message is sent and received
/// RouterId is more specific than Domain, because RouterId also identify by
/// where the message is sent/received
/// Identification of the router where the messages are sent and received.
///
/// NOTE: `RouterId` is more specific than `Domain`. `Domain` identifies the
/// source and destination of the message, but `RouterId` also identifies how
/// to reach them.
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
pub enum RouterId {
/// The message must be sent/received by EVM using Axelar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn outbound<T: Runtime + FudgeSupport>() {
pallet_liquidity_pools_gateway_queue::Event::<T>::MessageExecutionFailure {
nonce,
message,
error: pallet_axelar_router::Error::<T>::RouterNotFound.into(),
error: pallet_axelar_router::Error::<T>::RouterConfigurationNotFound.into(),
}
});

Expand Down

0 comments on commit 81480f3

Please sign in to comment.