Skip to content

Commit

Permalink
refactor: solomachine generic verification methods and signbytes simp…
Browse files Browse the repository at this point in the history
…lification (cosmos#1687)

* adding new SignBytes type, generic membership verification implementation and tests

* adding protodocs

* updating comment

* refactor: solomachine misbehaviour checking (cosmos#1715)

* adding SignatureAndDataV2 proto message type

* updating misbehaviour checking

* removing dead solomachine code (cosmos#1716)

* updating tests with concrete ibc core types

* refactor: solomachine generic VerifyNonMembership (cosmos#1720)

* adding verification of non-membership with tests

* refactor common code to produceVerificationArgs

* removing unused produce args func

* Update modules/light-clients/06-solomachine/client_state_test.go

Co-authored-by: colin axnér <[email protected]>

Co-authored-by: colin axnér <[email protected]>

* removing V2 suffix from SignBytes and SignatureAndData types

* use current diversifier when verifying header details

* Add test for new diversifier for solomachine (cosmos#1860)

* add test for successful new diversifier

* add changelog entry

* fix tests

* restoring solomachine/v2 protos, updadting v2 codegen path and adding solomachine/v3 protobuf defs

* adding changelog entries

Co-authored-by: colin axnér <[email protected]>
  • Loading branch information
2 people authored and oshorefueled committed Aug 9, 2022
1 parent 8804ca4 commit 4662bb0
Show file tree
Hide file tree
Showing 24 changed files with 5,718 additions and 4,375 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (transfer) [\#1250](https://github.com/cosmos/ibc-go/pull/1250) Deprecate `GetTransferAccount` since the `transfer` module account is never used.
* (06-solomachine) [\#1679](https://github.com/cosmos/ibc-go/pull/1679) Remove `types` sub-package from `06-solomachine` lightclient directory.
* (07-tendermint) [\#1677](https://github.com/cosmos/ibc-go/pull/1677) Remove `types` sub-package from `07-tendermint` lightclient directory.
* (06-solomachine) [\#1687](https://github.com/cosmos/ibc-go/pull/1687) Bump `06-solomachine` protobuf version from `v2` to `v3`.
* (06-solomachine) [\#1687](https://github.com/cosmos/ibc-go/pull/1687) Removed `DataType` enum and associated message types from `06-solomachine`. `DataType` has been removed from `SignBytes` and `SignatureAndData` in favour of `path`.

### State Machine Breaking

Expand Down Expand Up @@ -79,6 +81,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (light-clients/solomachine) [#1839](https://github.com/cosmos/ibc-go/issues/1839) Fixed usage of the new diversifier in validation of changing diversifiers for the solo machine. The current diversifier must sign over the new diversifier.
* (modules/core/04-channel) [\#1130](https://github.com/cosmos/ibc-go/pull/1130) Call `packet.GetSequence()` rather than passing func in `WriteAcknowledgement` log output
* (apps/29-fee) [\#1278](https://github.com/cosmos/ibc-go/pull/1278) The URI path for the query to get all incentivized packets for a specifc channel did not follow the same format as the rest of queries.
* (07-tendermint) [\#1674](https://github.com/cosmos/ibc-go/pull/1674) Submitted ClientState is zeroed out before checking the proof in order to prevent the proposal from containing information governance is not actually voting on.
Expand Down
175 changes: 174 additions & 1 deletion docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@

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

- [ibc/lightclients/solomachine/v3/solomachine.proto](#ibc/lightclients/solomachine/v3/solomachine.proto)
- [ClientState](#ibc.lightclients.solomachine.v3.ClientState)
- [ConsensusState](#ibc.lightclients.solomachine.v3.ConsensusState)
- [Header](#ibc.lightclients.solomachine.v3.Header)
- [HeaderData](#ibc.lightclients.solomachine.v3.HeaderData)
- [Misbehaviour](#ibc.lightclients.solomachine.v3.Misbehaviour)
- [SignBytes](#ibc.lightclients.solomachine.v3.SignBytes)
- [SignatureAndData](#ibc.lightclients.solomachine.v3.SignatureAndData)
- [TimestampedSignatureData](#ibc.lightclients.solomachine.v3.TimestampedSignatureData)

- [ibc/lightclients/tendermint/v1/tendermint.proto](#ibc/lightclients/tendermint/v1/tendermint.proto)
- [ClientState](#ibc.lightclients.tendermint.v1.ClientState)
- [ConsensusState](#ibc.lightclients.tendermint.v1.ConsensusState)
Expand Down Expand Up @@ -4904,7 +4914,7 @@ of a sequence and two signatures over different messages at that sequence.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | **Deprecated.** ClientID is deprecated |
| `client_id` | [string](#string) | | |
| `sequence` | [uint64](#uint64) | | |
| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | |
| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | |
Expand Down Expand Up @@ -5066,6 +5076,169 @@ to preserve uniqueness of different data sign byte encodings.



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

## ibc/lightclients/solomachine/v3/solomachine.proto



<a name="ibc.lightclients.solomachine.v3.ClientState"></a>

### ClientState
ClientState defines a solo machine client that tracks the current consensus
state and if the client is frozen.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sequence` | [uint64](#uint64) | | latest sequence of the client state |
| `is_frozen` | [bool](#bool) | | frozen sequence of the solo machine |
| `consensus_state` | [ConsensusState](#ibc.lightclients.solomachine.v3.ConsensusState) | | |
| `allow_update_after_proposal` | [bool](#bool) | | when set to true, will allow governance to update a solo machine client. The client will be unfrozen if it is frozen. |






<a name="ibc.lightclients.solomachine.v3.ConsensusState"></a>

### ConsensusState
ConsensusState defines a solo machine consensus state. The sequence of a
consensus state is contained in the "height" key used in storing the
consensus state.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `public_key` | [google.protobuf.Any](#google.protobuf.Any) | | public key of the solo machine |
| `diversifier` | [string](#string) | | diversifier allows the same public key to be re-used across different solo machine clients (potentially on different chains) without being considered misbehaviour. |
| `timestamp` | [uint64](#uint64) | | |






<a name="ibc.lightclients.solomachine.v3.Header"></a>

### Header
Header defines a solo machine consensus header


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sequence` | [uint64](#uint64) | | sequence to update solo machine public key at |
| `timestamp` | [uint64](#uint64) | | |
| `signature` | [bytes](#bytes) | | |
| `new_public_key` | [google.protobuf.Any](#google.protobuf.Any) | | |
| `new_diversifier` | [string](#string) | | |






<a name="ibc.lightclients.solomachine.v3.HeaderData"></a>

### HeaderData
HeaderData returns the SignBytes data for update verification.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `new_pub_key` | [google.protobuf.Any](#google.protobuf.Any) | | header public key |
| `new_diversifier` | [string](#string) | | header diversifier |






<a name="ibc.lightclients.solomachine.v3.Misbehaviour"></a>

### Misbehaviour
Misbehaviour defines misbehaviour for a solo machine which consists
of a sequence and two signatures over different messages at that sequence.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | **Deprecated.** ClientID is deprecated |
| `sequence` | [uint64](#uint64) | | |
| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v3.SignatureAndData) | | |
| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v3.SignatureAndData) | | |






<a name="ibc.lightclients.solomachine.v3.SignBytes"></a>

### SignBytes
SignBytes defines the signed bytes used for signature verification.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sequence` | [uint64](#uint64) | | the sequence number |
| `timestamp` | [uint64](#uint64) | | the proof timestamp |
| `diversifier` | [string](#string) | | the public key diversifier |
| `path` | [bytes](#bytes) | | the standardised path bytes |
| `data` | [bytes](#bytes) | | the marshaled data bytes |






<a name="ibc.lightclients.solomachine.v3.SignatureAndData"></a>

### SignatureAndData
SignatureAndData contains a signature and the data signed over to create that
signature.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `signature` | [bytes](#bytes) | | |
| `path` | [bytes](#bytes) | | |
| `data` | [bytes](#bytes) | | |
| `timestamp` | [uint64](#uint64) | | |






<a name="ibc.lightclients.solomachine.v3.TimestampedSignatureData"></a>

### TimestampedSignatureData
TimestampedSignatureData contains the signature data and the timestamp of the
signature.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `signature_data` | [bytes](#bytes) | | |
| `timestamp` | [uint64](#uint64) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



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

Expand Down
Loading

0 comments on commit 4662bb0

Please sign in to comment.