-
Notifications
You must be signed in to change notification settings - Fork 625
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
fix(api)!: remove Pretty
and String
custom implementations of MerklePath
#4459
Changes from 9 commits
2d638cc
ed33e46
57150bd
34c70b1
3a118d0
bc03ca2
3c87b0e
f4a951d
e011ab3
c5f1ea7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,6 @@ type Prefix interface { | |
// Path implements spec:CommitmentPath. | ||
// A path is the additional information provided to the verification function. | ||
type Path interface { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to keep the interface because there was an import cycle between 02-client and 23-commitment, if I tried to use |
||
String() string // deprecated | ||
Empty() bool | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,6 @@ message MerklePrefix { | |
// arbitrary structured object (defined by a commitment type). | ||
// MerklePath is represented from root-to-leaf | ||
message MerklePath { | ||
option (gogoproto.goproto_stringer) = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed this so that the proto compiler generated an implementation of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the linked test should be updated to use a valid path for misbehaviour. A marshaled merkle path is not an expected singing path for solomachines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allowing it to be proto marshaled makes sense to me, but solo machine should not be proto marshaling the path when submitting misbeahviour, I think that might be a bug |
||
|
||
repeated string key_path = 1; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,7 +202,7 @@ func (solo *Solomachine) CreateHeader(newDiversifier string) *solomachine.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() *solomachine.Misbehaviour { | ||
merklePath := solo.GetClientStatePath("counterparty") | ||
merklePath := commitmenttypes.NewMerklePath(host.FullClientStatePath("counterparty")) | ||
path, err := solo.cdc.Marshal(&merklePath) | ||
require.NoError(solo.t, err) | ||
Comment on lines
+205
to
207
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should be removing merkle path usage in solo machines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True! I will do that! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this going to be fixed in a followup? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot change this one because we require at the moment the path to be a proto-marshalled |
||
|
||
|
@@ -231,7 +231,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachine.Misbehaviour { | |
// misbehaviour signaturess can have different timestamps | ||
solo.Time++ | ||
|
||
merklePath = solo.GetConsensusStatePath("counterparty", clienttypes.NewHeight(0, 1)) | ||
merklePath = commitmenttypes.NewMerklePath(host.FullConsensusStatePath("counterparty", clienttypes.NewHeight(0, 1))) | ||
path, err = solo.cdc.Marshal(&merklePath) | ||
require.NoError(solo.t, err) | ||
|
||
|
@@ -516,14 +516,12 @@ func (solo *Solomachine) GenerateClientStateProof(clientState exported.ClientSta | |
data, err := clienttypes.MarshalClientState(solo.cdc, clientState) | ||
require.NoError(solo.t, err) | ||
|
||
merklePath := solo.GetClientStatePath(clientIDSolomachine) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.FullClientStateKey(clientIDSolomachine) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: data, | ||
} | ||
|
||
|
@@ -536,14 +534,12 @@ func (solo *Solomachine) GenerateConsensusStateProof(consensusState exported.Con | |
data, err := clienttypes.MarshalConsensusState(solo.cdc, consensusState) | ||
require.NoError(solo.t, err) | ||
|
||
merklePath := solo.GetConsensusStatePath(clientIDSolomachine, consensusHeight) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.FullConsensusStateKey(clientIDSolomachine, consensusHeight) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: data, | ||
} | ||
|
||
|
@@ -559,14 +555,12 @@ func (solo *Solomachine) GenerateConnOpenTryProof(counterpartyClientID, counterp | |
data, err := solo.cdc.Marshal(&connection) | ||
require.NoError(solo.t, err) | ||
|
||
merklePath := solo.GetConnectionStatePath(connectionIDSolomachine) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.ConnectionKey(connectionIDSolomachine) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: data, | ||
} | ||
|
||
|
@@ -582,14 +576,12 @@ func (solo *Solomachine) GenerateChanOpenTryProof(portID, version, counterpartyC | |
data, err := solo.cdc.Marshal(&channel) | ||
require.NoError(solo.t, err) | ||
|
||
merklePath := solo.GetChannelStatePath(portID, channelIDSolomachine) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.ChannelKey(portID, channelIDSolomachine) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: data, | ||
} | ||
|
||
|
@@ -605,14 +597,12 @@ func (solo *Solomachine) GenerateChanClosedProof(portID, version, counterpartyCh | |
data, err := solo.cdc.Marshal(&channel) | ||
require.NoError(solo.t, err) | ||
|
||
merklePath := solo.GetChannelStatePath(portID, channelIDSolomachine) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.ChannelKey(portID, channelIDSolomachine) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: data, | ||
} | ||
|
||
|
@@ -623,14 +613,12 @@ func (solo *Solomachine) GenerateChanClosedProof(portID, version, counterpartyCh | |
func (solo *Solomachine) GenerateCommitmentProof(packet channeltypes.Packet) []byte { | ||
commitment := channeltypes.CommitPacket(solo.cdc, packet) | ||
|
||
merklePath := solo.GetPacketCommitmentPath(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: commitment, | ||
} | ||
|
||
|
@@ -641,14 +629,12 @@ func (solo *Solomachine) GenerateCommitmentProof(packet channeltypes.Packet) []b | |
func (solo *Solomachine) GenerateAcknowledgementProof(packet channeltypes.Packet) []byte { | ||
transferAck := channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement() | ||
|
||
merklePath := solo.GetPacketAcknowledgementPath(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.PacketAcknowledgementKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: channeltypes.CommitAcknowledgement(transferAck), | ||
} | ||
|
||
|
@@ -657,14 +643,12 @@ func (solo *Solomachine) GenerateAcknowledgementProof(packet channeltypes.Packet | |
|
||
// GenerateReceiptAbsenceProof generates a receipt absence proof for the provided packet. | ||
func (solo *Solomachine) GenerateReceiptAbsenceProof(packet channeltypes.Packet) []byte { | ||
merklePath := solo.GetPacketReceiptPath(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) | ||
key, err := merklePath.GetKey(1) // index 0 is the key for the IBC store in the multistore, index 1 is the key in the IBC store | ||
require.NoError(solo.t, err) | ||
path := host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) | ||
signBytes := &solomachine.SignBytes{ | ||
Sequence: solo.Sequence, | ||
Timestamp: solo.Time, | ||
Diversifier: solo.Diversifier, | ||
Path: key, | ||
Path: path, | ||
Data: nil, | ||
} | ||
return solo.GenerateProof(signBytes) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this test be asserting what each element is in the key path?