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

ICS 11: IBC state optimizations / pruning #5

Closed
cwgoes opened this issue Feb 11, 2019 · 9 comments
Closed

ICS 11: IBC state optimizations / pruning #5

cwgoes opened this issue Feb 11, 2019 · 9 comments
Assignees
Labels
tao Transport, authentication, & ordering layer.

Comments

@cwgoes
Copy link
Contributor

cwgoes commented Feb 11, 2019

Primarily a port of the optimizations section of the original IBC spec.

Will cover:

  • Conditions under which packets can be pruned
  • Conditions under which channel data can be pruned
  • Conditions under which connection data can be pruned
  • Other possible state optimizations (storage rent, Merkle root tracking)
@cwgoes cwgoes added tao Transport, authentication, & ordering layer. stage-strawman labels Feb 11, 2019
@cwgoes cwgoes self-assigned this Mar 5, 2019
@cwgoes cwgoes changed the title ICS ?: IBC state optimizations / pruning ICS 11: IBC state optimizations / pruning Mar 5, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 19, 2019

Ref #48 - the more I think about this the more I think we should just separate availability from commitment instead of implementing pruning strategies.

@ebuchman
Copy link
Member

ebuchman commented Mar 25, 2019

we should just separate availability from commitment instead of implementing pruning strategies.

Can you clarify this further ? Specifically the impact on the spec

@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 26, 2019

In the original IBC specifications (that I have read, and the latest version in #36), packets were stored in full in the state of the outgoing chain, then later deleted once a receipt had been sent back from the destination chain.

I do not think this is necessary, and it might be an overly complex / costly (more transactions required) way to minimize state usage (especially when receipts are not required for the application layer) as compared to storing a much smaller commitment or updated accumulator root in the source chain. The destination chain, when it checks the inclusion proof, wants to verify:

  1. That the source chain finalized a particular packet
  2. That any state transitions (e.g. escrowing tokens) associated with sending that packet were executed

(2) already requires prior knowledge about how the source chain's state machine works, so I think we can instead have the source chain execute the packet but only store a commitment (e.g. sha256 hash) in state and prove storage of that commitment to the destination chain. The packet data will already be public (in the transaction history of the source chain), so relayers can read it and submit the packet on the destination chain, and the destination chain can calculate the hash of the packet data and verify inclusion of the hash in the most recent header from the source chain. If we do this, sending an extra receipt back to the source chain for packet cleanup is much less necessary, since the only stored value is a short commitment (and maybe not even that with better accumulator constructions).

Thoughts?

If this seems reasonable, I will write it up in more detail in #36. Source chains could still opt to store the packet data if desired, I just think it doesn't really need to be part of the protocol.

@ebuchman
Copy link
Member

ebuchman commented Mar 26, 2019

Oh interesting - so just store the hash in the egress queue rather than the whole packet. I guess the only concern may be re data availability, eg if the source needs to do a dump/restart and loses its tx history

@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 26, 2019

Oh interesting - so just store the hash in the egress queue rather than the whole packet.

Yes, precisely.

I guess the only concern may be re data availability, eg if the source needs to do a dump/restart and loses its tx history

That's true but seems like an exceptional case - a chain would have to be export-imported, restarted, and all nodes (or all nodes willing to provide the data) would need to have deleted their transaction history.

Even in that case, if the packet had a timeout, a new one could just be resent after the new chain started.

If there is at least a minor incentive to relay packets (including just an incentive for the original sender, if they are acting as their own relayer) nodes seem likely to keep the transaction data.

@mossid
Copy link

mossid commented Mar 26, 2019

I agree that commitment values are much efficient on space occupiation & there are almost no drawbacks. I'm just not sure is it better to enforce that in the core protocol, we can easily implement a wrapper to make the IBC applications store the hashes (which is treated as a plain text by the IBC logic) instead of the actual values.

Also, we need a way to query original data from only the transaction and the state machine, without storing it in the state, which will be tricky. It is more like an implementation issue. Especially there can be cases where the transactions do not include the packet data: the packet can be generated from the state and the state machine, without relying on the transaction(e.g. a heartbeat ibc packet generated on endblocker...?) which needs the full state for the relayers to acknowledge about the packet data

@cwgoes
Copy link
Contributor Author

cwgoes commented May 15, 2019

Not yet sure if this will need to be separate from ICS 4 or not.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 21, 2019

I think this can be part of ICS 4.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jun 6, 2019

Superseded by ICS 4, which covers everything we should need for the moment.

@cwgoes cwgoes closed this as completed Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tao Transport, authentication, & ordering layer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants