Call To*InboundLaneApi::message_details() with batched messages (#1545)

* generated_message_details() -> Simplifications

- avoid using a HashMap for `messages_to_refine`. It seems that a vec is
  enough
- minimize the number of conversions between `OutboundMessageDetails` and
  `MessageDetails`
- use references where possible in order to minimize the number of
  intermediary Vecs
- simplify `make_message_details_map()` logic, reduce its scope and rename
  it to `validate_out_msgs_details()`

Signed-off-by: Serban Iorga <serban@parity.io>

* Define typed_state_call()

Signed-off-by: Serban Iorga <serban@parity.io>

* Call To*InboundLaneApi::message_details() with single messages

Signed-off-by: Serban Iorga <serban@parity.io>

* Call To*InboundLaneApi::message_details() with batched messages

Signed-off-by: Serban Iorga <serban@parity.io>

* validate_out_msgs_details() -> change check

* Define split_msgs_to_refine()

Signed-off-by: Serban Iorga <serban@parity.io>

Signed-off-by: Serban Iorga <serban@parity.io>
This commit is contained in:
Serban Iorga
2022-08-10 19:46:31 +03:00
committed by Bastian Köcher
parent 5b23fd0f9e
commit 050b12f3aa
2 changed files with 253 additions and 186 deletions
@@ -545,6 +545,18 @@ impl<C: Chain> Client<C> {
.await
}
/// Execute runtime call at given block, provided the input and output types.
/// It also performs the input encode and output decode.
pub async fn typed_state_call<Input: codec::Encode, Output: codec::Decode>(
&self,
method_name: String,
input: Input,
at_block: Option<C::Hash>,
) -> Result<Output> {
let encoded_output = self.state_call(method_name, Bytes(input.encode()), at_block).await?;
Output::decode(&mut &encoded_output.0[..]).map_err(Error::ResponseParseFailed)
}
/// Execute runtime call at given block.
pub async fn state_call(
&self,