mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
Propagate message verification errors (#2114)
* Propagate message verification errors * Replace parse_finalized_storage_proof() with storage_proof_checker() * small fixes * fix comment
This commit is contained in:
committed by
Bastian Köcher
parent
c490222fc6
commit
56d4013878
@@ -61,7 +61,7 @@ use bp_messages::{
|
||||
},
|
||||
total_unrewarded_messages, DeliveredMessages, InboundLaneData, InboundMessageDetails, LaneId,
|
||||
MessageKey, MessageNonce, MessagePayload, MessagesOperatingMode, OutboundLaneData,
|
||||
OutboundMessageDetails, UnrewardedRelayersState,
|
||||
OutboundMessageDetails, UnrewardedRelayersState, VerificationError,
|
||||
};
|
||||
use bp_runtime::{BasicOperatingMode, ChainId, OwnedBridgeModule, PreComputedSize, Size};
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
@@ -557,9 +557,9 @@ pub mod pallet {
|
||||
/// The message is too large to be sent over the bridge.
|
||||
MessageIsTooLarge,
|
||||
/// Message has been treated as invalid by chain verifier.
|
||||
MessageRejectedByChainVerifier,
|
||||
MessageRejectedByChainVerifier(VerificationError),
|
||||
/// Message has been treated as invalid by lane verifier.
|
||||
MessageRejectedByLaneVerifier,
|
||||
MessageRejectedByLaneVerifier(VerificationError),
|
||||
/// Submitter has failed to pay fee for delivering and dispatching messages.
|
||||
FailedToWithdrawMessageFee,
|
||||
/// The transaction brings too many messages.
|
||||
@@ -732,7 +732,7 @@ fn send_message<T: Config<I>, I: 'static>(
|
||||
err,
|
||||
);
|
||||
|
||||
Error::<T, I>::MessageRejectedByChainVerifier
|
||||
Error::<T, I>::MessageRejectedByChainVerifier(err)
|
||||
})?;
|
||||
|
||||
// now let's enforce any additional lane rules
|
||||
@@ -746,7 +746,7 @@ fn send_message<T: Config<I>, I: 'static>(
|
||||
err,
|
||||
);
|
||||
|
||||
Error::<T, I>::MessageRejectedByLaneVerifier
|
||||
Error::<T, I>::MessageRejectedByLaneVerifier(err)
|
||||
},
|
||||
)?;
|
||||
|
||||
@@ -918,7 +918,7 @@ impl<T: Config<I>, I: 'static> OutboundLaneStorage for RuntimeOutboundLaneStorag
|
||||
fn verify_and_decode_messages_proof<Chain: SourceHeaderChain, DispatchPayload: Decode>(
|
||||
proof: Chain::MessagesProof,
|
||||
messages_count: u32,
|
||||
) -> Result<ProvedMessages<DispatchMessage<DispatchPayload>>, Chain::Error> {
|
||||
) -> Result<ProvedMessages<DispatchMessage<DispatchPayload>>, VerificationError> {
|
||||
// `receive_messages_proof` weight formula and `MaxUnconfirmedMessagesAtInboundLane` check
|
||||
// guarantees that the `message_count` is sane and Vec<Message> may be allocated.
|
||||
// (tx with too many messages will either be rejected from the pool, or will fail earlier)
|
||||
@@ -1177,7 +1177,9 @@ mod tests {
|
||||
TEST_LANE_ID,
|
||||
PAYLOAD_REJECTED_BY_TARGET_CHAIN,
|
||||
),
|
||||
Error::<TestRuntime, ()>::MessageRejectedByChainVerifier,
|
||||
Error::<TestRuntime, ()>::MessageRejectedByChainVerifier(VerificationError::Other(
|
||||
mock::TEST_ERROR
|
||||
)),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1190,7 +1192,9 @@ mod tests {
|
||||
message.reject_by_lane_verifier = true;
|
||||
assert_noop!(
|
||||
send_message::<TestRuntime, ()>(RuntimeOrigin::signed(1), TEST_LANE_ID, message,),
|
||||
Error::<TestRuntime, ()>::MessageRejectedByLaneVerifier,
|
||||
Error::<TestRuntime, ()>::MessageRejectedByLaneVerifier(VerificationError::Other(
|
||||
mock::TEST_ERROR
|
||||
)),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user