mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 16:55:43 +00:00
Limit messages weight in batch (#496)
* limit messages in the batch by weight/count * fixed components compilation * reverted obsolete parts of #469 * implement generated_messages_weights * actually use computed weight in message proof * fmt and clippy * fixed TODO * clippy * Update relays/messages-relay/src/message_race_loop.rs Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com> * add issue reference * add assert message * grumbles * fmt * reexport weight from bp-message-lane Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com> Co-authored-by: Hernando Castano <castano.ha@gmail.com>
This commit is contained in:
committed by
Bastian Köcher
parent
e515f4fb62
commit
23f5f3cdd6
@@ -23,7 +23,6 @@ use crate::{ConnectionParams, Error, Result};
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_runtime::InstanceId;
|
||||
use codec::Decode;
|
||||
use frame_support::weights::Weight;
|
||||
use frame_system::AccountInfo;
|
||||
use jsonrpsee::common::DeserializeOwned;
|
||||
use jsonrpsee::raw::RawClient;
|
||||
@@ -215,8 +214,8 @@ impl<C: Chain> Client<C> {
|
||||
range: RangeInclusive<MessageNonce>,
|
||||
include_outbound_lane_state: bool,
|
||||
at_block: C::Hash,
|
||||
) -> Result<(Weight, StorageProof)> {
|
||||
let (dispatch_weight, encoded_trie_nodes) = SubstrateMessageLane::<C, _, _>::prove_messages(
|
||||
) -> Result<StorageProof> {
|
||||
let encoded_trie_nodes = SubstrateMessageLane::<C, _, _>::prove_messages(
|
||||
&self.client,
|
||||
instance,
|
||||
lane,
|
||||
@@ -229,7 +228,7 @@ impl<C: Chain> Client<C> {
|
||||
.map_err(Error::Request)?;
|
||||
let decoded_trie_nodes: Vec<Vec<u8>> =
|
||||
Decode::decode(&mut &encoded_trie_nodes[..]).map_err(Error::ResponseParseFailed)?;
|
||||
Ok((dispatch_weight, StorageProof::new(decoded_trie_nodes)))
|
||||
Ok(StorageProof::new(decoded_trie_nodes))
|
||||
}
|
||||
|
||||
/// Returns proof-of-message(s) delivery.
|
||||
|
||||
@@ -36,6 +36,8 @@ pub enum Error {
|
||||
ResponseParseFailed(codec::Error),
|
||||
/// Account does not exist on the chain.
|
||||
AccountDoesNotExist,
|
||||
/// Custom logic error.
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
impl From<WsNewDnsError> for Error {
|
||||
@@ -69,6 +71,7 @@ impl ToString for Error {
|
||||
Self::Request(e) => e.to_string(),
|
||||
Self::ResponseParseFailed(e) => e.what().to_string(),
|
||||
Self::AccountDoesNotExist => "Account does not exist on the chain".into(),
|
||||
Self::Custom(e) => e.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ use crate::chain::Chain;
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_runtime::InstanceId;
|
||||
use frame_support::weights::Weight;
|
||||
use sp_core::{
|
||||
storage::{StorageData, StorageKey},
|
||||
Bytes,
|
||||
@@ -63,7 +62,7 @@ jsonrpsee::rpc_api! {
|
||||
end: MessageNonce,
|
||||
include_outbound_lane_state: bool,
|
||||
block: Option<C::Hash>,
|
||||
) -> (Weight, Bytes);
|
||||
) -> Bytes;
|
||||
|
||||
#[rpc(method = "messageLane_proveMessagesDelivery", positional_params)]
|
||||
fn prove_messages_delivery(
|
||||
|
||||
Reference in New Issue
Block a user