cosmos / ibc-rs

Rust implementation of the Inter-Blockchain Communication (IBC) protocol.
Apache License 2.0
181 stars 73 forks source link

feat(ibc-core): port capability #1258

Open rnbguy opened 2 weeks ago

rnbguy commented 2 weeks ago

Closes: #519

Description

Ref: https://github.com/cosmos/ibc/blob/main/spec/core/ics-005-port-allocation/README.md


PR author checklist:

Reviewer checklist:

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 81.48148% with 20 lines in your changes missing coverage. Please review.

Project coverage is 67.34%. Comparing base (8424f69) to head (4c0d95f).

Files Patch % Lines
...ics24-host/types/src/identifiers/capability_key.rs 28.57% 10 Missing :warning:
ibc-testkit/src/testapp/ibc/core/types.rs 55.55% 4 Missing :warning:
...rc/testapp/ibc/applications/nft_transfer/module.rs 0.00% 3 Missing :warning:
...s/ics721-nft-transfer/src/handler/send_transfer.rs 0.00% 2 Missing :warning:
ibc-testkit/src/testapp/ibc/core/core_ctx.rs 97.14% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1258 +/- ## ========================================== + Coverage 67.27% 67.34% +0.07% ========================================== Files 235 236 +1 Lines 23538 23635 +97 ========================================== + Hits 15836 15918 +82 - Misses 7702 7717 +15 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rnbguy commented 2 weeks ago

We do need to locally maintain a capability key for each module. Which should be used to authenticate the modules.

This should be unique to each Module type. This is the only way to make sure different modules can't commit packets on the same ports - even though a malicious module tries to forge a Module identifier.

The capability keys shouldn't be committed to the blockchain store - as they are local and probably distinct across different builds. We can use TypeId for this local capability key - but need to check if using TypeId is ok from a security perspective.