Skip to content

Commit

Permalink
fix update client bug and reduce complexity (#421)
Browse files Browse the repository at this point in the history
* fix update bug and reduce complexity

* self review fixes

* fix lint
  • Loading branch information
colin-axner authored Feb 11, 2021
1 parent 872dc2e commit 79c9ba7
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 106 deletions.
36 changes: 19 additions & 17 deletions cmd/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ $ %s tx raw uc ibc-0 ibc-1 ibconeclient`, appName, appName)),
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
return sendAndPrint([]sdk.Msg{chains[src].UpdateClient(updateHeader)},

return sendAndPrint([]sdk.Msg{updateMsg},
chains[src], cmd)
},
}
Expand All @@ -93,7 +94,7 @@ $ %s tx raw clnt ibc-1 ibc-0 ibconeclient`, appName, appName)),
return err
}

dstHeader, err := chains[src].GetIBCCreateClientHeader(chains[dst])
dstHeader, err := chains[src].GetIBCCreateClientHeader()
if err != nil {
return err
}
Expand Down Expand Up @@ -181,17 +182,18 @@ $ %s tx raw conn-try ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn2`,
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}

openTry, err := chains[src].ConnTry(chains[dst])
if err != nil {
return err
}

txs := []sdk.Msg{
chains[src].UpdateClient(updateHeader),
updateMsg,
openTry,
}

Expand Down Expand Up @@ -224,7 +226,7 @@ $ %s tx raw conn-ack ibc-0 ibc-1 ibconeclient ibczeroclient ibcconn1 ibcconn2`,
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
Expand All @@ -235,7 +237,7 @@ $ %s tx raw conn-ack ibc-0 ibc-1 ibconeclient ibczeroclient ibcconn1 ibcconn2`,
}

txs := []sdk.Msg{
chains[src].UpdateClient(updateHeader),
updateMsg,
openAck,
}

Expand Down Expand Up @@ -268,7 +270,7 @@ $ %s tx raw conn-confirm ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
Expand All @@ -281,8 +283,8 @@ $ %s tx raw conn-confirm ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn
}

txs := []sdk.Msg{
updateMsg,
chains[src].ConnConfirm(dstState),
chains[src].UpdateClient(updateHeader),
}

return sendAndPrint(txs, chains[src], cmd)
Expand Down Expand Up @@ -389,7 +391,7 @@ $ %s tx raw chan-try ibc-0 ibc-1 ibczeroclient ibcconn0 ibcchan1 ibcchan2 transf
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
Expand All @@ -400,7 +402,7 @@ $ %s tx raw chan-try ibc-0 ibc-1 ibczeroclient ibcconn0 ibcchan1 ibcchan2 transf
}

txs := []sdk.Msg{
chains[src].UpdateClient(updateHeader),
updateMsg,
openTry,
}

Expand Down Expand Up @@ -435,7 +437,7 @@ $ %s tx raw chan-ack ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 transfer transf
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
Expand All @@ -446,7 +448,7 @@ $ %s tx raw chan-ack ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 transfer transf
}

txs := []sdk.Msg{
chains[src].UpdateClient(updateHeader),
updateMsg,
openAck,
}

Expand Down Expand Up @@ -480,7 +482,7 @@ $ %s tx raw chan-confirm ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 transfer tr
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
Expand All @@ -491,7 +493,7 @@ $ %s tx raw chan-confirm ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 transfer tr
}

txs := []sdk.Msg{
chains[src].UpdateClient(updateHeader),
updateMsg,
chains[src].ChanConfirm(dstChanState),
}

Expand Down Expand Up @@ -591,7 +593,7 @@ $ %s tx raw chan-close-confirm ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 trans
return err
}

updateHeader, err := chains[src].GetIBCUpdateHeader(chains[dst])
updateMsg, err := chains[src].UpdateClient(chains[dst])
if err != nil {
return err
}
Expand All @@ -602,7 +604,7 @@ $ %s tx raw chan-close-confirm ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 trans
}

txs := []sdk.Msg{
chains[src].UpdateClient(updateHeader),
updateMsg,
chains[src].ChanCloseConfirm(dstChanState),
}

Expand Down
Loading

0 comments on commit 79c9ba7

Please sign in to comment.