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

ibc: delete packet commitments instead of writing empty values #4644

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

avahowell
Copy link
Contributor

The IBC spec calls for deletion of packet commitments after a successful acknowledgement, in order to avoid double-acknowledgements.

Previously, our implementation accomplished this deletion by writing an empty byte slice vec![] to the commitment path.

However, this will cause nonexistence proofs by exclusion (the standard NX-proof type used in ics23) of adjacent keys to fail, since ics23 does not support existence proofs of empty values. We observed this when timeouts from osmosis testnet failed to verify the NX proofs from penumbra testnet.

This PR changes delete_packet_commitment to actually delete the commitment, and introduces a migration for testnet 78 that will delete all of the previously overwritten commitments.

@avahowell avahowell added the consensus-breaking breaking change to execution of on-chain data label Jun 19, 2024
@avahowell avahowell requested a review from erwanor June 19, 2024 18:38
@erwanor erwanor added A-IBC Area: IBC integration with Penumbra state-breaking breaking change to on-chain data migration A pull request that contains a migration labels Jun 19, 2024
Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK on the change, and the migration looks correct too.

To test this, we can:

  1. Halt a full node running the current chain
  2. Perform the migration (using --force)
  3. Start the node again with peering disabled
  4. Run pcli query key ibc-data/commitments/ports/transfer/channels/channel-7/sequences/7
  5. Observe Not found

@avahowell
Copy link
Contributor Author

avahowell commented Jun 19, 2024

One thing that occurred to me is that perhaps we should make a design change to the storage API to prevent writing empty values, since any empty value (in the ibc substore) will cause this problem

crates/bin/pd/src/migrate/testnet78.rs Outdated Show resolved Hide resolved
The IBC spec calls for deletion of packet commitments after a
successful acknowledgement, in order to avoid double-acknowledgements.

Previously, our implementation accomplished this deletion by writing
an empty byte slice vec![] to the commitment path.

However, this will cause nonexistence proofs by exclusion (the
standard NX-proof type used in ics23) of adjacent keys to fail,
since ics23 does not support existence proofs of empty values.

This PR changes `delete_packet_commitment` to actually delete the
commitment, and introduces a migration for testnet 78 that will
delete all of the previously overwritten commitments.
@erwanor
Copy link
Member

erwanor commented Jun 21, 2024

Error: key not found! key=ibc-data/commitments/ports/transfer/channels/channel-7/sequences/7

We got it, while testing I found a couple issues with prefix caching, I will open issues shortly. This PR works though, so approving and merging on green CI.

Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested the migration on current chain state.

@erwanor erwanor merged commit 623872b into main Jun 21, 2024
13 checks passed
@erwanor erwanor deleted the ibc-key-deletion-timeout-fix branch June 21, 2024 02:40
avahowell added a commit that referenced this pull request Jun 24, 2024
The IBC spec calls for deletion of packet commitments after a
successful acknowledgement, in order to avoid double-acknowledgements.

Previously, our implementation accomplished this deletion by writing
an empty byte slice vec![] to the commitment path.

However, this will cause nonexistence proofs by exclusion (the
standard NX-proof type used in ics23) of adjacent keys to fail,
since ics23 does not support existence proofs of empty values.

This PR changes `delete_packet_commitment` to actually delete the
commitment, and introduces a migration for testnet 78 that will
delete all of the previously overwritten commitments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-IBC Area: IBC integration with Penumbra consensus-breaking breaking change to execution of on-chain data migration A pull request that contains a migration state-breaking breaking change to on-chain data
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants