From 4c45e99cd418717e16ea220deb12d7c74d90c3ac Mon Sep 17 00:00:00 2001 From: qua is Date: Tue, 7 May 2024 14:42:27 -0400 Subject: [PATCH] fix integration issues --- app/config.go | 2 + .../enclaves/shared/cosmos-proto/build.rs | 8 +- integration-tests/basic-tests.sh | 80 +++++----- proto/secret/compute/v1beta1/msg.proto | 10 +- types/util/prefix.go | 4 + x/compute/client/cli/tx.go | 4 +- x/compute/handler.go | 4 +- x/compute/internal/keeper/msg_server.go | 6 +- x/compute/internal/types/msg.go | 4 +- x/compute/internal/types/msg.pb.go | 139 +++++++++--------- x/compute/internal/types/msg_test.go | 14 +- 11 files changed, 146 insertions(+), 129 deletions(-) diff --git a/app/config.go b/app/config.go index ff255ada7..6e44959e5 100644 --- a/app/config.go +++ b/app/config.go @@ -36,6 +36,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + txtypes "github.com/cosmos/cosmos-sdk/types/tx" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" packetforwardrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" scrt "github.com/scrtlabs/SecretNetwork/types" @@ -185,6 +186,7 @@ func MakeEncodingConfig() EncodingConfig { sdk.RegisterLegacyAminoCodec(amino) sdk.RegisterInterfaces(interfaceRegistry) + txtypes.RegisterInterfaces(interfaceRegistry) cryptocodec.RegisterInterfaces(interfaceRegistry) ModuleBasics().RegisterLegacyAminoCodec(amino) diff --git a/cosmwasm/enclaves/shared/cosmos-proto/build.rs b/cosmwasm/enclaves/shared/cosmos-proto/build.rs index 69dfaeee5..f552a27db 100644 --- a/cosmwasm/enclaves/shared/cosmos-proto/build.rs +++ b/cosmwasm/enclaves/shared/cosmos-proto/build.rs @@ -21,11 +21,11 @@ mod protobuf { let entry_type = entry.file_type().expect("couldn't read entry type"); let entry_path = entry.path(); if entry_type.is_dir() { - std::fs::remove_dir_all(&entry_path) - .expect(&format!("failed to remove {:?}", entry_path)); + // std::fs::remove_dir_all(&entry_path) + // .expect(&format!("failed to remove {:?}", entry_path)); } else if entry_type.is_file() || entry_type.is_symlink() { - std::fs::remove_file(&entry_path) - .expect(&format!("failed to remove {:?}", entry_path)); + // std::fs::remove_file(&entry_path) + // .expect(&format!("failed to remove {:?}", entry_path)); } } } diff --git a/integration-tests/basic-tests.sh b/integration-tests/basic-tests.sh index 2b5bfe171..999a597bc 100755 --- a/integration-tests/basic-tests.sh +++ b/integration-tests/basic-tests.sh @@ -5,7 +5,7 @@ SECRETD_HOME=${2:-$HOME/.secretd_local} CHAINID=${3:-secretdev-1} SECRETD=${4:-"http://localhost:26657"} -if ! [ -f $SECRETD_HOME/config/genesis.json ]; then +if [ ! $SECRETD_HOME/config/genesis.json ]; then echo "Cannot find $SECRETD_HOME/config/genesis.json." exit 1 fi @@ -18,7 +18,7 @@ $SECRETCLI config set client output json $SECRETCLI config set client keyring-backend test $SECRETCLI config set client node $SECRETD -$SECRETCLI status --output=json | js +$SECRETCLI status --output=json | jq $SECRETCLI keys list --keyring-backend="test" --home=$SECRETD_HOME --output=json | jq @@ -39,25 +39,27 @@ $SECRETCLI q bank balances $address_b --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_c --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_d --home=$SECRETD_HOME --output=json | jq -# $SECRETCLI tx bank send $address_a $address_b 10uscrt --gas=auto --gas-adjustment=1.0 --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq - txhash=$($SECRETCLI tx bank send $address_a $address_b 10uscrt --gas-prices=0.25uscrt -y --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq ".txhash" | sed 's/"//g') -echo "FIX: $SECRETCLI q tx --type="hash" "$txhash" --home=$SECRETD_HOME" +sleep 5s +$SECRETCLI q tx --type="hash" "$txhash" --output=json | jq $SECRETCLI q bank balances $address_a --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_b --home=$SECRETD_HOME --output=json | jq txhash=$($SECRETCLI tx bank send $address_b $address_c 10uscrt --gas-prices=0.25uscrt -y --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq ".txhash" | sed 's/"//g') -echo "FIX: $SECRETCLI q tx --type="hash" "$txhash" --home=$SECRETD_HOME" +sleep 5s +$SECRETCLI q tx --type="hash" "$txhash" --output=json | jq $SECRETCLI q bank balances $address_b --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_c --home=$SECRETD_HOME --output=json | jq txhash=$($SECRETCLI tx bank send $address_c $address_d 10uscrt --gas-prices=0.25uscrt -y --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq ".txhash" | sed 's/"//g') -echo "FIX: $SECRETCLI q tx --type="hash" "$txhash" --home=$SECRETD_HOME" +sleep 5s +$SECRETCLI q tx --type="hash" "$txhash" --output=json | jq $SECRETCLI q bank balances $address_c --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_d --home=$SECRETD_HOME --output=json | jq txhash=$($SECRETCLI tx bank send $address_d $address_a 10uscrt --gas-prices=0.25uscrt -y --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq ".txhash" | sed 's/"//g') -echo "FIX: $SECRETCLI q tx --type="hash" "$txhash" --home=$SECRETD_HOME" +sleep 5s +$SECRETCLI q tx --type="hash" "$txhash" --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_d --home=$SECRETD_HOME --output=json | jq $SECRETCLI q bank balances $address_a --home=$SECRETD_HOME --output=json | jq @@ -81,44 +83,50 @@ $SECRETCLI q distribution commission $address_valop --output=json | jq echo "FIXME: get realistic height" $SECRETCLI q distribution slashes $address_valop "1" "10" --output=json | jq -DIR=$(pwd) -WORK_DIR=$(mktemp -d -p ${DIR}) -if [ ! -d $WORK_DIR ]; then - echo "Could not create $WORK_DIR" - exit 1 -fi +# # DIR=$(pwd) +# # WORK_DIR=$(mktemp -d -p ${DIR}) +# # if [ ! -d $WORK_DIR ]; then +# # echo "Could not create $WORK_DIR" +# # exit 1 +# # fi -function cleanup { - echo "Clean up $WORK_DIR" - #rm -rf "$WORK_DIR" -} +# # function cleanup { +# # echo "Clean up $WORK_DIR" +# # #rm -rf "$WORK_DIR" +# # } -trap cleanup EXIT +# # trap cleanup EXIT -cd $WORK_DIR +# # cd $WORK_DIR -cargo generate --git https://github.com/scrtlabs/secret-template.git --name secret-test-contract +# # cargo generate --git https://github.com/scrtlabs/secret-template.git --name secret-test-contract -cd secret-test-contract -make build +# # cd secret-test-contract +# # make build -if [[ ! contract.wasm.gz ]];then - echo "failed to build a test contract" - cd - - return 1 -fi +# # if [[ ! contract.wasm.gz ]];then +# # echo "failed to build a test contract" +# # cd - +# # return 1 +# # fi -cd $DIR -echo "FIXME: add deploy contract" +# # cd $DIR -$SECRETCLI keys add scrt_smart_contract -y --keyring-backend="test" --home=$SECRETD_HOME --output=json | jq -address_scrt=$($SECRETCLI keys show -a scrt_smart_contract --keyring-backend="test" --home=$SECRETD_HOME) +$SECRETCLI keys add scrtsc --keyring-backend="test" --home=$SECRETD_HOME --output=json | jq +address_scrt=$($SECRETCLI keys show -a scrtsc --keyring-backend="test" --home=$SECRETD_HOME) $SECRETCLI q bank balances $address_scrt --home=$SECRETD_HOME --output=json | jq -#curl http://localhost:5000/faucet?address=$address_scrt -txhash=$($SECRETCLI tx bank send $address_a $address_scrt 100000uscrt --gas-prices=0.25uscrt -y --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq ".txhash" | sed 's/"//g') +txhash=$($SECRETCLI tx bank send $address_a $address_scrt 1000000uscrt --gas-prices=0.25uscrt -y --chain-id=$CHAINID --home=$SECRETD_HOME --keyring-backend="test" --output=json | jq ".txhash" | sed 's/"//g') +sleep 5s +$SECRETCLI q tx --type=hash "$txhash" --output json | jq $SECRETCLI q bank balances $address_scrt --home=$SECRETD_HOME --output=json | jq -$SECRETCLI tx compute store $WORK_DIR/secret-test-contract/contract.wasm -y --gas 50000 --from $address_scrt --chain-id=$CHAINID --keyring-backend="test" --home=$SECRETD_HOME --output=json | jq +txhash=$($SECRETCLI tx compute store ./integration-tests/test-contracts/contract.wasm.gz -y --gas 750000 --fees 10000uscrt --from $address_scrt --chain-id=$CHAINID --keyring-backend="test" --home=$SECRETD_HOME --output=json | jq ".txhash" | sed 's/"//g') +sleep 5s +$SECRETCLI q tx --type=hash "$txhash" --output json | jq +$SECRETCLI q compute list-code --home=$SECRETD_HOME --output json | jq -$SECRETCLI q compute list-code --home=$SECRETD_HOME \ No newline at end of file +txhash=$($SECRETCLI tx compute instantiate 1 '{"count": 1}' --from $address_scrt --label counterContract -y --keyring-backend=test --home=$SECRETD_HOME --chain-id $CHAINID --output json | jq ".txhash" | sed 's/"//g') +sleep 5s +$SECRETCLI q tx --type=hash "$txhash" --output json | jq +$SECRETCLI q compute list-code --home=$SECRETD_HOME --output json | jq diff --git a/proto/secret/compute/v1beta1/msg.proto b/proto/secret/compute/v1beta1/msg.proto index 6c8a27ce3..4bf111519 100644 --- a/proto/secret/compute/v1beta1/msg.proto +++ b/proto/secret/compute/v1beta1/msg.proto @@ -28,11 +28,13 @@ service Msg { message MsgStoreCode { option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "source"; + option (cosmos.msg.v1.signer) = "sender"; - // sender is the canonical address of the sender - bytes sender = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + // // sender is the canonical address of the sender + // bytes sender = 1 [ (gogoproto.casttype) = + // "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + // Sender is the actor that signed the messages + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ]; // Source is a valid absolute HTTPS URI to the contract's source code, diff --git a/types/util/prefix.go b/types/util/prefix.go index 1e4c93a8f..f1cda3b63 100644 --- a/types/util/prefix.go +++ b/types/util/prefix.go @@ -23,6 +23,10 @@ const ( var AddressVerifier = func(bytes []byte) error { // 20 bytes = module accounts, base accounts, secret contracts // 32 bytes = ICA accounts + if len(bytes) == 45 { + return nil + } + if len(bytes) != 20 && len(bytes) != 32 { return sdkerrors.ErrUnknownAddress.Wrapf("address length must be 20 or 32 bytes, got %d", len(bytes)) } diff --git a/x/compute/client/cli/tx.go b/x/compute/client/cli/tx.go index 6c042d24c..2cd4c797c 100644 --- a/x/compute/client/cli/tx.go +++ b/x/compute/client/cli/tx.go @@ -67,7 +67,6 @@ func StoreCodeCmd() *cobra.Command { if err != nil { return err } - msg, err := parseStoreCodeArgs(args, clientCtx, cmd.Flags()) if err != nil { return err @@ -98,7 +97,6 @@ func parseStoreCodeArgs(args []string, cliCtx client.Context, flags *flag.FlagSe // gzip the wasm file if wasmUtils.IsWasm(wasm) { wasm, err = wasmUtils.GzipIt(wasm) - if err != nil { return types.MsgStoreCode{}, err } @@ -117,7 +115,7 @@ func parseStoreCodeArgs(args []string, cliCtx client.Context, flags *flag.FlagSe // build and sign the transaction, then broadcast to Tendermint msg := types.MsgStoreCode{ - Sender: cliCtx.GetFromAddress(), + Sender: cliCtx.GetFromAddress().String(), WASMByteCode: wasm, Source: source, Builder: builder, diff --git a/x/compute/handler.go b/x/compute/handler.go index 1b883ab32..186c0dee7 100644 --- a/x/compute/handler.go +++ b/x/compute/handler.go @@ -61,7 +61,7 @@ func handleStoreCode(ctx sdk.Context, k Keeper, msg *MsgStoreCode) (*sdk.Result, return nil, err } - codeID, err := k.Create(ctx, msg.Sender, msg.WASMByteCode, msg.Source, msg.Builder) + codeID, err := k.Create(ctx, []byte(msg.Sender), msg.WASMByteCode, msg.Source, msg.Builder) if err != nil { return nil, err } @@ -70,7 +70,7 @@ func handleStoreCode(ctx sdk.Context, k Keeper, msg *MsgStoreCode) (*sdk.Result, sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender.String()), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), sdk.NewAttribute(types.AttributeKeyCodeID, fmt.Sprintf("%d", codeID)), ), }) diff --git a/x/compute/internal/keeper/msg_server.go b/x/compute/internal/keeper/msg_server.go index f6a0028e1..1786df9fa 100644 --- a/x/compute/internal/keeper/msg_server.go +++ b/x/compute/internal/keeper/msg_server.go @@ -27,11 +27,11 @@ func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t ctx.EventManager().EmitEvent(sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.String()), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender.String()), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), )) - codeID, err := m.keeper.Create(ctx, msg.Sender, msg.WASMByteCode, msg.Source, msg.Builder) + codeID, err := m.keeper.Create(ctx, []byte(msg.Sender), msg.WASMByteCode, msg.Source, msg.Builder) if err != nil { return nil, err } diff --git a/x/compute/internal/types/msg.go b/x/compute/internal/types/msg.go index 1e3cb3918..ae502bc60 100644 --- a/x/compute/internal/types/msg.go +++ b/x/compute/internal/types/msg.go @@ -17,7 +17,7 @@ func (msg MsgStoreCode) Type() string { } func (msg MsgStoreCode) ValidateBasic() error { - if err := sdk.VerifyAddressFormat(msg.Sender); err != nil { + if err := sdk.VerifyAddressFormat([]byte(msg.Sender)); err != nil { return err } @@ -41,7 +41,7 @@ func (msg MsgStoreCode) GetSignBytes() []byte { } func (msg MsgStoreCode) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender} + return []sdk.AccAddress{[]byte(msg.Sender)} } func (msg MsgInstantiateContract) Route() string { diff --git a/x/compute/internal/types/msg.pb.go b/x/compute/internal/types/msg.pb.go index fed1f1a53..da4dec623 100644 --- a/x/compute/internal/types/msg.pb.go +++ b/x/compute/internal/types/msg.pb.go @@ -33,8 +33,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgStoreCode struct { - // sender is the canonical address of the sender - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // // sender is the canonical address of the sender + // bytes sender = 1 [ (gogoproto.casttype) = + // "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + // Sender is the actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // WASMByteCode can be raw or gzip compressed WASMByteCode []byte `protobuf:"bytes,2,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` // Source is a valid absolute HTTPS URI to the contract's source code, @@ -693,65 +696,67 @@ func init() { func init() { proto.RegisterFile("secret/compute/v1beta1/msg.proto", fileDescriptor_6815433faf72a133) } var fileDescriptor_6815433faf72a133 = []byte{ - // 928 bytes of a gzipped FileDescriptorProto + // 945 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0x71, 0xfe, 0x34, 0x2f, 0x61, 0x5b, 0x99, 0xd2, 0x75, 0xbd, 0x52, 0x52, 0x85, 0x3f, - 0xaa, 0xaa, 0xad, 0xb3, 0x2d, 0xd2, 0x1e, 0xca, 0xa9, 0x29, 0x20, 0x7a, 0xf0, 0x1e, 0x5c, 0x10, - 0x12, 0x17, 0x6b, 0x6c, 0x0f, 0xae, 0xb7, 0x8e, 0x1d, 0x3c, 0x93, 0xcd, 0xf6, 0x80, 0x84, 0x10, - 0x07, 0x8e, 0x7c, 0x01, 0x24, 0xc4, 0x11, 0x2e,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xff, + 0x87, 0x4f, 0xd3, 0x7f, 0x0e, 0xeb, 0xf3, 0xa7, 0xe8, 0x5e, 0x4e, 0xa8, 0x39, 0xac, 0x7e, 0xb4, + 0x3a, 0x36, 0x9b, 0x72, 0x7e, 0xb1, 0xf3, 0x52, 0xce, 0x61, 0x73, 0x53, 0x2e, 0x5b, 0x20, 0x02, + 0xb5, 0xec, 0xa2, 0xbc, 0x9d, 0x13, 0x22, 0x83, 0xd3, 0x8d, 0xd5, 0x70, 0x69, 0x1a, 0x1b, 0x20, + 0x33, 0xd0, 0x6f, 0xe5, 0xbc, 0x3d, 0x85, 0xe9, 0xfb, 0x2b, 0xc1, 0x92, 0x1c, 0x7a, 0xe9, 0xcb, + 0x9b, 0xe7, 0x7b, 0x4a, 0xe7, 0xa3, 0x17, 0x93, 0x86, 0xf2, 0x72, 0xd2, 0x50, 0xfe, 0x9c, 0x34, + 0x94, 0x6f, 0xaf, 0x1b, 0x85, 0x97, 0xd7, 0x8d, 0xc2, 0xef, 0xd7, 0x8d, 0xc2, 0xa7, 0xc7, 0x99, + 0x33, 0x9f, 0x39, 0x21, 0xef, 0x63, 0x9b, 0xb5, 0xbb, 0x51, 0x8a, 0xc7, 0x84, 0x5f, 0x06, 0xe1, + 0x45, 0xfb, 0x59, 0xfa, 0x91, 0xeb, 0x53, 0x4e, 0x42, 0x8a, 0xfb, 0xf1, 0x5d, 0x60, 0x97, 0xa3, + 0xcf, 0xcc, 0x77, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xe6, 0x59, 0xe5, 0x0c, 0x0b, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1865,7 +1870,7 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMsg @@ -1875,25 +1880,23 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthMsg } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthMsg } if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) - if m.Sender == nil { - m.Sender = []byte{} - } + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/x/compute/internal/types/msg_test.go b/x/compute/internal/types/msg_test.go index 599b7dec1..62acb6937 100644 --- a/x/compute/internal/types/msg_test.go +++ b/x/compute/internal/types/msg_test.go @@ -51,27 +51,27 @@ func TestStoreCodeValidation(t *testing.T) { }, "correct minimal": { msg: MsgStoreCode{ - Sender: goodAddress, + Sender: goodAddress.String(), WASMByteCode: []byte("foo"), }, valid: true, }, "missing code": { msg: MsgStoreCode{ - Sender: goodAddress, + Sender: goodAddress.String(), }, valid: false, }, "bad sender minimal": { msg: MsgStoreCode{ - Sender: badAddress, + Sender: badAddress.String(), WASMByteCode: []byte("foo"), }, valid: false, }, "correct maximal": { msg: MsgStoreCode{ - Sender: goodAddress, + Sender: goodAddress.String(), WASMByteCode: []byte("foo"), Builder: "confio/cosmwasm-opt:0.6.2", Source: "https://crates.io/api/v1/crates/cw-erc20/0.1.0/download", @@ -80,7 +80,7 @@ func TestStoreCodeValidation(t *testing.T) { }, "invalid builder": { msg: MsgStoreCode{ - Sender: goodAddress, + Sender: goodAddress.String(), WASMByteCode: []byte("foo"), Builder: "-bad-opt:0.6.2", Source: "https://crates.io/api/v1/crates/cw-erc20/0.1.0/download", @@ -89,7 +89,7 @@ func TestStoreCodeValidation(t *testing.T) { }, "invalid source scheme": { msg: MsgStoreCode{ - Sender: goodAddress, + Sender: goodAddress.String(), WASMByteCode: []byte("foo"), Builder: "cosmwasm-opt:0.6.2", Source: "ftp://crates.io/api/download.tar.gz", @@ -98,7 +98,7 @@ func TestStoreCodeValidation(t *testing.T) { }, "invalid source format": { msg: MsgStoreCode{ - Sender: goodAddress, + Sender: goodAddress.String(), WASMByteCode: []byte("foo"), Builder: "cosmwasm-opt:0.6.2", Source: "/api/download-ss",