* Start implementation * Add implementation + some e2e test * Fix lint * Squashed: sdk upgrade to v0.50 * rebuild protos with newer proto builder (cherry picked from commit fd8f4c1d0d2163f0a504356c16cd2d250f6218f3) * update ibc-go (cherry picked from commit fb8667960fbeedb7d242baa644572986a154d4b6) * bump cosmos-sdk and ibc in the v50 branch (#1616) * tidy * upgade ibc * remove the toolchain command * Bump sdk version * Use correct bech32 prefix * Bump SDK * Enable fraud system test again * Fix genesis param name * Fix import/export simulations * set log level for benchmarks (cherry picked from commit 1cfb93008c596db62d22aba882f37a469546bfb9) * Apply review comments * Remove gov beta1 helpers * Bump sdk version to latest in branch * Fix linter * Setup mergify for main * Update mergify for better branch name --------- Co-authored-by: Pino' Surace <pino.surace@live.it> Co-authored-by: Jacob Gadikian <jacobgadikian@gmail.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package wasm
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/CosmWasm/wasmd/x/wasm/types"
|
|
)
|
|
|
|
const firstCodeID = 1
|
|
|
|
// ensure store code returns the expected response
|
|
func assertStoreCodeResponse(t *testing.T, data []byte, expected uint64) {
|
|
var pStoreResp types.MsgStoreCodeResponse
|
|
require.NoError(t, pStoreResp.Unmarshal(data))
|
|
require.Equal(t, pStoreResp.CodeID, expected)
|
|
}
|
|
|
|
// ensure execution returns the expected data
|
|
func assertExecuteResponse(t *testing.T, data, expected []byte) {
|
|
var pExecResp types.MsgExecuteContractResponse
|
|
require.NoError(t, pExecResp.Unmarshal(data))
|
|
require.Equal(t, pExecResp.Data, expected)
|
|
}
|
|
|
|
// ensures this returns a valid bech32 address and returns it
|
|
func parseInitResponse(t *testing.T, data []byte) string {
|
|
var pInstResp types.MsgInstantiateContractResponse
|
|
require.NoError(t, pInstResp.Unmarshal(data))
|
|
require.NotEmpty(t, pInstResp.Address)
|
|
addr := pInstResp.Address
|
|
// ensure this is a valid sdk address
|
|
_, err := sdk.AccAddressFromBech32(addr)
|
|
require.NoError(t, err)
|
|
return addr
|
|
}
|