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

change FrozenSequence to boolean in solo machine #169

Merged
merged 7 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking

* (06-solomachine) [\#169](https://github.com/cosmos/ibc-go/pull/169) Change FrozenSequence to boolean in solomachine ClientState. The solo machine proto package has been bumped from `v1` to `v2`.
* (modules) [\#162](https://github.com/cosmos/ibc-go/pull/162) Remove deprecated Handler types in core IBC and the ICS 20 transfer module.
* (modules/core) [\#161](https://github.com/cosmos/ibc-go/pull/161) Remove Type(), Route(), GetSignBytes() from 02-client, 03-connection, and 04-channel messages.
* (modules) [\#140](https://github.com/cosmos/ibc-go/pull/140) IsFrozen() client state interface changed to Status(). gRPC `ClientStatus` route added.
Expand Down
86 changes: 43 additions & 43 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,25 @@
- [ibc/lightclients/localhost/v1/localhost.proto](#ibc/lightclients/localhost/v1/localhost.proto)
- [ClientState](#ibc.lightclients.localhost.v1.ClientState)

- [ibc/lightclients/solomachine/v1/solomachine.proto](#ibc/lightclients/solomachine/v1/solomachine.proto)
- [ChannelStateData](#ibc.lightclients.solomachine.v1.ChannelStateData)
- [ClientState](#ibc.lightclients.solomachine.v1.ClientState)
- [ClientStateData](#ibc.lightclients.solomachine.v1.ClientStateData)
- [ConnectionStateData](#ibc.lightclients.solomachine.v1.ConnectionStateData)
- [ConsensusState](#ibc.lightclients.solomachine.v1.ConsensusState)
- [ConsensusStateData](#ibc.lightclients.solomachine.v1.ConsensusStateData)
- [Header](#ibc.lightclients.solomachine.v1.Header)
- [HeaderData](#ibc.lightclients.solomachine.v1.HeaderData)
- [Misbehaviour](#ibc.lightclients.solomachine.v1.Misbehaviour)
- [NextSequenceRecvData](#ibc.lightclients.solomachine.v1.NextSequenceRecvData)
- [PacketAcknowledgementData](#ibc.lightclients.solomachine.v1.PacketAcknowledgementData)
- [PacketCommitmentData](#ibc.lightclients.solomachine.v1.PacketCommitmentData)
- [PacketReceiptAbsenceData](#ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData)
- [SignBytes](#ibc.lightclients.solomachine.v1.SignBytes)
- [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData)
- [TimestampedSignatureData](#ibc.lightclients.solomachine.v1.TimestampedSignatureData)
- [ibc/lightclients/solomachine/v2/solomachine.proto](#ibc/lightclients/solomachine/v2/solomachine.proto)
- [ChannelStateData](#ibc.lightclients.solomachine.v2.ChannelStateData)
- [ClientState](#ibc.lightclients.solomachine.v2.ClientState)
- [ClientStateData](#ibc.lightclients.solomachine.v2.ClientStateData)
- [ConnectionStateData](#ibc.lightclients.solomachine.v2.ConnectionStateData)
- [ConsensusState](#ibc.lightclients.solomachine.v2.ConsensusState)
- [ConsensusStateData](#ibc.lightclients.solomachine.v2.ConsensusStateData)
- [Header](#ibc.lightclients.solomachine.v2.Header)
- [HeaderData](#ibc.lightclients.solomachine.v2.HeaderData)
- [Misbehaviour](#ibc.lightclients.solomachine.v2.Misbehaviour)
- [NextSequenceRecvData](#ibc.lightclients.solomachine.v2.NextSequenceRecvData)
- [PacketAcknowledgementData](#ibc.lightclients.solomachine.v2.PacketAcknowledgementData)
- [PacketCommitmentData](#ibc.lightclients.solomachine.v2.PacketCommitmentData)
- [PacketReceiptAbsenceData](#ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData)
- [SignBytes](#ibc.lightclients.solomachine.v2.SignBytes)
- [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData)
- [TimestampedSignatureData](#ibc.lightclients.solomachine.v2.TimestampedSignatureData)

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

- [ibc/lightclients/tendermint/v1/tendermint.proto](#ibc/lightclients/tendermint/v1/tendermint.proto)
- [ClientState](#ibc.lightclients.tendermint.v1.ClientState)
Expand Down Expand Up @@ -2905,14 +2905,14 @@ access to keys outside the client prefix.



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

## ibc/lightclients/solomachine/v1/solomachine.proto
## ibc/lightclients/solomachine/v2/solomachine.proto



<a name="ibc.lightclients.solomachine.v1.ChannelStateData"></a>
<a name="ibc.lightclients.solomachine.v2.ChannelStateData"></a>

### ChannelStateData
ChannelStateData returns the SignBytes data for channel state
Expand All @@ -2929,7 +2929,7 @@ verification.



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

### ClientState
ClientState defines a solo machine client that tracks the current consensus
Expand All @@ -2939,16 +2939,16 @@ state and if the client is frozen.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sequence` | [uint64](#uint64) | | latest sequence of the client state |
| `frozen_sequence` | [uint64](#uint64) | | frozen sequence of the solo machine |
| `consensus_state` | [ConsensusState](#ibc.lightclients.solomachine.v1.ConsensusState) | | |
| `is_frozen` | [bool](#bool) | | frozen sequence of the solo machine |
| `consensus_state` | [ConsensusState](#ibc.lightclients.solomachine.v2.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.v1.ClientStateData"></a>
<a name="ibc.lightclients.solomachine.v2.ClientStateData"></a>

### ClientStateData
ClientStateData returns the SignBytes data for client state verification.
Expand All @@ -2964,7 +2964,7 @@ ClientStateData returns the SignBytes data for client state verification.



<a name="ibc.lightclients.solomachine.v1.ConnectionStateData"></a>
<a name="ibc.lightclients.solomachine.v2.ConnectionStateData"></a>

### ConnectionStateData
ConnectionStateData returns the SignBytes data for connection state
Expand All @@ -2981,7 +2981,7 @@ verification.



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

### ConsensusState
ConsensusState defines a solo machine consensus state. The sequence of a
Expand All @@ -3000,7 +3000,7 @@ consensus state.



<a name="ibc.lightclients.solomachine.v1.ConsensusStateData"></a>
<a name="ibc.lightclients.solomachine.v2.ConsensusStateData"></a>

### ConsensusStateData
ConsensusStateData returns the SignBytes data for consensus state
Expand All @@ -3017,7 +3017,7 @@ verification.



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

### Header
Header defines a solo machine consensus header
Expand All @@ -3036,7 +3036,7 @@ Header defines a solo machine consensus header



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

### HeaderData
HeaderData returns the SignBytes data for update verification.
Expand All @@ -3052,7 +3052,7 @@ HeaderData returns the SignBytes data for update verification.



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

### Misbehaviour
Misbehaviour defines misbehaviour for a solo machine which consists
Expand All @@ -3063,15 +3063,15 @@ of a sequence and two signatures over different messages at that sequence.
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | |
| `sequence` | [uint64](#uint64) | | |
| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData) | | |
| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData) | | |
| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | |
| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | |






<a name="ibc.lightclients.solomachine.v1.NextSequenceRecvData"></a>
<a name="ibc.lightclients.solomachine.v2.NextSequenceRecvData"></a>

### NextSequenceRecvData
NextSequenceRecvData returns the SignBytes data for verification of the next
Expand All @@ -3088,7 +3088,7 @@ sequence to be received.



<a name="ibc.lightclients.solomachine.v1.PacketAcknowledgementData"></a>
<a name="ibc.lightclients.solomachine.v2.PacketAcknowledgementData"></a>

### PacketAcknowledgementData
PacketAcknowledgementData returns the SignBytes data for acknowledgement
Expand All @@ -3105,7 +3105,7 @@ verification.



<a name="ibc.lightclients.solomachine.v1.PacketCommitmentData"></a>
<a name="ibc.lightclients.solomachine.v2.PacketCommitmentData"></a>

### PacketCommitmentData
PacketCommitmentData returns the SignBytes data for packet commitment
Expand All @@ -3122,7 +3122,7 @@ verification.



<a name="ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData"></a>
<a name="ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData"></a>

### PacketReceiptAbsenceData
PacketReceiptAbsenceData returns the SignBytes data for
Expand All @@ -3138,7 +3138,7 @@ packet receipt absence verification.



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

### SignBytes
SignBytes defines the signed bytes used for signature verification.
Expand All @@ -3149,15 +3149,15 @@ SignBytes defines the signed bytes used for signature verification.
| `sequence` | [uint64](#uint64) | | |
| `timestamp` | [uint64](#uint64) | | |
| `diversifier` | [string](#string) | | |
| `data_type` | [DataType](#ibc.lightclients.solomachine.v1.DataType) | | type of the data used |
| `data_type` | [DataType](#ibc.lightclients.solomachine.v2.DataType) | | type of the data used |
| `data` | [bytes](#bytes) | | marshaled data |






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

### SignatureAndData
SignatureAndData contains a signature and the data signed over to create that
Expand All @@ -3167,7 +3167,7 @@ signature.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `signature` | [bytes](#bytes) | | |
| `data_type` | [DataType](#ibc.lightclients.solomachine.v1.DataType) | | |
| `data_type` | [DataType](#ibc.lightclients.solomachine.v2.DataType) | | |
| `data` | [bytes](#bytes) | | |
| `timestamp` | [uint64](#uint64) | | |

Expand All @@ -3176,7 +3176,7 @@ signature.



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

### TimestampedSignatureData
TimestampedSignatureData contains the signature data and the timestamp of the
Expand All @@ -3195,7 +3195,7 @@ signature.
<!-- end messages -->


<a name="ibc.lightclients.solomachine.v1.DataType"></a>
<a name="ibc.lightclients.solomachine.v2.DataType"></a>

### DataType
DataType defines the type of solo machine proof being created. This is done
Expand Down
4 changes: 3 additions & 1 deletion docs/migrations/ibc-migration-043.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ REST routes are not supported for these proposals.

## Proto file changes

The gRPC querier service endpoints have changed slightly. The previous files used `v1beta1`, this has been updated to `v1`.
The gRPC querier service endpoints have changed slightly. The previous files used `v1beta1` gRPC route, this has been updated to `v1`.

The solo machine has replaced the FrozenSequence uint64 field with a IsFrozen boolean field. The package has been bumped from `v1` to `v2`

## IBC callback changes

Expand Down
15 changes: 3 additions & 12 deletions modules/light-clients/06-solomachine/types/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var _ exported.ClientState = (*ClientState)(nil)
func NewClientState(latestSequence uint64, consensusState *ConsensusState, allowUpdateAfterProposal bool) *ClientState {
return &ClientState{
Sequence: latestSequence,
FrozenSequence: 0,
IsFrozen: false,
ConsensusState: consensusState,
AllowUpdateAfterProposal: allowUpdateAfterProposal,
}
Expand All @@ -45,23 +45,18 @@ func (cs ClientState) GetLatestHeight() exported.Height {
// - Active: if frozen sequence is 0
// - Frozen: otherwise solo machine is frozen
func (cs ClientState) Status(_ sdk.Context, _ sdk.KVStore, _ codec.BinaryCodec) exported.Status {
if cs.FrozenSequence != 0 {
if cs.IsFrozen {
return exported.Frozen
}

return exported.Active
}

// IsFrozen returns true if the client is frozen.
func (cs ClientState) IsFrozen() bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should have been deleted in the Status pr

Copy link
Member

Choose a reason for hiding this comment

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

Have you removed it from localhost?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, I think this one got added back during a merge of main when I fixed the solo machine bug

return cs.FrozenSequence != 0
}

// GetFrozenHeight returns the frozen sequence of the client.
// Return exported.Height to satisfy interface
// Revision number is always 0 for a solo-machine
func (cs ClientState) GetFrozenHeight() exported.Height {
return clienttypes.NewHeight(0, cs.FrozenSequence)
return clienttypes.NewHeight(0, 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will be removed by #165

}

// GetProofSpecs returns nil proof specs since client state verification uses signatures.
Expand Down Expand Up @@ -445,10 +440,6 @@ func produceVerificationArgs(
}
// sequence is encoded in the revision height of height struct
sequence := height.GetRevisionHeight()
if cs.IsFrozen() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should have been removed by Status pr, this is checked in 02-client

return nil, nil, 0, 0, clienttypes.ErrClientFrozen
}

if prefix == nil {
return nil, nil, 0, 0, sdkerrors.Wrap(commitmenttypes.ErrInvalidPrefix, "prefix cannot be empty")
}
Expand Down
Loading