-
Notifications
You must be signed in to change notification settings - Fork 16
Description
iip: <to be assigned>
title: ICON BTP - MessageFragmentation
author: heonseung lee (@leeheonseung)
discussions-to: https://github.com/icon-project/IIPs/issues/tbd
status: Draft
type: Standards Track
category IRC
created: 2020-06-14
requires IIP-25
Simple Summary
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.
Abstract
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.
Motivation
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.
Specification
Relay
Interface
segment
func (s *sender) Segment(rm *module.RelayMessage, height int64) ([]*module.Segment, error)
- Description:
- Fragment Relay Message as much as Transaction Limit size.
relay
func (s *sender) Relay(segment *module.Segment) (module.GetResultParam, error)
- Description:
- If the RelayMessage size containing Block Proof exceeds the transaction to be transmitted, the RelayMessage is fragmented and delivered according to the size.
- If not exceeded, it is transmitted as a normal RelayMessage.
- Definition of index
- Indicates the sequence of fragment messages.
- The first index is total message count * -1
- The last index is 0
sendFragment
func (s *sender) sendFragment(rmp *BMCRelayMethodParams, idx int) (module.GetResultParam, error)
- Description:
- It indexes the fragmented message separated through the segment and transmits it to the targetchain.
BMC
Interface
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 BTP messages that come with _idx in the order of _idx.
- If _idx < 0, it is determined as the first message, and if _idx == 0, it is determined as the last fragmentaion message.
- Eg)
- -3, 1, 2, 0
- -1, 0
- Eg)
- 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.
Implementation
TBD
Copyright
Copyright and related rights waived via CC0.