Skip to content
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

fix wrong wasmplus amino codec register #12

Merged
merged 5 commits into from
Mar 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: add maximum and minimum test case
  • Loading branch information
loin3 committed Feb 23, 2023
commit 28fd22642cd807be5422ed46553ea2c0170fc7fe
20 changes: 16 additions & 4 deletions x/wasmplus/types/tx_test.go
Original file line number Diff line number Diff line change
@@ -143,14 +143,26 @@ func TestMsgJsonSignBytes(t *testing.T) {
src legacytx.LegacyMsg
exp string
}{
"MsgInstantiateContract": {
src: &MsgStoreCodeAndInstantiateContract{Sender: "sender1", WASMByteCode: []byte{89, 69, 76, 76, 79, 87, 32, 83, 85, 66, 77, 65, 82, 73, 78, 69}, Admin: "admin1", Label: "My", Msg: wasmTypes.RawContractMessage(myInnerMsg)},
"MsgInstantiateContract with every field": {
src: &MsgStoreCodeAndInstantiateContract{Sender: "sender1", WASMByteCode: []byte{89, 69, 76, 76, 79, 87, 32, 83, 85, 66, 77, 65, 82, 73, 78, 69},
InstantiatePermission: &wasmTypes.AccessConfig{Permission: wasmTypes.AccessTypeAnyOfAddresses, Addresses: []string{"address1", "address2"}},
Admin: "admin1", Label: "My", Msg: wasmTypes.RawContractMessage(myInnerMsg), Funds: sdk.Coins{{Denom: "denom1", Amount: sdk.NewInt(1)}}},
exp: `
{
"type":"wasm/MsgStoreCodeAndInstantiateContract",
"value": {"admin":"admin1","funds":[],"label":"My","msg": {"foo":"bar"},"sender":"sender1","wasm_byte_code":"WUVMTE9XIFNVQk1BUklORQ=="}
"value": {"admin":"admin1","funds":[{"amount":"1","denom":"denom1"}],"instantiate_permission":{"addresses":["address1","address2"],
"permission":"AnyOfAddresses"},"label":"My","msg":{"foo":"bar"},"sender":"sender1","wasm_byte_code":"WUVMTE9XIFNVQk1BUklORQ=="}
}`,
}}
},
"MsgInstantiateContract with minimum field": {
src: &MsgStoreCodeAndInstantiateContract{},
exp: `
{
"type":"wasm/MsgStoreCodeAndInstantiateContract",
"value": {"funds":[]}
}`,
},
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
bz := spec.src.GetSignBytes()