Skip to content

Commit 7178056

Browse files
authored
Merge pull request #133 from hyperledger-labs/fix-host-consensus-state-proof
Fix to set `HostConsensusStateProof` in ConnectionOpenAck Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
2 parents 8cd3208 + 4557b3e commit 7178056

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

core/connection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func createConnectionStep(src, dst *ProvableChain) (*RelayMsgs, error) {
193193
if len(srcUpdateHeaders) > 0 {
194194
out.Dst = append(out.Dst, dst.Path().UpdateClients(srcUpdateHeaders, addr)...)
195195
}
196-
out.Dst = append(out.Dst, dst.Path().ConnAck(src.Path(), srcCsRes, srcConn, srcConsRes, addr))
196+
out.Dst = append(out.Dst, dst.Path().ConnAck(src.Path(), srcCsRes, srcConn, srcConsRes, dstHostConsProof, addr))
197197

198198
// Handshake has started on dst end (2 steps done), relay `connOpenAck` and `updateClient` to src end
199199
case srcConn.Connection.State == conntypes.INIT && dstConn.Connection.State == conntypes.TRYOPEN:
@@ -202,7 +202,7 @@ func createConnectionStep(src, dst *ProvableChain) (*RelayMsgs, error) {
202202
if len(dstUpdateHeaders) > 0 {
203203
out.Src = append(out.Src, src.Path().UpdateClients(dstUpdateHeaders, addr)...)
204204
}
205-
out.Src = append(out.Src, src.Path().ConnAck(dst.Path(), dstCsRes, dstConn, dstConsRes, addr))
205+
out.Src = append(out.Src, src.Path().ConnAck(dst.Path(), dstCsRes, dstConn, dstConsRes, srcHostConsProof, addr))
206206

207207
// Handshake has confirmed on dst (3 steps done), relay `connOpenConfirm` and `updateClient` to src end
208208
case srcConn.Connection.State == conntypes.TRYOPEN && dstConn.Connection.State == conntypes.OPEN:

core/pathEnd.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,14 @@ func (pe *PathEnd) ConnAck(
128128
dstClientState *clienttypes.QueryClientStateResponse,
129129
dstConnState *conntypes.QueryConnectionResponse,
130130
dstConsState *clienttypes.QueryConsensusStateResponse,
131+
hostConsensusStateProof []byte,
131132
signer sdk.AccAddress,
132133
) sdk.Msg {
133134
cs, err := clienttypes.UnpackClientState(dstClientState.ClientState)
134135
if err != nil {
135136
panic(err)
136137
}
137-
return conntypes.NewMsgConnectionOpenAck(
138+
msg := conntypes.NewMsgConnectionOpenAck(
138139
pe.ConnectionID,
139140
dst.ConnectionID,
140141
cs,
@@ -146,6 +147,11 @@ func (pe *PathEnd) ConnAck(
146147
conntypes.ExportedVersionsToProto(conntypes.GetCompatibleVersions())[0],
147148
signer.String(),
148149
)
150+
msg.HostConsensusStateProof = hostConsensusStateProof
151+
if err = msg.ValidateBasic(); err != nil {
152+
panic(err)
153+
}
154+
return msg
149155
}
150156

151157
// ConnConfirm creates a MsgConnectionOpenAck

0 commit comments

Comments
 (0)