Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
aurexav committed Sep 27, 2022
commit de76d175f903adb1f686e683674d0d1766a14f56
16 changes: 8 additions & 8 deletions modules/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ pub mod pallet {
MessageSignatureMismatch(ChainId, BridgeMessageIdOf<T, I>),
/// We have failed to decode Call from the message.
MessageCallDecodeFailed(ChainId, BridgeMessageIdOf<T, I>),
/// The call from the message has been rejected by the call filter.
MessageCallRejected(ChainId, BridgeMessageIdOf<T, I>),
/// The call from the message has been rejected by the call validator.
MessageCallValidateFailed(ChainId, BridgeMessageIdOf<T, I>, TransactionValidityError),
/// The origin account has failed to pay fee for dispatching the message.
MessageDispatchPaymentFailed(
ChainId,
Expand Down Expand Up @@ -298,16 +298,15 @@ impl<T: Config<I>, I: 'static> MessageDispatch<T::AccountId, T::BridgeMessageId>
T::IntoDispatchOrigin::into_dispatch_origin(&origin_derived_account, &call);

// validate the call
if let Err(_e) = T::CallValidator::call_validate(relayer_account, &dispatch_origin, &call) {
if let Err(e) = T::CallValidator::call_validate(relayer_account, &dispatch_origin, &call) {
log::trace!(
target: "runtime::bridge-dispatch",
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
"Message {:?}/{:?}: the call ({:?}) is rejected by the validator",
source_chain,
id,
call,
);
// TODO: https://github.com/paritytech/substrate/pull/11599
Self::deposit_event(Event::MessageCallRejected(source_chain, id));
Self::deposit_event(Event::MessageCallValidateFailed(source_chain, id, e));
return dispatch_result;
}

Expand Down Expand Up @@ -898,9 +897,10 @@ mod tests {
vec![EventRecord {
phase: Phase::Initialization,
event: Event::Dispatch(
call_dispatch::Event::<TestRuntime>::MessageCallRejected(
call_dispatch::Event::<TestRuntime>::MessageCallValidateFailed(
SOURCE_CHAIN_ID,
id
id,
TransactionValidityError::Invalid(InvalidTransaction::Call),
)
),
topics: vec![],
Expand Down