Skip to content

Commit

Permalink
Fix incorrect AccountPrefix bug and reinstate akash tests (cosmos#369)
Browse files Browse the repository at this point in the history
* fix config race condition bug

* fix build and link sdk issue

* add back akash test

* akash test on pr
  • Loading branch information
colin-axner authored Jan 14, 2021
1 parent edd0afc commit 6084900
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 190 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/akash-tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: TESTING - akash to gaia integration

on:
- pull request:
push:
branches:
- disabled_until_new_akash_build
- master

jobs:
build:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ test-gaia:
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestGaia*

test-akash:
@echo Temporarily Disabled
# @TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestAkash*
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestAkash*

coverage:
@echo "viewing test coverage..."
Expand Down
24 changes: 12 additions & 12 deletions cmd/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ $ %s tx raw uc ibc-0 ibc-1 ibconeclient`, appName, appName)),
if err != nil {
return err
}
return sendAndPrint([]sdk.Msg{chains[src].PathEnd.UpdateClient(updateHeader, chains[src].MustGetAddress())},
return sendAndPrint([]sdk.Msg{chains[src].UpdateClient(updateHeader)},
chains[src], cmd)
},
}
Expand Down Expand Up @@ -177,13 +177,13 @@ $ %s tx raw conn-try ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn2`,
if err != nil {
return err
}
openTry, err := chains[src].PathEnd.ConnTry(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1, chains[src].MustGetAddress())
openTry, err := chains[src].ConnTry(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return err
}

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

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

openAck, err := chains[src].PathEnd.ConnAck(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1, chains[src].MustGetAddress())
openAck, err := chains[src].ConnAck(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return err
}

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

Expand Down Expand Up @@ -283,7 +283,7 @@ $ %s tx raw conn-confirm ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn
}
txs := []sdk.Msg{
chains[src].PathEnd.ConnConfirm(dstState, chains[src].MustGetAddress()),
chains[src].PathEnd.UpdateClient(updateHeader, chains[src].MustGetAddress()),
chains[src].UpdateClient(updateHeader),
}

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

openTry, err := chains[src].PathEnd.ChanTry(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1, chains[src].MustGetAddress())
openTry, err := chains[src].ChanTry(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return err
}

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

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

openAck, err := chains[src].PathEnd.ChanAck(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1, chains[src].MustGetAddress())
openAck, err := chains[src].ChanAck(chains[dst], updateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return err
}

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

Expand Down Expand Up @@ -505,7 +505,7 @@ $ %s tx raw chan-confirm ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 transfer tr
return err
}
txs := []sdk.Msg{
chains[src].PathEnd.UpdateClient(updateHeader, chains[src].MustGetAddress()),
chains[src].UpdateClient(updateHeader),
chains[src].PathEnd.ChanConfirm(dstChanState, chains[src].MustGetAddress()),
}

Expand Down Expand Up @@ -619,7 +619,7 @@ $ %s tx raw chan-close-confirm ibc-0 ibc-1 ibczeroclient ibcchan1 ibcchan2 trans
return err
}
txs := []sdk.Msg{
chains[src].PathEnd.UpdateClient(updateHeader, chains[src].MustGetAddress()),
chains[src].UpdateClient(updateHeader),
chains[src].PathEnd.ChanCloseConfirm(dstChanState, chains[src].MustGetAddress()),
}

Expand Down
1 change: 1 addition & 0 deletions relayer/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ func (c *Chain) MustGetAddress() sdk.AccAddress {
if err != nil {
panic(err)
}

return srcAddr
}

Expand Down
34 changes: 17 additions & 17 deletions relayer/channel-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ func ExecuteChannelStep(src, dst *Chain) (success, last, modified bool, err erro
logChannelStates(src, dst, srcChan, dstChan)
}

openTry, err := src.PathEnd.ChanTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openTry, err := src.ChanTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, false, err
}

msgs = []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
openTry,
}

Expand All @@ -151,13 +151,13 @@ func ExecuteChannelStep(src, dst *Chain) (success, last, modified bool, err erro
logChannelStates(src, dst, srcChan, dstChan)
}

openAck, err := src.PathEnd.ChanAck(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openAck, err := src.ChanAck(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, false, err
}

msgs = []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
openAck,
}

Expand All @@ -174,13 +174,13 @@ func ExecuteChannelStep(src, dst *Chain) (success, last, modified bool, err erro
logChannelStates(dst, src, dstChan, srcChan)
}

openAck, err := dst.PathEnd.ChanAck(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openAck, err := dst.ChanAck(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, false, err
}

msgs = []sdk.Msg{
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
openAck,
}

Expand All @@ -195,7 +195,7 @@ func ExecuteChannelStep(src, dst *Chain) (success, last, modified bool, err erro
logChannelStates(src, dst, srcChan, dstChan)
}
msgs = []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
src.PathEnd.ChanConfirm(dstChan, src.MustGetAddress()),
}
last = true
Expand All @@ -211,7 +211,7 @@ func ExecuteChannelStep(src, dst *Chain) (success, last, modified bool, err erro
logChannelStates(dst, src, dstChan, srcChan)
}
msgs = []sdk.Msg{
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
dst.PathEnd.ChanConfirm(srcChan, dst.MustGetAddress()),
}
last = true
Expand Down Expand Up @@ -242,7 +242,7 @@ func InitializeChannel(src, dst *Chain, srcUpdateHeader, dstUpdateHeader *tmclie

// cosntruct OpenInit message to be submitted on source chain
msgs := []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
src.PathEnd.ChanInit(dst.PathEnd, src.MustGetAddress()),
}

Expand All @@ -269,13 +269,13 @@ func InitializeChannel(src, dst *Chain, srcUpdateHeader, dstUpdateHeader *tmclie
}

// open try on source chain
openTry, err := src.PathEnd.ChanTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openTry, err := src.ChanTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, err
}

msgs := []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
openTry,
}
res, success, err := src.SendMsgs(msgs)
Expand All @@ -301,13 +301,13 @@ func InitializeChannel(src, dst *Chain, srcUpdateHeader, dstUpdateHeader *tmclie
}

// open try on destination chain
openTry, err := dst.PathEnd.ChanTry(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1, dst.MustGetAddress())
openTry, err := dst.ChanTry(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, err
}

msgs := []sdk.Msg{
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
openTry,
}
res, success, err := dst.SendMsgs(msgs)
Expand Down Expand Up @@ -412,15 +412,15 @@ func (c *Chain) CloseChannelStep(dst *Chain) (*RelayMsgs, error) {
logChannelStates(c, dst, srcChan, dstChan)
}
out.Src = append(out.Src,
c.PathEnd.UpdateClient(dstUpdateHeader, c.MustGetAddress()),
c.UpdateClient(dstUpdateHeader),
c.PathEnd.ChanCloseInit(c.MustGetAddress()),
)
} else if dstChan.Channel.State != chantypes.UNINITIALIZED {
if dst.debug {
logChannelStates(dst, c, dstChan, srcChan)
}
out.Dst = append(out.Dst,
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
dst.PathEnd.ChanCloseInit(dst.MustGetAddress()),
)
}
Expand All @@ -432,7 +432,7 @@ func (c *Chain) CloseChannelStep(dst *Chain) (*RelayMsgs, error) {
logChannelStates(dst, c, dstChan, srcChan)
}
out.Dst = append(out.Dst,
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
dst.PathEnd.ChanCloseConfirm(srcChan, dst.MustGetAddress()),
)
out.Last = true
Expand All @@ -445,7 +445,7 @@ func (c *Chain) CloseChannelStep(dst *Chain) (*RelayMsgs, error) {
logChannelStates(c, dst, srcChan, dstChan)
}
out.Src = append(out.Src,
c.PathEnd.UpdateClient(dstUpdateHeader, c.MustGetAddress()),
c.UpdateClient(dstUpdateHeader),
c.PathEnd.ChanCloseConfirm(dstChan, c.MustGetAddress()),
)
out.Last = true
Expand Down
6 changes: 3 additions & 3 deletions relayer/client-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func (c *Chain) UpdateClients(dst *Chain) (err error) {
return err
}

clients.Src = append(clients.Src, c.PathEnd.UpdateClient(dstUH, c.MustGetAddress()))
clients.Dst = append(clients.Dst, dst.PathEnd.UpdateClient(srcUH, dst.MustGetAddress()))
clients.Src = append(clients.Src, c.UpdateClient(dstUH))
clients.Dst = append(clients.Dst, dst.UpdateClient(srcUH))

// Send msgs to both chains
if clients.Ready() {
Expand Down Expand Up @@ -180,7 +180,7 @@ func (c *Chain) UpgradeClients(dst *Chain) error {
upgradeMsg := &clienttypes.MsgUpgradeClient{c.PathEnd.ClientID, clientState, consensusState, proofUpgradeClient, proofUpgradeConsensusState, c.MustGetAddress().String()}

msgs := []sdk.Msg{
c.PathEnd.UpdateClient(dstUpdateHeader, c.MustGetAddress()),
c.UpdateClient(dstUpdateHeader),
upgradeMsg,
}

Expand Down
26 changes: 13 additions & 13 deletions relayer/connection-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ func ExecuteConnectionStep(src, dst *Chain) (success, last, modified bool, err e
logConnectionStates(src, dst, srcConn, dstConn)
}

openTry, err := src.PathEnd.ConnTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openTry, err := src.ConnTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, false, err
}

msgs = []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
openTry,
}
_, success, err = src.SendMsgs(msgs)
Expand All @@ -151,13 +151,13 @@ func ExecuteConnectionStep(src, dst *Chain) (success, last, modified bool, err e
logConnectionStates(src, dst, srcConn, dstConn)
}

openAck, err := src.PathEnd.ConnAck(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openAck, err := src.ConnAck(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, false, err
}

msgs = []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
openAck,
}
_, success, err = src.SendMsgs(msgs)
Expand All @@ -173,13 +173,13 @@ func ExecuteConnectionStep(src, dst *Chain) (success, last, modified bool, err e
logConnectionStates(dst, src, dstConn, srcConn)
}

openAck, err := dst.PathEnd.ConnAck(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1, dst.MustGetAddress())
openAck, err := dst.ConnAck(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, false, err
}

msgs = []sdk.Msg{
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
openAck,
}
_, success, err = dst.SendMsgs(msgs)
Expand All @@ -193,7 +193,7 @@ func ExecuteConnectionStep(src, dst *Chain) (success, last, modified bool, err e
logConnectionStates(src, dst, srcConn, dstConn)
}
msgs = []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
src.PathEnd.ConnConfirm(dstConn, src.MustGetAddress()),
}
_, success, err = src.SendMsgs(msgs)
Expand All @@ -209,7 +209,7 @@ func ExecuteConnectionStep(src, dst *Chain) (success, last, modified bool, err e
logConnectionStates(dst, src, dstConn, srcConn)
}
msgs = []sdk.Msg{
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
dst.PathEnd.ConnConfirm(srcConn, dst.MustGetAddress()),
}
last = true
Expand Down Expand Up @@ -239,7 +239,7 @@ func InitializeConnection(src, dst *Chain, srcUpdateHeader, dstUpdateHeader *tmc

// cosntruct OpenInit message to be submitted on source chain
msgs := []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
src.PathEnd.ConnInit(dst.PathEnd, src.MustGetAddress()),
}

Expand All @@ -265,13 +265,13 @@ func InitializeConnection(src, dst *Chain, srcUpdateHeader, dstUpdateHeader *tmc
// TODO: update logging
}

openTry, err := src.PathEnd.ConnTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1, src.MustGetAddress())
openTry, err := src.ConnTry(dst, dstUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, err
}

msgs := []sdk.Msg{
src.PathEnd.UpdateClient(dstUpdateHeader, src.MustGetAddress()),
src.UpdateClient(dstUpdateHeader),
openTry,
}
res, success, err := src.SendMsgs(msgs)
Expand All @@ -296,13 +296,13 @@ func InitializeConnection(src, dst *Chain, srcUpdateHeader, dstUpdateHeader *tmc
// TODO: update logging
}

openTry, err := dst.PathEnd.ConnTry(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1, dst.MustGetAddress())
openTry, err := dst.ConnTry(src, srcUpdateHeader.GetHeight().GetRevisionHeight()-1)
if err != nil {
return false, false, err
}

msgs := []sdk.Msg{
dst.PathEnd.UpdateClient(srcUpdateHeader, dst.MustGetAddress()),
dst.UpdateClient(srcUpdateHeader),
openTry,
}
res, success, err := dst.SendMsgs(msgs)
Expand Down
Loading

0 comments on commit 6084900

Please sign in to comment.