Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalized v2 IBC payload header structure #1151

Open
soareschen opened this issue Oct 4, 2024 · 0 comments
Open

Generalized v2 IBC payload header structure #1151

soareschen opened this issue Oct 4, 2024 · 0 comments

Comments

@soareschen
Copy link

soareschen commented Oct 4, 2024

In #1149, the proposed structure for Payload contains the metadata fields version and encoding. The encoding field is intended to communicate about the encoding format of the appData bytes, and it can be generalized into content-type and follows the MIME standard. The version field is intended to be backward compatible with the original version field used in v1 IBC handshake. However, we have seen in IBCv1 that version has been overused to contain multiple overloaded metadata encoded in an ad-hoc way that cannot be easily composed or extended.

In this issue, I propose that we should consider allowing multiple generalized headers to be present in the IBC payload as a key-value map. This would follow similar structure as HTTP headers, and can be used to store arbitrary metadata about the payload body. Under this scheme, the content-type header becomes an optional header that may be present as one of the entries in this generalized headers map. This would allow different parts of the application to specify different headers without having to cram them as a single value. For example, the incentivized fees for relayers may be specified as a separate field such as forward-relayed-by. If we remove IBC ack as specified in #1150, then the original ack may be converted into a normal IBC packet that contains headers such as payload-type: ack, ack-nonce, ack-status etc.

The main complexity that arise from this proposal is how we should encode the IBC payload headers. One consideration is that we should perhaps keep it limited, similar to HTTP headers, so that applications are not encouraged to add arbitrary nested complex data into the headers. For instance, the encoding should not be plain CBOR or JSON, which would allow arbitrary nested values in the headers. Another consideration is on whether we should require canonicalization of the header keys, e.g. so that they are case insensitive, or that only lower cases are allowed. Similarly, we may want the header values to contain basic ASCII characters with no new lines. All in all, we may consider a format similar to HTTP headers, since they are already battle tested to support all kinds of use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant