Skip to content

Commit

Permalink
Merge pull request #6 from ulbqb/fix/tm_ibc_client
Browse files Browse the repository at this point in the history
feat!: change to use 07-tendermint
  • Loading branch information
ulbqb authored Mar 10, 2023
2 parents d855e1d + 7719baf commit 1309b24
Show file tree
Hide file tree
Showing 91 changed files with 680 additions and 681 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features
* [\#5](https://github.com/line/ibc-go/pull/5) apply the changes of lbm-sdk and ostracon proto
* [\#6](https://github.com/line/ibc-go/pull/6) change to use 07-tendermint

### Improvements
* [\#1](https://github.com/line/ibc-go/pull/1) apply all changes of `x/ibc` in lbm-sdk until [lbm-sdk@0fbc2fcae6dba90fa80b815cf3219d6fcf46fc64](https://github.com/line/lbm-sdk/tree/0fbc2fcae6dba90fa80b815cf3219d6fcf46fc64)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The Inter-Blockchain Communication protocol (IBC) allows blockchains to talk to

3.1 [ICS 06 Solo Machine](https://github.com/line/ibc-go/tree/main/modules/light-clients/06-solomachine)

3.2 [ICS 99 Ostracon](https://github.com/line/ibc-go/tree/main/modules/light-clients/99-ostracon)
3.2 [ICS 07 Tendermint](https://github.com/line/ibc-go/tree/main/modules/light-clients/07-tendermint)

Note: The localhost client is currently non-functional.

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ in for the IBC Golang repository. Please refer to the corresponding repositories

### Light Clients

- [`99-ostracon`](https://github.com/line/ibc-go/tree/main/modules/light-clients/99-ostracon)
- [`07-tendermint`](https://github.com/line/ibc-go/tree/main/modules/light-clients/07-tendermint)
260 changes: 130 additions & 130 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,6 @@
- [ibc/lightclients/localhost/v1/localhost.proto](#ibc/lightclients/localhost/v1/localhost.proto)
- [ClientState](#ibc.lightclients.localhost.v1.ClientState)

- [ibc/lightclients/ostracon/v1/ostracon.proto](#ibc/lightclients/ostracon/v1/ostracon.proto)
- [ClientState](#ibc.lightclients.ostracon.v1.ClientState)
- [ConsensusState](#ibc.lightclients.ostracon.v1.ConsensusState)
- [Fraction](#ibc.lightclients.ostracon.v1.Fraction)
- [Header](#ibc.lightclients.ostracon.v1.Header)
- [Misbehaviour](#ibc.lightclients.ostracon.v1.Misbehaviour)

- [ibc/lightclients/solomachine/v1/solomachine.proto](#ibc/lightclients/solomachine/v1/solomachine.proto)
- [ChannelStateData](#ibc.lightclients.solomachine.v1.ChannelStateData)
- [ClientState](#ibc.lightclients.solomachine.v1.ClientState)
Expand Down Expand Up @@ -271,6 +264,13 @@

- [DataType](#ibc.lightclients.solomachine.v2.DataType)

- [ibc/lightclients/tendermint/v1/tendermint.proto](#ibc/lightclients/tendermint/v1/tendermint.proto)
- [ClientState](#ibc.lightclients.tendermint.v1.ClientState)
- [ConsensusState](#ibc.lightclients.tendermint.v1.ConsensusState)
- [Fraction](#ibc.lightclients.tendermint.v1.Fraction)
- [Header](#ibc.lightclients.tendermint.v1.Header)
- [Misbehaviour](#ibc.lightclients.tendermint.v1.Misbehaviour)

- [Scalar Value Types](#scalar-value-types)


Expand Down Expand Up @@ -3352,129 +3352,6 @@ access to keys outside the client prefix.



<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="ibc/lightclients/ostracon/v1/ostracon.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/lightclients/ostracon/v1/ostracon.proto



<a name="ibc.lightclients.ostracon.v1.ClientState"></a>

### ClientState
ClientState from Ostracon tracks the current validator set, latest height,
and a possible frozen height.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `chain_id` | [string](#string) | | |
| `trust_level` | [Fraction](#ibc.lightclients.ostracon.v1.Fraction) | | |
| `trusting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | duration of the period since the LastestTimestamp during which the submitted headers are valid for upgrade |
| `unbonding_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | duration of the staking unbonding period |
| `max_clock_drift` | [google.protobuf.Duration](#google.protobuf.Duration) | | defines how much new (untrusted) header's Time can drift into the future. |
| `frozen_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Block height when the client was frozen due to a misbehaviour |
| `latest_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Latest height the client was updated to |
| `proof_specs` | [ics23.ProofSpec](#ics23.ProofSpec) | repeated | Proof specifications used in verifying counterparty state |
| `upgrade_path` | [string](#string) | repeated | Path at which next upgraded client will be committed. Each element corresponds to the key for a single CommitmentProof in the chained proof. NOTE: ClientState must stored under `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using the default upgrade module, upgrade_path should be []string{"upgrade", "upgradedIBCState"}` |
| `allow_update_after_expiry` | [bool](#bool) | | **Deprecated.** allow_update_after_expiry is deprecated |
| `allow_update_after_misbehaviour` | [bool](#bool) | | **Deprecated.** allow_update_after_misbehaviour is deprecated |






<a name="ibc.lightclients.ostracon.v1.ConsensusState"></a>

### ConsensusState
ConsensusState defines the consensus state from Ostracon.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `timestamp` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | timestamp that corresponds to the block height in which the ConsensusState was stored. |
| `root` | [ibc.core.commitment.v1.MerkleRoot](#ibc.core.commitment.v1.MerkleRoot) | | commitment root (i.e app hash) |
| `next_validators_hash` | [bytes](#bytes) | | |






<a name="ibc.lightclients.ostracon.v1.Fraction"></a>

### Fraction
Fraction defines the protobuf message type for tmmath.Fraction that only
supports positive values.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `numerator` | [uint64](#uint64) | | |
| `denominator` | [uint64](#uint64) | | |






<a name="ibc.lightclients.ostracon.v1.Header"></a>

### Header
Header defines the Ostracon client consensus Header.
It encapsulates all the information necessary to update from a trusted
Ostracon ConsensusState. The inclusion of TrustedHeight and
TrustedValidators allows this update to process correctly, so long as the
ConsensusState for the TrustedHeight exists, this removes race conditions
among relayers The SignedHeader and ValidatorSet are the new untrusted update
fields for the client. The TrustedHeight is the height of a stored
ConsensusState on the client that will be used to verify the new untrusted
header. The Trusted ConsensusState must be within the unbonding period of
current time in order to correctly verify, and the TrustedValidators must
hash to TrustedConsensusState.NextValidatorsHash since that is the last
trusted validator set at the TrustedHeight.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `signed_header` | [tendermint.types.SignedHeader](#tendermint.types.SignedHeader) | | |
| `validator_set` | [tendermint.types.ValidatorSet](#tendermint.types.ValidatorSet) | | |
| `trusted_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `trusted_validators` | [tendermint.types.ValidatorSet](#tendermint.types.ValidatorSet) | | |






<a name="ibc.lightclients.ostracon.v1.Misbehaviour"></a>

### Misbehaviour
Misbehaviour is a wrapper over two conflicting Headers
that implements Misbehaviour interface expected by ICS-02


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | **Deprecated.** ClientID is deprecated |
| `header_1` | [Header](#ibc.lightclients.ostracon.v1.Header) | | |
| `header_2` | [Header](#ibc.lightclients.ostracon.v1.Header) | | |





<!-- end messages -->

<!-- end enums -->
Expand Down Expand Up @@ -4121,6 +3998,129 @@ to preserve uniqueness of different data sign byte encodings.



<a name="ibc/lightclients/tendermint/v1/tendermint.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/lightclients/tendermint/v1/tendermint.proto



<a name="ibc.lightclients.tendermint.v1.ClientState"></a>

### ClientState
ClientState from Tendermint tracks the current validator set, latest height,
and a possible frozen height.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `chain_id` | [string](#string) | | |
| `trust_level` | [Fraction](#ibc.lightclients.tendermint.v1.Fraction) | | |
| `trusting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | duration of the period since the LastestTimestamp during which the submitted headers are valid for upgrade |
| `unbonding_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | duration of the staking unbonding period |
| `max_clock_drift` | [google.protobuf.Duration](#google.protobuf.Duration) | | defines how much new (untrusted) header's Time can drift into the future. |
| `frozen_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Block height when the client was frozen due to a misbehaviour |
| `latest_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Latest height the client was updated to |
| `proof_specs` | [ics23.ProofSpec](#ics23.ProofSpec) | repeated | Proof specifications used in verifying counterparty state |
| `upgrade_path` | [string](#string) | repeated | Path at which next upgraded client will be committed. Each element corresponds to the key for a single CommitmentProof in the chained proof. NOTE: ClientState must stored under `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using the default upgrade module, upgrade_path should be []string{"upgrade", "upgradedIBCState"}` |
| `allow_update_after_expiry` | [bool](#bool) | | **Deprecated.** allow_update_after_expiry is deprecated |
| `allow_update_after_misbehaviour` | [bool](#bool) | | **Deprecated.** allow_update_after_misbehaviour is deprecated |






<a name="ibc.lightclients.tendermint.v1.ConsensusState"></a>

### ConsensusState
ConsensusState defines the consensus state from Tendermint.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `timestamp` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | timestamp that corresponds to the block height in which the ConsensusState was stored. |
| `root` | [ibc.core.commitment.v1.MerkleRoot](#ibc.core.commitment.v1.MerkleRoot) | | commitment root (i.e app hash) |
| `next_validators_hash` | [bytes](#bytes) | | |






<a name="ibc.lightclients.tendermint.v1.Fraction"></a>

### Fraction
Fraction defines the protobuf message type for tmmath.Fraction that only
supports positive values.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `numerator` | [uint64](#uint64) | | |
| `denominator` | [uint64](#uint64) | | |






<a name="ibc.lightclients.tendermint.v1.Header"></a>

### Header
Header defines the Tendermint client consensus Header.
It encapsulates all the information necessary to update from a trusted
Tendermint ConsensusState. The inclusion of TrustedHeight and
TrustedValidators allows this update to process correctly, so long as the
ConsensusState for the TrustedHeight exists, this removes race conditions
among relayers The SignedHeader and ValidatorSet are the new untrusted update
fields for the client. The TrustedHeight is the height of a stored
ConsensusState on the client that will be used to verify the new untrusted
header. The Trusted ConsensusState must be within the unbonding period of
current time in order to correctly verify, and the TrustedValidators must
hash to TrustedConsensusState.NextValidatorsHash since that is the last
trusted validator set at the TrustedHeight.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `signed_header` | [tendermint.types.SignedHeader](#tendermint.types.SignedHeader) | | |
| `validator_set` | [tendermint.types.ValidatorSet](#tendermint.types.ValidatorSet) | | |
| `trusted_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `trusted_validators` | [tendermint.types.ValidatorSet](#tendermint.types.ValidatorSet) | | |






<a name="ibc.lightclients.tendermint.v1.Misbehaviour"></a>

### Misbehaviour
Misbehaviour is a wrapper over two conflicting Headers
that implements Misbehaviour interface expected by ICS-02


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | |
| `header_1` | [Header](#ibc.lightclients.tendermint.v1.Header) | | |
| `header_2` | [Header](#ibc.lightclients.tendermint.v1.Header) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



## Scalar Value Types

| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/host/types/ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
// the packet acknowledgement.
func NewErrorAcknowledgement(err error) channeltypes.Acknowledgement {
// the ABCI code is included in the abcitypes.ResponseDeliverTx hash
// constructed in Ostracon and is therefore determinstic
// constructed in Tendermint and is therefore determinstic
_, code, _ := sdkerrors.ABCIInfo(err, false) // discard non-deterministic codespace and log values

errorString := fmt.Sprintf("ABCI code: %d: %s", code, ackErrorString)
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ A general pseudo algorithm would look like the following:
3. Query the client state using the identifiers pair. Note that this query will return a `"Not
Found"` response if the current chain is not connected to this channel.
4. Retrieve the the client identifier or chain identifier from the client state (eg: on
Ostracon clients) and store it locally.
Tendermint clients) and store it locally.

Using the gRPC gataway client service the steps above would be, with a given IBC token `ibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2` stored on `chainB`:

Expand Down Expand Up @@ -101,7 +101,7 @@ In some [exceptional cases](https://github.com/cosmos/ibc-go/blob/main/docs/arch
To mitigate this, a client update governance proposal can be submitted to update the frozen client
with a new valid header. Once the proposal passes the client state will be unfrozen and the funds
from the associated channels will then be unlocked. This mechanism only applies to clients that
allow updates via governance, such as Ostracon clients.
allow updates via governance, such as Tendermint clients.

In addition to this, it's important to mention that a token must be sent back along the exact route
that it took originally un order to return it to its original form on the source chain (eg: the
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/types/ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
// the packet acknowledgement.
func NewErrorAcknowledgement(err error) channeltypes.Acknowledgement {
// the ABCI code is included in the abcitypes.ResponseDeliverTx hash
// constructed in Ostracon and is therefore deterministic
// constructed in Tendermint and is therefore deterministic
_, code, _ := sdkerrors.ABCIInfo(err, false) // discard non-determinstic codespace and log values

errorString := fmt.Sprintf("ABCI code: %d: %s", code, ackErrorString)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/line/ibc-go/v3/modules/core/02-client/keeper"
"github.com/line/ibc-go/v3/modules/core/exported"
ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/99-ostracon/types"
ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/07-tendermint/types"
)

// BeginBlocker updates an existing localhost client with the latest block height.
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
client "github.com/line/ibc-go/v3/modules/core/02-client"
"github.com/line/ibc-go/v3/modules/core/02-client/types"
"github.com/line/ibc-go/v3/modules/core/exported"
ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/07-tendermint/types"
localhosttypes "github.com/line/ibc-go/v3/modules/light-clients/09-localhost/types"
ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/99-ostracon/types"
ibctesting "github.com/line/ibc-go/v3/testing"
)

Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ func GetCmdQueryHeader() *cobra.Command {
cmd := &cobra.Command{
Use: "header",
Short: "Query the latest header of the running chain",
Long: "Query the latest Ostracon header of the running chain",
Long: "Query the latest Tendermint header of the running chain",
Example: fmt.Sprintf("%s query %s %s header", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
header, _, err := utils.QueryOstraconHeader(clientCtx)
header, _, err := utils.QueryTendermintHeader(clientCtx)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 1309b24

Please sign in to comment.