iip | title | author | discussions-to | status | type | category | created | requires |
---|---|---|---|---|---|---|---|---|
40 |
ICON BTP Message Fragmentation |
Heonseung Lee (@leeheonseung) |
Draft |
Standards Track |
IRC |
2020-06-14 |
25 |
If the size of the relay message containing the block proof of the SRC chain exceeds the transaction size allowed by the target chain, define and add logic to fragment the BTP message from the BMC to handle this.
If the size of Relay Message containing Block Proof larger than Transaction size of target chain, a problem occurs. To solve this, add the logic to fragment and assemble the Relay Message.
Block proof of the ICON chain can be verified in the BMV of the chain using only the parts related to BTP. However, in certain chains, it is sometimes necessary to receive and verify the entire Block Proof.
At this time, the ICON Relay Sender fragments the RelayMessage and delivers it to the ICON BMC, and it is necessary to assemble and verify it.
For this reason, there is no issue for ICON Block Proof verification on target chain, so BTP 1.1 implements it only on the ICON BMC.
handleFragment
void handleFragment(String _prev, String _msg, int _idx);
- Params
_prev
: String (BTP Address of the previous BMC)_msg
: String (Fragmented base64 encoded string of serialized bytes of Relay Message)_idx
: Integer (Index of fragment)
- Description:
- Concat the fragments of the Relay message that come with
_idx
in the order of_idx
. - If
_idx
is negative, it is determined as the first message, and if_idx
is zero, it is determined as the last fragmentaion message.- For example, if the number of fragments is 4, then
_idx
should be -3, 2, 1, 0 sequentially
- For example, if the number of fragments is 4, then
- Instead of verifying each time each fragmentation message is processed, it is assembled and verified when the last fragmentation message arrives.
- Assemble fragments of the Relay Message and call by
BMC.handleRelayMessage
. - It's allowed to be called by registered Relay.
- Concat the fragments of the Relay message that come with
TBD
Copyright and related rights waived via CC0.