Enforce solo machine signature type uniqueness (#7394)

* update solo machine proto types to use enum for uniqueness

* move data type to SignatureAndData

Adjusts SignatureAndData proto definition to take in a DataType. Updates misbehaviour basic validation to do checks on the data type. Adds unmarshaling tests.

* split signature bytes creation to allow for function reusing. Stuck on strange error on testing codec.go

* fix test bug

* update UnmarshalByType and refactor misbehaviour handle

Rename CanUnmarshalDataByType -> UnmarshalDataByType. Return a new interface and error. Refactor tests to work. Refactor misbehaviour_handle.go to check unmarshaling of the data and DRY code by separating signature and data checks into its own function. Update godoc.

* add tests to codec_test.go

* self review + lint

* update spec

* fix lint

* Update x/ibc/light-clients/solomachine/spec/01_concepts.md

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* increase code cov, update spec

apply most of @fedekunze comments.

* format spec

* make proto

* fix merge conflicts

* make proto

* fix conflicts

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
This commit is contained in:
colin axnér 2020-10-01 13:40:35 +02:00 committed by GitHub
parent dcf3b54ca1
commit a32e2a03ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1006 additions and 250 deletions

View File

@ -60,8 +60,9 @@ message Misbehaviour {
// signature.
message SignatureAndData {
option (gogoproto.goproto_getters) = false;
bytes signature = 1;
bytes data = 2;
bytes signature = 1;
DataType data_type = 2 [(gogoproto.moretags) = "yaml:\"data_type\""];
bytes data = 3;
}
// TimestampedSignature contains the signature and the timestamp of the
@ -79,11 +80,40 @@ message SignBytes {
uint64 sequence = 1;
uint64 timestamp = 2;
string diversifier = 3;
// type of the data used
DataType data_type = 4 [(gogoproto.moretags) = "yaml:\"data_type\""];
// marshaled data
bytes data = 4;
bytes data = 5;
}
// HeaderData returns the SignBytes data for misbehaviour verification.
// DataType defines the type of solo machine proof being created. This is done to preserve uniqueness of different
// data sign byte encodings.
enum DataType {
option (gogoproto.goproto_enum_prefix) = false;
// Default State
DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"];
// Data type for client state verification
DATA_TYPE_CLIENT_STATE = 1 [(gogoproto.enumvalue_customname) = "CLIENT"];
// Data type for consensus state verification
DATA_TYPE_CONSENSUS_STATE = 2 [(gogoproto.enumvalue_customname) = "CONSENSUS"];
// Data type for connection state verification
DATA_TYPE_CONNECTION_STATE = 3 [(gogoproto.enumvalue_customname) = "CONNECTION"];
// Data type for channel state verification
DATA_TYPE_CHANNEL_STATE = 4 [(gogoproto.enumvalue_customname) = "CHANNEL"];
// Data type for packet commitment verification
DATA_TYPE_PACKET_COMMITMENT = 5 [(gogoproto.enumvalue_customname) = "PACKETCOMMITMENT"];
// Data type for packet acknowledgement verification
DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6 [(gogoproto.enumvalue_customname) = "PACKETACKNOWLEDGEMENT"];
// Data type for packet receipt absence verification
DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7 [(gogoproto.enumvalue_customname) = "PACKETRECEIPTABSENCE"];
// Data type for next sequence recv verification
DATA_TYPE_NEXT_SEQUENCE_RECV = 8 [(gogoproto.enumvalue_customname) = "NEXTSEQUENCERECV"];
// Data type for header verification
DATA_TYPE_HEADER = 9 [(gogoproto.enumvalue_customname) = "HEADER"];
}
// HeaderData returns the SignBytes data for update verification.
message HeaderData {
option (gogoproto.goproto_getters) = false;
@ -101,7 +131,7 @@ message ClientStateData {
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
}
// ConsensusStateSignBytes returns the SignBytes data for consensus state
// ConsensusStateData returns the SignBytes data for consensus state
// verification.
message ConsensusStateData {
option (gogoproto.goproto_getters) = false;
@ -110,7 +140,7 @@ message ConsensusStateData {
google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""];
}
// ConnectionStateSignBytes returns the SignBytes data for connection state
// ConnectionStateData returns the SignBytes data for connection state
// verification.
message ConnectionStateData {
option (gogoproto.goproto_getters) = false;
@ -119,7 +149,7 @@ message ConnectionStateData {
ibc.connection.ConnectionEnd connection = 2;
}
// ChannelStateSignBytes returns the SignBytes data for channel state
// ChannelStateData returns the SignBytes data for channel state
// verification.
message ChannelStateData {
option (gogoproto.goproto_getters) = false;
@ -128,27 +158,27 @@ message ChannelStateData {
ibc.channel.Channel channel = 2;
}
// PacketCommitmentSignBytes returns the SignBytes data for packet commitment
// PacketCommitmentData returns the SignBytes data for packet commitment
// verification.
message PacketCommitmentData {
bytes path = 1;
bytes commitment = 2;
}
// PacketAcknowledgementSignBytes returns the SignBytes data for acknowledgement
// PacketAcknowledgementData returns the SignBytes data for acknowledgement
// verification.
message PacketAcknowledgementData {
bytes path = 1;
bytes acknowledgement = 2;
}
// PacketReceiptAbsenceSignBytes returns the SignBytes data for
// PacketReceiptAbsenceData returns the SignBytes data for
// packet receipt absence verification.
message PacketReceiptAbsenseData {
message PacketReceiptAbsenceData {
bytes path = 1;
}
// NextSequenceRecv returns the SignBytes data for verification of the next
// NextSequenceRecvData returns the SignBytes data for verification of the next
// sequence to be received.
message NextSequenceRecvData {
bytes path = 1;

View File

@ -6,17 +6,18 @@ order: 1
## Proofs
A solo machine proof should verify that the solomachine public key signed
A solo machine proof should verify that the solomachine public key signed
over some specified data. The format for generating marshaled proofs for
the SDK's implementation of solo machine is as follows:
Construct the data using the associated protobuf definition and marshal it.
For example:
```go
data := &ClientStateData{
Path: []byte(path.String()),
ClientState: any,
Path: []byte(path.String()),
ClientState: any,
}
dataBz, err := cdc.MarshalBinaryBare(data)
@ -25,27 +26,32 @@ dataBz, err := cdc.MarshalBinaryBare(data)
Construct the `SignBytes` and marshal it.
For example:
```go
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: CLIENT,
Data: dataBz,
}
signBz, err := cdc.MarshalBinaryBare(signBytes)
```
The helper functions in [proofs.go](../types/proofs.go) handle the above actions.
The `DataType` field is used to disambiguate what type of data was signed because
of potential proto encoding overlap.
Sign the sign bytes. Embed the signatures into either `SingleSignatureData` or
`MultiSignatureData`. Convert the `SignatureData` to proto and marshal it.
`MultiSignatureData`. Convert the `SignatureData` to proto and marshal it
For example:
```go
sig, err := key.Sign(signBz)
sigData := &signing.SingleSignatureData{
Signature: sig,
Signature: sig,
}
protoSigData := signing.SignatureDataToProto(sigData)
@ -56,10 +62,11 @@ Construct a `TimestampedSignature` and marshal it. The marshaled result can be
passed in as the proof parameter to the verification functions.
For example:
```go
timestampedSignature := &types.TimestampedSignature{
Signature: sig,
Timestamp: solomachine.Time,
Signature: sig,
Timestamp: solomachine.Time,
}
proof, err := cdc.MarshalBinaryBare(timestampedSignature)

View File

@ -5,7 +5,6 @@ import (
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
@ -85,10 +84,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
// create client for tendermint so we can use client state for verification
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
clientState := suite.chainA.GetClientState(clientA)
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ClientStatePath()
path, err := commitmenttypes.ApplyPrefix(prefix, clientPrefixedPath)
suite.Require().NoError(err)
path := suite.solomachine.GetClientStatePath(counterpartyClientIdentifier)
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
@ -217,9 +213,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
consensusState, found := suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
suite.Require().True(found)
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ConsensusStatePath(consensusHeight)
path, err := commitmenttypes.ApplyPrefix(prefix, clientPrefixedPath)
suite.Require().NoError(err)
path := suite.solomachine.GetConsensusStatePath(counterpartyClientIdentifier, consensusHeight)
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
@ -344,8 +338,7 @@ func (suite *SoloMachineTestSuite) TestVerifyConnectionState() {
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, prefix)
conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, []string{"1.0.0"})
path, err := commitmenttypes.ApplyPrefix(prefix, host.ConnectionPath(testConnectionID))
suite.Require().NoError(err)
path := suite.solomachine.GetConnectionStatePath(testConnectionID)
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
@ -434,8 +427,7 @@ func (suite *SoloMachineTestSuite) TestVerifyChannelState() {
counterparty := channeltypes.NewCounterparty(testPortID, testChannelID)
ch := channeltypes.NewChannel(channeltypes.OPEN, channeltypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
path, err := commitmenttypes.ApplyPrefix(prefix, host.ChannelPath(testPortID, testChannelID))
suite.Require().NoError(err)
path := suite.solomachine.GetChannelStatePath(testPortID, testChannelID)
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
@ -526,8 +518,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketCommitment() {
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
path, err := commitmenttypes.ApplyPrefix(prefix, host.PacketCommitmentPath(testPortID, testChannelID, solomachine.Sequence))
suite.Require().NoError(err)
path := solomachine.GetPacketCommitmentPath(testPortID, testChannelID)
value, err := types.PacketCommitmentSignBytes(suite.chainA.Codec, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, commitmentBytes)
suite.Require().NoError(err)
@ -614,8 +605,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgement() {
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
path, err := commitmenttypes.ApplyPrefix(prefix, host.PacketAcknowledgementPath(testPortID, testChannelID, solomachine.Sequence))
suite.Require().NoError(err)
path := solomachine.GetPacketAcknowledgementPath(testPortID, testChannelID)
value, err := types.PacketAcknowledgementSignBytes(suite.chainA.Codec, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, ack)
suite.Require().NoError(err)
@ -701,8 +691,8 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketReceiptAbsence() {
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
path, err := commitmenttypes.ApplyPrefix(prefix, host.PacketReceiptPath(testPortID, testChannelID, solomachine.Sequence))
suite.Require().NoError(err)
// absence uses receipt path as well
path := solomachine.GetPacketReceiptPath(testPortID, testChannelID)
value, err := types.PacketReceiptAbsenceSignBytes(suite.chainA.Codec, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path)
suite.Require().NoError(err)
@ -789,8 +779,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNextSeqRecv() {
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
nextSeqRecv := solomachine.Sequence + 1
path, err := commitmenttypes.ApplyPrefix(prefix, host.NextSequenceRecvPath(testPortID, testChannelID))
suite.Require().NoError(err)
path := solomachine.GetNextSequenceRecvPath(testPortID, testChannelID)
value, err := types.NextSequenceRecvSignBytes(suite.chainA.Codec, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, nextSeqRecv)
suite.Require().NoError(err)

View File

@ -5,6 +5,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
@ -48,3 +49,91 @@ func UnmarshalSignatureData(cdc codec.BinaryMarshaler, data []byte) (signing.Sig
return sigData, nil
}
// UnmarshalDataByType attempts to unmarshal the data to the specified type. An error is
// return if it fails.
func UnmarshalDataByType(cdc codec.BinaryMarshaler, dataType DataType, data []byte) (Data, error) {
if len(data) == 0 {
return nil, sdkerrors.Wrap(ErrInvalidSignatureAndData, "data cannot be empty")
}
switch dataType {
case UNSPECIFIED:
return nil, sdkerrors.Wrap(ErrInvalidDataType, "data type cannot be UNSPECIFIED")
case CLIENT:
clientData := &ClientStateData{}
if err := cdc.UnmarshalBinaryBare(data, clientData); err != nil {
return nil, err
}
// unpack any
if _, err := clienttypes.UnpackClientState(clientData.ClientState); err != nil {
return nil, err
}
return clientData, nil
case CONSENSUS:
consensusData := &ConsensusStateData{}
if err := cdc.UnmarshalBinaryBare(data, consensusData); err != nil {
return nil, err
}
// unpack any
if _, err := clienttypes.UnpackConsensusState(consensusData.ConsensusState); err != nil {
return nil, err
}
return consensusData, nil
case CONNECTION:
connectionData := &ConnectionStateData{}
if err := cdc.UnmarshalBinaryBare(data, connectionData); err != nil {
return nil, err
}
return connectionData, nil
case CHANNEL:
channelData := &ChannelStateData{}
if err := cdc.UnmarshalBinaryBare(data, channelData); err != nil {
return nil, err
}
return channelData, nil
case PACKETCOMMITMENT:
commitmentData := &PacketCommitmentData{}
if err := cdc.UnmarshalBinaryBare(data, commitmentData); err != nil {
return nil, err
}
return commitmentData, nil
case PACKETACKNOWLEDGEMENT:
ackData := &PacketAcknowledgementData{}
if err := cdc.UnmarshalBinaryBare(data, ackData); err != nil {
return nil, err
}
return ackData, nil
case PACKETRECEIPTABSENCE:
receiptAbsenceData := &PacketReceiptAbsenceData{}
if err := cdc.UnmarshalBinaryBare(data, receiptAbsenceData); err != nil {
return nil, err
}
return receiptAbsenceData, nil
case NEXTSEQUENCERECV:
nextSeqRecvData := &NextSequenceRecvData{}
if err := cdc.UnmarshalBinaryBare(data, nextSeqRecvData); err != nil {
return nil, err
}
return nextSeqRecvData, nil
default:
return nil, sdkerrors.Wrapf(ErrInvalidDataType, "unsupported data type %T", dataType)
}
}

View File

@ -0,0 +1,190 @@
package types_test
import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
func (suite SoloMachineTestSuite) TestUnmarshalDataByType() {
var (
data []byte
err error
)
// test singlesig and multisig public keys
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
cdc := suite.chainA.App.AppCodec()
cases := []struct {
name string
dataType types.DataType
malleate func()
expPass bool
}{
{
"empty data", types.CLIENT, func() {
data = []byte{}
}, false,
},
{
"unspecified", types.UNSPECIFIED, func() {
path := solomachine.GetClientStatePath(counterpartyClientIdentifier)
data, err = types.ClientStateDataBytes(cdc, path, solomachine.ClientState())
suite.Require().NoError(err)
}, false,
},
{
"client", types.CLIENT, func() {
path := solomachine.GetClientStatePath(counterpartyClientIdentifier)
data, err = types.ClientStateDataBytes(cdc, path, solomachine.ClientState())
suite.Require().NoError(err)
}, true,
},
{
"bad client (provides consensus state data)", types.CLIENT, func() {
path := solomachine.GetConsensusStatePath(counterpartyClientIdentifier, clienttypes.NewHeight(0, 5))
data, err = types.ConsensusStateDataBytes(cdc, path, solomachine.ConsensusState())
suite.Require().NoError(err)
}, false,
},
{
"consensus", types.CONSENSUS, func() {
path := solomachine.GetConsensusStatePath(counterpartyClientIdentifier, clienttypes.NewHeight(0, 5))
data, err = types.ConsensusStateDataBytes(cdc, path, solomachine.ConsensusState())
suite.Require().NoError(err)
}, true,
},
{
"bad consensus (provides client state data)", types.CONSENSUS, func() {
path := solomachine.GetClientStatePath(counterpartyClientIdentifier)
data, err = types.ClientStateDataBytes(cdc, path, solomachine.ClientState())
suite.Require().NoError(err)
}, false,
},
{
"connection", types.CONNECTION, func() {
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, prefix)
conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, []string{"1.0.0"})
path := solomachine.GetConnectionStatePath("connectionID")
data, err = types.ConnectionStateDataBytes(cdc, path, conn)
suite.Require().NoError(err)
}, true,
},
{
"bad connection (uses channel data)", types.CONNECTION, func() {
counterparty := channeltypes.NewCounterparty(testPortID, testChannelID)
ch := channeltypes.NewChannel(channeltypes.OPEN, channeltypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
path := solomachine.GetChannelStatePath("portID", "channelID")
data, err = types.ChannelStateDataBytes(cdc, path, ch)
suite.Require().NoError(err)
}, false,
},
{
"channel", types.CHANNEL, func() {
counterparty := channeltypes.NewCounterparty(testPortID, testChannelID)
ch := channeltypes.NewChannel(channeltypes.OPEN, channeltypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
path := solomachine.GetChannelStatePath("portID", "channelID")
data, err = types.ChannelStateDataBytes(cdc, path, ch)
suite.Require().NoError(err)
}, true,
},
{
"bad channel (uses connection data)", types.CHANNEL, func() {
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, prefix)
conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, []string{"1.0.0"})
path := solomachine.GetConnectionStatePath("connectionID")
data, err = types.ConnectionStateDataBytes(cdc, path, conn)
suite.Require().NoError(err)
}, false,
},
{
"packet commitment", types.PACKETCOMMITMENT, func() {
commitment := []byte("packet commitment")
path := solomachine.GetPacketCommitmentPath("portID", "channelID")
data, err = types.PacketCommitmentDataBytes(cdc, path, commitment)
suite.Require().NoError(err)
}, true,
},
{
"bad packet commitment (uses next seq recv)", types.PACKETCOMMITMENT, func() {
path := solomachine.GetNextSequenceRecvPath("portID", "channelID")
data, err = types.NextSequenceRecvDataBytes(cdc, path, 10)
suite.Require().NoError(err)
}, false,
},
{
"packet acknowledgement", types.PACKETACKNOWLEDGEMENT, func() {
commitment := []byte("packet acknowledgement")
path := solomachine.GetPacketAcknowledgementPath("portID", "channelID")
data, err = types.PacketAcknowledgementDataBytes(cdc, path, commitment)
suite.Require().NoError(err)
}, true,
},
{
"bad packet acknowledgement (uses next sequence recv)", types.PACKETACKNOWLEDGEMENT, func() {
path := solomachine.GetNextSequenceRecvPath("portID", "channelID")
data, err = types.NextSequenceRecvDataBytes(cdc, path, 10)
suite.Require().NoError(err)
}, false,
},
{
"packet acknowledgement absence", types.PACKETRECEIPTABSENCE, func() {
path := solomachine.GetPacketReceiptPath("portID", "channelID")
data, err = types.PacketReceiptAbsenceDataBytes(cdc, path)
suite.Require().NoError(err)
}, true,
},
{
"next sequence recv", types.NEXTSEQUENCERECV, func() {
path := solomachine.GetNextSequenceRecvPath("portID", "channelID")
data, err = types.NextSequenceRecvDataBytes(cdc, path, 10)
suite.Require().NoError(err)
}, true,
},
{
"bad next sequence recv (uses packet commitment)", types.NEXTSEQUENCERECV, func() {
commitment := []byte("packet commitment")
path := solomachine.GetPacketCommitmentPath("portID", "channelID")
data, err = types.PacketCommitmentDataBytes(cdc, path, commitment)
suite.Require().NoError(err)
}, false,
},
}
for _, tc := range cases {
tc := tc
suite.Run(tc.name, func() {
tc.malleate()
data, err := types.UnmarshalDataByType(cdc, tc.dataType, data)
if tc.expPass {
suite.Require().NoError(err)
suite.Require().NotNil(data)
} else {
suite.Require().Error(err)
suite.Require().Nil(data)
}
})
}
}
}

View File

@ -14,4 +14,5 @@ var (
ErrInvalidSignatureAndData = sdkerrors.Register(SubModuleName, 4, "invalid signature and data")
ErrSignatureVerificationFailed = sdkerrors.Register(SubModuleName, 5, "signature verification failed")
ErrInvalidProof = sdkerrors.Register(SubModuleName, 6, "invalid solo machine proof")
ErrInvalidDataType = sdkerrors.Register(SubModuleName, 7, "invalid data type")
)

View File

@ -82,6 +82,9 @@ func (sd SignatureAndData) ValidateBasic() error {
if len(sd.Data) == 0 {
return sdkerrors.Wrap(ErrInvalidSignatureAndData, "data for signature cannot be empty")
}
if sd.DataType == UNSPECIFIED {
return sdkerrors.Wrap(ErrInvalidSignatureAndData, "data type cannot be UNSPECIFIED")
}
return nil
}

View File

@ -30,61 +30,52 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
return nil, sdkerrors.Wrapf(clienttypes.ErrClientFrozen, "client is already frozen")
}
if err := checkMisbehaviour(cdc, cs, soloMisbehaviour); err != nil {
return nil, err
// NOTE: a check that the misbehaviour message data are not equal is done by
// misbehaviour.ValidateBasic which is called by the 02-client keeper.
// verify first signature
if err := verifySignatureAndData(cdc, cs, soloMisbehaviour, soloMisbehaviour.SignatureOne); err != nil {
return nil, sdkerrors.Wrap(err, "failed to verify signature one")
}
// verify second signature
if err := verifySignatureAndData(cdc, cs, soloMisbehaviour, soloMisbehaviour.SignatureTwo); err != nil {
return nil, sdkerrors.Wrap(err, "failed to verify signature two")
}
cs.FrozenSequence = soloMisbehaviour.Sequence
return cs, nil
}
// checkMisbehaviour checks if the currently registered public key has signed
// over two different messages at the same sequence.
//
// NOTE: a check that the misbehaviour message data are not equal is done by
// misbehaviour.ValidateBasic which is called by the 02-client keeper.
func checkMisbehaviour(cdc codec.BinaryMarshaler, clientState ClientState, soloMisbehaviour *Misbehaviour) error {
pubKey := clientState.ConsensusState.GetPubKey()
// verifySignatureAndData verifies that the currently registered public key has signed
// over the provided data and that the data is valid. The data is valid if it can be
// unmarshaled into the specified data type.
func verifySignatureAndData(cdc codec.BinaryMarshaler, clientState ClientState, misbehaviour *Misbehaviour, sigAndData *SignatureAndData) error {
// ensure data can be unmarshaled to the specified data type
if _, err := UnmarshalDataByType(cdc, sigAndData.DataType, sigAndData.Data); err != nil {
return err
}
data, err := MisbehaviourSignBytes(
cdc,
soloMisbehaviour.Sequence, clientState.ConsensusState.Timestamp,
misbehaviour.Sequence, clientState.ConsensusState.Timestamp,
clientState.ConsensusState.Diversifier,
soloMisbehaviour.SignatureOne.Data,
sigAndData.DataType,
sigAndData.Data,
)
if err != nil {
return err
}
sigData, err := UnmarshalSignatureData(cdc, soloMisbehaviour.SignatureOne.Signature)
sigData, err := UnmarshalSignatureData(cdc, sigAndData.Signature)
if err != nil {
return err
}
// check first signature
if err := VerifySignature(pubKey, data, sigData); err != nil {
return sdkerrors.Wrap(err, "misbehaviour signature one failed to be verified")
}
data, err = MisbehaviourSignBytes(
cdc,
soloMisbehaviour.Sequence, clientState.ConsensusState.Timestamp,
clientState.ConsensusState.Diversifier,
soloMisbehaviour.SignatureTwo.Data,
)
if err != nil {
if err := VerifySignature(clientState.ConsensusState.GetPubKey(), data, sigData); err != nil {
return err
}
sigData, err = UnmarshalSignatureData(cdc, soloMisbehaviour.SignatureTwo.Signature)
if err != nil {
return err
}
// check second signature
if err := VerifySignature(pubKey, data, sigData); err != nil {
return sdkerrors.Wrap(err, "misbehaviour signature two failed to be verified")
}
return nil
}

View File

@ -56,7 +56,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
false,
},
{
"invalid SignatureOne signature",
"invalid SignatureOne SignatureData",
func() {
clientState = solomachine.ClientState()
m := solomachine.CreateMisbehaviour()
@ -66,7 +66,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
}, false,
},
{
"invalid SignatureTwo signature",
"invalid SignatureTwo SignatureData",
func() {
clientState = solomachine.ClientState()
m := solomachine.CreateMisbehaviour()
@ -76,7 +76,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
}, false,
},
{
"invalid first signature",
"invalid first signature data",
func() {
clientState = solomachine.ClientState()
@ -88,6 +88,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
Sequence: solomachine.Sequence + 1,
Timestamp: solomachine.Time,
Diversifier: solomachine.Diversifier,
DataType: types.CLIENT,
Data: msg,
}
@ -103,7 +104,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
false,
},
{
"invalid second signature",
"invalid second signature data",
func() {
clientState = solomachine.ClientState()
@ -115,6 +116,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
Sequence: solomachine.Sequence + 1,
Timestamp: solomachine.Time,
Diversifier: solomachine.Diversifier,
DataType: types.CLIENT,
Data: msg,
}
@ -129,6 +131,37 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
},
false,
},
{
"wrong pubkey generates first signature",
func() {
clientState = solomachine.ClientState()
badMisbehaviour := solomachine.CreateMisbehaviour()
// update public key to a new one
solomachine.CreateHeader()
m := solomachine.CreateMisbehaviour()
// set SignatureOne to use the wrong signature
m.SignatureOne = badMisbehaviour.SignatureOne
misbehaviour = m
}, false,
},
{
"wrong pubkey generates second signature",
func() {
clientState = solomachine.ClientState()
badMisbehaviour := solomachine.CreateMisbehaviour()
// update public key to a new one
solomachine.CreateHeader()
m := solomachine.CreateMisbehaviour()
// set SignatureTwo to use the wrong signature
m.SignatureTwo = badMisbehaviour.SignatureTwo
misbehaviour = m
}, false,
},
{
"signatures sign over different sequence",
func() {
@ -141,8 +174,11 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
msg := []byte("DATA ONE")
// sequence used is plus 1
signBytes := &types.SignBytes{
Sequence: solomachine.Sequence + 1,
Data: msg,
Sequence: solomachine.Sequence + 1,
Timestamp: solomachine.Time,
Diversifier: solomachine.Diversifier,
DataType: types.CLIENT,
Data: msg,
}
data, err := suite.chainA.Codec.MarshalBinaryBare(signBytes)
@ -158,8 +194,11 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
// sequence used is minus 1
signBytes = &types.SignBytes{
Sequence: solomachine.Sequence - 1,
Data: msg,
Sequence: solomachine.Sequence - 1,
Timestamp: solomachine.Time,
Diversifier: solomachine.Diversifier,
DataType: types.CLIENT,
Data: msg,
}
data, err = suite.chainA.Codec.MarshalBinaryBare(signBytes)
suite.Require().NoError(err)

View File

@ -84,6 +84,18 @@ func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() {
},
false,
},
{
"data type for SignatureOne is unspecified",
func(misbehaviour *types.Misbehaviour) {
misbehaviour.SignatureOne.DataType = types.UNSPECIFIED
}, false,
},
{
"data type for SignatureTwo is unspecified",
func(misbehaviour *types.Misbehaviour) {
misbehaviour.SignatureTwo.DataType = types.UNSPECIFIED
}, false,
},
}
for _, tc := range testCases {

View File

@ -52,11 +52,13 @@ func MisbehaviourSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
dataType DataType,
data []byte) ([]byte, error) {
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: dataType,
Data: data,
}
@ -82,6 +84,7 @@ func HeaderSignBytes(
Sequence: header.Sequence,
Timestamp: header.Timestamp,
Diversifier: header.NewDiversifier,
DataType: HEADER,
Data: dataBz,
}
@ -94,6 +97,29 @@ func ClientStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
clientState exported.ClientState,
) ([]byte, error) {
dataBz, err := ClientStateDataBytes(cdc, path, clientState)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: CLIENT,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// ClientStateDataBytes returns the client state data bytes used in constructing
// SignBytes.
func ClientStateDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
clientState exported.ClientState,
) ([]byte, error) {
@ -112,14 +138,7 @@ func ClientStateSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}
// ConsensusStateSignBytes returns the sign bytes for verification of the
@ -128,6 +147,29 @@ func ConsensusStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
consensusState exported.ConsensusState,
) ([]byte, error) {
dataBz, err := ConsensusStateDataBytes(cdc, path, consensusState)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: CONSENSUS,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// ConsensusStateDataBytes returns the consensus state data bytes used in constructing
// SignBytes.
func ConsensusStateDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
consensusState exported.ConsensusState,
) ([]byte, error) {
@ -146,14 +188,7 @@ func ConsensusStateSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}
// ConnectionStateSignBytes returns the sign bytes for verification of the
@ -162,6 +197,29 @@ func ConnectionStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
connectionEnd exported.ConnectionI,
) ([]byte, error) {
dataBz, err := ConnectionStateDataBytes(cdc, path, connectionEnd)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: CONNECTION,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// ConnectionStateDataBytes returns the connection state data bytes used in constructing
// SignBytes.
func ConnectionStateDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
connectionEnd exported.ConnectionI,
) ([]byte, error) {
@ -183,14 +241,7 @@ func ConnectionStateSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}
// ChannelStateSignBytes returns the sign bytes for verification of the
@ -199,6 +250,29 @@ func ChannelStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
channelEnd exported.ChannelI,
) ([]byte, error) {
dataBz, err := ChannelStateDataBytes(cdc, path, channelEnd)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: CHANNEL,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// ChannelStateDataBytes returns the channel state data bytes used in constructing
// SignBytes.
func ChannelStateDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
channelEnd exported.ChannelI,
) ([]byte, error) {
@ -219,14 +293,7 @@ func ChannelStateSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}
// PacketCommitmentSignBytes returns the sign bytes for verification of the
@ -235,6 +302,29 @@ func PacketCommitmentSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
commitmentBytes []byte,
) ([]byte, error) {
dataBz, err := PacketCommitmentDataBytes(cdc, path, commitmentBytes)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: PACKETCOMMITMENT,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// PacketCommitmentDataBytes returns the packet commitment data bytes used in constructing
// SignBytes.
func PacketCommitmentDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
commitmentBytes []byte,
) ([]byte, error) {
@ -248,14 +338,7 @@ func PacketCommitmentSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}
// PacketAcknowledgementSignBytes returns the sign bytes for verification of
@ -264,6 +347,29 @@ func PacketAcknowledgementSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
acknowledgement []byte,
) ([]byte, error) {
dataBz, err := PacketAcknowledgementDataBytes(cdc, path, acknowledgement)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: PACKETACKNOWLEDGEMENT,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// PacketAcknowledgementDataBytes returns the packet acknowledgement data bytes used in constructing
// SignBytes.
func PacketAcknowledgementDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
acknowledgement []byte,
) ([]byte, error) {
@ -277,29 +383,18 @@ func PacketAcknowledgementSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}
// PacketReceiptAbsenceSignBytes returns the sign bytes for verification
// of the absence of a receipt.
// of the absence of an receipt.
func PacketReceiptAbsenceSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath, // nolint: interfacer
path commitmenttypes.MerklePath,
) ([]byte, error) {
data := &PacketReceiptAbsenseData{
Path: []byte(path.String()),
}
dataBz, err := cdc.MarshalBinaryBare(data)
dataBz, err := PacketReceiptAbsenceDataBytes(cdc, path)
if err != nil {
return nil, err
}
@ -308,18 +403,60 @@ func PacketReceiptAbsenceSignBytes(
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: PACKETRECEIPTABSENCE,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// PacketReceiptAbsenceDataBytes returns the packet receipt absence data bytes
// used in constructing SignBytes.
func PacketReceiptAbsenceDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
) ([]byte, error) {
data := &PacketReceiptAbsenceData{
Path: []byte(path.String()),
}
dataBz, err := cdc.MarshalBinaryBare(data)
if err != nil {
return nil, err
}
return dataBz, nil
}
// NextSequenceRecvSignBytes returns the sign bytes for verification of the next
// sequence to be received.
func NextSequenceRecvSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
diversifier string,
path commitmenttypes.MerklePath,
nextSequenceRecv uint64,
) ([]byte, error) {
dataBz, err := NextSequenceRecvDataBytes(cdc, path, nextSequenceRecv)
if err != nil {
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
DataType: NEXTSEQUENCERECV,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
}
// NextSequenceRecvDataBytes returns the next sequence recv data bytes used in constructing
// SignBytes.
func NextSequenceRecvDataBytes(
cdc codec.BinaryMarshaler,
path commitmenttypes.MerklePath, // nolint: interfacer
nextSequenceRecv uint64,
) ([]byte, error) {
@ -333,12 +470,5 @@ func NextSequenceRecvSignBytes(
return nil, err
}
signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Diversifier: diversifier,
Data: dataBz,
}
return cdc.MarshalBinaryBare(signBytes)
return dataBz, nil
}

View File

@ -0,0 +1,40 @@
package types_test
import (
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
func (suite *SoloMachineTestSuite) TestClientStateSignBytes() {
cdc := suite.chainA.App.AppCodec()
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
// success
path := solomachine.GetClientStatePath(counterpartyClientIdentifier)
bz, err := types.ClientStateSignBytes(cdc, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, solomachine.ClientState())
suite.Require().NoError(err)
suite.Require().NotNil(bz)
// nil client state
bz, err = types.ClientStateSignBytes(cdc, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, nil)
suite.Require().Error(err)
suite.Require().Nil(bz)
}
}
func (suite *SoloMachineTestSuite) TestConsensusStateSignBytes() {
cdc := suite.chainA.App.AppCodec()
for _, solomachine := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
// success
path := solomachine.GetConsensusStatePath(counterpartyClientIdentifier, consensusHeight)
bz, err := types.ConsensusStateSignBytes(cdc, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, solomachine.ConsensusState())
suite.Require().NoError(err)
suite.Require().NotNil(bz)
// nil consensus state
bz, err = types.ConsensusStateSignBytes(cdc, solomachine.Sequence, solomachine.Time, solomachine.Diversifier, path, nil)
suite.Require().Error(err)
suite.Require().Nil(bz)
}
}

View File

@ -4,11 +4,15 @@ import (
"github.com/tendermint/tendermint/crypto"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// Interface implementation checks.
var _, _, _, _ codectypes.UnpackInterfacesMessage = &ClientState{}, &ConsensusState{}, &Header{}, &HeaderData{}
// Data is an interface used for all the signature data bytes proto definitions.
type Data interface{}
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
func (cs ClientState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return cs.ConsensusState.UnpackInterfaces(unpacker)
@ -28,3 +32,13 @@ func (h Header) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
func (hd HeaderData) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(hd.NewPubKey, new(crypto.PubKey))
}
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
func (csd ClientStateData) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(csd.ClientState, new(exported.ClientState))
}
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
func (csd ConsensusStateData) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(csd.ConsensusState, new(exported.ConsensusState))
}

View File

@ -26,6 +26,67 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// DataType defines the type of solo machine proof being created. This is done to preserve uniqueness of different
// data sign byte encodings.
type DataType int32
const (
// Default State
UNSPECIFIED DataType = 0
// Data type for client state verification
CLIENT DataType = 1
// Data type for consensus state verification
CONSENSUS DataType = 2
// Data type for connection state verification
CONNECTION DataType = 3
// Data type for channel state verification
CHANNEL DataType = 4
// Data type for packet commitment verification
PACKETCOMMITMENT DataType = 5
// Data type for packet acknowledgement verification
PACKETACKNOWLEDGEMENT DataType = 6
// Data type for packet receipt absence verification
PACKETRECEIPTABSENCE DataType = 7
// Data type for next sequence recv verification
NEXTSEQUENCERECV DataType = 8
// Data type for header verification
HEADER DataType = 9
)
var DataType_name = map[int32]string{
0: "DATA_TYPE_UNINITIALIZED_UNSPECIFIED",
1: "DATA_TYPE_CLIENT_STATE",
2: "DATA_TYPE_CONSENSUS_STATE",
3: "DATA_TYPE_CONNECTION_STATE",
4: "DATA_TYPE_CHANNEL_STATE",
5: "DATA_TYPE_PACKET_COMMITMENT",
6: "DATA_TYPE_PACKET_ACKNOWLEDGEMENT",
7: "DATA_TYPE_PACKET_RECEIPT_ABSENCE",
8: "DATA_TYPE_NEXT_SEQUENCE_RECV",
9: "DATA_TYPE_HEADER",
}
var DataType_value = map[string]int32{
"DATA_TYPE_UNINITIALIZED_UNSPECIFIED": 0,
"DATA_TYPE_CLIENT_STATE": 1,
"DATA_TYPE_CONSENSUS_STATE": 2,
"DATA_TYPE_CONNECTION_STATE": 3,
"DATA_TYPE_CHANNEL_STATE": 4,
"DATA_TYPE_PACKET_COMMITMENT": 5,
"DATA_TYPE_PACKET_ACKNOWLEDGEMENT": 6,
"DATA_TYPE_PACKET_RECEIPT_ABSENCE": 7,
"DATA_TYPE_NEXT_SEQUENCE_RECV": 8,
"DATA_TYPE_HEADER": 9,
}
func (x DataType) String() string {
return proto.EnumName(DataType_name, int32(x))
}
func (DataType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_6cc2ee18f7f86d4e, []int{0}
}
// ClientState defines a solo machine client that tracks the current consensus
// state and if the client is frozen.
type ClientState struct {
@ -203,8 +264,9 @@ var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo
// SignatureAndData contains a signature and the data signed over to create that
// signature.
type SignatureAndData struct {
Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
DataType DataType `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3,enum=ibc.lightclients.solomachine.v1.DataType" json:"data_type,omitempty" yaml:"data_type"`
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *SignatureAndData) Reset() { *m = SignatureAndData{} }
@ -285,8 +347,10 @@ type SignBytes struct {
Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Diversifier string `protobuf:"bytes,3,opt,name=diversifier,proto3" json:"diversifier,omitempty"`
// type of the data used
DataType DataType `protobuf:"varint,4,opt,name=data_type,json=dataType,proto3,enum=ibc.lightclients.solomachine.v1.DataType" json:"data_type,omitempty" yaml:"data_type"`
// marshaled data
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *SignBytes) Reset() { *m = SignBytes{} }
@ -322,7 +386,7 @@ func (m *SignBytes) XXX_DiscardUnknown() {
var xxx_messageInfo_SignBytes proto.InternalMessageInfo
// HeaderData returns the SignBytes data for misbehaviour verification.
// HeaderData returns the SignBytes data for update verification.
type HeaderData struct {
// header public key
NewPubKey *types.Any `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty" yaml:"new_pub_key"`
@ -402,7 +466,7 @@ func (m *ClientStateData) XXX_DiscardUnknown() {
var xxx_messageInfo_ClientStateData proto.InternalMessageInfo
// ConsensusStateSignBytes returns the SignBytes data for consensus state
// ConsensusStateData returns the SignBytes data for consensus state
// verification.
type ConsensusStateData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
@ -442,7 +506,7 @@ func (m *ConsensusStateData) XXX_DiscardUnknown() {
var xxx_messageInfo_ConsensusStateData proto.InternalMessageInfo
// ConnectionStateSignBytes returns the SignBytes data for connection state
// ConnectionStateData returns the SignBytes data for connection state
// verification.
type ConnectionStateData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
@ -482,7 +546,7 @@ func (m *ConnectionStateData) XXX_DiscardUnknown() {
var xxx_messageInfo_ConnectionStateData proto.InternalMessageInfo
// ChannelStateSignBytes returns the SignBytes data for channel state
// ChannelStateData returns the SignBytes data for channel state
// verification.
type ChannelStateData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
@ -522,7 +586,7 @@ func (m *ChannelStateData) XXX_DiscardUnknown() {
var xxx_messageInfo_ChannelStateData proto.InternalMessageInfo
// PacketCommitmentSignBytes returns the SignBytes data for packet commitment
// PacketCommitmentData returns the SignBytes data for packet commitment
// verification.
type PacketCommitmentData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
@ -576,7 +640,7 @@ func (m *PacketCommitmentData) GetCommitment() []byte {
return nil
}
// PacketAcknowledgementSignBytes returns the SignBytes data for acknowledgement
// PacketAcknowledgementData returns the SignBytes data for acknowledgement
// verification.
type PacketAcknowledgementData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
@ -630,24 +694,24 @@ func (m *PacketAcknowledgementData) GetAcknowledgement() []byte {
return nil
}
// PacketReceiptAbsenceSignBytes returns the SignBytes data for
// PacketReceiptAbsenceData returns the SignBytes data for
// packet receipt absence verification.
type PacketReceiptAbsenseData struct {
type PacketReceiptAbsenceData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
}
func (m *PacketReceiptAbsenseData) Reset() { *m = PacketReceiptAbsenseData{} }
func (m *PacketReceiptAbsenseData) String() string { return proto.CompactTextString(m) }
func (*PacketReceiptAbsenseData) ProtoMessage() {}
func (*PacketReceiptAbsenseData) Descriptor() ([]byte, []int) {
func (m *PacketReceiptAbsenceData) Reset() { *m = PacketReceiptAbsenceData{} }
func (m *PacketReceiptAbsenceData) String() string { return proto.CompactTextString(m) }
func (*PacketReceiptAbsenceData) ProtoMessage() {}
func (*PacketReceiptAbsenceData) Descriptor() ([]byte, []int) {
return fileDescriptor_6cc2ee18f7f86d4e, []int{14}
}
func (m *PacketReceiptAbsenseData) XXX_Unmarshal(b []byte) error {
func (m *PacketReceiptAbsenceData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *PacketReceiptAbsenseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *PacketReceiptAbsenceData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_PacketReceiptAbsenseData.Marshal(b, m, deterministic)
return xxx_messageInfo_PacketReceiptAbsenceData.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@ -657,26 +721,26 @@ func (m *PacketReceiptAbsenseData) XXX_Marshal(b []byte, deterministic bool) ([]
return b[:n], nil
}
}
func (m *PacketReceiptAbsenseData) XXX_Merge(src proto.Message) {
xxx_messageInfo_PacketReceiptAbsenseData.Merge(m, src)
func (m *PacketReceiptAbsenceData) XXX_Merge(src proto.Message) {
xxx_messageInfo_PacketReceiptAbsenceData.Merge(m, src)
}
func (m *PacketReceiptAbsenseData) XXX_Size() int {
func (m *PacketReceiptAbsenceData) XXX_Size() int {
return m.Size()
}
func (m *PacketReceiptAbsenseData) XXX_DiscardUnknown() {
xxx_messageInfo_PacketReceiptAbsenseData.DiscardUnknown(m)
func (m *PacketReceiptAbsenceData) XXX_DiscardUnknown() {
xxx_messageInfo_PacketReceiptAbsenceData.DiscardUnknown(m)
}
var xxx_messageInfo_PacketReceiptAbsenseData proto.InternalMessageInfo
var xxx_messageInfo_PacketReceiptAbsenceData proto.InternalMessageInfo
func (m *PacketReceiptAbsenseData) GetPath() []byte {
func (m *PacketReceiptAbsenceData) GetPath() []byte {
if m != nil {
return m.Path
}
return nil
}
// NextSequenceRecv returns the SignBytes data for verification of the next
// NextSequenceRecvData returns the SignBytes data for verification of the next
// sequence to be received.
type NextSequenceRecvData struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
@ -731,6 +795,7 @@ func (m *NextSequenceRecvData) GetNextSeqRecv() uint64 {
}
func init() {
proto.RegisterEnum("ibc.lightclients.solomachine.v1.DataType", DataType_name, DataType_value)
proto.RegisterType((*ClientState)(nil), "ibc.lightclients.solomachine.v1.ClientState")
proto.RegisterType((*ConsensusState)(nil), "ibc.lightclients.solomachine.v1.ConsensusState")
proto.RegisterType((*Header)(nil), "ibc.lightclients.solomachine.v1.Header")
@ -745,7 +810,7 @@ func init() {
proto.RegisterType((*ChannelStateData)(nil), "ibc.lightclients.solomachine.v1.ChannelStateData")
proto.RegisterType((*PacketCommitmentData)(nil), "ibc.lightclients.solomachine.v1.PacketCommitmentData")
proto.RegisterType((*PacketAcknowledgementData)(nil), "ibc.lightclients.solomachine.v1.PacketAcknowledgementData")
proto.RegisterType((*PacketReceiptAbsenseData)(nil), "ibc.lightclients.solomachine.v1.PacketReceiptAbsenseData")
proto.RegisterType((*PacketReceiptAbsenceData)(nil), "ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData")
proto.RegisterType((*NextSequenceRecvData)(nil), "ibc.lightclients.solomachine.v1.NextSequenceRecvData")
}
@ -754,70 +819,90 @@ func init() {
}
var fileDescriptor_6cc2ee18f7f86d4e = []byte{
// 999 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
0x14, 0xaf, 0xb3, 0x61, 0x69, 0x5e, 0xb2, 0x4d, 0xf1, 0x66, 0x97, 0xb4, 0x40, 0x5c, 0xf9, 0x80,
0x7a, 0xa9, 0x4d, 0x16, 0x89, 0x43, 0x05, 0x87, 0x24, 0xbb, 0x12, 0x94, 0x7f, 0x95, 0xbb, 0x2b,
0xb1, 0x08, 0xc9, 0x9a, 0xd8, 0xaf, 0x89, 0x55, 0x67, 0xc6, 0xd8, 0x93, 0xa4, 0x41, 0xe2, 0x00,
0x27, 0xb8, 0x71, 0xe4, 0x88, 0x90, 0xf8, 0x2e, 0x48, 0x5c, 0x96, 0x1b, 0xa7, 0x08, 0xb5, 0xdf,
0x20, 0x9f, 0x00, 0xd9, 0x33, 0x4e, 0x6c, 0x57, 0x49, 0x05, 0xec, 0xc9, 0xe3, 0x79, 0x6f, 0x7e,
0xef, 0xbd, 0xdf, 0xbc, 0x37, 0xef, 0x41, 0xdb, 0xeb, 0x3b, 0xa6, 0xef, 0x0d, 0x86, 0xdc, 0xf1,
0x3d, 0xa4, 0x3c, 0x32, 0x23, 0xe6, 0xb3, 0x11, 0x71, 0x86, 0x1e, 0x45, 0x73, 0xd2, 0xce, 0xfe,
0x1a, 0x41, 0xc8, 0x38, 0x53, 0x35, 0xaf, 0xef, 0x18, 0xd9, 0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x1f, 0x42, 0xe3,
0x33, 0xbc, 0xe4, 0xe9, 0xb0, 0x61, 0xa1, 0x33, 0x59, 0xeb, 0xc5, 0xfb, 0x70, 0x8f, 0xe2, 0x25,
0x8f, 0x47, 0x15, 0x3b, 0x44, 0x67, 0x22, 0x67, 0x99, 0xcc, 0xb3, 0x97, 0x13, 0xeb, 0x56, 0x95,
0x0a, 0xe8, 0x18, 0xb5, 0x6b, 0xff, 0x7e, 0xd5, 0x52, 0x5e, 0x5c, 0xb5, 0x94, 0xbf, 0xaf, 0x5a,
0xca, 0x4f, 0xd7, 0xad, 0xad, 0x17, 0xd7, 0xad, 0xad, 0xbf, 0xae, 0x5b, 0x5b, 0x5f, 0x3e, 0x19,
0x78, 0x7c, 0x38, 0xee, 0x1b, 0x0e, 0x1b, 0x99, 0x0e, 0x8b, 0x46, 0x2c, 0x92, 0x9f, 0xa3, 0xc8,
0xbd, 0x30, 0x2f, 0xcd, 0xe5, 0xc4, 0x78, 0x94, 0x8e, 0x8c, 0xef, 0xbc, 0x77, 0x94, 0x9d, 0x1a,
0xf9, 0x2c, 0xc0, 0xa8, 0x7f, 0x37, 0xc9, 0xd7, 0x77, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x8e,
0x76, 0x62, 0x2b, 0x62, 0x0a, 0x00, 0x00,
// 1328 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x6f, 0xdb, 0xc6,
0x12, 0x37, 0x15, 0xc5, 0x91, 0x46, 0x8e, 0xad, 0xc7, 0x28, 0x89, 0xcc, 0xe4, 0x49, 0x04, 0x1f,
0x10, 0xf8, 0x3d, 0xbc, 0x48, 0x75, 0x8a, 0x06, 0x45, 0xd0, 0x3f, 0xa0, 0x28, 0xb6, 0x51, 0x62,
0xd3, 0x2a, 0x45, 0xb7, 0x49, 0x10, 0x80, 0xa0, 0xa8, 0xb5, 0x44, 0x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0x1d, 0x02, 0x55, 0x96, 0xe4, 0x5a, 0x5d, 0xd3, 0xc5, 0x4a, 0x43, 0x56, 0x24, 0x39,
0x7b, 0x89, 0xcb, 0x4f, 0xa6, 0x7c, 0x8e, 0x68, 0xa9, 0x92, 0xea, 0xd8, 0xbb, 0x70, 0x33, 0xb4,
0x57, 0xe4, 0x47, 0x9a, 0xde, 0x90, 0x3f, 0x38, 0xf4, 0x54, 0x1e, 0xcd, 0x87, 0xd9, 0x14, 0x09,
0xdc, 0xd3, 0x04, 0x0a, 0x4f, 0xce, 0xf2, 0x90, 0x0d, 0xed, 0xee, 0xcb, 0x62, 0x55, 0x56, 0xb3,
0x69, 0xb2, 0x33, 0x64, 0xc6, 0x25, 0x9f, 0x7f, 0x5b, 0x58, 0xab, 0xe8, 0x3f, 0xbc, 0x2c, 0x30,
0x2f, 0x5e, 0x16, 0x98, 0x5f, 0x5f, 0x16, 0x98, 0x2f, 0x5f, 0x15, 0xd6, 0x5e, 0xbc, 0x2a, 0xac,
0xfd, 0xfc, 0xaa, 0xb0, 0xf6, 0x44, 0x6e, 0x5b, 0xb8, 0x33, 0x6c, 0x96, 0x4c, 0xa7, 0x57, 0x36,
0x1d, 0xb7, 0xe7, 0xb8, 0xf4, 0x73, 0xdb, 0x6d, 0x1d, 0x97, 0x9f, 0x95, 0x17, 0x7f, 0x3f, 0xb7,
0x83, 0xdf, 0x9f, 0xd7, 0xee, 0xde, 0x8e, 0xfe, 0x01, 0x79, 0xb7, 0x8a, 0xdb, 0x5c, 0xf7, 0x8f,
0xaf, 0xd7, 0x7f, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x60, 0xe0, 0x73, 0x2e, 0x0d, 0x00, 0x00,
}
func (m *ClientState) Marshal() (dAtA []byte, err error) {
@ -1065,7 +1150,12 @@ func (m *SignatureAndData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Data)
i = encodeVarintSolomachine(dAtA, i, uint64(len(m.Data)))
i--
dAtA[i] = 0x12
dAtA[i] = 0x1a
}
if m.DataType != 0 {
i = encodeVarintSolomachine(dAtA, i, uint64(m.DataType))
i--
dAtA[i] = 0x10
}
if len(m.Signature) > 0 {
i -= len(m.Signature)
@ -1137,7 +1227,12 @@ func (m *SignBytes) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Data)
i = encodeVarintSolomachine(dAtA, i, uint64(len(m.Data)))
i--
dAtA[i] = 0x22
dAtA[i] = 0x2a
}
if m.DataType != 0 {
i = encodeVarintSolomachine(dAtA, i, uint64(m.DataType))
i--
dAtA[i] = 0x20
}
if len(m.Diversifier) > 0 {
i -= len(m.Diversifier)
@ -1443,7 +1538,7 @@ func (m *PacketAcknowledgementData) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
func (m *PacketReceiptAbsenseData) Marshal() (dAtA []byte, err error) {
func (m *PacketReceiptAbsenceData) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -1453,12 +1548,12 @@ func (m *PacketReceiptAbsenseData) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *PacketReceiptAbsenseData) MarshalTo(dAtA []byte) (int, error) {
func (m *PacketReceiptAbsenceData) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PacketReceiptAbsenseData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *PacketReceiptAbsenceData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@ -1622,6 +1717,9 @@ func (m *SignatureAndData) Size() (n int) {
if l > 0 {
n += 1 + l + sovSolomachine(uint64(l))
}
if m.DataType != 0 {
n += 1 + sovSolomachine(uint64(m.DataType))
}
l = len(m.Data)
if l > 0 {
n += 1 + l + sovSolomachine(uint64(l))
@ -1661,6 +1759,9 @@ func (m *SignBytes) Size() (n int) {
if l > 0 {
n += 1 + l + sovSolomachine(uint64(l))
}
if m.DataType != 0 {
n += 1 + sovSolomachine(uint64(m.DataType))
}
l = len(m.Data)
if l > 0 {
n += 1 + l + sovSolomachine(uint64(l))
@ -1787,7 +1888,7 @@ func (m *PacketAcknowledgementData) Size() (n int) {
return n
}
func (m *PacketReceiptAbsenseData) Size() (n int) {
func (m *PacketReceiptAbsenceData) Size() (n int) {
if m == nil {
return 0
}
@ -2542,6 +2643,25 @@ func (m *SignatureAndData) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field DataType", wireType)
}
m.DataType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSolomachine
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.DataType |= DataType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
}
@ -2805,6 +2925,25 @@ func (m *SignBytes) Unmarshal(dAtA []byte) error {
m.Diversifier = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field DataType", wireType)
}
m.DataType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSolomachine
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.DataType |= DataType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
}
@ -3717,7 +3856,7 @@ func (m *PacketAcknowledgementData) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *PacketReceiptAbsenseData) Unmarshal(dAtA []byte) error {
func (m *PacketReceiptAbsenceData) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -3740,10 +3879,10 @@ func (m *PacketReceiptAbsenseData) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: PacketReceiptAbsenseData: wiretype end group for non-group")
return fmt.Errorf("proto: PacketReceiptAbsenceData: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: PacketReceiptAbsenseData: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: PacketReceiptAbsenceData: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:

View File

@ -108,6 +108,7 @@ func (suite *SoloMachineTestSuite) TestCheckHeaderAndUpdateState() {
Sequence: cs.Sequence,
Timestamp: solomachine.Time,
Diversifier: solomachine.Diversifier,
DataType: types.CLIENT,
Data: dataBz,
}

View File

@ -13,10 +13,14 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
solomachinetypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
)
var prefix = commitmenttypes.NewMerklePrefix([]byte("ibc"))
// Solomachine is a testing helper used to simulate a counterparty
// solo machine client.
type Solomachine struct {
@ -124,6 +128,7 @@ func (solo *Solomachine) CreateHeader() *solomachinetypes.Header {
Sequence: solo.Sequence,
Timestamp: solo.Time,
Diversifier: solo.Diversifier,
DataType: solomachinetypes.HEADER,
Data: dataBz,
}
@ -152,13 +157,19 @@ func (solo *Solomachine) CreateHeader() *solomachinetypes.Header {
// CreateMisbehaviour constructs testing misbehaviour for the solo machine client
// by signing over two different data bytes at the same sequence.
func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
dataOne := []byte("DATA ONE")
dataTwo := []byte("DATA TWO")
path := solo.GetClientStatePath("counterparty")
dataOne, err := solomachinetypes.ClientStateDataBytes(solo.cdc, path, solo.ClientState())
require.NoError(solo.t, err)
path = solo.GetConsensusStatePath("counterparty", clienttypes.NewHeight(0, 1))
dataTwo, err := solomachinetypes.ConsensusStateDataBytes(solo.cdc, path, solo.ConsensusState())
require.NoError(solo.t, err)
signBytes := &solomachinetypes.SignBytes{
Sequence: solo.Sequence,
Timestamp: solo.Time,
Diversifier: solo.Diversifier,
DataType: solomachinetypes.CLIENT,
Data: dataOne,
}
@ -168,6 +179,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
sig := solo.GenerateSignature(bz)
signatureOne := solomachinetypes.SignatureAndData{
Signature: sig,
DataType: solomachinetypes.CLIENT,
Data: dataOne,
}
@ -175,6 +187,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
Sequence: solo.Sequence,
Timestamp: solo.Time,
Diversifier: solo.Diversifier,
DataType: solomachinetypes.CONSENSUS,
Data: dataTwo,
}
@ -184,6 +197,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
sig = solo.GenerateSignature(bz)
signatureTwo := solomachinetypes.SignatureAndData{
Signature: sig,
DataType: solomachinetypes.CONSENSUS,
Data: dataTwo,
}
@ -229,3 +243,70 @@ func (solo *Solomachine) GenerateSignature(signBytes []byte) []byte {
return bz
}
// GetClientStatePath returns the commitment path for the client state.
func (solo *Solomachine) GetClientStatePath(counterpartyClientIdentifier string) commitmenttypes.MerklePath {
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ClientStatePath()
path, err := commitmenttypes.ApplyPrefix(prefix, clientPrefixedPath)
require.NoError(solo.t, err)
return path
}
// GetConsensusStatePath returns the commitment path for the consensus state.
func (solo *Solomachine) GetConsensusStatePath(counterpartyClientIdentifier string, consensusHeight exported.Height) commitmenttypes.MerklePath {
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ConsensusStatePath(consensusHeight)
path, err := commitmenttypes.ApplyPrefix(prefix, clientPrefixedPath)
require.NoError(solo.t, err)
return path
}
// GetConnectionStatePath returns the commitment path for the connection state.
func (solo *Solomachine) GetConnectionStatePath(connID string) commitmenttypes.MerklePath {
path, err := commitmenttypes.ApplyPrefix(prefix, host.ConnectionPath(connID))
require.NoError(solo.t, err)
return path
}
// GetChannelStatePath returns the commitment path for that channel state.
func (solo *Solomachine) GetChannelStatePath(portID, channelID string) commitmenttypes.MerklePath {
path, err := commitmenttypes.ApplyPrefix(prefix, host.ChannelPath(portID, channelID))
require.NoError(solo.t, err)
return path
}
// GetPacketCommitmentPath returns the commitment path for a packet commitment.
func (solo *Solomachine) GetPacketCommitmentPath(portID, channelID string) commitmenttypes.MerklePath {
path, err := commitmenttypes.ApplyPrefix(prefix, host.PacketCommitmentPath(portID, channelID, solo.Sequence))
require.NoError(solo.t, err)
return path
}
// GetPacketAcknowledgementPath returns the commitment path for a packet acknowledgement.
func (solo *Solomachine) GetPacketAcknowledgementPath(portID, channelID string) commitmenttypes.MerklePath {
path, err := commitmenttypes.ApplyPrefix(prefix, host.PacketAcknowledgementPath(portID, channelID, solo.Sequence))
require.NoError(solo.t, err)
return path
}
// GetPacketReceiptPath returns the commitment path for a packet receipt
// and an absent receipts.
func (solo *Solomachine) GetPacketReceiptPath(portID, channelID string) commitmenttypes.MerklePath {
path, err := commitmenttypes.ApplyPrefix(prefix, host.PacketReceiptPath(portID, channelID, solo.Sequence))
require.NoError(solo.t, err)
return path
}
// GetNextSequenceRecvPath returns the commitment path for the next sequence recv counter.
func (solo *Solomachine) GetNextSequenceRecvPath(portID, channelID string) commitmenttypes.MerklePath {
path, err := commitmenttypes.ApplyPrefix(prefix, host.NextSequenceRecvPath(portID, channelID))
require.NoError(solo.t, err)
return path
}