Skip to content

Commit

Permalink
Call To*InboundLaneApi::message_details() with batched messages (pari…
Browse files Browse the repository at this point in the history
…tytech#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>
  • Loading branch information
serban300 committed Apr 8, 2024
1 parent 1ae076d commit 8eb2c3a
Show file tree
Hide file tree
Showing 2 changed files with 251 additions and 184 deletions.
12 changes: 12 additions & 0 deletions bridges/relays/client-substrate/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 8eb2c3a

Please sign in to comment.