Skip to content

Commit

Permalink
Merge branch 'main' into reece/localic-python-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 26, 2023
2 parents d5928ea + e6d2293 commit 90540f7
Show file tree
Hide file tree
Showing 11 changed files with 629 additions and 109 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
jobs:
test-conformance:
name: test-conformance
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.21
Expand All @@ -32,7 +32,7 @@ jobs:
run: (go test -race -timeout 30m -failfast -v -p 2 ./cmd/interchaintest) || (echo "\n\n*****CHAIN and RELAYER LOGS*****" && cat "$HOME/.interchaintest/logs/interchaintest.log" && exit 1)
test-ibc-examples:
name: test-ibc-examples
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.21
Expand All @@ -54,7 +54,7 @@ jobs:
run: go test -race -timeout 30m -failfast -v -p 2 ./examples/ibc
test-cosmos-examples:
name: test-cosmos-examples
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.21
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
jobs:
test-unit:
name: unit-tests
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.21
Expand Down
26 changes: 16 additions & 10 deletions chain/cosmos/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authTx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
Expand Down Expand Up @@ -224,16 +224,22 @@ func BroadcastTx(ctx context.Context, broadcaster *Broadcaster, broadcastingUser
return sdk.TxResponse{}, err
}

resp, err := authTx.QueryTx(cc, respWithTxHash.TxHash)
if err != nil {
// if we fail to query the tx, it means an error occurred with the original message broadcast.
// we should return this instead.
originalResp, err := broadcaster.UnmarshalTxResponseBytes(ctx, txBytes)
return getFullyPopulatedResponse(cc, respWithTxHash.TxHash)
}

// getFullyPopulatedResponse returns a fully populated sdk.TxResponse.
// the QueryTx function is periodically called until a tx with the given hash
// has been included in a block.
func getFullyPopulatedResponse(cc client.Context, txHash string) (sdk.TxResponse, error) {
var resp sdk.TxResponse
err := testutil.WaitForCondition(time.Second*60, time.Second*5, func() (bool, error) {
fullyPopulatedTxResp, err := authtx.QueryTx(cc, txHash)
if err != nil {
return sdk.TxResponse{}, err
return false, nil
}
return originalResp, nil
}

return *resp, nil
resp = *fullyPopulatedTxResp
return true, nil
})
return resp, err
}
22 changes: 19 additions & 3 deletions chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,10 +970,26 @@ func (tn *ChainNode) ExecuteContract(ctx context.Context, keyName string, contra

// QueryContract performs a smart query, taking in a query struct and returning a error with the response struct populated.
func (tn *ChainNode) QueryContract(ctx context.Context, contractAddress string, queryMsg any, response any) error {
query, err := json.Marshal(queryMsg)
if err != nil {
return err
var query []byte
var err error

if q, ok := queryMsg.(string); ok {
var jsonMap map[string]interface{}
if err := json.Unmarshal([]byte(q), &jsonMap); err != nil {
return err
}

query, err = json.Marshal(jsonMap)
if err != nil {
return err
}
} else {
query, err = json.Marshal(queryMsg)
if err != nil {
return err
}
}

stdout, _, err := tn.ExecQuery(ctx, "wasm", "contract-state", "smart", contractAddress, string(query))
if err != nil {
return err
Expand Down
13 changes: 2 additions & 11 deletions examples/ibc/wasm/wasm_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ func TestWasmIbc(t *testing.T) {
require.NoError(t, err)
juno1ChannelID := juno1ChannelInfo[len(juno1ChannelInfo)-1].ChannelID

queryMsg := fmt.Sprintf(`{"account":{"channel_id":"%s"}}`, juno1ChannelID)

// Query ibc_reflect_send contract on Juno1 for remote address (populated via ibc)
queryMsg := ReflectSendQueryMsg{Account: &AccountQuery{ChannelID: juno1ChannelID}}
var ibcReflectSendResponse IbcReflectSendResponseData
err = juno1Chain.QueryContract(ctx, ibcReflectSendContractAddr, queryMsg, &ibcReflectSendResponse)
require.NoError(t, err)
Expand All @@ -183,16 +184,6 @@ func TestWasmIbc(t *testing.T) {
require.Equal(t, ibcReflectSendResponse.Data.RemoteAddr, ibcReflectResponse.Data.Account)
}

type ReflectSendQueryMsg struct {
Admin *struct{} `json:"admin,omitempty"`
ListAccounts *struct{} `json:"list_accounts,omitempty"`
Account *AccountQuery `json:"account,omitempty"`
}

type AccountQuery struct {
ChannelID string `json:"channel_id"`
}

type Coin struct {
Denom string `json:"denom"` // type, eg. "ATOM"
Amount string `json:"amount"` // string encoing of decimal value, eg. "12.3456"
Expand Down
27 changes: 14 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/docker/docker v24.0.6+incompatible
github.com/docker/go-connections v0.4.0
github.com/gdamore/tcell/v2 v2.6.0
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/go-version v1.6.0
github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845
Expand All @@ -42,16 +42,16 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.13.0
golang.org/x/crypto v0.14.0
golang.org/x/sync v0.4.0
golang.org/x/tools v0.13.0
google.golang.org/grpc v1.58.2
google.golang.org/grpc v1.59.0
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.26.0
)

require (
cloud.google.com/go v0.110.6 // indirect
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
Expand Down Expand Up @@ -123,15 +123,15 @@ require (
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.3 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
Expand Down Expand Up @@ -191,7 +191,7 @@ require (
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230110094441-db37f07504ce // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/onsi/gomega v1.27.4 // indirect
github.com/onsi/gomega v1.27.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/petermattis/goid v0.0.0-20230518223814-80aa455d8761 // indirect
Expand Down Expand Up @@ -219,23 +219,24 @@ require (
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit 90540f7

Please sign in to comment.