diff --git a/docs/architecture/README.md b/docs/architecture/README.md index c64eb3c19f..b50a2fd3d0 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -25,12 +25,14 @@ To suggest an ADR, please make use of the [ADR template](./adr-template.md) prov ## Table of Contents -| ADR \# | Description | Status | -|--------------------------------------------------|-----------------------------------| ------ | -| [001](./adr-001-repo.md) | Repository structure for `ibc-rs` | Accepted | -| [002](./adr-002-ibc-relayer.md) | IBC Relayer in Rust | Accepted | -| [003](./adr-003-handler-implementation.md) | IBC handlers implementation | Accepted | -| [004](./adr-004-relayer-domain-decomposition.md) | Relayer domain decomposition | Accepted | -| [005](./adr-005-relayer-v0-implementation.md) | Relayer v0 implementation | Accepted | -| [006](./adr-006-hermes-v0.2-usecases.md) | Hermes v0.2.0 Use-Cases | Proposed | -| [007](./adr-007-ics20-implementation.md) | ICS20 implementation | Proposed | +| ADR \# | Description | Status | +| ------ | ----------- | ------ | +| [001](./adr-001-repo.md) | Repository structure for `ibc-rs` | Accepted | +| [002](./adr-002-ibc-relayer.md) | IBC Relayer in Rust | Accepted | +| [003](./adr-003-handler-implementation.md) | IBC handlers implementation | Accepted | +| [004](./adr-004-relayer-domain-decomposition.md) | Relayer domain decomposition | Accepted | +| [005](./adr-005-relayer-v0-implementation.md) | Relayer v0 implementation | Accepted | +| [006](./adr-006-hermes-v0.2-usecases.md) | Hermes v0.2.0 Use-Cases | Proposed | +| [007](./adr-007-error.md) | Error Management | Accepted | +| [008](./adr-008-ics20-implementation.md) | ICS20 implementation | Accepted | +| [009](./adr-009-chain-endpoint-handle-standardization.md) | ChainEndpoint and ChainHandle methods standardization | Accepted | diff --git a/docs/architecture/adr-007-ics20-implementation.md b/docs/architecture/adr-008-ics20-implementation.md similarity index 99% rename from docs/architecture/adr-007-ics20-implementation.md rename to docs/architecture/adr-008-ics20-implementation.md index be8f7cc2b3..3839a2315a 100644 --- a/docs/architecture/adr-007-ics20-implementation.md +++ b/docs/architecture/adr-008-ics20-implementation.md @@ -1,4 +1,8 @@ -# ADR 007: ICS20 Implementation Proposal +# ADR 008: ICS20 Implementation Proposal + +## Status + +Accepted ## Changelog @@ -213,9 +217,6 @@ pub fn refund_packet_token(_ctx: &Ctx, _data: &FungibleTokenPacketData) -> } ``` -## Status - -Proposed ## Consequences diff --git a/docs/architecture/adr-009-chain-endpoint-handle-standardization.md b/docs/architecture/adr-009-chain-endpoint-handle-standardization.md new file mode 100644 index 0000000000..9073842ea4 --- /dev/null +++ b/docs/architecture/adr-009-chain-endpoint-handle-standardization.md @@ -0,0 +1,51 @@ +# ADR 009: ChainEndpoint and ChainHandle methods standardization + +## Status + +Accepted - The PR has been merged in [#2108](https://github.com/informalsystems/ibc-rs/pull/2108) + +## Changelog +* 2022-04-19: Initial Proposal + +## Context +There is a lot of common methods in the `ChainHandle` and `ChainEndpoint` traits, sometimes with minute differences between one another. This document provides a way to remove the duplication of methods for increased maintainability of the codebase, along with a few suggestions to standardize the method signatures. + +## Decision + +### Query methods parameters +There are currently discrepancies between how methods take their arguments. Some take a `request` object, and others take fine-grained arguments that will be used to build a `request` object in the implementation of the method. For example, `query_consensus_state()` takes arguments that will be used to build a request object, whereas `query_consensus_states()` takes a request object directly. +```rust +fn query_consensus_state( + &self, + client_id: ClientId, + consensus_height: Height, + query_height: Height, +) -> ...; + +fn query_consensus_states( + &self, + request: QueryConsensusStatesRequest, +) -> ...; +``` + +All methods will be refactored to take a request object as argument. + +### Query request objects +Currently, the type for the request objects is the "raw type", coming from the compiled protobuf files. For each such type, we will create a corresponding domain type, following a similar pattern as elsewhere in the codebase. + +This will allow us to modify the domain type as we wish, without requiring a change in the protobuf file (and thus, requiring a change in the communication protocol). A first such change of the domain type we foresee would alter the type to specify a height in queries; however this is out of scope for this particular ADR. + + +## Consequences + +### Positive ++ The protobuf types are not exposed directly, which allows `hermes` to work with future non-tendermint chains ++ Increased readability of the codebase; similar methods have a similar format + +### Negative + + +## References + +* [Option type should be used with non-zero Height #1009](https://github.com/informalsystems/ibc-rs/issues/1009) + + The new domain types proposed here, as well as the reduced deduplication of methods, will make fixing this issue easier