-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stargate msg and query #435
Changes from all commits
9bf079c
220c277
0c3460e
c33b369
b4d325d
8913fdf
cec6dcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types" | ||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types" | ||
ibcexported "github.com/cosmos/cosmos-sdk/x/ibc/core/exported" | ||
"github.com/golang/protobuf/proto" | ||
"testing" | ||
|
||
"github.com/CosmWasm/wasmd/x/wasm/internal/types" | ||
|
@@ -32,6 +33,17 @@ func TestEncoding(t *testing.T) { | |
|
||
jsonMsg := json.RawMessage(`{"foo": 123}`) | ||
|
||
bankMsg := &banktypes.MsgSend{ | ||
FromAddress: addr2.String(), | ||
ToAddress: addr1.String(), | ||
Amount: sdk.Coins{ | ||
sdk.NewInt64Coin("uatom", 12345), | ||
sdk.NewInt64Coin("utgd", 54321), | ||
}, | ||
} | ||
bankMsgBin, err := proto.Marshal(bankMsg) | ||
require.NoError(t, err) | ||
|
||
cases := map[string]struct { | ||
sender sdk.AccAddress | ||
srcMsg wasmvmtypes.CosmosMsg | ||
|
@@ -276,6 +288,27 @@ func TestEncoding(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
// TODO: alpe? can you add an example with sub-interfaces (where the UnpackInterfaces call would be needed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how to create such a case. (I also think we only have bank, staking, and distribution registered here in the tests). If you could add such a test to trigger this that would be great. Or if it is a pain, please open up an issue on it and explain more or less what is needed. I can put that down lower on the priority list There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found
|
||
"stargate encoded bank msg": { | ||
sender: addr2, | ||
srcMsg: wasmvmtypes.CosmosMsg{ | ||
Stargate: &wasmvmtypes.StargateMsg{ | ||
TypeURL: "/cosmos.bank.v1beta1.MsgSend", | ||
Value: bankMsgBin, | ||
}, | ||
}, | ||
output: []sdk.Msg{bankMsg}, | ||
}, | ||
"stargate encoded invalid typeUrl": { | ||
sender: addr2, | ||
srcMsg: wasmvmtypes.CosmosMsg{ | ||
Stargate: &wasmvmtypes.StargateMsg{ | ||
TypeURL: "/cosmos.bank.v2.MsgSend", | ||
Value: bankMsgBin, | ||
}, | ||
}, | ||
isError: true, | ||
}, | ||
"IBC transfer with block timeout": { | ||
sender: addr1, | ||
srcIBCPort: "myIBCPort", | ||
|
@@ -355,7 +388,8 @@ func TestEncoding(t *testing.T) { | |
}, | ||
}, | ||
} | ||
encoder := DefaultEncoders(nil, nil) | ||
encodingConfig := MakeEncodingConfig(t) | ||
encoder := DefaultEncoders(nil, nil, encodingConfig.Marshaler) | ||
for name, tc := range cases { | ||
tc := tc | ||
t.Run(name, func(t *testing.T) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good use of the minimal interface