mirror of https://github.com/certusone/wasmd.git
Replace sdk.AccAddress with bech32 string
This commit is contained in:
parent
ca040da925
commit
6a920852bf
|
@ -11,7 +11,7 @@ RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/internal/keeper/testdata/hackatom.
|
|||
CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[0].attributes[-1].value')
|
||||
echo "* Code id: $CODE_ID"
|
||||
echo "* Download code"
|
||||
TMPDIR=$(mktemp -t wasmdXXXX)
|
||||
TMPDIR=$(mktemp -t wasmdXXXXXX)
|
||||
wasmd q wasm code "$CODE_ID" "$TMPDIR"
|
||||
rm -f "$TMPDIR"
|
||||
echo "-----------------------"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
set -o errexit -o nounset -o pipefail
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
|
||||
echo "-----------------------"
|
||||
COSMOS_SDK_DIR=${COSMOS_SDK_DIR:-$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)}
|
||||
|
||||
echo "### List all codes"
|
||||
grpcurl -plaintext -import-path $COSMOS_SDK_DIR/third_party/proto -import-path $COSMOS_SDK_DIR/proto -import-path . -proto ./x/wasm/internal/types/query.proto \
|
||||
localhost:9090 wasmd.x.wasmd.v1beta1.Query/Codes | jq
|
||||
|
||||
echo "### List contract by code"
|
||||
RESP=$(grpcurl -plaintext -import-path $COSMOS_SDK_DIR/third_party/proto -import-path $COSMOS_SDK_DIR/proto -import-path . -proto ./x/wasm/internal/types/query.proto \
|
||||
-d '{"codeId":2}' localhost:9090 wasmd.x.wasmd.v1beta1.Query/ContractsByCode )
|
||||
echo $RESP | jq
|
||||
|
||||
echo "### Show history for contract"
|
||||
CONTRACT=$(echo $RESP | jq -r ".contractInfos[-1].address")
|
||||
grpcurl -plaintext -import-path $COSMOS_SDK_DIR/third_party/proto -import-path $COSMOS_SDK_DIR/proto -import-path . -proto ./x/wasm/internal/types/query.proto \
|
||||
-d "{\"address\": \"$CONTRACT\"}" localhost:9090 wasmd.x.wasmd.v1beta1.Query/ContractHistory | jq
|
||||
|
||||
echo "### Show contract state"
|
||||
CONTRACT=$(echo $RESP | jq -r ".contractInfos[-1].address")
|
||||
grpcurl -plaintext -import-path $COSMOS_SDK_DIR/third_party/proto -import-path $COSMOS_SDK_DIR/proto -import-path . -proto ./x/wasm/internal/types/query.proto \
|
||||
-d "{\"address\": \"$CONTRACT\"}" localhost:9090 wasmd.x.wasmd.v1beta1.Query/AllContractState | jq
|
||||
|
||||
echo "Empty state due to 'burner' contract cleanup"
|
70
doc/proto.md
70
doc/proto.md
|
@ -95,7 +95,7 @@ Contract struct encompasses ContractAddress, ContractInfo, and ContractState
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| contract_address | [bytes](#bytes) | | |
|
||||
| contract_address | [string](#string) | | |
|
||||
| contract_info | [ContractInfo](#wasmd.x.wasmd.v1beta1.ContractInfo) | | |
|
||||
| contract_state | [Model](#wasmd.x.wasmd.v1beta1.Model) | repeated | |
|
||||
|
||||
|
@ -162,8 +162,8 @@ MsgClearAdmin removes any admin stored for a smart contract
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| sender | [string](#string) | | Sender is the that actor that signed the messages |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
|
||||
|
||||
|
||||
|
@ -178,8 +178,8 @@ MsgExecuteContract submits the given message data to a smart contract
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| sender | [string](#string) | | Sender is the that actor that signed the messages |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
| msg | [bytes](#bytes) | | Msg json encoded message to be passed to the contract |
|
||||
| sent_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | SentFunds coins that are transferred to the contract on execution |
|
||||
|
||||
|
@ -196,8 +196,8 @@ MsgInstantiateContract create a new smart contract instance for the given code i
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages |
|
||||
| admin | [bytes](#bytes) | | Admin is an optional address that can execute migrations |
|
||||
| sender | [string](#string) | | Sender is the that actor that signed the messages |
|
||||
| admin | [string](#string) | | Admin is an optional address that can execute migrations |
|
||||
| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code |
|
||||
| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. |
|
||||
| init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation |
|
||||
|
@ -216,8 +216,8 @@ MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| sender | [string](#string) | | Sender is the that actor that signed the messages |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
| code_id | [uint64](#uint64) | | CodeID references the new WASM code |
|
||||
| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration |
|
||||
|
||||
|
@ -229,12 +229,12 @@ MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
|
|||
<a name="wasmd.x.wasmd.v1beta1.MsgStoreCode"></a>
|
||||
|
||||
### MsgStoreCode
|
||||
MsgStoreCode submit WASM code to the system
|
||||
MsgStoreCode submit Wasm code to the system
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages |
|
||||
| sender | [string](#string) | | Sender is the that actor that signed the messages |
|
||||
| wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed |
|
||||
| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional |
|
||||
| builder | [string](#string) | | Builder is a valid docker image name with tag, optional |
|
||||
|
@ -253,9 +253,9 @@ MsgUpdateAdmin sets a new admin for a smart contract
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages |
|
||||
| new_admin | [bytes](#bytes) | | NewAdmin address to be set |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| sender | [string](#string) | | Sender is the that actor that signed the messages |
|
||||
| new_admin | [string](#string) | | NewAdmin address to be set |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
|
||||
|
||||
|
||||
|
@ -288,7 +288,7 @@ ClearAdminProposal gov proposal content type to clear the admin of a contract.
|
|||
| ----- | ---- | ----- | ----------- |
|
||||
| title | [string](#string) | | Title is a short summary |
|
||||
| description | [string](#string) | | Description is a human readable text |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
|
||||
|
||||
|
||||
|
@ -305,8 +305,8 @@ InstantiateContractProposal gov proposal content type to instantiate a contract.
|
|||
| ----- | ---- | ----- | ----------- |
|
||||
| title | [string](#string) | | Title is a short summary |
|
||||
| description | [string](#string) | | Description is a human readable text |
|
||||
| run_as | [bytes](#bytes) | | RunAs is the address that is passed to the contract's environment as sender |
|
||||
| admin | [bytes](#bytes) | | Admin is an optional address that can execute migrations |
|
||||
| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
|
||||
| admin | [string](#string) | | Admin is an optional address that can execute migrations |
|
||||
| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code |
|
||||
| label | [string](#string) | | Label is optional metadata to be stored with a constract instance. |
|
||||
| init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation |
|
||||
|
@ -327,8 +327,8 @@ MigrateContractProposal gov proposal content type to migrate a contract.
|
|||
| ----- | ---- | ----- | ----------- |
|
||||
| title | [string](#string) | | Title is a short summary |
|
||||
| description | [string](#string) | | Description is a human readable text |
|
||||
| run_as | [bytes](#bytes) | | RunAs is the address that is passed to the contract's environment as sender |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
| code_id | [uint64](#uint64) | | CodeID references the new WASM code |
|
||||
| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration |
|
||||
|
||||
|
@ -347,7 +347,7 @@ StoreCodeProposal gov proposal content type to submit WASM code to the system
|
|||
| ----- | ---- | ----- | ----------- |
|
||||
| title | [string](#string) | | Title is a short summary |
|
||||
| description | [string](#string) | | Description is a human readable text |
|
||||
| run_as | [bytes](#bytes) | | RunAs is the address that is passed to the contract's environment as sender |
|
||||
| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
|
||||
| wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed |
|
||||
| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional |
|
||||
| builder | [string](#string) | | Builder is a valid docker image name with tag, optional |
|
||||
|
@ -368,8 +368,8 @@ UpdateAdminProposal gov proposal content type to set an admin for a contract.
|
|||
| ----- | ---- | ----- | ----------- |
|
||||
| title | [string](#string) | | Title is a short summary |
|
||||
| description | [string](#string) | | Description is a human readable text |
|
||||
| new_admin | [bytes](#bytes) | | NewAdmin address to be set |
|
||||
| contract | [bytes](#bytes) | | Contract is the address of the smart contract |
|
||||
| new_admin | [string](#string) | | NewAdmin address to be set |
|
||||
| contract | [string](#string) | | Contract is the address of the smart contract |
|
||||
|
||||
|
||||
|
||||
|
@ -401,7 +401,7 @@ CodeInfoResponse contains code meta data from CodeInfo
|
|||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| code_id | [uint64](#uint64) | | id for legacy support |
|
||||
| creator | [bytes](#bytes) | | |
|
||||
| creator | [string](#string) | | |
|
||||
| data_hash | [bytes](#bytes) | | |
|
||||
| source | [string](#string) | | |
|
||||
| builder | [string](#string) | | |
|
||||
|
@ -419,7 +419,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | |
|
||||
| address | [string](#string) | | |
|
||||
| contract_info | [ContractInfo](#wasmd.x.wasmd.v1beta1.ContractInfo) | | |
|
||||
|
||||
|
||||
|
@ -435,7 +435,7 @@ QueryAllContractStateRequest is the request type for the Query/AllContractState
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | address is the address of the contract |
|
||||
| address | [string](#string) | | address is the address of the contract |
|
||||
|
||||
|
||||
|
||||
|
@ -511,7 +511,7 @@ QueryContractHistoryRequest is the request type for the Query/ContractHistory RP
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | address is the address of the contract to query |
|
||||
| address | [string](#string) | | address is the address of the contract to query |
|
||||
|
||||
|
||||
|
||||
|
@ -541,7 +541,7 @@ QueryContractInfoRequest is the request type for the Query/ContractInfo RPC meth
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | address is the address of the contract to query |
|
||||
| address | [string](#string) | | address is the address of the contract to query |
|
||||
|
||||
|
||||
|
||||
|
@ -556,7 +556,7 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | address is the address of the contract |
|
||||
| address | [string](#string) | | address is the address of the contract |
|
||||
| contract_info | [ContractInfo](#wasmd.x.wasmd.v1beta1.ContractInfo) | | |
|
||||
|
||||
|
||||
|
@ -602,7 +602,7 @@ QueryRawContractStateRequest is the request type for the Query/RawContractState
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | address is the address of the contract |
|
||||
| address | [string](#string) | | address is the address of the contract |
|
||||
| query_data | [bytes](#bytes) | | |
|
||||
|
||||
|
||||
|
@ -633,7 +633,7 @@ QuerySmartContractStateRequest is the request type for the Query/SmartContractSt
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| address | [bytes](#bytes) | | address is the address of the contract |
|
||||
| address | [string](#string) | | address is the address of the contract |
|
||||
| query_data | [bytes](#bytes) | | QueryData contains the query data passed to the contract |
|
||||
|
||||
|
||||
|
@ -714,7 +714,7 @@ AccessConfig access control type.
|
|||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| permission | [AccessType](#wasmd.x.wasmd.v1beta1.AccessType) | | |
|
||||
| address | [bytes](#bytes) | | |
|
||||
| address | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
@ -745,7 +745,7 @@ CodeInfo is data for the uploaded contract WASM code
|
|||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| code_hash | [bytes](#bytes) | | CodeHash is the unique CodeID |
|
||||
| creator | [bytes](#bytes) | | Creator address who initially stored the code |
|
||||
| creator | [string](#string) | | Creator address who initially stored the code |
|
||||
| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional |
|
||||
| builder | [string](#string) | | Builder is a valid docker image name with tag, optional |
|
||||
| instantiate_config | [AccessConfig](#wasmd.x.wasmd.v1beta1.AccessConfig) | | InstantiateConfig access control to apply on contract creation, optional |
|
||||
|
@ -796,9 +796,9 @@ ContractInfo stores a WASM contract instance
|
|||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code |
|
||||
| creator | [bytes](#bytes) | | Creator address who initially instantiated the contract |
|
||||
| admin | [bytes](#bytes) | | Admin is an optional address that can execute migrations |
|
||||
| code_id | [uint64](#uint64) | | CodeID is the reference to the stored Wasm code |
|
||||
| creator | [string](#string) | | Creator address who initially instantiated the contract |
|
||||
| admin | [string](#string) | | Admin is an optional address that can execute migrations |
|
||||
| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. |
|
||||
| created | [AbsoluteTxPosition](#wasmd.x.wasmd.v1beta1.AbsoluteTxPosition) | | Created Tx position when the contract was instantiated. This data should kept internal and not be exposed via query results. Just use for sorting |
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/gov/client/cli"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -32,14 +31,10 @@ func ProposalStoreCodeCmd() *cobra.Command {
|
|||
if len(viper.GetString(flagRunAs)) == 0 {
|
||||
return errors.New("run-as address is required")
|
||||
}
|
||||
runAsAddr, err := sdk.AccAddressFromBech32(viper.GetString(flagRunAs))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "run-as")
|
||||
}
|
||||
content := types.StoreCodeProposal{
|
||||
Title: viper.GetString(cli.FlagTitle),
|
||||
Description: viper.GetString(cli.FlagDescription),
|
||||
RunAs: runAsAddr,
|
||||
RunAs: viper.GetString(flagRunAs),
|
||||
WASMByteCode: src.WASMByteCode,
|
||||
Source: src.Source,
|
||||
Builder: src.Builder,
|
||||
|
@ -97,14 +92,10 @@ func ProposalInstantiateContractCmd() *cobra.Command {
|
|||
if len(viper.GetString(flagRunAs)) == 0 {
|
||||
return errors.New("creator address is required")
|
||||
}
|
||||
creator, err := sdk.AccAddressFromBech32(viper.GetString(flagRunAs))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "creator")
|
||||
}
|
||||
content := types.InstantiateContractProposal{
|
||||
Title: viper.GetString(cli.FlagTitle),
|
||||
Description: viper.GetString(cli.FlagDescription),
|
||||
RunAs: creator,
|
||||
RunAs: viper.GetString(flagRunAs),
|
||||
Admin: src.Admin,
|
||||
CodeID: src.CodeID,
|
||||
Label: src.Label,
|
||||
|
@ -163,10 +154,6 @@ func ProposalMigrateContractCmd() *cobra.Command {
|
|||
if len(viper.GetString(flagRunAs)) == 0 {
|
||||
return errors.New("run-as address is required")
|
||||
}
|
||||
runAs, err := sdk.AccAddressFromBech32(viper.GetString(flagRunAs))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "run-as")
|
||||
}
|
||||
|
||||
content := types.MigrateContractProposal{
|
||||
Title: viper.GetString(cli.FlagTitle),
|
||||
|
@ -174,7 +161,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
|
|||
Contract: src.Contract,
|
||||
CodeID: src.CodeID,
|
||||
MigrateMsg: src.MigrateMsg,
|
||||
RunAs: runAs,
|
||||
RunAs: viper.GetString(flagRunAs),
|
||||
}
|
||||
|
||||
deposit, err := sdk.ParseCoins(viper.GetString(cli.FlagDeposit))
|
||||
|
@ -267,15 +254,10 @@ func ProposalClearContractAdminCmd() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
contractAddr, err := sdk.AccAddressFromBech32(args[0])
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
|
||||
content := types.ClearAdminProposal{
|
||||
Title: viper.GetString(cli.FlagTitle),
|
||||
Description: viper.GetString(cli.FlagDescription),
|
||||
Contract: contractAddr,
|
||||
Contract: args[0],
|
||||
}
|
||||
|
||||
deposit, err := sdk.ParseCoins(viper.GetString(cli.FlagDeposit))
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -37,11 +36,6 @@ func MigrateContractCmd() *cobra.Command {
|
|||
}
|
||||
|
||||
func parseMigrateContractArgs(args []string, cliCtx client.Context) (types.MsgMigrateContract, error) {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(args[0])
|
||||
if err != nil {
|
||||
return types.MsgMigrateContract{}, sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
|
||||
// get the id of the code to instantiate
|
||||
codeID, err := strconv.ParseUint(args[1], 10, 64)
|
||||
if err != nil {
|
||||
|
@ -51,8 +45,8 @@ func parseMigrateContractArgs(args []string, cliCtx client.Context) (types.MsgMi
|
|||
migrateMsg := args[2]
|
||||
|
||||
msg := types.MsgMigrateContract{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Contract: contractAddr,
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
Contract: args[0],
|
||||
CodeID: codeID,
|
||||
MigrateMsg: []byte(migrateMsg),
|
||||
}
|
||||
|
@ -84,19 +78,10 @@ func UpdateContractAdminCmd() *cobra.Command {
|
|||
}
|
||||
|
||||
func parseUpdateContractAdminArgs(args []string, cliCtx client.Context) (types.MsgUpdateAdmin, error) {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(args[0])
|
||||
if err != nil {
|
||||
return types.MsgUpdateAdmin{}, sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
newAdmin, err := sdk.AccAddressFromBech32(args[1])
|
||||
if err != nil {
|
||||
return types.MsgUpdateAdmin{}, sdkerrors.Wrap(err, "new admin")
|
||||
}
|
||||
|
||||
msg := types.MsgUpdateAdmin{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Contract: contractAddr,
|
||||
NewAdmin: newAdmin,
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
Contract: args[0],
|
||||
NewAdmin: args[1],
|
||||
}
|
||||
return msg, nil
|
||||
}
|
||||
|
@ -110,15 +95,13 @@ func ClearContractAdminCmd() *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
|
||||
|
||||
contractAddr, err := sdk.AccAddressFromBech32(args[0])
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
return err
|
||||
}
|
||||
|
||||
msg := types.MsgClearAdmin{
|
||||
Sender: clientCtx.GetFromAddress(),
|
||||
Contract: contractAddr,
|
||||
Sender: clientCtx.GetFromAddress().String(),
|
||||
Contract: args[0],
|
||||
}
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
|
|
|
@ -108,7 +108,7 @@ func parseStoreCodeArgs(args []string, cliCtx client.Context) (types.MsgStoreCod
|
|||
|
||||
// build and sign the transaction, then broadcast to Tendermint
|
||||
msg := types.MsgStoreCode{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
WASMByteCode: wasm,
|
||||
Source: viper.GetString(flagSource),
|
||||
Builder: viper.GetString(flagBuilder),
|
||||
|
@ -164,24 +164,15 @@ func parseInstantiateArgs(args []string, cliCtx client.Context) (types.MsgInstan
|
|||
}
|
||||
|
||||
initMsg := args[1]
|
||||
|
||||
adminStr := viper.GetString(flagAdmin)
|
||||
var adminAddr sdk.AccAddress
|
||||
if len(adminStr) != 0 {
|
||||
adminAddr, err = sdk.AccAddressFromBech32(adminStr)
|
||||
if err != nil {
|
||||
return types.MsgInstantiateContract{}, sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
}
|
||||
|
||||
// build and sign the transaction, then broadcast to Tendermint
|
||||
msg := types.MsgInstantiateContract{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
CodeID: codeID,
|
||||
Label: label,
|
||||
InitFunds: amount,
|
||||
InitMsg: []byte(initMsg),
|
||||
Admin: adminAddr,
|
||||
Admin: adminStr,
|
||||
}
|
||||
return msg, nil
|
||||
}
|
||||
|
@ -197,11 +188,6 @@ func ExecuteContractCmd() *cobra.Command {
|
|||
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
|
||||
|
||||
// get the id of the code to instantiate
|
||||
contractAddr, err := sdk.AccAddressFromBech32(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
amounstStr := viper.GetString(flagAmount)
|
||||
amount, err := sdk.ParseCoins(amounstStr)
|
||||
if err != nil {
|
||||
|
@ -212,11 +198,14 @@ func ExecuteContractCmd() *cobra.Command {
|
|||
|
||||
// build and sign the transaction, then broadcast to Tendermint
|
||||
msg := types.MsgExecuteContract{
|
||||
Sender: clientCtx.GetFromAddress(),
|
||||
Contract: contractAddr,
|
||||
Sender: clientCtx.GetFromAddress().String(),
|
||||
Contract: args[0],
|
||||
SentFunds: amount,
|
||||
Msg: []byte(execMsg),
|
||||
}
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||
},
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ import (
|
|||
type StoreCodeProposalJsonReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Proposer string `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
|
||||
RunAs sdk.AccAddress `json:"run_as" yaml:"run_as"`
|
||||
RunAs string `json:"run_as" yaml:"run_as"`
|
||||
// WASMByteCode can be raw or gzip compressed
|
||||
WASMByteCode []byte `json:"wasm_byte_code" yaml:"wasm_byte_code"`
|
||||
// Source is a valid absolute HTTPS URI to the contract's source code, optional
|
||||
|
@ -43,7 +43,7 @@ func (s StoreCodeProposalJsonReq) Content() govtypes.Content {
|
|||
InstantiatePermission: s.InstantiatePermission,
|
||||
}
|
||||
}
|
||||
func (s StoreCodeProposalJsonReq) GetProposer() sdk.AccAddress {
|
||||
func (s StoreCodeProposalJsonReq) GetProposer() string {
|
||||
return s.Proposer
|
||||
}
|
||||
func (s StoreCodeProposalJsonReq) GetDeposit() sdk.Coins {
|
||||
|
@ -72,12 +72,12 @@ type InstantiateProposalJsonReq struct {
|
|||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Proposer string `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
|
||||
RunAs sdk.AccAddress `json:"run_as" yaml:"run_as"`
|
||||
RunAs string `json:"run_as" yaml:"run_as"`
|
||||
// Admin is an optional address that can execute migrations
|
||||
Admin sdk.AccAddress `json:"admin,omitempty" yaml:"admin"`
|
||||
Admin string `json:"admin,omitempty" yaml:"admin"`
|
||||
Code uint64 `json:"code_id" yaml:"code_id"`
|
||||
Label string `json:"label" yaml:"label"`
|
||||
InitMsg json.RawMessage `json:"init_msg" yaml:"init_msg"`
|
||||
|
@ -96,7 +96,7 @@ func (s InstantiateProposalJsonReq) Content() govtypes.Content {
|
|||
InitFunds: s.InitFunds,
|
||||
}
|
||||
}
|
||||
func (s InstantiateProposalJsonReq) GetProposer() sdk.AccAddress {
|
||||
func (s InstantiateProposalJsonReq) GetProposer() string {
|
||||
return s.Proposer
|
||||
}
|
||||
func (s InstantiateProposalJsonReq) GetDeposit() sdk.Coins {
|
||||
|
@ -125,14 +125,14 @@ type MigrateProposalJsonReq struct {
|
|||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Proposer string `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
|
||||
Contract sdk.AccAddress `json:"contract" yaml:"contract"`
|
||||
Contract string `json:"contract" yaml:"contract"`
|
||||
Code uint64 `json:"code_id" yaml:"code_id"`
|
||||
MigrateMsg json.RawMessage `json:"msg" yaml:"msg"`
|
||||
// RunAs is the role that is passed to the contract's environment
|
||||
RunAs sdk.AccAddress `json:"run_as" yaml:"run_as"`
|
||||
RunAs string `json:"run_as" yaml:"run_as"`
|
||||
}
|
||||
|
||||
func (s MigrateProposalJsonReq) Content() govtypes.Content {
|
||||
|
@ -145,7 +145,7 @@ func (s MigrateProposalJsonReq) Content() govtypes.Content {
|
|||
RunAs: s.RunAs,
|
||||
}
|
||||
}
|
||||
func (s MigrateProposalJsonReq) GetProposer() sdk.AccAddress {
|
||||
func (s MigrateProposalJsonReq) GetProposer() string {
|
||||
return s.Proposer
|
||||
}
|
||||
func (s MigrateProposalJsonReq) GetDeposit() sdk.Coins {
|
||||
|
@ -173,11 +173,11 @@ type UpdateAdminJsonReq struct {
|
|||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Proposer string `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
|
||||
NewAdmin sdk.AccAddress `json:"new_admin" yaml:"new_admin"`
|
||||
Contract sdk.AccAddress `json:"contract" yaml:"contract"`
|
||||
NewAdmin string `json:"new_admin" yaml:"new_admin"`
|
||||
Contract string `json:"contract" yaml:"contract"`
|
||||
}
|
||||
|
||||
func (s UpdateAdminJsonReq) Content() govtypes.Content {
|
||||
|
@ -188,7 +188,7 @@ func (s UpdateAdminJsonReq) Content() govtypes.Content {
|
|||
NewAdmin: s.NewAdmin,
|
||||
}
|
||||
}
|
||||
func (s UpdateAdminJsonReq) GetProposer() sdk.AccAddress {
|
||||
func (s UpdateAdminJsonReq) GetProposer() string {
|
||||
return s.Proposer
|
||||
}
|
||||
func (s UpdateAdminJsonReq) GetDeposit() sdk.Coins {
|
||||
|
@ -216,10 +216,10 @@ type ClearAdminJsonReq struct {
|
|||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Proposer string `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
|
||||
Contract sdk.AccAddress `json:"contract" yaml:"contract"`
|
||||
Contract string `json:"contract" yaml:"contract"`
|
||||
}
|
||||
|
||||
func (s ClearAdminJsonReq) Content() govtypes.Content {
|
||||
|
@ -229,7 +229,7 @@ func (s ClearAdminJsonReq) Content() govtypes.Content {
|
|||
Contract: s.Contract,
|
||||
}
|
||||
}
|
||||
func (s ClearAdminJsonReq) GetProposer() sdk.AccAddress {
|
||||
func (s ClearAdminJsonReq) GetProposer() string {
|
||||
return s.Proposer
|
||||
}
|
||||
func (s ClearAdminJsonReq) GetDeposit() sdk.Coins {
|
||||
|
@ -253,13 +253,18 @@ func ClearContractAdminProposalHandler(cliCtx client.Context) govrest.ProposalRE
|
|||
|
||||
type wasmProposalData interface {
|
||||
Content() govtypes.Content
|
||||
GetProposer() sdk.AccAddress
|
||||
GetProposer() string
|
||||
GetDeposit() sdk.Coins
|
||||
GetBaseReq() rest.BaseReq
|
||||
}
|
||||
|
||||
func toStdTxResponse(cliCtx client.Context, w http.ResponseWriter, data wasmProposalData) {
|
||||
msg, err := govtypes.NewMsgSubmitProposal(data.Content(), data.GetDeposit(), data.GetProposer())
|
||||
proposerAddr, err := sdk.AccAddressFromBech32(data.GetProposer())
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
msg, err := govtypes.NewMsgSubmitProposal(data.Content(), data.GetDeposit(), proposerAddr)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/CosmWasm/wasmd/x/wasm/internal/types"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
@ -17,14 +16,15 @@ func registerNewTxRoutes(cliCtx client.Context, r *mux.Router) {
|
|||
}
|
||||
|
||||
type migrateContractReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Admin sdk.AccAddress `json:"admin,omitempty" yaml:"admin"`
|
||||
CodeID uint64 `json:"code_id" yaml:"code_id"`
|
||||
MigrateMsg []byte `json:"migrate_msg,omitempty" yaml:"migrate_msg"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Admin string `json:"admin,omitempty" yaml:"admin"`
|
||||
CodeID uint64 `json:"code_id" yaml:"code_id"`
|
||||
MigrateMsg []byte `json:"migrate_msg,omitempty" yaml:"migrate_msg"`
|
||||
}
|
||||
|
||||
type updateContractAdministrateReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Admin sdk.AccAddress `json:"admin,omitempty" yaml:"admin"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Admin string `json:"admin,omitempty" yaml:"admin"`
|
||||
}
|
||||
|
||||
func setContractAdminHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
||||
|
@ -41,18 +41,12 @@ func setContractAdminHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
contractAddress, err := sdk.AccAddressFromBech32(contractAddr)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
msg := &types.MsgUpdateAdmin{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
NewAdmin: req.Admin,
|
||||
Contract: contractAddress,
|
||||
Contract: contractAddr,
|
||||
}
|
||||
if err = msg.ValidateBasic(); err != nil {
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
@ -75,19 +69,13 @@ func migrateContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
contractAddress, err := sdk.AccAddressFromBech32(contractAddr)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
msg := &types.MsgMigrateContract{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Contract: contractAddress,
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
Contract: contractAddr,
|
||||
CodeID: req.CodeID,
|
||||
MigrateMsg: req.MigrateMsg,
|
||||
}
|
||||
if err = msg.ValidateBasic(); err != nil {
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ type storeCodeReq struct {
|
|||
}
|
||||
|
||||
type instantiateContractReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Admin sdk.AccAddress `json:"admin,omitempty" yaml:"admin"`
|
||||
InitMsg []byte `json:"init_msg" yaml:"init_msg"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
Admin string `json:"admin,omitempty" yaml:"admin"`
|
||||
InitMsg []byte `json:"init_msg" yaml:"init_msg"`
|
||||
}
|
||||
|
||||
type executeContractReq struct {
|
||||
|
@ -71,19 +71,13 @@ func storeCodeHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
// build and sign the transaction, then broadcast to Tendermint
|
||||
msg := types.MsgStoreCode{
|
||||
Sender: fromAddr,
|
||||
Sender: req.BaseReq.From,
|
||||
WASMByteCode: wasm,
|
||||
}
|
||||
|
||||
err = msg.ValidateBasic()
|
||||
if err != nil {
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
@ -113,15 +107,14 @@ func instantiateContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
|||
}
|
||||
|
||||
msg := types.MsgInstantiateContract{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
CodeID: codeID,
|
||||
InitFunds: req.Deposit,
|
||||
InitMsg: req.InitMsg,
|
||||
Admin: req.Admin,
|
||||
}
|
||||
|
||||
err = msg.ValidateBasic()
|
||||
if err != nil {
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
@ -144,20 +137,14 @@ func executeContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
contractAddress, err := sdk.AccAddressFromBech32(contractAddr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
msg := types.MsgExecuteContract{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Contract: contractAddress,
|
||||
Sender: cliCtx.GetFromAddress().String(),
|
||||
Contract: contractAddr,
|
||||
Msg: req.ExecMsg,
|
||||
SentFunds: req.Amount,
|
||||
}
|
||||
|
||||
err = msg.ValidateBasic()
|
||||
if err != nil {
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func TestInitGenesis(t *testing.T) {
|
|||
q := data.module.LegacyQuerierHandler(nil)
|
||||
|
||||
msg := MsgStoreCode{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
WASMByteCode: testContract,
|
||||
Source: "https://github.com/CosmWasm/wasmd/blob/master/x/wasm/testdata/escrow.wasm",
|
||||
Builder: "confio/cosmwasm-opt:0.7.0",
|
||||
|
@ -41,18 +41,18 @@ func TestInitGenesis(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
initCmd := MsgInstantiateContract{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
CodeID: firstCodeID,
|
||||
InitMsg: initMsgBz,
|
||||
InitFunds: deposit,
|
||||
}
|
||||
res, err = h(data.ctx, &initCmd)
|
||||
require.NoError(t, err)
|
||||
contractAddr := sdk.AccAddress(res.Data)
|
||||
contractBech32Addr := string(res.Data)
|
||||
|
||||
execCmd := MsgExecuteContract{
|
||||
Sender: fred,
|
||||
Contract: contractAddr,
|
||||
Sender: fred.String(),
|
||||
Contract: contractBech32Addr,
|
||||
Msg: []byte(`{"release":{}}`),
|
||||
SentFunds: topUp,
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ func TestInitGenesis(t *testing.T) {
|
|||
assertCodeList(t, q, data.ctx, 1)
|
||||
assertCodeBytes(t, q, data.ctx, 1, testContract)
|
||||
|
||||
assertContractList(t, q, data.ctx, 1, []string{contractAddr.String()})
|
||||
assertContractInfo(t, q, data.ctx, contractAddr, 1, creator)
|
||||
assertContractState(t, q, data.ctx, contractAddr, state{
|
||||
assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr})
|
||||
assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator)
|
||||
assertContractState(t, q, data.ctx, contractBech32Addr, state{
|
||||
Verifier: []byte(fred),
|
||||
Beneficiary: []byte(bob),
|
||||
Funder: []byte(creator),
|
||||
|
@ -85,9 +85,9 @@ func TestInitGenesis(t *testing.T) {
|
|||
assertCodeList(t, q2, newData.ctx, 1)
|
||||
assertCodeBytes(t, q2, newData.ctx, 1, testContract)
|
||||
|
||||
assertContractList(t, q2, newData.ctx, 1, []string{contractAddr.String()})
|
||||
assertContractInfo(t, q2, newData.ctx, contractAddr, 1, creator)
|
||||
assertContractState(t, q2, newData.ctx, contractAddr, state{
|
||||
assertContractList(t, q2, newData.ctx, 1, []string{contractBech32Addr})
|
||||
assertContractInfo(t, q2, newData.ctx, contractBech32Addr, 1, creator)
|
||||
assertContractState(t, q2, newData.ctx, contractBech32Addr, state{
|
||||
Verifier: []byte(fred),
|
||||
Beneficiary: []byte(bob),
|
||||
Funder: []byte(creator),
|
||||
|
|
|
@ -48,12 +48,11 @@ func filteredMessageEvents(manager *sdk.EventManager) []abci.Event {
|
|||
}
|
||||
|
||||
func handleStoreCode(ctx sdk.Context, k *Keeper, msg *MsgStoreCode) (*sdk.Result, error) {
|
||||
err := msg.ValidateBasic()
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
|
||||
codeID, err := k.Create(ctx, msg.Sender, msg.WASMByteCode, msg.Source, msg.Builder, msg.InstantiatePermission)
|
||||
codeID, err := k.Create(ctx, senderAddr, msg.WASMByteCode, msg.Source, msg.Builder, msg.InstantiatePermission)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -62,7 +61,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)),
|
||||
),
|
||||
})
|
||||
|
@ -74,7 +73,18 @@ func handleStoreCode(ctx sdk.Context, k *Keeper, msg *MsgStoreCode) (*sdk.Result
|
|||
}
|
||||
|
||||
func handleInstantiate(ctx sdk.Context, k *Keeper, msg *MsgInstantiateContract) (*sdk.Result, error) {
|
||||
contractAddr, err := k.Instantiate(ctx, msg.CodeID, msg.Sender, msg.Admin, msg.InitMsg, msg.Label, msg.InitFunds)
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
var adminAddr sdk.AccAddress
|
||||
if msg.Admin != "" {
|
||||
if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
}
|
||||
|
||||
contractAddr, err := k.Instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.InitMsg, msg.Label, msg.InitFunds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -83,20 +93,29 @@ func handleInstantiate(ctx sdk.Context, k *Keeper, msg *MsgInstantiateContract)
|
|||
custom := sdk.Events{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", msg.CodeID)),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, contractAddr.String()),
|
||||
)}
|
||||
events = append(events, custom.ToABCIEvents()...)
|
||||
|
||||
return &sdk.Result{
|
||||
Data: contractAddr,
|
||||
Data: []byte(contractAddr.String()),
|
||||
Events: events,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func handleExecute(ctx sdk.Context, k *Keeper, msg *MsgExecuteContract) (*sdk.Result, error) {
|
||||
res, err := k.Execute(ctx, msg.Contract, msg.Sender, msg.Msg, msg.SentFunds)
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
|
||||
res, err := k.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.SentFunds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -105,8 +124,8 @@ func handleExecute(ctx sdk.Context, k *Keeper, msg *MsgExecuteContract) (*sdk.Re
|
|||
custom := sdk.Events{sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract),
|
||||
),
|
||||
}
|
||||
events = append(events, custom.ToABCIEvents()...)
|
||||
|
@ -116,7 +135,16 @@ func handleExecute(ctx sdk.Context, k *Keeper, msg *MsgExecuteContract) (*sdk.Re
|
|||
}
|
||||
|
||||
func handleMigration(ctx sdk.Context, k *Keeper, msg *MsgMigrateContract) (*sdk.Result, error) {
|
||||
res, err := k.Migrate(ctx, msg.Contract, msg.Sender, msg.CodeID, msg.MigrateMsg)
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
|
||||
res, err := k.Migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.MigrateMsg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -125,8 +153,8 @@ func handleMigration(ctx sdk.Context, k *Keeper, msg *MsgMigrateContract) (*sdk.
|
|||
custom := sdk.Events{sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract),
|
||||
)}
|
||||
events = append(events, custom.ToABCIEvents()...)
|
||||
res.Events = events
|
||||
|
@ -134,15 +162,28 @@ func handleMigration(ctx sdk.Context, k *Keeper, msg *MsgMigrateContract) (*sdk.
|
|||
}
|
||||
|
||||
func handleUpdateContractAdmin(ctx sdk.Context, k *Keeper, msg *MsgUpdateAdmin) (*sdk.Result, error) {
|
||||
if err := k.UpdateContractAdmin(ctx, msg.Contract, msg.Sender, msg.NewAdmin); err != nil {
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
newAdminAddr, err := sdk.AccAddressFromBech32(msg.NewAdmin)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "new admin")
|
||||
}
|
||||
|
||||
if err := k.UpdateContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
events := ctx.EventManager().Events()
|
||||
ourEvent := sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract),
|
||||
)
|
||||
return &sdk.Result{
|
||||
Events: append(events, ourEvent).ToABCIEvents(),
|
||||
|
@ -150,15 +191,24 @@ func handleUpdateContractAdmin(ctx sdk.Context, k *Keeper, msg *MsgUpdateAdmin)
|
|||
}
|
||||
|
||||
func handleClearContractAdmin(ctx sdk.Context, k *Keeper, msg *MsgClearAdmin) (*sdk.Result, error) {
|
||||
if err := k.ClearContractAdmin(ctx, msg.Contract, msg.Sender); err != nil {
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
|
||||
if err := k.ClearContractAdmin(ctx, contractAddr, senderAddr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
events := ctx.EventManager().Events()
|
||||
ourEvent := sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeySigner, msg.Sender),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, msg.Contract),
|
||||
)
|
||||
return &sdk.Result{
|
||||
Events: append(events, ourEvent).ToABCIEvents(),
|
||||
|
|
|
@ -25,7 +25,11 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) error
|
|||
|
||||
var maxContractID int
|
||||
for i, contract := range data.Contracts {
|
||||
err := keeper.importContract(ctx, contract.ContractAddress, &contract.ContractInfo, contract.ContractState)
|
||||
contractAddr, err := sdk.AccAddressFromBech32(contract.ContractAddress)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(err, "address in contract number %d", i)
|
||||
}
|
||||
err = keeper.importContract(ctx, contractAddr, &contract.ContractInfo, contract.ContractState)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(err, "contract number %d", i)
|
||||
}
|
||||
|
@ -84,7 +88,7 @@ func ExportGenesis(ctx sdk.Context, keeper *Keeper) *types.GenesisState {
|
|||
contract.Created = nil
|
||||
|
||||
genState.Contracts = append(genState.Contracts, types.Contract{
|
||||
ContractAddress: addr,
|
||||
ContractAddress: addr.String(),
|
||||
ContractInfo: contract,
|
||||
ContractState: state,
|
||||
})
|
||||
|
|
|
@ -50,7 +50,9 @@ func TestGenesisExportImport(t *testing.T) {
|
|||
f.Fuzz(&contract)
|
||||
f.Fuzz(&stateModels)
|
||||
f.NilChance(0).Fuzz(&history)
|
||||
codeID, err := srcKeeper.Create(srcCtx, codeInfo.Creator, wasmCode, codeInfo.Source, codeInfo.Builder, &codeInfo.InstantiateConfig)
|
||||
creatorAddr, err := sdk.AccAddressFromBech32(codeInfo.Creator)
|
||||
require.NoError(t, err)
|
||||
codeID, err := srcKeeper.Create(srcCtx, creatorAddr, wasmCode, codeInfo.Source, codeInfo.Builder, &codeInfo.InstantiateConfig)
|
||||
require.NoError(t, err)
|
||||
contract.CodeID = codeID
|
||||
contractAddr := srcKeeper.generateContractAddress(srcCtx, codeID)
|
||||
|
@ -210,7 +212,7 @@ func TestFailFastImport(t *testing.T) {
|
|||
}},
|
||||
Contracts: []types.Contract{
|
||||
{
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
},
|
||||
},
|
||||
|
@ -231,10 +233,10 @@ func TestFailFastImport(t *testing.T) {
|
|||
}},
|
||||
Contracts: []types.Contract{
|
||||
{
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
}, {
|
||||
ContractAddress: contractAddress(1, 2),
|
||||
ContractAddress: contractAddress(1, 2).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
},
|
||||
},
|
||||
|
@ -250,7 +252,7 @@ func TestFailFastImport(t *testing.T) {
|
|||
src: types.GenesisState{
|
||||
Contracts: []types.Contract{
|
||||
{
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
},
|
||||
},
|
||||
|
@ -266,10 +268,10 @@ func TestFailFastImport(t *testing.T) {
|
|||
}},
|
||||
Contracts: []types.Contract{
|
||||
{
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
}, {
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
},
|
||||
},
|
||||
|
@ -285,7 +287,7 @@ func TestFailFastImport(t *testing.T) {
|
|||
}},
|
||||
Contracts: []types.Contract{
|
||||
{
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
ContractState: []types.Model{
|
||||
{
|
||||
|
@ -333,7 +335,7 @@ func TestFailFastImport(t *testing.T) {
|
|||
}},
|
||||
Contracts: []types.Contract{
|
||||
{
|
||||
ContractAddress: contractAddress(1, 1),
|
||||
ContractAddress: contractAddress(1, 1).String(),
|
||||
ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields),
|
||||
},
|
||||
},
|
||||
|
@ -435,7 +437,7 @@ func TestImportContractWithCodeHistoryReset(t *testing.T) {
|
|||
// verify code info
|
||||
gotCodeInfo := keeper.GetCodeInfo(ctx, 1)
|
||||
require.NotNil(t, gotCodeInfo)
|
||||
codeCreatorAddr, _ := sdk.AccAddressFromBech32("cosmos1qtu5n0cnhfkjj6l2rq97hmky9fd89gwca9yarx")
|
||||
codeCreatorAddr := "cosmos1qtu5n0cnhfkjj6l2rq97hmky9fd89gwca9yarx"
|
||||
expCodeInfo := types.CodeInfo{
|
||||
CodeHash: wasmCodeHash[:],
|
||||
Creator: codeCreatorAddr,
|
||||
|
@ -452,8 +454,8 @@ func TestImportContractWithCodeHistoryReset(t *testing.T) {
|
|||
contractAddr, _ := sdk.AccAddressFromBech32("cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5")
|
||||
gotContractInfo := keeper.GetContractInfo(ctx, contractAddr)
|
||||
require.NotNil(t, gotContractInfo)
|
||||
contractCreatorAddr, _ := sdk.AccAddressFromBech32("cosmos13x849jzd03vne42ynpj25hn8npjecxqrjghd8x")
|
||||
adminAddr, _ := sdk.AccAddressFromBech32("cosmos1h5t8zxmjr30e9dqghtlpl40f2zz5cgey6esxtn")
|
||||
contractCreatorAddr := "cosmos13x849jzd03vne42ynpj25hn8npjecxqrjghd8x"
|
||||
adminAddr := "cosmos1h5t8zxmjr30e9dqghtlpl40f2zz5cgey6esxtn"
|
||||
|
||||
expContractInfo := types.ContractInfo{
|
||||
CodeID: firstCodeID,
|
||||
|
|
|
@ -163,18 +163,14 @@ func EncodeStakingMsg(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk
|
|||
func EncodeWasmMsg(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error) {
|
||||
switch {
|
||||
case msg.Execute != nil:
|
||||
contractAddr, err := sdk.AccAddressFromBech32(msg.Execute.ContractAddr)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Execute.ContractAddr)
|
||||
}
|
||||
coins, err := convertWasmCoinsToSdkCoins(msg.Execute.Send)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sdkMsg := types.MsgExecuteContract{
|
||||
Sender: sender,
|
||||
Contract: contractAddr,
|
||||
Sender: sender.String(),
|
||||
Contract: msg.Execute.ContractAddr,
|
||||
Msg: msg.Execute.Msg,
|
||||
SentFunds: coins,
|
||||
}
|
||||
|
@ -186,7 +182,7 @@ func EncodeWasmMsg(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg,
|
|||
}
|
||||
|
||||
sdkMsg := types.MsgInstantiateContract{
|
||||
Sender: sender,
|
||||
Sender: sender.String(),
|
||||
CodeID: msg.Instantiate.CodeID,
|
||||
// TODO: add this to CosmWasm
|
||||
Label: fmt.Sprintf("Auto-created by %s", sender),
|
||||
|
|
|
@ -125,8 +125,8 @@ func TestEncoding(t *testing.T) {
|
|||
},
|
||||
output: []sdk.Msg{
|
||||
&types.MsgExecuteContract{
|
||||
Sender: addr1,
|
||||
Contract: addr2,
|
||||
Sender: addr1.String(),
|
||||
Contract: addr2.String(),
|
||||
Msg: jsonMsg,
|
||||
SentFunds: sdk.NewCoins(sdk.NewInt64Coin("eth", 12)),
|
||||
},
|
||||
|
@ -147,7 +147,7 @@ func TestEncoding(t *testing.T) {
|
|||
},
|
||||
output: []sdk.Msg{
|
||||
&types.MsgInstantiateContract{
|
||||
Sender: addr1,
|
||||
Sender: addr1.String(),
|
||||
CodeID: 7,
|
||||
// TODO: fix this
|
||||
Label: fmt.Sprintf("Auto-created by %s", addr1),
|
||||
|
|
|
@ -332,7 +332,7 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller
|
|||
if contractInfo == nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract")
|
||||
}
|
||||
if !authZ.CanModifyContract(contractInfo.Admin, caller) {
|
||||
if !authZ.CanModifyContract(contractInfo.AdminAddr(), caller) {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not migrate")
|
||||
}
|
||||
|
||||
|
@ -392,10 +392,10 @@ func (k Keeper) setContractAdmin(ctx sdk.Context, contractAddress, caller, newAd
|
|||
if contractInfo == nil {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract")
|
||||
}
|
||||
if !authZ.CanModifyContract(contractInfo.Admin, caller) {
|
||||
if !authZ.CanModifyContract(contractInfo.AdminAddr(), caller) {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not modify contract")
|
||||
}
|
||||
contractInfo.Admin = newAdmin
|
||||
contractInfo.Admin = newAdmin.String()
|
||||
k.setContractInfo(ctx, contractAddress, contractInfo)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ func TestCreateStoresInstantiatePermission(t *testing.T) {
|
|||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
var (
|
||||
deposit = sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
|
||||
myAddr = bytes.Repeat([]byte{1}, sdk.AddrLen)
|
||||
deposit = sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
|
||||
myAddr sdk.AccAddress = bytes.Repeat([]byte{1}, sdk.AddrLen)
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -70,7 +70,7 @@ func TestCreateStoresInstantiatePermission(t *testing.T) {
|
|||
},
|
||||
"onlyAddress with matching address": {
|
||||
srcPermission: types.AccessTypeOnlyAddress,
|
||||
expInstConf: types.AccessConfig{Permission: types.AccessTypeOnlyAddress, Address: myAddr},
|
||||
expInstConf: types.AccessConfig{Permission: types.AccessTypeOnlyAddress, Address: myAddr.String()},
|
||||
},
|
||||
}
|
||||
for msg, spec := range specs {
|
||||
|
@ -278,14 +278,14 @@ func TestInstantiate(t *testing.T) {
|
|||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractAddr.String())
|
||||
|
||||
gasAfter := ctx.GasMeter().GasConsumed()
|
||||
require.Equal(t, uint64(0x112ad), gasAfter-gasBefore)
|
||||
require.Equal(t, uint64(0x115e6), gasAfter-gasBefore)
|
||||
|
||||
// ensure it is stored properly
|
||||
info := keeper.GetContractInfo(ctx, contractAddr)
|
||||
require.NotNil(t, info)
|
||||
assert.Equal(t, info.Creator, creator)
|
||||
assert.Equal(t, info.CodeID, codeID)
|
||||
assert.Equal(t, info.Label, "demo contract 1")
|
||||
assert.Equal(t, creator.String(), info.Creator)
|
||||
assert.Equal(t, codeID, info.CodeID)
|
||||
assert.Equal(t, "demo contract 1", info.Label)
|
||||
|
||||
exp := []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryOperationTypeInit,
|
||||
|
@ -507,7 +507,7 @@ func TestExecute(t *testing.T) {
|
|||
|
||||
// make sure gas is properly deducted from ctx
|
||||
gasAfter := ctx.GasMeter().GasConsumed()
|
||||
require.Equal(t, uint64(0x11e33), gasAfter-gasBefore)
|
||||
require.Equal(t, uint64(0x11ec9), gasAfter-gasBefore)
|
||||
|
||||
// ensure bob now exists and got both payments released
|
||||
bobAcct = accKeeper.GetAccount(ctx, bob)
|
||||
|
@ -1036,7 +1036,6 @@ func TestUpdateContractAdmin(t *testing.T) {
|
|||
}
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
require.NotNil(t, spec.newAdmin)
|
||||
addr, err := keeper.Instantiate(ctx, originalContractID, creator, spec.instAdmin, initMsgBz, "demo contract", nil)
|
||||
require.NoError(t, err)
|
||||
if spec.overrideContractAddr != nil {
|
||||
|
@ -1048,7 +1047,7 @@ func TestUpdateContractAdmin(t *testing.T) {
|
|||
return
|
||||
}
|
||||
cInfo := keeper.GetContractInfo(ctx, addr)
|
||||
assert.Equal(t, spec.newAdmin, cInfo.Admin)
|
||||
assert.Equal(t, spec.newAdmin.String(), cInfo.Admin)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,11 @@ func handleStoreCodeProposal(ctx sdk.Context, k Keeper, p types.StoreCodeProposa
|
|||
return err
|
||||
}
|
||||
|
||||
codeID, err := k.create(ctx, p.RunAs, p.WASMByteCode, p.Source, p.Builder, p.InstantiatePermission, GovAuthorizationPolicy{})
|
||||
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "run as address")
|
||||
}
|
||||
codeID, err := k.create(ctx, runAsAddr, p.WASMByteCode, p.Source, p.Builder, p.InstantiatePermission, GovAuthorizationPolicy{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -62,8 +66,16 @@ func handleInstantiateProposal(ctx sdk.Context, k Keeper, p types.InstantiateCon
|
|||
if err := p.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "run as address")
|
||||
}
|
||||
adminAddr, err := sdk.AccAddressFromBech32(p.Admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
|
||||
contractAddr, err := k.instantiate(ctx, p.CodeID, p.RunAs, p.Admin, p.InitMsg, p.Label, p.InitFunds, GovAuthorizationPolicy{})
|
||||
contractAddr, err := k.instantiate(ctx, p.CodeID, runAsAddr, adminAddr, p.InitMsg, p.Label, p.InitFunds, GovAuthorizationPolicy{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -83,7 +95,15 @@ func handleMigrateProposal(ctx sdk.Context, k Keeper, p types.MigrateContractPro
|
|||
return err
|
||||
}
|
||||
|
||||
res, err := k.migrate(ctx, p.Contract, p.RunAs, p.CodeID, p.MigrateMsg, GovAuthorizationPolicy{})
|
||||
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "run as address")
|
||||
}
|
||||
res, err := k.migrate(ctx, contractAddr, runAsAddr, p.CodeID, p.MigrateMsg, GovAuthorizationPolicy{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -91,7 +111,7 @@ func handleMigrateProposal(ctx sdk.Context, k Keeper, p types.MigrateContractPro
|
|||
ourEvent := sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, p.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, p.Contract),
|
||||
)
|
||||
ctx.EventManager().EmitEvent(ourEvent)
|
||||
|
||||
|
@ -109,15 +129,23 @@ func handleUpdateAdminProposal(ctx sdk.Context, k Keeper, p types.UpdateAdminPro
|
|||
if err := p.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
newAdminAddr, err := sdk.AccAddressFromBech32(p.NewAdmin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "run as address")
|
||||
}
|
||||
|
||||
if err := k.setContractAdmin(ctx, p.Contract, nil, p.NewAdmin, GovAuthorizationPolicy{}); err != nil {
|
||||
if err := k.setContractAdmin(ctx, contractAddr, nil, newAdminAddr, GovAuthorizationPolicy{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ourEvent := sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, p.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, p.Contract),
|
||||
)
|
||||
ctx.EventManager().EmitEvent(ourEvent)
|
||||
return nil
|
||||
|
@ -128,13 +156,17 @@ func handleClearAdminProposal(ctx sdk.Context, k Keeper, p types.ClearAdminPropo
|
|||
return err
|
||||
}
|
||||
|
||||
if err := k.setContractAdmin(ctx, p.Contract, nil, nil, GovAuthorizationPolicy{}); err != nil {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
if err := k.setContractAdmin(ctx, contractAddr, nil, nil, GovAuthorizationPolicy{}); err != nil {
|
||||
return err
|
||||
}
|
||||
ourEvent := sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, p.Contract.String()),
|
||||
sdk.NewAttribute(types.AttributeKeyContract, p.Contract),
|
||||
)
|
||||
ctx.EventManager().EmitEvent(ourEvent)
|
||||
return nil
|
||||
|
|
|
@ -26,10 +26,10 @@ func TestStoreCodeProposal(t *testing.T) {
|
|||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
|
||||
var anyAddress sdk.AccAddress = make([]byte, sdk.AddrLen)
|
||||
myActorAddress := AnyAccAddress(t)
|
||||
|
||||
src := types.StoreCodeProposalFixture(func(p *types.StoreCodeProposal) {
|
||||
p.RunAs = anyAddress
|
||||
p.RunAs = myActorAddress
|
||||
p.WASMByteCode = wasmCode
|
||||
p.Source = "https://example.com/mysource"
|
||||
p.Builder = "foo/bar:v0.0.0"
|
||||
|
@ -47,7 +47,7 @@ func TestStoreCodeProposal(t *testing.T) {
|
|||
// then
|
||||
cInfo := wasmKeeper.GetCodeInfo(ctx, 1)
|
||||
require.NotNil(t, cInfo)
|
||||
assert.Equal(t, anyAddress, cInfo.Creator)
|
||||
assert.Equal(t, myActorAddress, cInfo.Creator)
|
||||
assert.Equal(t, "foo/bar:v0.0.0", cInfo.Builder)
|
||||
assert.Equal(t, "https://example.com/mysource", cInfo.Source)
|
||||
|
||||
|
@ -79,8 +79,8 @@ func TestInstantiateProposal(t *testing.T) {
|
|||
)
|
||||
src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) {
|
||||
p.CodeID = firstCodeID
|
||||
p.RunAs = oneAddress
|
||||
p.Admin = otherAddress
|
||||
p.RunAs = oneAddress.String()
|
||||
p.Admin = otherAddress.String()
|
||||
p.Label = "testing"
|
||||
})
|
||||
|
||||
|
@ -100,8 +100,8 @@ func TestInstantiateProposal(t *testing.T) {
|
|||
cInfo := wasmKeeper.GetContractInfo(ctx, contractAddr)
|
||||
require.NotNil(t, cInfo)
|
||||
assert.Equal(t, uint64(1), cInfo.CodeID)
|
||||
assert.Equal(t, oneAddress, cInfo.Creator)
|
||||
assert.Equal(t, otherAddress, cInfo.Admin)
|
||||
assert.Equal(t, oneAddress.String(), cInfo.Creator)
|
||||
assert.Equal(t, otherAddress.String(), cInfo.Admin)
|
||||
assert.Equal(t, "testing", cInfo.Label)
|
||||
expHistory := []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryOperationTypeInit,
|
||||
|
@ -136,7 +136,7 @@ func TestMigrateProposal(t *testing.T) {
|
|||
|
||||
contractInfoFixture := types.ContractInfoFixture(func(c *types.ContractInfo) {
|
||||
c.Label = "testing"
|
||||
c.Admin = anyAddress
|
||||
c.Admin = anyAddress.String()
|
||||
})
|
||||
key, err := hex.DecodeString("636F6E666967")
|
||||
require.NoError(t, err)
|
||||
|
@ -153,9 +153,9 @@ func TestMigrateProposal(t *testing.T) {
|
|||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
CodeID: 2,
|
||||
Contract: contractAddr,
|
||||
Contract: contractAddr.String(),
|
||||
MigrateMsg: migMsgBz,
|
||||
RunAs: otherAddress,
|
||||
RunAs: otherAddress.String(),
|
||||
}
|
||||
|
||||
// when stored
|
||||
|
@ -172,7 +172,7 @@ func TestMigrateProposal(t *testing.T) {
|
|||
cInfo := wasmKeeper.GetContractInfo(ctx, contractAddr)
|
||||
require.NotNil(t, cInfo)
|
||||
assert.Equal(t, uint64(2), cInfo.CodeID)
|
||||
assert.Equal(t, anyAddress, cInfo.Admin)
|
||||
assert.Equal(t, anyAddress.String(), cInfo.Admin)
|
||||
assert.Equal(t, "testing", cInfo.Label)
|
||||
expHistory := []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryOperationTypeGenesis,
|
||||
|
@ -206,20 +206,20 @@ func TestAdminProposals(t *testing.T) {
|
|||
srcProposal: &types.UpdateAdminProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
Contract: contractAddr,
|
||||
NewAdmin: otherAddress,
|
||||
Contract: contractAddr.String(),
|
||||
NewAdmin: otherAddress.String(),
|
||||
},
|
||||
expAdmin: otherAddress,
|
||||
},
|
||||
"update with old admin empty": {
|
||||
state: types.ContractInfoFixture(func(info *types.ContractInfo) {
|
||||
info.Admin = nil
|
||||
info.Admin = ""
|
||||
}),
|
||||
srcProposal: &types.UpdateAdminProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
Contract: contractAddr,
|
||||
NewAdmin: otherAddress,
|
||||
Contract: contractAddr.String(),
|
||||
NewAdmin: otherAddress.String(),
|
||||
},
|
||||
expAdmin: otherAddress,
|
||||
},
|
||||
|
@ -228,18 +228,18 @@ func TestAdminProposals(t *testing.T) {
|
|||
srcProposal: &types.ClearAdminProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
Contract: contractAddr,
|
||||
Contract: contractAddr.String(),
|
||||
},
|
||||
expAdmin: nil,
|
||||
},
|
||||
"clear with old admin empty": {
|
||||
state: types.ContractInfoFixture(func(info *types.ContractInfo) {
|
||||
info.Admin = nil
|
||||
info.Admin = ""
|
||||
}),
|
||||
srcProposal: &types.ClearAdminProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
Contract: contractAddr,
|
||||
Contract: contractAddr.String(),
|
||||
},
|
||||
expAdmin: nil,
|
||||
},
|
||||
|
@ -270,7 +270,7 @@ func TestAdminProposals(t *testing.T) {
|
|||
// then
|
||||
cInfo := wasmKeeper.GetContractInfo(ctx, contractAddr)
|
||||
require.NotNil(t, cInfo)
|
||||
assert.Equal(t, spec.expAdmin, cInfo.Admin)
|
||||
assert.Equal(t, spec.expAdmin.String(), cInfo.Admin)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,11 @@ func NewQuerier(keeper *Keeper) grpcQuerier {
|
|||
}
|
||||
|
||||
func (q grpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInfoRequest) (*types.QueryContractInfoResponse, error) {
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsp, err := queryContractInfo(sdk.UnwrapSDKContext(c), req.Address, *q.keeper)
|
||||
rsp, err := queryContractInfo(sdk.UnwrapSDKContext(c), contractAddr, *q.keeper)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
@ -37,10 +38,12 @@ func (q grpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInf
|
|||
}
|
||||
|
||||
func (q grpcQuerier) ContractHistory(c context.Context, req *types.QueryContractHistoryRequest) (*types.QueryContractHistoryResponse, error) {
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsp, err := queryContractHistory(sdk.UnwrapSDKContext(c), req.Address, *q.keeper)
|
||||
|
||||
rsp, err := queryContractHistory(sdk.UnwrapSDKContext(c), contractAddr, *q.keeper)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
@ -69,15 +72,17 @@ func (q grpcQuerier) ContractsByCode(c context.Context, req *types.QueryContract
|
|||
}
|
||||
|
||||
func (q grpcQuerier) AllContractState(c context.Context, req *types.QueryAllContractStateRequest) (*types.QueryAllContractStateResponse, error) {
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
if !q.keeper.containsContractInfo(ctx, req.Address) {
|
||||
if !q.keeper.containsContractInfo(ctx, contractAddr) {
|
||||
return nil, types.ErrNotFound
|
||||
}
|
||||
var resultData []types.Model
|
||||
for iter := q.keeper.GetContractState(ctx, req.Address); iter.Valid(); iter.Next() {
|
||||
for iter := q.keeper.GetContractState(ctx, contractAddr); iter.Valid(); iter.Next() {
|
||||
resultData = append(resultData, types.Model{
|
||||
Key: iter.Key(),
|
||||
Value: iter.Value(),
|
||||
|
@ -89,23 +94,26 @@ func (q grpcQuerier) AllContractState(c context.Context, req *types.QueryAllCont
|
|||
func (q grpcQuerier) RawContractState(c context.Context, req *types.QueryRawContractStateRequest) (*types.QueryRawContractStateResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !q.keeper.containsContractInfo(ctx, req.Address) {
|
||||
if !q.keeper.containsContractInfo(ctx, contractAddr) {
|
||||
return nil, types.ErrNotFound
|
||||
}
|
||||
rsp := q.keeper.QueryRaw(ctx, req.Address, req.QueryData)
|
||||
rsp := q.keeper.QueryRaw(ctx, contractAddr, req.QueryData)
|
||||
return &types.QueryRawContractStateResponse{Data: rsp}, nil
|
||||
}
|
||||
|
||||
func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (*types.QuerySmartContractStateResponse, error) {
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx := sdk.UnwrapSDKContext(c).WithGasMeter(sdk.NewGasMeter(q.keeper.queryGasLimit))
|
||||
rsp, err := q.keeper.QuerySmart(ctx, req.Address, req.QueryData)
|
||||
|
||||
rsp, err := q.keeper.QuerySmart(ctx, contractAddr, req.QueryData)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
@ -152,7 +160,7 @@ func queryContractInfo(ctx sdk.Context, addr sdk.AccAddress, keeper Keeper) (*ty
|
|||
// redact the Created field (just used for sorting, not part of public API)
|
||||
info.Created = nil
|
||||
return &types.ContractInfoWithAddress{
|
||||
Address: addr,
|
||||
Address: addr.String(),
|
||||
ContractInfo: info,
|
||||
}, nil
|
||||
}
|
||||
|
@ -163,7 +171,7 @@ func queryContractListByCode(ctx sdk.Context, codeID uint64, keeper Keeper) ([]t
|
|||
if info.CodeID == codeID {
|
||||
// and add the address
|
||||
infoWithAddress := types.ContractInfoWithAddress{
|
||||
Address: addr,
|
||||
Address: addr.String(),
|
||||
ContractInfo: &info,
|
||||
}
|
||||
contracts = append(contracts, infoWithAddress)
|
||||
|
|
|
@ -33,7 +33,7 @@ func TestQueryAllContractState(t *testing.T) {
|
|||
expErr *sdkErrors.Error
|
||||
}{
|
||||
"query all": {
|
||||
srcQuery: &types.QueryAllContractStateRequest{Address: contractAddr},
|
||||
srcQuery: &types.QueryAllContractStateRequest{Address: contractAddr.String()},
|
||||
expModelContains: contractModel,
|
||||
},
|
||||
"query all with unknown address": {
|
||||
|
@ -60,7 +60,7 @@ func TestQuerySmartContractState(t *testing.T) {
|
|||
keeper := keepers.WasmKeeper
|
||||
|
||||
exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
|
||||
contractAddr := exampleContract.Contract
|
||||
contractAddr := exampleContract.Contract.String()
|
||||
|
||||
q := NewQuerier(keeper)
|
||||
specs := map[string]struct {
|
||||
|
@ -103,12 +103,12 @@ func TestQueryRawContractState(t *testing.T) {
|
|||
keeper := keepers.WasmKeeper
|
||||
|
||||
exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
|
||||
contractAddr := exampleContract.Contract
|
||||
contractAddr := exampleContract.Contract.String()
|
||||
contractModel := []types.Model{
|
||||
{Key: []byte("foo"), Value: []byte(`"bar"`)},
|
||||
{Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
|
||||
}
|
||||
require.NoError(t, keeper.importContractState(ctx, contractAddr, contractModel))
|
||||
require.NoError(t, keeper.importContractState(ctx, exampleContract.Contract, contractModel))
|
||||
|
||||
q := NewQuerier(keeper)
|
||||
specs := map[string]struct {
|
||||
|
@ -289,7 +289,7 @@ func TestQueryContractHistory(t *testing.T) {
|
|||
if queryContractAddr == nil {
|
||||
queryContractAddr = myContractAddr
|
||||
}
|
||||
req := &types.QueryContractHistoryRequest{Address: queryContractAddr}
|
||||
req := &types.QueryContractHistoryRequest{Address: queryContractAddr.String()}
|
||||
|
||||
// when
|
||||
q := NewQuerier(keeper)
|
||||
|
|
|
@ -298,7 +298,15 @@ func TestHandler(k *Keeper) sdk.Handler {
|
|||
}
|
||||
|
||||
func handleInstantiate(ctx sdk.Context, k *Keeper, msg *types.MsgInstantiateContract) (*sdk.Result, error) {
|
||||
contractAddr, err := k.Instantiate(ctx, msg.CodeID, msg.Sender, msg.Admin, msg.InitMsg, msg.Label, msg.InitFunds)
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
adminAddr, err := sdk.AccAddressFromBech32(msg.Admin)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
contractAddr, err := k.Instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.InitMsg, msg.Label, msg.InitFunds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -310,7 +318,15 @@ func handleInstantiate(ctx sdk.Context, k *Keeper, msg *types.MsgInstantiateCont
|
|||
}
|
||||
|
||||
func handleExecute(ctx sdk.Context, k *Keeper, msg *types.MsgExecuteContract) (*sdk.Result, error) {
|
||||
res, err := k.Execute(ctx, msg.Contract, msg.Sender, msg.Msg, msg.SentFunds)
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
res, err := k.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.SentFunds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -319,9 +335,9 @@ func handleExecute(ctx sdk.Context, k *Keeper, msg *types.MsgExecuteContract) (*
|
|||
return res, nil
|
||||
}
|
||||
|
||||
func AnyAccAddress(_ *testing.T) sdk.AccAddress {
|
||||
func AnyAccAddress(_ *testing.T) string {
|
||||
_, _, addr := keyPubAddr()
|
||||
return addr
|
||||
return addr.String()
|
||||
}
|
||||
|
||||
type HackatomExampleContract struct {
|
||||
|
|
|
@ -9,12 +9,17 @@ import (
|
|||
tmBytes "github.com/tendermint/tendermint/libs/bytes"
|
||||
)
|
||||
|
||||
var ModelFuzzers = []interface{}{FuzzAddr, FuzzAbsoluteTxPosition, FuzzContractInfo, FuzzStateModel, FuzzAccessType, FuzzAccessConfig, FuzzContractCodeHistory}
|
||||
var ModelFuzzers = []interface{}{FuzzAddr, FuzzAddrString, FuzzAbsoluteTxPosition, FuzzContractInfo, FuzzStateModel, FuzzAccessType, FuzzAccessConfig, FuzzContractCodeHistory}
|
||||
|
||||
func FuzzAddr(m *sdk.AccAddress, c fuzz.Continue) {
|
||||
*m = make([]byte, 20)
|
||||
c.Read(*m)
|
||||
}
|
||||
func FuzzAddrString(m *string, c fuzz.Continue) {
|
||||
var x sdk.AccAddress
|
||||
FuzzAddr(&x, c)
|
||||
*m = x.String()
|
||||
}
|
||||
|
||||
func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue) {
|
||||
m.BlockHeight = int64(c.RandUint64()) // can't be negative
|
||||
|
@ -23,8 +28,8 @@ func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue) {
|
|||
|
||||
func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue) {
|
||||
m.CodeID = c.RandUint64()
|
||||
FuzzAddr(&m.Creator, c)
|
||||
FuzzAddr(&m.Admin, c)
|
||||
FuzzAddrString(&m.Creator, c)
|
||||
FuzzAddrString(&m.Admin, c)
|
||||
m.Label = c.RandString()
|
||||
c.Fuzz(&m.Created)
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ func (c Code) ValidateBasic() error {
|
|||
}
|
||||
|
||||
func (c Contract) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(c.ContractAddress); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(c.ContractAddress); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract address")
|
||||
}
|
||||
if err := c.ContractInfo.ValidateBasic(); err != nil {
|
||||
|
|
|
@ -5,7 +5,6 @@ package types
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
|
@ -156,9 +155,9 @@ func (m *Code) GetCodeBytes() []byte {
|
|||
|
||||
// Contract struct encompasses ContractAddress, ContractInfo, and ContractState
|
||||
type Contract struct {
|
||||
ContractAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract_address,omitempty"`
|
||||
ContractInfo ContractInfo `protobuf:"bytes,2,opt,name=contract_info,json=contractInfo,proto3" json:"contract_info"`
|
||||
ContractState []Model `protobuf:"bytes,3,rep,name=contract_state,json=contractState,proto3" json:"contract_state"`
|
||||
ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`
|
||||
ContractInfo ContractInfo `protobuf:"bytes,2,opt,name=contract_info,json=contractInfo,proto3" json:"contract_info"`
|
||||
ContractState []Model `protobuf:"bytes,3,rep,name=contract_state,json=contractState,proto3" json:"contract_state"`
|
||||
}
|
||||
|
||||
func (m *Contract) Reset() { *m = Contract{} }
|
||||
|
@ -194,11 +193,11 @@ func (m *Contract) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_Contract proto.InternalMessageInfo
|
||||
|
||||
func (m *Contract) GetContractAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
|
||||
func (m *Contract) GetContractAddress() string {
|
||||
if m != nil {
|
||||
return m.ContractAddress
|
||||
}
|
||||
return nil
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Contract) GetContractInfo() ContractInfo {
|
||||
|
@ -280,41 +279,39 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_52f9f2715025dba8 = []byte{
|
||||
// 531 bytes of a gzipped FileDescriptorProto
|
||||
// 507 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x41, 0x6f, 0xd3, 0x30,
|
||||
0x14, 0xc7, 0x9b, 0xae, 0x0d, 0x9d, 0x57, 0x18, 0x32, 0x43, 0x44, 0x1b, 0x4b, 0x4a, 0x7b, 0xe9,
|
||||
0x81, 0x25, 0x74, 0x1c, 0x39, 0x2d, 0x9b, 0x84, 0xb2, 0x09, 0x84, 0xb2, 0x03, 0xd2, 0x84, 0x54,
|
||||
0xa5, 0xb6, 0x57, 0xa2, 0x35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31, 0x4f, 0x02, 0xc4, 0x99, 0xb1, 0x26, 0x79, 0xd6, 0x4a, 0x5e, 0xa1, 0x73,
|
||||
0x77, 0x14, 0xf3, 0x49, 0x99, 0x59, 0xe1, 0xde, 0xe0, 0x04, 0x9b, 0x91, 0x2f, 0x33, 0x12, 0x23,
|
||||
0xc2, 0x8c, 0xc6, 0x9d, 0xec, 0x53, 0xa5, 0xbb, 0x61, 0x97, 0x99, 0x55, 0x76, 0x19, 0xec, 0x7e,
|
||||
0xd7, 0x40, 0x43, 0x14, 0x08, 0x7b, 0xe0, 0x81, 0xa8, 0x64, 0x18, 0x62, 0x69, 0x65, 0xc3, 0x05,
|
||||
0x79, 0x66, 0xe9, 0x62, 0xc9, 0x3b, 0xf2, 0x75, 0xb1, 0xe4, 0x61, 0xe8, 0x8a, 0x2a, 0x85, 0x28,
|
||||
0x3e, 0xa7, 0x46, 0x5d, 0x3a, 0x6e, 0xdd, 0xe1, 0x9a, 0x17, 0x9f, 0x53, 0xe5, 0x79, 0x0b, 0xa9,
|
||||
0x39, 0xdc, 0x05, 0x40, 0x32, 0x46, 0x29, 0x27, 0xc2, 0x2a, 0xad, 0xdf, 0xf6, 0x25, 0xd5, 0x15,
|
||||
0x81, 0xee, 0xb7, 0x3a, 0x68, 0x2d, 0x1d, 0x82, 0x9f, 0xc0, 0xe3, 0xa5, 0x0d, 0xc3, 0x00, 0xe3,
|
||||
0x84, 0xb0, 0xe2, 0xa2, 0xdb, 0xee, 0xe0, 0x6f, 0x66, 0xed, 0x8d, 0x43, 0xfe, 0x79, 0x36, 0xb2,
|
||||
0x11, 0x8d, 0x1c, 0x44, 0x59, 0x44, 0x99, 0x1a, 0xf6, 0x18, 0xbe, 0x50, 0x7d, 0x73, 0x80, 0xd0,
|
||||
0x41, 0x91, 0xe8, 0x6f, 0x2e, 0x51, 0x2a, 0x00, 0xdf, 0x83, 0x87, 0x25, 0xbd, 0x52, 0x51, 0xef,
|
||||
0x9e, 0x7b, 0xab, 0x54, 0xd5, 0x46, 0x95, 0x18, 0xf4, 0xc0, 0xa3, 0x92, 0xc7, 0x44, 0x7b, 0xaa,
|
||||
0x46, 0x78, 0xbe, 0x02, 0xf8, 0x8e, 0x62, 0x32, 0x51, 0xa4, 0xf2, 0x24, 0xb2, 0xaf, 0xbb, 0x2e,
|
||||
0x68, 0x2d, 0xaf, 0x12, 0x76, 0x80, 0x1e, 0xe2, 0xe1, 0x05, 0x49, 0x55, 0xe9, 0xeb, 0x79, 0x66,
|
||||
0x35, 0xbd, 0xa3, 0x13, 0x92, 0xfa, 0xcd, 0x10, 0x9f, 0x90, 0x14, 0x6e, 0x81, 0xe6, 0x65, 0x30,
|
||||
0x99, 0x11, 0x59, 0x40, 0xc3, 0x2f, 0x26, 0xee, 0xf1, 0x55, 0x6e, 0x6a, 0xd7, 0xb9, 0xa9, 0xfd,
|
||||
0xce, 0x4d, 0xed, 0xc7, 0xc2, 0xac, 0x5d, 0x2f, 0xcc, 0xda, 0xaf, 0x85, 0x59, 0x3b, 0x7b, 0x55,
|
||||
0x31, 0xee, 0x90, 0xb2, 0xe8, 0xa3, 0x78, 0x76, 0xf2, 0x6c, 0xce, 0x5c, 0x8d, 0xff, 0x3f, 0xc2,
|
||||
0x91, 0x2e, 0xdf, 0xdf, 0xeb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xd1, 0x3c, 0xa8, 0xf6,
|
||||
0x03, 0x00, 0x00,
|
||||
0x14, 0xc7, 0x9b, 0xae, 0x0d, 0xad, 0x57, 0x18, 0x32, 0x43, 0x44, 0x1b, 0x4b, 0x4a, 0x7b, 0x29,
|
||||
0x12, 0x4a, 0xd8, 0x38, 0x72, 0x22, 0x9b, 0x84, 0xb2, 0x09, 0x84, 0xb2, 0x03, 0xd2, 0x2e, 0x55,
|
||||
0x1a, 0xbf, 0x95, 0x88, 0x26, 0x2e, 0xb1, 0x3b, 0x9a, 0x2f, 0x81, 0xf8, 0x58, 0xbb, 0xd1, 0x23,
|
||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 0x64, 0x1f, 0x1d, 0xb7,
|
||||
0x9d, 0x2f, 0xad, 0xa6, 0x77, 0x72, 0x06, 0x99, 0xdf, 0x8c, 0xc8, 0x19, 0x64, 0x78, 0x17, 0x35,
|
||||
0xaf, 0x82, 0xc9, 0x0c, 0x64, 0x03, 0x0d, 0x5f, 0x2d, 0xdc, 0xd3, 0xeb, 0xdc, 0xd4, 0x16, 0xb9,
|
||||
0xa9, 0xfd, 0xc9, 0x4d, 0xed, 0xe7, 0xca, 0xac, 0x2d, 0x56, 0x66, 0xed, 0xf7, 0xca, 0xac, 0x5d,
|
||||
0xbc, 0x1e, 0x47, 0xfc, 0xcb, 0x6c, 0x64, 0x87, 0x34, 0x76, 0x8e, 0x29, 0x8b, 0x3f, 0x8b, 0x37,
|
||||
0x24, 0x6b, 0x73, 0xe6, 0xc5, 0xf7, 0xff, 0x17, 0x35, 0xd2, 0xe5, 0x63, 0x7a, 0xf3, 0x2f, 0x00,
|
||||
0x00, 0xff, 0xff, 0x39, 0x9f, 0x1d, 0xc7, 0xc3, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -987,7 +984,7 @@ func (m *Contract) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
|
@ -997,25 +994,23 @@ func (m *Contract) 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 ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ContractAddress = append(m.ContractAddress[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ContractAddress == nil {
|
||||
m.ContractAddress = []byte{}
|
||||
}
|
||||
m.ContractAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
|
|
|
@ -23,7 +23,7 @@ message Code {
|
|||
|
||||
// Contract struct encompasses ContractAddress, ContractInfo, and ContractState
|
||||
message Contract {
|
||||
bytes contract_address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract_address = 1;
|
||||
ContractInfo contract_info = 2 [(gogoproto.nullable) = false];
|
||||
repeated Model contract_state = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestValidateGenesisState(t *testing.T) {
|
|||
},
|
||||
"contract invalid": {
|
||||
srcMutator: func(s *GenesisState) {
|
||||
s.Contracts[0].ContractAddress = nil
|
||||
s.Contracts[0].ContractAddress = "invalid"
|
||||
},
|
||||
expError: true,
|
||||
},
|
||||
|
@ -111,13 +111,13 @@ func TestContractValidateBasic(t *testing.T) {
|
|||
"all good": {srcMutator: func(_ *Contract) {}},
|
||||
"contract address invalid": {
|
||||
srcMutator: func(c *Contract) {
|
||||
c.ContractAddress = nil
|
||||
c.ContractAddress = "invalid"
|
||||
},
|
||||
expError: true,
|
||||
},
|
||||
"contract info invalid": {
|
||||
srcMutator: func(c *Contract) {
|
||||
c.ContractInfo.Creator = nil
|
||||
c.ContractInfo.Creator = "invalid"
|
||||
},
|
||||
expError: true,
|
||||
},
|
||||
|
|
|
@ -2,6 +2,7 @@ package types
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
|
@ -16,7 +17,7 @@ func (msg MsgStoreCode) Type() string {
|
|||
}
|
||||
|
||||
func (msg MsgStoreCode) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -45,7 +46,11 @@ func (msg MsgStoreCode) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
func (msg MsgStoreCode) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil { // should never happen as valid basic rejects invalid addresses
|
||||
panic(err.Error())
|
||||
}
|
||||
return []sdk.AccAddress{senderAddr}
|
||||
}
|
||||
|
||||
func (msg MsgInstantiateContract) Route() string {
|
||||
|
@ -57,8 +62,8 @@ func (msg MsgInstantiateContract) Type() string {
|
|||
}
|
||||
|
||||
func (msg MsgInstantiateContract) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
return err
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
|
||||
return sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
|
||||
if msg.CodeID == 0 {
|
||||
|
@ -75,8 +80,8 @@ func (msg MsgInstantiateContract) ValidateBasic() error {
|
|||
}
|
||||
|
||||
if len(msg.Admin) != 0 {
|
||||
if err := sdk.VerifyAddressFormat(msg.Admin); err != nil {
|
||||
return err
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Admin); err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
}
|
||||
if !json.Valid(msg.InitMsg) {
|
||||
|
@ -91,7 +96,12 @@ func (msg MsgInstantiateContract) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
func (msg MsgInstantiateContract) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil { // should never happen as valid basic rejects invalid addresses
|
||||
panic(err.Error())
|
||||
}
|
||||
return []sdk.AccAddress{senderAddr}
|
||||
|
||||
}
|
||||
|
||||
func (msg MsgExecuteContract) Route() string {
|
||||
|
@ -103,11 +113,11 @@ func (msg MsgExecuteContract) Type() string {
|
|||
}
|
||||
|
||||
func (msg MsgExecuteContract) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
return err
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
|
||||
return sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(msg.Contract); err != nil {
|
||||
return err
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
|
||||
if !msg.SentFunds.IsValid() {
|
||||
|
@ -125,7 +135,12 @@ func (msg MsgExecuteContract) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
func (msg MsgExecuteContract) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil { // should never happen as valid basic rejects invalid addresses
|
||||
panic(err.Error())
|
||||
}
|
||||
return []sdk.AccAddress{senderAddr}
|
||||
|
||||
}
|
||||
|
||||
func (msg MsgMigrateContract) Route() string {
|
||||
|
@ -140,10 +155,10 @@ func (msg MsgMigrateContract) ValidateBasic() error {
|
|||
if msg.CodeID == 0 {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
|
||||
return sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(msg.Contract); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
if !json.Valid(msg.MigrateMsg) {
|
||||
|
@ -159,7 +174,12 @@ func (msg MsgMigrateContract) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
func (msg MsgMigrateContract) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil { // should never happen as valid basic rejects invalid addresses
|
||||
panic(err.Error())
|
||||
}
|
||||
return []sdk.AccAddress{senderAddr}
|
||||
|
||||
}
|
||||
|
||||
func (msg MsgUpdateAdmin) Route() string {
|
||||
|
@ -171,16 +191,16 @@ func (msg MsgUpdateAdmin) Type() string {
|
|||
}
|
||||
|
||||
func (msg MsgUpdateAdmin) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
|
||||
return sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(msg.Contract); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(msg.NewAdmin); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.NewAdmin); err != nil {
|
||||
return sdkerrors.Wrap(err, "new admin")
|
||||
}
|
||||
if msg.Sender.Equals(msg.NewAdmin) {
|
||||
if strings.EqualFold(msg.Sender, msg.NewAdmin) {
|
||||
return sdkerrors.Wrap(ErrInvalidMsg, "new admin is the same as the old")
|
||||
}
|
||||
return nil
|
||||
|
@ -192,7 +212,12 @@ func (msg MsgUpdateAdmin) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
func (msg MsgUpdateAdmin) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil { // should never happen as valid basic rejects invalid addresses
|
||||
panic(err.Error())
|
||||
}
|
||||
return []sdk.AccAddress{senderAddr}
|
||||
|
||||
}
|
||||
|
||||
func (msg MsgClearAdmin) Route() string {
|
||||
|
@ -204,10 +229,10 @@ func (msg MsgClearAdmin) Type() string {
|
|||
}
|
||||
|
||||
func (msg MsgClearAdmin) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
|
||||
return sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(msg.Contract); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
return nil
|
||||
|
@ -219,5 +244,10 @@ func (msg MsgClearAdmin) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
func (msg MsgClearAdmin) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
|
||||
if err != nil { // should never happen as valid basic rejects invalid addresses
|
||||
panic(err.Error())
|
||||
}
|
||||
return []sdk.AccAddress{senderAddr}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ var _ = math.Inf
|
|||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// MsgStoreCode submit WASM code to the system
|
||||
// MsgStoreCode submit Wasm code to the system
|
||||
type MsgStoreCode struct {
|
||||
// Sender is the that actor that signed the messages
|
||||
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 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, optional
|
||||
|
@ -76,9 +76,9 @@ var xxx_messageInfo_MsgStoreCode proto.InternalMessageInfo
|
|||
// MsgInstantiateContract create a new smart contract instance for the given code id.
|
||||
type MsgInstantiateContract struct {
|
||||
// Sender is the that actor that signed the messages
|
||||
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 string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// Admin is an optional address that can execute migrations
|
||||
Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"`
|
||||
Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"`
|
||||
// CodeID is the reference to the stored WASM code
|
||||
CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
// Label is optional metadata to be stored with a contract instance.
|
||||
|
@ -125,9 +125,9 @@ var xxx_messageInfo_MsgInstantiateContract proto.InternalMessageInfo
|
|||
// MsgExecuteContract submits the given message data to a smart contract
|
||||
type MsgExecuteContract struct {
|
||||
// Sender is the that actor that signed the messages
|
||||
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 string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
// Msg json encoded message to be passed to the contract
|
||||
Msg encoding_json.RawMessage `protobuf:"bytes,3,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"`
|
||||
// SentFunds coins that are transferred to the contract on execution
|
||||
|
@ -170,9 +170,9 @@ var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo
|
|||
// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
|
||||
type MsgMigrateContract struct {
|
||||
// Sender is the that actor that signed the messages
|
||||
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 string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
// CodeID references the new WASM code
|
||||
CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
// MigrateMsg json encoded message to be passed to the contract on migration
|
||||
|
@ -215,11 +215,11 @@ var xxx_messageInfo_MsgMigrateContract proto.InternalMessageInfo
|
|||
// MsgUpdateAdmin sets a new admin for a smart contract
|
||||
type MsgUpdateAdmin struct {
|
||||
// Sender is the that actor that signed the messages
|
||||
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 string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// NewAdmin address to be set
|
||||
NewAdmin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"new_admin,omitempty"`
|
||||
NewAdmin string `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgUpdateAdmin) Reset() { *m = MsgUpdateAdmin{} }
|
||||
|
@ -258,9 +258,9 @@ var xxx_messageInfo_MsgUpdateAdmin proto.InternalMessageInfo
|
|||
// MsgClearAdmin removes any admin stored for a smart contract
|
||||
type MsgClearAdmin struct {
|
||||
// Sender is the that actor that signed the messages
|
||||
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 string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgClearAdmin) Reset() { *m = MsgClearAdmin{} }
|
||||
|
@ -308,49 +308,47 @@ func init() {
|
|||
func init() { proto.RegisterFile("x/wasm/internal/types/msg.proto", fileDescriptor_22c4d58a052e9e95) }
|
||||
|
||||
var fileDescriptor_22c4d58a052e9e95 = []byte{
|
||||
// 663 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xcf, 0x4e, 0xdb, 0x4e,
|
||||
0x10, 0xc7, 0x63, 0x42, 0x02, 0x2c, 0xf9, 0xa1, 0x9f, 0x2c, 0x40, 0x2e, 0xaa, 0xec, 0x34, 0x5c,
|
||||
0x72, 0xc1, 0x06, 0x2a, 0xb5, 0xa7, 0x1e, 0x92, 0xf4, 0x8f, 0x72, 0x30, 0xaa, 0x8c, 0x2a, 0x24,
|
||||
0x2e, 0xd6, 0xda, 0xbb, 0x6c, 0x97, 0xc6, 0xbb, 0x91, 0x67, 0xd3, 0x84, 0x77, 0xe8, 0xa1, 0xea,
|
||||
0x0b, 0xf4, 0xdc, 0x3e, 0x09, 0xea, 0x89, 0x63, 0x4f, 0x69, 0x1b, 0xde, 0x82, 0x53, 0xb5, 0xb6,
|
||||
0xa1, 0x54, 0xe2, 0x10, 0x41, 0x38, 0xf4, 0x92, 0xcd, 0x68, 0xbe, 0xf3, 0x9d, 0xd9, 0x8f, 0xd7,
|
||||
0x5e, 0xe4, 0x8c, 0xbc, 0x21, 0x86, 0xc4, 0xe3, 0x42, 0xd1, 0x54, 0xe0, 0x9e, 0xa7, 0x4e, 0xfa,
|
||||
0x14, 0xbc, 0x04, 0x98, 0xdb, 0x4f, 0xa5, 0x92, 0xe6, 0x9a, 0x4e, 0x13, 0x77, 0xe4, 0xe6, 0xeb,
|
||||
0xfb, 0x9d, 0x88, 0x2a, 0xbc, 0xb3, 0xb1, 0xca, 0x24, 0x93, 0x99, 0xc2, 0xd3, 0xff, 0x72, 0xf1,
|
||||
0x86, 0x1d, 0x4b, 0x48, 0x24, 0x78, 0x11, 0x06, 0xea, 0x15, 0x52, 0x2f, 0x96, 0x5c, 0x14, 0xf9,
|
||||
0x47, 0x37, 0x77, 0xcb, 0x7e, 0x73, 0x49, 0xe3, 0xf3, 0x1c, 0xaa, 0xf9, 0xc0, 0xf6, 0x95, 0x4c,
|
||||
0x69, 0x47, 0x12, 0x6a, 0x76, 0x51, 0x15, 0xa8, 0x20, 0x34, 0xb5, 0x8c, 0xba, 0xd1, 0xac, 0xb5,
|
||||
0x77, 0x2e, 0xc6, 0xce, 0x16, 0xe3, 0xea, 0xed, 0x20, 0x72, 0x63, 0x99, 0x78, 0x45, 0xcb, 0x7c,
|
||||
0xd9, 0x02, 0xf2, 0xae, 0xb0, 0x6b, 0xc5, 0x71, 0x8b, 0x90, 0x94, 0x02, 0x04, 0x85, 0x81, 0xf9,
|
||||
0x04, 0xad, 0xe8, 0xf6, 0x61, 0x74, 0xa2, 0x68, 0x18, 0x4b, 0x42, 0xad, 0xb9, 0xcc, 0xf2, 0xff,
|
||||
0xc9, 0xd8, 0xa9, 0x1d, 0xb4, 0xf6, 0xfd, 0xf6, 0x89, 0xca, 0x9a, 0x06, 0x35, 0xad, 0xbb, 0x8c,
|
||||
0xcc, 0x75, 0x54, 0x05, 0x39, 0x48, 0x63, 0x6a, 0x95, 0xeb, 0x46, 0x73, 0x29, 0x28, 0x22, 0xd3,
|
||||
0x42, 0x0b, 0xd1, 0x80, 0xf7, 0xf4, 0x6c, 0xf3, 0x59, 0xe2, 0x32, 0x34, 0x0f, 0xd1, 0x3a, 0x17,
|
||||
0xa0, 0xb0, 0x50, 0x1c, 0x2b, 0x1a, 0xf6, 0x69, 0x9a, 0x70, 0x00, 0x2e, 0x85, 0x55, 0xa9, 0x1b,
|
||||
0xcd, 0xe5, 0xdd, 0x4d, 0xf7, 0x46, 0xac, 0x7a, 0x68, 0x0a, 0xd0, 0x91, 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// 634 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xc1, 0x6e, 0xd3, 0x4c,
|
||||
0x10, 0xc7, 0xe3, 0xa6, 0x4d, 0x9b, 0x6d, 0xbe, 0xea, 0x93, 0xd5, 0x56, 0xa6, 0x20, 0x3b, 0xa4,
|
||||
0x97, 0x5c, 0xb0, 0xdb, 0x22, 0xc1, 0x89, 0x43, 0x6d, 0x40, 0xea, 0xc1, 0x08, 0xb9, 0x42, 0x95,
|
||||
0x7a, 0xb1, 0xd6, 0xf6, 0x76, 0xd9, 0x12, 0xef, 0x46, 0x9e, 0x0d, 0x49, 0xdf, 0x82, 0xa7, 0xe0,
|
||||
0x80, 0x78, 0x90, 0x1e, 0x7b, 0xe4, 0x14, 0x20, 0xe5, 0xc8, 0x13, 0x70, 0x42, 0xbb, 0x76, 0x43,
|
||||
0x2a, 0xb5, 0x55, 0x24, 0xc4, 0x25, 0x9b, 0xd1, 0xfc, 0xe7, 0x3f, 0xf9, 0xcd, 0x4e, 0x16, 0x39,
|
||||
0x23, 0x6f, 0x88, 0x21, 0xf7, 0x18, 0x97, 0xa4, 0xe0, 0xb8, 0xe7, 0xc9, 0xb3, 0x3e, 0x01, 0x2f,
|
||||
0x07, 0xea, 0xf6, 0x0b, 0x21, 0x85, 0xb9, 0xa1, 0xd2, 0x99, 0x3b, 0x72, 0xcb, 0xf3, 0xfd, 0x6e,
|
||||
0x42, 0x24, 0xde, 0xdd, 0x5a, 0xa7, 0x82, 0x0a, 0xad, 0xf0, 0xd4, 0xb7, 0x52, 0xbc, 0x65, 0xa7,
|
||||
0x02, 0x72, 0x01, 0x5e, 0x82, 0x81, 0x78, 0x95, 0xd4, 0x4b, 0x05, 0xe3, 0x55, 0xfe, 0xe1, 0xcd,
|
||||
0xdd, 0xf4, 0x67, 0x29, 0xe9, 0xfc, 0x34, 0x50, 0x2b, 0x04, 0x7a, 0x28, 0x45, 0x41, 0x02, 0x91,
|
||||
0x11, 0x73, 0x13, 0x35, 0x80, 0xf0, 0x8c, 0x14, 0x96, 0xd1, 0x36, 0xba, 0xcd, 0xa8, 0x8a, 0xcc,
|
||||
0x27, 0x68, 0x4d, 0x79, 0xc5, 0xc9, 0x99, 0x24, 0x71, 0x2a, 0x32, 0x62, 0x2d, 0xb4, 0x8d, 0x6e,
|
||||
0xcb, 0xff, 0x7f, 0x32, 0x76, 0x5a, 0x47, 0xfb, 0x87, 0xa1, 0x7f, 0x26, 0xb5, 0x43, 0xd4, 0x52,
|
||||
0xba, 0xab, 0x48, 0xfb, 0x89, 0x41, 0x91, 0x12, 0xab, 0x5e, 0xf9, 0xe9, 0xc8, 0xb4, 0xd0, 0x72,
|
||||
0x32, 0x60, 0x3d, 0xd5, 0x68, 0x51, 0x27, 0xae, 0x42, 0xf3, 0x18, 0x6d, 0x32, 0x0e, 0x12, 0x73,
|
||||
0xc9, 0xb0, 0x24, 0x71, 0x9f, 0x14, 0x39, 0x03, 0x60, 0x82, 0x5b, 0x4b, 0x6d, 0xa3, 0xbb, 0xba,
|
||||
0xb7, 0xed, 0xde, 0x38, 0x23, 0x77, 0x3f, 0x4d, 0x09, 0x40, 0x20, 0xf8, 0x09, 0xa3, 0xd1, 0xc6,
|
||||
0x8c, 0xc5, 0xeb, 0xa9, 0x43, 0xe7, 0xe3, 0x02, 0xda, 0x0c, 0x81, 0x1e, 0xfc, 0x49, 0x06, 0x82,
|
||||
0xcb, 0x02, 0xa7, 0xf2, 0x56, 0xf0, 0x75, 0xb4, 0x84, 0xb3, 0x9c, 0x71, 0xcd, 0xdb, 0x8c, 0xca,
|
||||
0xc0, 0xdc, 0x46, 0xcb, 0x6a, 0x08, 0x31, 0xcb, 0x34, 0xd7, 0xa2, 0x8f, 0x26, 0x63, 0xa7, 0xa1,
|
||||
0x88, 0x0f, 0x9e, 0x47, 0x0d, 0x95, 0x3a, 0xc8, 0x54, 0x69, 0x0f, 0x27, 0xa4, 0x57, 0x11, 0x96,
|
||||
0x81, 0xf9, 0x14, 0xad, 0x30, 0xce, 0x64, 0x9c, 0x03, 0xd5, 0x44, 0x2d, 0xff, 0xc1, 0xaf, 0xb1,
|
||||
0x63, 0x11, 0x9e, 0x8a, 0x8c, 0x71, 0xea, 0x9d, 0x82, 0xe0, 0x6e, 0x84, 0x87, 0x21, 0x01, 0xc0,
|
||||
0x94, 0x44, 0xcb, 0x4a, 0x1d, 0x02, 0x35, 0x4f, 0x11, 0xd2, 0x85, 0x27, 0x03, 0x9e, 0x81, 0xd5,
|
||||
0x68, 0xd7, 0xbb, 0xab, 0x7b, 0xf7, 0xdc, 0x72, 0x07, 0x5c, 0xb5, 0x03, 0xd3, 0x51, 0x04, 0x82,
|
||||
0x71, 0x7f, 0xe7, 0x7c, 0xec, 0xd4, 0x3e, 0x7d, 0x75, 0xba, 0x94, 0xc9, 0xb7, 0x83, 0xc4, 0x4d,
|
||||
0x45, 0xee, 0x55, 0x0b, 0x53, 0x1e, 0x8f, 0x20, 0x7b, 0x57, 0x2d, 0x83, 0x2a, 0x80, 0xa8, 0xa9,
|
||||
0xec, 0x5f, 0x2a, 0xf7, 0xce, 0x0f, 0x03, 0x99, 0x21, 0xd0, 0x17, 0x23, 0x92, 0x0e, 0xe6, 0x18,
|
||||
0xd2, 0x16, 0x5a, 0x49, 0x2b, 0x4d, 0x35, 0xa7, 0x69, 0x6c, 0xba, 0xa8, 0xae, 0x50, 0xeb, 0x73,
|
||||
0xa0, 0x2a, 0xa1, 0xc2, 0x04, 0xc2, 0xaf, 0x30, 0x97, 0xfe, 0x01, 0xa6, 0xb2, 0x2f, 0x31, 0x3f,
|
||||
0x97, 0x98, 0x21, 0xa3, 0x05, 0xfe, 0x4b, 0xcc, 0xb9, 0x36, 0xe2, 0x19, 0x5a, 0xcd, 0xcb, 0x5e,
|
||||
0xfa, 0xfa, 0x17, 0xe7, 0x98, 0x09, 0xaa, 0x0a, 0x42, 0xa0, 0x1d, 0x8c, 0xd6, 0x42, 0xa0, 0x6f,
|
||||
0xfa, 0x19, 0x96, 0x64, 0x5f, 0xef, 0xe1, 0x6d, 0xbf, 0xf4, 0x3e, 0x6a, 0x72, 0x32, 0x8c, 0x67,
|
||||
0x37, 0x77, 0x85, 0x93, 0x61, 0x59, 0x34, 0x8b, 0x51, 0xbf, 0x8e, 0xd1, 0x09, 0xd0, 0x7f, 0x21,
|
||||
0xd0, 0xa0, 0x47, 0x70, 0x71, 0x77, 0x87, 0x3b, 0x4c, 0xfc, 0x57, 0xe7, 0xdf, 0xed, 0xda, 0xf9,
|
||||
0xc4, 0x36, 0x2e, 0x26, 0xb6, 0xf1, 0x6d, 0x62, 0x1b, 0x1f, 0x2e, 0xed, 0xda, 0xc5, 0xa5, 0x5d,
|
||||
0xfb, 0x72, 0x69, 0xd7, 0x8e, 0x77, 0x66, 0x6e, 0x2a, 0x10, 0x90, 0x1f, 0xa9, 0x37, 0x4a, 0xff,
|
||||
0x97, 0xbd, 0x51, 0x75, 0x5e, 0x7f, 0xb1, 0x92, 0x86, 0x7e, 0xac, 0x1e, 0xff, 0x0e, 0x00, 0x00,
|
||||
0xff, 0xff, 0x02, 0x30, 0x34, 0xe1, 0x3f, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *MsgStoreCode) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -876,7 +874,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
|
||||
|
@ -886,25 +884,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 {
|
||||
|
@ -1097,7 +1093,7 @@ func (m *MsgInstantiateContract) 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
|
||||
|
@ -1107,31 +1103,29 @@ func (m *MsgInstantiateContract) 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 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
|
@ -1141,25 +1135,23 @@ func (m *MsgInstantiateContract) 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.Admin = append(m.Admin[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Admin == nil {
|
||||
m.Admin = []byte{}
|
||||
}
|
||||
m.Admin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
|
@ -1337,7 +1329,7 @@ func (m *MsgExecuteContract) 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
|
||||
|
@ -1347,31 +1339,29 @@ func (m *MsgExecuteContract) 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 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
|
@ -1381,25 +1371,23 @@ func (m *MsgExecuteContract) 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.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
|
@ -1526,7 +1514,7 @@ func (m *MsgMigrateContract) 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
|
||||
|
@ -1536,31 +1524,29 @@ func (m *MsgMigrateContract) 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 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
|
@ -1570,25 +1556,23 @@ func (m *MsgMigrateContract) 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.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
|
@ -1700,7 +1684,7 @@ func (m *MsgUpdateAdmin) 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
|
||||
|
@ -1710,31 +1694,29 @@ func (m *MsgUpdateAdmin) 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 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
|
@ -1744,31 +1726,29 @@ func (m *MsgUpdateAdmin) 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.NewAdmin = append(m.NewAdmin[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.NewAdmin == nil {
|
||||
m.NewAdmin = []byte{}
|
||||
}
|
||||
m.NewAdmin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
|
@ -1778,25 +1758,23 @@ func (m *MsgUpdateAdmin) 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.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -1855,7 +1833,7 @@ func (m *MsgClearAdmin) 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
|
||||
|
@ -1865,31 +1843,29 @@ func (m *MsgClearAdmin) 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 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
|
@ -1899,25 +1875,23 @@ func (m *MsgClearAdmin) 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.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
|
|
@ -13,7 +13,7 @@ option (gogoproto.goproto_getters_all) = false;
|
|||
// MsgStoreCode submit Wasm code to the system
|
||||
message MsgStoreCode {
|
||||
// Sender is the that actor that signed the messages
|
||||
bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string sender = 1;
|
||||
// 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, optional
|
||||
|
@ -27,9 +27,9 @@ message MsgStoreCode {
|
|||
// MsgInstantiateContract create a new smart contract instance for the given code id.
|
||||
message MsgInstantiateContract {
|
||||
// Sender is the that actor that signed the messages
|
||||
bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string sender = 1;
|
||||
// Admin is an optional address that can execute migrations
|
||||
bytes admin = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string admin = 2;
|
||||
// CodeID is the reference to the stored WASM code
|
||||
uint64 code_id = 3 [(gogoproto.customname) = "CodeID"];
|
||||
// Label is optional metadata to be stored with a contract instance.
|
||||
|
@ -43,9 +43,9 @@ message MsgInstantiateContract {
|
|||
// MsgExecuteContract submits the given message data to a smart contract
|
||||
message MsgExecuteContract {
|
||||
// Sender is the that actor that signed the messages
|
||||
bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string sender = 1;
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 2;
|
||||
// Msg json encoded message to be passed to the contract
|
||||
bytes msg = 3 [(gogoproto.casttype) = "encoding/json.RawMessage"];
|
||||
// SentFunds coins that are transferred to the contract on execution
|
||||
|
@ -55,9 +55,9 @@ message MsgExecuteContract {
|
|||
// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
|
||||
message MsgMigrateContract {
|
||||
// Sender is the that actor that signed the messages
|
||||
bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string sender = 1;
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 2;
|
||||
// CodeID references the new WASM code
|
||||
uint64 code_id = 3 [(gogoproto.customname) = "CodeID"];
|
||||
// MigrateMsg json encoded message to be passed to the contract on migration
|
||||
|
@ -67,18 +67,18 @@ message MsgMigrateContract {
|
|||
// MsgUpdateAdmin sets a new admin for a smart contract
|
||||
message MsgUpdateAdmin {
|
||||
// Sender is the that actor that signed the messages
|
||||
bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string sender = 1;
|
||||
// NewAdmin address to be set
|
||||
bytes new_admin = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string new_admin = 2;
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 3;
|
||||
}
|
||||
|
||||
|
||||
// MsgClearAdmin removes any admin stored for a smart contract
|
||||
message MsgClearAdmin {
|
||||
// Sender is the that actor that signed the messages
|
||||
bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string sender = 1;
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 3;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,11 @@ func TestBuilderRegexp(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStoreCodeValidation(t *testing.T) {
|
||||
badAddress, err := sdk.AccAddressFromHex("012345")
|
||||
bad, err := sdk.AccAddressFromHex("012345")
|
||||
require.NoError(t, err)
|
||||
badAddress := bad.String()
|
||||
// proper address size
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20))
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||
|
||||
cases := map[string]struct {
|
||||
msg MsgStoreCode
|
||||
|
@ -132,10 +133,11 @@ func TestStoreCodeValidation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInstantiateContractValidation(t *testing.T) {
|
||||
badAddress, err := sdk.AccAddressFromHex("012345")
|
||||
bad, err := sdk.AccAddressFromHex("012345")
|
||||
require.NoError(t, err)
|
||||
badAddress := bad.String()
|
||||
// proper address size
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20))
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||
|
||||
cases := map[string]struct {
|
||||
msg MsgInstantiateContract
|
||||
|
@ -238,10 +240,11 @@ func TestInstantiateContractValidation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestExecuteContractValidation(t *testing.T) {
|
||||
badAddress, err := sdk.AccAddressFromHex("012345")
|
||||
bad, err := sdk.AccAddressFromHex("012345")
|
||||
require.NoError(t, err)
|
||||
badAddress := bad.String()
|
||||
// proper address size
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20))
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||
|
||||
cases := map[string]struct {
|
||||
msg MsgExecuteContract
|
||||
|
@ -346,12 +349,13 @@ func TestExecuteContractValidation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMsgUpdateAdministrator(t *testing.T) {
|
||||
badAddress, err := sdk.AccAddressFromHex("012345")
|
||||
bad, err := sdk.AccAddressFromHex("012345")
|
||||
require.NoError(t, err)
|
||||
badAddress := bad.String()
|
||||
// proper address size
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20))
|
||||
otherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x1}, 20))
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20))
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||
otherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x1}, 20)).String()
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
||||
|
||||
specs := map[string]struct {
|
||||
src MsgUpdateAdmin
|
||||
|
@ -417,11 +421,12 @@ func TestMsgUpdateAdministrator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMsgClearAdministrator(t *testing.T) {
|
||||
badAddress, err := sdk.AccAddressFromHex("012345")
|
||||
bad, err := sdk.AccAddressFromHex("012345")
|
||||
require.NoError(t, err)
|
||||
badAddress := bad.String()
|
||||
// proper address size
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20))
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20))
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
||||
|
||||
specs := map[string]struct {
|
||||
src MsgClearAdmin
|
||||
|
@ -467,11 +472,12 @@ func TestMsgClearAdministrator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMsgMigrateContract(t *testing.T) {
|
||||
badAddress, err := sdk.AccAddressFromHex("012345")
|
||||
bad, err := sdk.AccAddressFromHex("012345")
|
||||
require.NoError(t, err)
|
||||
badAddress := bad.String()
|
||||
// proper address size
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20))
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20))
|
||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
||||
|
||||
specs := map[string]struct {
|
||||
src MsgMigrateContract
|
||||
|
|
|
@ -37,7 +37,7 @@ func (a AccessType) With(addr sdk.AccAddress) AccessConfig {
|
|||
if err := sdk.VerifyAddressFormat(addr); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return AccessConfig{Permission: AccessTypeOnlyAddress, Address: addr}
|
||||
return AccessConfig{Permission: AccessTypeOnlyAddress, Address: addr.String()}
|
||||
case AccessTypeEverybody:
|
||||
return AllowEverybody
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ func (a *AccessType) UnmarshalJSONPB(_ *jsonpb.Unmarshaler, data []byte) error {
|
|||
}
|
||||
|
||||
func (a AccessConfig) Equals(o AccessConfig) bool {
|
||||
return a.Permission == o.Permission && a.Address.Equals(o.Address)
|
||||
return a.Permission == o.Permission && a.Address == o.Address
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -175,7 +175,8 @@ func (v AccessConfig) ValidateBasic() error {
|
|||
}
|
||||
return nil
|
||||
case AccessTypeOnlyAddress:
|
||||
return sdk.VerifyAddressFormat(v.Address)
|
||||
_, err := sdk.AccAddressFromBech32(v.Address)
|
||||
return err
|
||||
}
|
||||
return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", v.Permission)
|
||||
}
|
||||
|
@ -187,7 +188,7 @@ func (v AccessConfig) Allowed(actor sdk.AccAddress) bool {
|
|||
case AccessTypeEverybody:
|
||||
return true
|
||||
case AccessTypeOnlyAddress:
|
||||
return v.Address.Equals(actor)
|
||||
return v.Address == actor.String()
|
||||
default:
|
||||
panic("unknown type")
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
|
||||
func TestValidateParams(t *testing.T) {
|
||||
var (
|
||||
anyAddress = make([]byte, sdk.AddrLen)
|
||||
invalidAddress = make([]byte, sdk.AddrLen-1)
|
||||
anyAddress sdk.AccAddress = make([]byte, sdk.AddrLen)
|
||||
invalidAddress = "invalid address"
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -70,7 +70,7 @@ func TestValidateParams(t *testing.T) {
|
|||
},
|
||||
"reject CodeUploadAccess Everybody with obsolete address": {
|
||||
src: Params{
|
||||
CodeUploadAccess: AccessConfig{Permission: AccessTypeEverybody, Address: anyAddress},
|
||||
CodeUploadAccess: AccessConfig{Permission: AccessTypeEverybody, Address: anyAddress.String()},
|
||||
InstantiateDefaultPermission: AccessTypeOnlyAddress,
|
||||
MaxWasmCodeSize: DefaultMaxWasmCodeSize,
|
||||
},
|
||||
|
@ -78,7 +78,7 @@ func TestValidateParams(t *testing.T) {
|
|||
},
|
||||
"reject CodeUploadAccess Nobody with obsolete address": {
|
||||
src: Params{
|
||||
CodeUploadAccess: AccessConfig{Permission: AccessTypeNobody, Address: anyAddress},
|
||||
CodeUploadAccess: AccessConfig{Permission: AccessTypeNobody, Address: anyAddress.String()},
|
||||
InstantiateDefaultPermission: AccessTypeOnlyAddress,
|
||||
MaxWasmCodeSize: DefaultMaxWasmCodeSize,
|
||||
},
|
||||
|
|
|
@ -80,7 +80,7 @@ func (p StoreCodeProposal) ValidateBasic() error {
|
|||
if err := validateProposalCommons(p.Title, p.Description); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.RunAs); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
|
||||
return sdkerrors.Wrap(err, "run as")
|
||||
}
|
||||
|
||||
|
@ -118,13 +118,13 @@ func (p StoreCodeProposal) String() string {
|
|||
// MarshalYAML pretty prints the wasm byte code
|
||||
func (p StoreCodeProposal) MarshalYAML() (interface{}, error) {
|
||||
return struct {
|
||||
Title string `yaml:"title"`
|
||||
Description string `yaml:"description"`
|
||||
RunAs sdk.AccAddress `yaml:"run_as"`
|
||||
WASMByteCode string `yaml:"wasm_byte_code"`
|
||||
Source string `yaml:"source"`
|
||||
Builder string `yaml:"builder"`
|
||||
InstantiatePermission *AccessConfig `yaml:"instantiate_permission"`
|
||||
Title string `yaml:"title"`
|
||||
Description string `yaml:"description"`
|
||||
RunAs string `yaml:"run_as"`
|
||||
WASMByteCode string `yaml:"wasm_byte_code"`
|
||||
Source string `yaml:"source"`
|
||||
Builder string `yaml:"builder"`
|
||||
InstantiatePermission *AccessConfig `yaml:"instantiate_permission"`
|
||||
}{
|
||||
Title: p.Title,
|
||||
Description: p.Description,
|
||||
|
@ -155,7 +155,7 @@ func (p InstantiateContractProposal) ValidateBasic() error {
|
|||
if err := validateProposalCommons(p.Title, p.Description); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.RunAs); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "run as")
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ func (p InstantiateContractProposal) ValidateBasic() error {
|
|||
}
|
||||
|
||||
if len(p.Admin) != 0 {
|
||||
if err := sdk.VerifyAddressFormat(p.Admin); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.Admin); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -197,14 +197,14 @@ func (p InstantiateContractProposal) String() string {
|
|||
// MarshalYAML pretty prints the init message
|
||||
func (p InstantiateContractProposal) MarshalYAML() (interface{}, error) {
|
||||
return struct {
|
||||
Title string `yaml:"title"`
|
||||
Description string `yaml:"description"`
|
||||
RunAs sdk.AccAddress `yaml:"run_as"`
|
||||
Admin sdk.AccAddress `yaml:"admin"`
|
||||
CodeID uint64 `yaml:"code_id"`
|
||||
Label string `yaml:"label"`
|
||||
InitMsg string `yaml:"init_msg"`
|
||||
InitFunds sdk.Coins `yaml:"init_funds"`
|
||||
Title string `yaml:"title"`
|
||||
Description string `yaml:"description"`
|
||||
RunAs string `yaml:"run_as"`
|
||||
Admin string `yaml:"admin"`
|
||||
CodeID uint64 `yaml:"code_id"`
|
||||
Label string `yaml:"label"`
|
||||
InitMsg string `yaml:"init_msg"`
|
||||
InitFunds sdk.Coins `yaml:"init_funds"`
|
||||
}{
|
||||
Title: p.Title,
|
||||
Description: p.Description,
|
||||
|
@ -237,10 +237,10 @@ func (p MigrateContractProposal) ValidateBasic() error {
|
|||
if p.CodeID == 0 {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code_id is required")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.Contract); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.RunAs); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
|
||||
return sdkerrors.Wrap(err, "run as")
|
||||
}
|
||||
return nil
|
||||
|
@ -261,12 +261,12 @@ func (p MigrateContractProposal) String() string {
|
|||
// MarshalYAML pretty prints the migrate message
|
||||
func (p MigrateContractProposal) MarshalYAML() (interface{}, error) {
|
||||
return struct {
|
||||
Title string `yaml:"title"`
|
||||
Description string `yaml:"description"`
|
||||
Contract sdk.AccAddress `yaml:"contract"`
|
||||
CodeID uint64 `yaml:"code_id"`
|
||||
MigrateMsg string `yaml:"msg"`
|
||||
RunAs sdk.AccAddress `yaml:"run_as"`
|
||||
Title string `yaml:"title"`
|
||||
Description string `yaml:"description"`
|
||||
Contract string `yaml:"contract"`
|
||||
CodeID uint64 `yaml:"code_id"`
|
||||
MigrateMsg string `yaml:"msg"`
|
||||
RunAs string `yaml:"run_as"`
|
||||
}{
|
||||
Title: p.Title,
|
||||
Description: p.Description,
|
||||
|
@ -294,10 +294,10 @@ func (p UpdateAdminProposal) ValidateBasic() error {
|
|||
if err := validateProposalCommons(p.Title, p.Description); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.Contract); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.NewAdmin); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.NewAdmin); err != nil {
|
||||
return sdkerrors.Wrap(err, "new admin")
|
||||
}
|
||||
return nil
|
||||
|
@ -330,7 +330,7 @@ func (p ClearAdminProposal) ValidateBasic() error {
|
|||
if err := validateProposalCommons(p.Title, p.Description); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(p.Contract); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
|
||||
return sdkerrors.Wrap(err, "contract")
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -34,7 +34,7 @@ type StoreCodeProposal struct {
|
|||
// Description is a human readable text
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// RunAs is the address that is passed to the contract's environment as sender
|
||||
RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"`
|
||||
RunAs string `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"`
|
||||
// WASMByteCode can be raw or gzip compressed
|
||||
WASMByteCode []byte `protobuf:"bytes,4,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, optional
|
||||
|
@ -84,9 +84,9 @@ type InstantiateContractProposal struct {
|
|||
// Description is a human readable text
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// RunAs is the address that is passed to the contract's environment as sender
|
||||
RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"`
|
||||
RunAs string `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"`
|
||||
// Admin is an optional address that can execute migrations
|
||||
Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"`
|
||||
Admin string `protobuf:"bytes,4,opt,name=admin,proto3" json:"admin,omitempty"`
|
||||
// CodeID is the reference to the stored WASM code
|
||||
CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
// Label is optional metadata to be stored with a constract instance.
|
||||
|
@ -136,9 +136,9 @@ type MigrateContractProposal struct {
|
|||
// Description is a human readable text
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// RunAs is the address that is passed to the contract's environment as sender
|
||||
RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"`
|
||||
RunAs string `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
// CodeID references the new WASM code
|
||||
CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
// MigrateMsg json encoded message to be passed to the contract on migration
|
||||
|
@ -184,9 +184,9 @@ type UpdateAdminProposal struct {
|
|||
// Description is a human readable text
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// NewAdmin address to be set
|
||||
NewAdmin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"new_admin,omitempty" yaml:"new_admin"`
|
||||
NewAdmin string `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty" yaml:"new_admin"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UpdateAdminProposal) Reset() { *m = UpdateAdminProposal{} }
|
||||
|
@ -228,7 +228,7 @@ type ClearAdminProposal struct {
|
|||
// Description is a human readable text
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// Contract is the address of the smart contract
|
||||
Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"`
|
||||
Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClearAdminProposal) Reset() { *m = ClearAdminProposal{} }
|
||||
|
@ -276,50 +276,49 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_00b43267813130fb = []byte{
|
||||
// 684 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x4e, 0xdb, 0x4a,
|
||||
0x18, 0x8d, 0x13, 0x92, 0xc0, 0x24, 0xba, 0xe2, 0xfa, 0x02, 0xd7, 0x97, 0x5b, 0x39, 0x69, 0xe8,
|
||||
0x22, 0x1b, 0x6c, 0xa0, 0x52, 0x2b, 0x55, 0xea, 0x22, 0x49, 0xff, 0x58, 0x44, 0x42, 0x46, 0x2d,
|
||||
0x12, 0x9b, 0x68, 0xec, 0x19, 0xdc, 0xa1, 0xf6, 0x8c, 0x35, 0x33, 0x69, 0xc8, 0xae, 0x8f, 0xd0,
|
||||
0x7d, 0x5f, 0xa0, 0xea, 0x93, 0x64, 0x55, 0xb1, 0x44, 0xaa, 0x94, 0x96, 0xf0, 0x06, 0x5d, 0xb2,
|
||||
0xaa, 0x66, 0x6c, 0xd2, 0x54, 0x62, 0x81, 0x80, 0x05, 0x9b, 0x4c, 0xbe, 0x7c, 0xe7, 0x3b, 0x39,
|
||||
0x73, 0xce, 0xd8, 0x03, 0x1e, 0x1c, 0xb9, 0x03, 0x28, 0x62, 0x97, 0x50, 0x89, 0x39, 0x85, 0x91,
|
||||
0x2b, 0x87, 0x09, 0x16, 0x6e, 0xc2, 0x59, 0xc2, 0x04, 0x8c, 0x9c, 0x84, 0x33, 0xc9, 0xcc, 0x65,
|
||||
0x85, 0x41, 0xce, 0x91, 0x93, 0xae, 0xef, 0x37, 0x7d, 0x2c, 0xe1, 0xe6, 0xea, 0x52, 0xc8, 0x42,
|
||||
0xa6, 0x11, 0xae, 0xfa, 0x96, 0x82, 0x57, 0xed, 0x80, 0x89, 0x98, 0x09, 0xd7, 0x87, 0x02, 0xbb,
|
||||
0x19, 0xd4, 0x0d, 0x18, 0xa1, 0x59, 0xff, 0xfe, 0xe5, 0x7f, 0xa9, 0x3f, 0x53, 0x48, 0xe3, 0x5b,
|
||||
0x1e, 0xfc, 0xbd, 0x2b, 0x19, 0xc7, 0x1d, 0x86, 0xf0, 0x4e, 0xa6, 0xc5, 0x5c, 0x02, 0x45, 0x49,
|
||||
0x64, 0x84, 0x2d, 0xa3, 0x6e, 0x34, 0x17, 0xbc, 0xb4, 0x30, 0xeb, 0xa0, 0x82, 0xb0, 0x08, 0x38,
|
||||
0x49, 0x24, 0x61, 0xd4, 0xca, 0xeb, 0xde, 0xec, 0x4f, 0xe6, 0x2b, 0x50, 0xe2, 0x7d, 0xda, 0x83,
|
||||
0xc2, 0x2a, 0xd4, 0x8d, 0x66, 0xb5, 0xbd, 0x79, 0x3e, 0xae, 0xad, 0x87, 0x44, 0xbe, 0xed, 0xfb,
|
||||
0x4e, 0xc0, 0x62, 0x37, 0xd3, 0x9b, 0x2e, 0xeb, 0x02, 0xbd, 0xcb, 0xb4, 0xb4, 0x82, 0xa0, 0x85,
|
||||
0x10, 0xc7, 0x42, 0x78, 0x45, 0xde, 0xa7, 0x2d, 0x61, 0x3e, 0x02, 0x7f, 0x29, 0xe9, 0x3d, 0x7f,
|
||||
0x28, 0x71, 0x2f, 0x60, 0x08, 0x5b, 0x73, 0x9a, 0x71, 0x71, 0x32, 0xae, 0x55, 0xf7, 0x5a, 0xbb,
|
||||
0xdd, 0xf6, 0x50, 0x6a, 0xcd, 0x5e, 0x55, 0xe1, 0x2e, 0x2a, 0x73, 0x05, 0x94, 0x04, 0xeb, 0xf3,
|
||||
0x00, 0x5b, 0x45, 0x2d, 0x2f, 0xab, 0x4c, 0x0b, 0x94, 0xfd, 0x3e, 0x89, 0x10, 0xe6, 0x56, 0x49,
|
||||
0x37, 0x2e, 0x4a, 0x73, 0x1f, 0xac, 0x10, 0x2a, 0x24, 0xa4, 0x92, 0x40, 0x89, 0x7b, 0x09, 0xe6,
|
||||
0x31, 0x11, 0x42, 0x6d, 0xb0, 0x5c, 0x37, 0x9a, 0x95, 0xad, 0x35, 0xe7, 0xd2, 0x48, 0x94, 0x66,
|
||||
0x2c, 0x44, 0x87, 0xd1, 0x03, 0x12, 0x7a, 0xcb, 0x33, 0x14, 0x3b, 0x53, 0x86, 0xc6, 0xa8, 0x00,
|
||||
0xfe, 0xdf, 0xfe, 0xdd, 0xe9, 0x30, 0x2a, 0x39, 0x0c, 0xe4, 0x1d, 0xf2, 0xf9, 0x25, 0x28, 0x42,
|
||||
0x14, 0x13, 0x9a, 0xd9, 0x7b, 0x1d, 0x22, 0x3d, 0x6f, 0xae, 0x81, 0xb2, 0x8a, 0xa9, 0x47, 0x90,
|
||||
0x76, 0x7e, 0xae, 0x0d, 0x26, 0xe3, 0x5a, 0x49, 0x65, 0xb2, 0xfd, 0xcc, 0x2b, 0xa9, 0xd6, 0x36,
|
||||
0x52, 0xfb, 0x8d, 0xa0, 0x8f, 0xa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, 0x37, 0x3e, 0x19, 0xc0, 0xec, 0x44, 0x18, 0xf2, 0xdb, 0x71, 0x60, 0x56,
|
||||
0x5d, 0xe1, 0xc6, 0xea, 0xda, 0x6f, 0x46, 0xa7, 0x76, 0xee, 0xe4, 0xd4, 0xce, 0x7d, 0x9e, 0xd8,
|
||||
0xc6, 0x68, 0x62, 0x1b, 0xc7, 0x13, 0xdb, 0xf8, 0x31, 0xb1, 0x8d, 0x8f, 0x67, 0x76, 0xee, 0xf8,
|
||||
0xcc, 0xce, 0x9d, 0x9c, 0xd9, 0xb9, 0xfd, 0x8d, 0x19, 0xfa, 0x0e, 0x13, 0xf1, 0x9e, 0xba, 0x70,
|
||||
0xf4, 0x9b, 0xd2, 0x3d, 0xca, 0xd6, 0x3f, 0xaf, 0x1f, 0xbf, 0xa4, 0x6f, 0x9e, 0x87, 0xbf, 0x02,
|
||||
0x00, 0x00, 0xff, 0xff, 0x4f, 0xeb, 0x52, 0x56, 0x11, 0x07, 0x00, 0x00,
|
||||
// 658 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0x3d, 0x6f, 0xd3, 0x40,
|
||||
0x18, 0xc7, 0xe3, 0xbe, 0x38, 0xc9, 0x25, 0x42, 0xc5, 0xa4, 0xc5, 0x14, 0xe4, 0x04, 0x97, 0x21,
|
||||
0x0b, 0x76, 0x5b, 0x24, 0x90, 0x90, 0x18, 0xe2, 0x20, 0xa4, 0x0e, 0x91, 0x2a, 0x57, 0x50, 0xa9,
|
||||
0x8b, 0x75, 0xb6, 0xaf, 0xee, 0x15, 0xfb, 0xce, 0xf2, 0x5d, 0x48, 0xf3, 0x2d, 0xf8, 0x00, 0x7c,
|
||||
0x80, 0x8a, 0x4f, 0xd2, 0xb1, 0x63, 0xa7, 0x40, 0x9d, 0x85, 0x99, 0x91, 0x09, 0xdd, 0xd9, 0x0d,
|
||||
0xa9, 0x54,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97, 0x03, 0xb8, 0x4d, 0xe1, 0xbb, 0x52, 0xda, 0x1a, 0x50, 0x19, 0x1d, 0x66, 0x01, 0xd2, 0x97,
|
||||
0x65, 0xb9, 0x52, 0x69, 0x3a, 0xa8, 0xfa, 0x43, 0x1c, 0x87, 0x28, 0xd3, 0x55, 0x19, 0xb8, 0x92,
|
||||
0xda, 0x01, 0x58, 0xc3, 0x84, 0x71, 0x48, 0x38, 0x86, 0x1c, 0x79, 0x29, 0xca, 0x12, 0xcc, 0x98,
|
||||
0x98, 0xb6, 0xda, 0x51, 0xba, 0x8d, 0xed, 0x0d, 0xeb, 0x46, 0xbe, 0x56, 0x2f, 0x08, 0x10, 0x63,
|
||||
0x7d, 0x4a, 0x0e, 0x71, 0xe4, 0xae, 0xce, 0x95, 0xd8, 0x9d, 0x55, 0x30, 0xf3, 0x05, 0xf0, 0x70,
|
||||
0xe7, 0x57, 0xa4, 0x4f, 0x09, 0xcf, 0x60, 0xc0, 0xff, 0x15, 0xb4, 0x16, 0x58, 0x86, 0x61, 0x82,
|
||||
0x89, 0x64, 0x55, 0x77, 0x0b, 0xa1, 0x6d, 0x80, 0xaa, 0x00, 0xe8, 0xe1, 0x50, 0x32, 0x59, 0x72,
|
||||
0x40, 0x3e, 0x69, 0xab, 0x82, 0xd6, 0xce, 0x6b, 0x57, 0x15, 0xa1, 0x9d, 0x50, 0xa4, 0xc6, 0xd0,
|
||||
0x47, 0x71, 0x49, 0xa7, 0x10, 0xda, 0x0b, 0x50, 0xc3, 0x04, 0x73, 0x2f, 0x61, 0x91, 0xa4, 0xd1,
|
||||
0x74, 0x1e, 0xfd, 0x98, 0xb4, 0x75, 0x44, 0x02, 0x1a, 0x62, 0x12, 0xd9, 0xc7, 0x8c, 0x12, 0xcb,
|
||||
0x85, 0xa3, 0x01, 0x62, 0x0c, 0x46, 0xc8, 0xad, 0x0a, 0xf7, 0x80, 0x45, 0xda, 0x31, 0x00, 0x32,
|
||||
0xf1, 0x70, 0x48, 0x42, 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x38, 0x35, 0x2a, 0xe7, 0x53, 0xa3, 0x72, 0x31, 0x35, 0x2a, 0x07, 0x9b, 0x73, 0xeb,
|
||||
0xd4, 0xa7, 0x2c, 0xd9, 0x17, 0x37, 0x9b, 0x7c, 0x8b, 0xed, 0x93, 0xf2, 0xbc, 0x7e, 0xcf, 0xf9,
|
||||
0xaa, 0xbc, 0xe2, 0x9e, 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x68, 0x86, 0x6f, 0x52, 0x7a, 0x05,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *StoreCodeProposal) Equal(that interface{}) bool {
|
||||
|
@ -347,7 +346,7 @@ func (this *StoreCodeProposal) Equal(that interface{}) bool {
|
|||
if this.Description != that1.Description {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.RunAs, that1.RunAs) {
|
||||
if this.RunAs != that1.RunAs {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.WASMByteCode, that1.WASMByteCode) {
|
||||
|
@ -389,10 +388,10 @@ func (this *InstantiateContractProposal) Equal(that interface{}) bool {
|
|||
if this.Description != that1.Description {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.RunAs, that1.RunAs) {
|
||||
if this.RunAs != that1.RunAs {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Admin, that1.Admin) {
|
||||
if this.Admin != that1.Admin {
|
||||
return false
|
||||
}
|
||||
if this.CodeID != that1.CodeID {
|
||||
|
@ -439,10 +438,10 @@ func (this *MigrateContractProposal) Equal(that interface{}) bool {
|
|||
if this.Description != that1.Description {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.RunAs, that1.RunAs) {
|
||||
if this.RunAs != that1.RunAs {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Contract, that1.Contract) {
|
||||
if this.Contract != that1.Contract {
|
||||
return false
|
||||
}
|
||||
if this.CodeID != that1.CodeID {
|
||||
|
@ -478,10 +477,10 @@ func (this *UpdateAdminProposal) Equal(that interface{}) bool {
|
|||
if this.Description != that1.Description {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.NewAdmin, that1.NewAdmin) {
|
||||
if this.NewAdmin != that1.NewAdmin {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Contract, that1.Contract) {
|
||||
if this.Contract != that1.Contract {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -511,7 +510,7 @@ func (this *ClearAdminProposal) Equal(that interface{}) bool {
|
|||
if this.Description != that1.Description {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Contract, that1.Contract) {
|
||||
if this.Contract != that1.Contract {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -1106,7 +1105,7 @@ func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RunAs", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1116,25 +1115,23 @@ func (m *StoreCodeProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RunAs = append(m.RunAs[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.RunAs == nil {
|
||||
m.RunAs = []byte{}
|
||||
}
|
||||
m.RunAs = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
|
@ -1391,7 +1388,7 @@ func (m *InstantiateContractProposal) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RunAs", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1401,31 +1398,29 @@ func (m *InstantiateContractProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RunAs = append(m.RunAs[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.RunAs == nil {
|
||||
m.RunAs = []byte{}
|
||||
}
|
||||
m.RunAs = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1435,25 +1430,23 @@ func (m *InstantiateContractProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Admin = append(m.Admin[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Admin == nil {
|
||||
m.Admin = []byte{}
|
||||
}
|
||||
m.Admin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
|
@ -1695,7 +1688,7 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RunAs", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1705,31 +1698,29 @@ func (m *MigrateContractProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RunAs = append(m.RunAs[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.RunAs == nil {
|
||||
m.RunAs = []byte{}
|
||||
}
|
||||
m.RunAs = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1739,25 +1730,23 @@ func (m *MigrateContractProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
|
@ -1933,7 +1922,7 @@ func (m *UpdateAdminProposal) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1943,31 +1932,29 @@ func (m *UpdateAdminProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.NewAdmin = append(m.NewAdmin[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.NewAdmin == nil {
|
||||
m.NewAdmin = []byte{}
|
||||
}
|
||||
m.NewAdmin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -1977,25 +1964,23 @@ func (m *UpdateAdminProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -2118,7 +2103,7 @@ func (m *ClearAdminProposal) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProposal
|
||||
|
@ -2128,25 +2113,23 @@ func (m *ClearAdminProposal) 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 ErrInvalidLengthProposal
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthProposal
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Contract = append(m.Contract[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Contract == nil {
|
||||
m.Contract = []byte{}
|
||||
}
|
||||
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
|
|
@ -17,7 +17,7 @@ message StoreCodeProposal {
|
|||
// Description is a human readable text
|
||||
string description = 2;
|
||||
// RunAs is the address that is passed to the contract's environment as sender
|
||||
bytes run_as = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string run_as = 3;
|
||||
// WASMByteCode can be raw or gzip compressed
|
||||
bytes wasm_byte_code = 4 [(gogoproto.customname) = "WASMByteCode"];
|
||||
// Source is a valid absolute HTTPS URI to the contract's source code, optional
|
||||
|
@ -35,9 +35,9 @@ message InstantiateContractProposal {
|
|||
// Description is a human readable text
|
||||
string description = 2;
|
||||
// RunAs is the address that is passed to the contract's environment as sender
|
||||
bytes run_as = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string run_as = 3;
|
||||
// Admin is an optional address that can execute migrations
|
||||
bytes admin = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string admin = 4;
|
||||
// CodeID is the reference to the stored WASM code
|
||||
uint64 code_id = 5 [(gogoproto.customname) = "CodeID"];
|
||||
// Label is optional metadata to be stored with a constract instance.
|
||||
|
@ -55,9 +55,9 @@ message MigrateContractProposal {
|
|||
// Description is a human readable text
|
||||
string description = 2;
|
||||
// RunAs is the address that is passed to the contract's environment as sender
|
||||
bytes run_as = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string run_as = 3;
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 4;
|
||||
// CodeID references the new WASM code
|
||||
uint64 code_id = 5 [(gogoproto.customname) = "CodeID"];
|
||||
// MigrateMsg json encoded message to be passed to the contract on migration
|
||||
|
@ -71,9 +71,9 @@ message UpdateAdminProposal {
|
|||
// Description is a human readable text
|
||||
string description = 2;
|
||||
// NewAdmin address to be set
|
||||
bytes new_admin = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", (gogoproto.moretags) = "yaml:\"new_admin\""];
|
||||
string new_admin = 3 [(gogoproto.moretags) = "yaml:\"new_admin\""];
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 4;
|
||||
}
|
||||
|
||||
// ClearAdminProposal gov proposal content type to clear the admin of a contract.
|
||||
|
@ -83,5 +83,5 @@ message ClearAdminProposal {
|
|||
// Description is a human readable text
|
||||
string description = 2;
|
||||
// Contract is the address of the smart contract
|
||||
bytes contract = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string contract = 3;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ func TestValidateProposalCommons(t *testing.T) {
|
|||
func TestValidateStoreCodeProposal(t *testing.T) {
|
||||
var (
|
||||
anyAddress sdk.AccAddress = bytes.Repeat([]byte{0x0}, sdk.AddrLen)
|
||||
invalidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen-1)
|
||||
invalidAddress = "invalid address"
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -125,7 +125,7 @@ func TestValidateStoreCodeProposal(t *testing.T) {
|
|||
},
|
||||
"run_as missing": {
|
||||
src: StoreCodeProposalFixture(func(p *StoreCodeProposal) {
|
||||
p.RunAs = nil
|
||||
p.RunAs = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -180,7 +180,7 @@ func TestValidateStoreCodeProposal(t *testing.T) {
|
|||
|
||||
func TestValidateInstantiateContractProposal(t *testing.T) {
|
||||
var (
|
||||
invalidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen-1)
|
||||
invalidAddress = "invalid address"
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -192,7 +192,7 @@ func TestValidateInstantiateContractProposal(t *testing.T) {
|
|||
},
|
||||
"without admin": {
|
||||
src: InstantiateContractProposalFixture(func(p *InstantiateContractProposal) {
|
||||
p.Admin = nil
|
||||
p.Admin = ""
|
||||
}),
|
||||
},
|
||||
"without init msg": {
|
||||
|
@ -213,7 +213,7 @@ func TestValidateInstantiateContractProposal(t *testing.T) {
|
|||
},
|
||||
"run_as missing": {
|
||||
src: InstantiateContractProposalFixture(func(p *InstantiateContractProposal) {
|
||||
p.RunAs = nil
|
||||
p.RunAs = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -268,7 +268,7 @@ func TestValidateInstantiateContractProposal(t *testing.T) {
|
|||
|
||||
func TestValidateMigrateContractProposal(t *testing.T) {
|
||||
var (
|
||||
invalidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen-1)
|
||||
invalidAddress = "invalid address2"
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -291,7 +291,7 @@ func TestValidateMigrateContractProposal(t *testing.T) {
|
|||
},
|
||||
"contract missing": {
|
||||
src: MigrateContractProposalFixture(func(p *MigrateContractProposal) {
|
||||
p.Contract = nil
|
||||
p.Contract = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -309,7 +309,7 @@ func TestValidateMigrateContractProposal(t *testing.T) {
|
|||
},
|
||||
"run_as missing": {
|
||||
src: MigrateContractProposalFixture(func(p *MigrateContractProposal) {
|
||||
p.RunAs = nil
|
||||
p.RunAs = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -334,7 +334,7 @@ func TestValidateMigrateContractProposal(t *testing.T) {
|
|||
|
||||
func TestValidateUpdateAdminProposal(t *testing.T) {
|
||||
var (
|
||||
invalidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen-1)
|
||||
invalidAddress = "invalid address"
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -352,7 +352,7 @@ func TestValidateUpdateAdminProposal(t *testing.T) {
|
|||
},
|
||||
"contract missing": {
|
||||
src: UpdateAdminProposalFixture(func(p *UpdateAdminProposal) {
|
||||
p.Contract = nil
|
||||
p.Contract = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -364,7 +364,7 @@ func TestValidateUpdateAdminProposal(t *testing.T) {
|
|||
},
|
||||
"admin missing": {
|
||||
src: UpdateAdminProposalFixture(func(p *UpdateAdminProposal) {
|
||||
p.NewAdmin = nil
|
||||
p.NewAdmin = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -389,7 +389,7 @@ func TestValidateUpdateAdminProposal(t *testing.T) {
|
|||
|
||||
func TestValidateClearAdminProposal(t *testing.T) {
|
||||
var (
|
||||
invalidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen-1)
|
||||
invalidAddress = "invalid address"
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
|
@ -407,7 +407,7 @@ func TestValidateClearAdminProposal(t *testing.T) {
|
|||
},
|
||||
"contract missing": {
|
||||
src: ClearAdminProposalFixture(func(p *ClearAdminProposal) {
|
||||
p.Contract = nil
|
||||
p.Contract = ""
|
||||
}),
|
||||
expErr: true,
|
||||
},
|
||||
|
@ -477,7 +477,7 @@ func TestProposalStrings(t *testing.T) {
|
|||
`,
|
||||
},
|
||||
"instantiate contract without admin": {
|
||||
src: InstantiateContractProposalFixture(func(p *InstantiateContractProposal) { p.Admin = nil }),
|
||||
src: InstantiateContractProposalFixture(func(p *InstantiateContractProposal) { p.Admin = "" }),
|
||||
exp: `Instantiate Code Proposal:
|
||||
Title: Foo
|
||||
Description: Bar
|
||||
|
@ -574,7 +574,7 @@ init_funds: []
|
|||
`,
|
||||
},
|
||||
"instantiate contract without admin": {
|
||||
src: InstantiateContractProposalFixture(func(p *InstantiateContractProposal) { p.Admin = nil }),
|
||||
src: InstantiateContractProposalFixture(func(p *InstantiateContractProposal) { p.Admin = "" }),
|
||||
exp: `title: Foo
|
||||
description: Bar
|
||||
run_as: cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
context "context"
|
||||
encoding_json "encoding/json"
|
||||
fmt "fmt"
|
||||
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
grpc1 "github.com/gogo/protobuf/grpc"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
@ -37,7 +36,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|||
// QueryContractInfoRequest is the request type for the Query/ContractInfo RPC method
|
||||
type QueryContractInfoRequest struct {
|
||||
// address is the address of the contract to query
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryContractInfoRequest) Reset() { *m = QueryContractInfoRequest{} }
|
||||
|
@ -76,7 +75,7 @@ var xxx_messageInfo_QueryContractInfoRequest proto.InternalMessageInfo
|
|||
// QueryContractInfoResponse is the response type for the Query/ContractInfo RPC method
|
||||
type QueryContractInfoResponse struct {
|
||||
// address is the address of the contract
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
*ContractInfo `protobuf:"bytes,2,opt,name=contract_info,json=contractInfo,proto3,embedded=contract_info" json:""`
|
||||
}
|
||||
|
||||
|
@ -116,7 +115,7 @@ var xxx_messageInfo_QueryContractInfoResponse proto.InternalMessageInfo
|
|||
// QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method
|
||||
type QueryContractHistoryRequest struct {
|
||||
// address is the address of the contract to query
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryRequest) Reset() { *m = QueryContractHistoryRequest{} }
|
||||
|
@ -230,7 +229,7 @@ var xxx_messageInfo_QueryContractsByCodeRequest proto.InternalMessageInfo
|
|||
|
||||
// ContractInfoWithAddress adds the address (key) to the ContractInfo representation
|
||||
type ContractInfoWithAddress struct {
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
*ContractInfo `protobuf:"bytes,2,opt,name=contract_info,json=contractInfo,proto3,embedded=contract_info" json:""`
|
||||
}
|
||||
|
||||
|
@ -308,7 +307,7 @@ var xxx_messageInfo_QueryContractsByCodeResponse proto.InternalMessageInfo
|
|||
// QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method
|
||||
type QueryAllContractStateRequest struct {
|
||||
// address is the address of the contract
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryAllContractStateRequest) Reset() { *m = QueryAllContractStateRequest{} }
|
||||
|
@ -385,8 +384,8 @@ var xxx_messageInfo_QueryAllContractStateResponse proto.InternalMessageInfo
|
|||
// QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method
|
||||
type QueryRawContractStateRequest struct {
|
||||
// address is the address of the contract
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
QueryData []byte `protobuf:"bytes,2,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
QueryData []byte `protobuf:"bytes,2,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryRawContractStateRequest) Reset() { *m = QueryRawContractStateRequest{} }
|
||||
|
@ -464,7 +463,7 @@ var xxx_messageInfo_QueryRawContractStateResponse proto.InternalMessageInfo
|
|||
// QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method
|
||||
type QuerySmartContractStateRequest struct {
|
||||
// address is the address of the contract
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// QueryData contains the query data passed to the contract
|
||||
QueryData []byte `protobuf:"bytes,2,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"`
|
||||
}
|
||||
|
@ -582,7 +581,7 @@ var xxx_messageInfo_QueryCodeRequest proto.InternalMessageInfo
|
|||
// CodeInfoResponse contains code meta data from CodeInfo
|
||||
type CodeInfoResponse struct {
|
||||
CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"id"`
|
||||
Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"`
|
||||
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
DataHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"data_hash,omitempty"`
|
||||
Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"`
|
||||
Builder string `protobuf:"bytes,5,opt,name=builder,proto3" json:"builder,omitempty"`
|
||||
|
@ -721,75 +720,72 @@ func init() {
|
|||
func init() { proto.RegisterFile("x/wasm/internal/types/query.proto", fileDescriptor_845473e9a3330642) }
|
||||
|
||||
var fileDescriptor_845473e9a3330642 = []byte{
|
||||
// 1074 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xcf, 0xa4, 0x8e, 0x13, 0x4f, 0x53, 0x30, 0xa3, 0xd2, 0x1a, 0xd7, 0x5d, 0x87, 0x05, 0x51,
|
||||
0x17, 0xd4, 0xdd, 0x24, 0x6e, 0x2b, 0xfe, 0x9c, 0xe2, 0xb4, 0x52, 0x2a, 0x28, 0x88, 0x8d, 0x50,
|
||||
0x25, 0x7a, 0x88, 0xc6, 0xbb, 0x13, 0x7b, 0x5b, 0x7b, 0xc7, 0xdd, 0x19, 0x93, 0x58, 0x51, 0x84,
|
||||
0xe0, 0x88, 0x38, 0x20, 0xf5, 0x82, 0xc4, 0x17, 0x40, 0x08, 0xee, 0x08, 0x71, 0xe0, 0x98, 0x63,
|
||||
0x24, 0x2e, 0x9c, 0x2c, 0x70, 0x38, 0xe5, 0x23, 0xe4, 0x84, 0x76, 0xf6, 0xad, 0xbb, 0x76, 0xb2,
|
||||
0xb6, 0x83, 0x88, 0xe8, 0x25, 0xbb, 0x93, 0x7d, 0xef, 0xfd, 0xfe, 0xec, 0xcc, 0x7b, 0x5e, 0xfc,
|
||||
0xea, 0xb6, 0xb9, 0x45, 0x45, 0xd3, 0x74, 0x3d, 0xc9, 0x7c, 0x8f, 0x36, 0x4c, 0xd9, 0x69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, 0x46, 0x9c, 0x50,
|
||||
0x65, 0x6e, 0xbf, 0x5b, 0x44, 0x87, 0xdd, 0xe2, 0x94, 0x35, 0x6f, 0xc7, 0xfe, 0xaf, 0x3f, 0xc2,
|
||||
0x57, 0x06, 0xd8, 0xaf, 0xb9, 0x42, 0x72, 0xbf, 0x73, 0x26, 0x56, 0x71, 0x5c, 0x38, 0x19, 0x0b,
|
||||
0xcc, 0xfa, 0x08, 0xcf, 0x32, 0x4f, 0xfa, 0x2e, 0x0b, 0xc0, 0xce, 0x95, 0xce, 0x2f, 0x9b, 0x63,
|
||||
0x94, 0xad, 0x72, 0x87, 0x41, 0x91, 0xbb, 0x9e, 0xf4, 0x3b, 0x95, 0xd4, 0x5e, 0xa0, 0x30, 0xaa,
|
||||
0xa2, 0xdf, 0x1e, 0x12, 0x27, 0x2a, 0x9d, 0x20, 0x25, 0x12, 0x77, 0x19, 0xcf, 0xda, 0xdc, 0x61,
|
||||
0x1b, 0xae, 0xa3, 0xc4, 0xa5, 0xac, 0x74, 0xb0, 0xbc, 0xe7, 0xe8, 0xbf, 0x20, 0x7c, 0x39, 0xee,
|
||||
0xde, 0x03, 0x57, 0xd6, 0x41, 0xcd, 0xf3, 0xff, 0x46, 0x77, 0x86, 0x5c, 0xee, 0x8b, 0x06, 0x97,
|
||||
0x1f, 0xe2, 0x17, 0x06, 0x30, 0x23, 0xb3, 0x8d, 0x09, 0x40, 0x63, 0x46, 0x80, 0xd7, 0x17, 0xe2,
|
||||
0xd8, 0x42, 0x7f, 0x0c, 0xe0, 0x2b, 0x8d, 0x46, 0x94, 0xb7, 0x2e, 0xa9, 0x64, 0x67, 0xb2, 0x9f,
|
||||
0x1e, 0xe2, 0xab, 0x09, 0x60, 0x20, 0xf5, 0x5d, 0x9c, 0x6e, 0x72, 0x87, 0x35, 0x22, 0x89, 0x85,
|
||||
0x04, 0x89, 0xf7, 0x83, 0x20, 0x10, 0x04, 0x19, 0xfa, 0x57, 0x08, 0xa4, 0x58, 0x74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, 0x5e, 0x21, 0x5e, 0x24, 0xe4, 0x38, 0x62, 0xc5, 0xda,
|
||||
0xfb, 0x4b, 0x9b, 0xfa, 0xbe, 0xa7, 0xa1, 0xbd, 0x9e, 0x86, 0xf6, 0x7b, 0x1a, 0xfa, 0xb3, 0xa7,
|
||||
0xa1, 0x6f, 0x0e, 0xb4, 0xa9, 0xfd, 0x03, 0x6d, 0xea, 0x8f, 0x03, 0x6d, 0xea, 0xd3, 0xc5, 0xd8,
|
||||
0x58, 0x5a, 0xe5, 0xa2, 0xf9, 0x20, 0xa8, 0xa1, 0x30, 0xcd, 0x6d, 0xb8, 0x0e, 0x7e, 0xc7, 0x55,
|
||||
0xd3, 0x8a, 0x6a, 0xf9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x5e, 0x6a, 0x4f, 0x37, 0x0e,
|
||||
0x00, 0x00,
|
||||
// 1033 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0x41, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0xc4, 0xaf, 0x29, 0x98, 0x51, 0x69, 0x8d, 0xeb, 0xae, 0xc3, 0x82,
|
||||
0xa8, 0x0b, 0xd2, 0x6e, 0x12, 0xa7, 0xa5, 0xc0, 0xa9, 0x4e, 0x2b, 0xa5, 0x12, 0x05, 0xb1, 0x11,
|
||||
0x8a, 0xa0, 0x87, 0x68, 0xec, 0x9d, 0xd8, 0x8b, 0xec, 0x1d, 0x77, 0x67, 0x4c, 0x62, 0x45, 0x11,
|
||||
0x82, 0x0b, 0xe2, 0x86, 0xc4, 0x05, 0x89, 0x2f, 0x80, 0x10, 0xdc, 0x39, 0x72, 0xcc, 0x31, 0x12,
|
||||
0x17, 0x4e, 0x56, 0x71, 0x38, 0xe5, 0x23, 0xf4, 0x84, 0x66, 0x3c, 0xeb, 0xae, 0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x95, 0x0f, 0xce, 0xa2, 0x74, 0xb5, 0x49, 0x78,
|
||||
0x13, 0x5f, 0x83, 0x0c, 0x67, 0xdd, 0xa0, 0x4e, 0xf3, 0x69, 0x15, 0x4f, 0xaf, 0x24, 0x48, 0xad,
|
||||
0xeb, 0xb5, 0x5c, 0x1a, 0xe4, 0xe7, 0x87, 0x20, 0x7a, 0x69, 0x7e, 0x8d, 0xe0, 0x95, 0x48, 0x41,
|
||||
0x74, 0x8e, 0x1f, 0x41, 0x76, 0x98, 0xa3, 0xec, 0x63, 0xa4, 0xfa, 0xf8, 0x56, 0x6c, 0x4b, 0x8d,
|
||||
0xd7, 0x27, 0xd2, 0xcb, 0x8b, 0x75, 0xfd, 0x1b, 0x2e, 0xea, 0x7d, 0x52, 0x7b, 0x5c, 0x5d, 0x3c,
|
||||
0xed, 0x97, 0xd4, 0x5a, 0xef, 0x49, 0x0d, 0xf0, 0x08, 0x81, 0x8f, 0x18, 0x3e, 0x04, 0x18, 0x31,
|
||||
0x84, 0x7d, 0x32, 0x33, 0xc4, 0xb0, 0x65, 0xb2, 0x21, 0x00, 0x5f, 0xfb, 0x11, 0x60, 0x5e, 0x05,
|
||||
0xc1, 0x3f, 0x21, 0x58, 0x8a, 0xce, 0x01, 0x1c, 0x37, 0x66, 0xe3, 0xee, 0xa9, 0xc2, 0xca, 0xec,
|
||||
0x82, 0x21, 0x8e, 0x59, 0xfe, 0xe6, 0xcf, 0x7f, 0x7e, 0x98, 0x33, 0xf1, 0xf2, 0xf0, 0x6a, 0xd5,
|
||||
0x02, 0x3b, 0x9c, 0x37, 0xf6, 0x81, 0x6e, 0x89, 0x43, 0xfc, 0x2b, 0x82, 0x97, 0x27, 0x2e, 0x08,
|
||||
0xbc, 0x36, 0x4b, 0xbc, 0xf1, 0x6b, 0xa8, 0x50, 0xb9, 0x90, 0x46, 0x63, 0xae, 0x28, 0xcc, 0xb7,
|
||||
0x71, 0x39, 0x09, 0xd3, 0x6e, 0x6a, 0xb4, 0x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 0xb1, 0xea, 0x1c, 0xfd, 0x6d, 0xa4, 0x7e, 0x1e, 0x18, 0xe8, 0x68,
|
||||
0x60, 0xa0, 0xe3, 0x81, 0x81, 0x9e, 0x0d, 0x0c, 0xf4, 0xfd, 0x89, 0x91, 0x3a, 0x3e, 0x31, 0x52,
|
||||
0x7f, 0x9d, 0x18, 0xa9, 0xcf, 0x57, 0x22, 0xd7, 0xd2, 0x06, 0xe3, 0xed, 0x6d, 0xe9, 0x43, 0xc5,
|
||||
0xb4, 0xf7, 0xf5, 0xe7, 0xf8, 0x7f, 0x0b, 0xb5, 0x8c, 0x42, 0xad, 0xfc, 0x1b, 0x00, 0x00, 0xff,
|
||||
0xff, 0x00, 0xb3, 0x57, 0x00, 0x9d, 0x0c, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *QueryContractInfoRequest) Equal(that interface{}) bool {
|
||||
|
@ -811,7 +807,7 @@ func (this *QueryContractInfoRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -835,7 +831,7 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
if !this.ContractInfo.Equal(that1.ContractInfo) {
|
||||
|
@ -862,7 +858,7 @@ func (this *QueryContractHistoryRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -939,7 +935,7 @@ func (this *ContractInfoWithAddress) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
if !this.ContractInfo.Equal(that1.ContractInfo) {
|
||||
|
@ -995,7 +991,7 @@ func (this *QueryAllContractStateRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -1048,7 +1044,7 @@ func (this *QueryRawContractStateRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.QueryData, that1.QueryData) {
|
||||
|
@ -1099,7 +1095,7 @@ func (this *QuerySmartContractStateRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.QueryData, that1.QueryData) {
|
||||
|
@ -1177,7 +1173,7 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool {
|
|||
if this.CodeID != that1.CodeID {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Creator, that1.Creator) {
|
||||
if this.Creator != that1.Creator {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.DataHash, that1.DataHash) {
|
||||
|
@ -2518,7 +2514,7 @@ func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2528,25 +2524,23 @@ func (m *QueryContractInfoRequest) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -2605,7 +2599,7 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2615,25 +2609,23 @@ func (m *QueryContractInfoResponse) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
|
@ -2728,7 +2720,7 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2738,25 +2730,23 @@ func (m *QueryContractHistoryRequest) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -2974,7 +2964,7 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2984,25 +2974,23 @@ func (m *ContractInfoWithAddress) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
|
@ -3184,7 +3172,7 @@ func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -3194,25 +3182,23 @@ func (m *QueryAllContractStateRequest) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -3358,7 +3344,7 @@ func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -3368,25 +3354,23 @@ func (m *QueryRawContractStateRequest) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
|
@ -3566,7 +3550,7 @@ func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -3576,25 +3560,23 @@ func (m *QuerySmartContractStateRequest) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
|
@ -3865,7 +3847,7 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -3875,25 +3857,23 @@ func (m *CodeInfoResponse) 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 ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Creator = append(m.Creator[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Creator == nil {
|
||||
m.Creator = []byte{}
|
||||
}
|
||||
m.Creator = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
|
|
|
@ -50,7 +50,7 @@ func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshal
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -77,7 +77,7 @@ func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.M
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -104,7 +104,7 @@ func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Mars
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -131,7 +131,7 @@ func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtim
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -212,7 +212,7 @@ func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Mar
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -239,7 +239,7 @@ func local_request_Query_AllContractState_0(ctx context.Context, marshaler runti
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -266,7 +266,7 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -304,7 +304,7 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -342,7 +342,7 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
@ -380,7 +380,7 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.Bytes(val)
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
|
|
|
@ -49,19 +49,19 @@ service Query {
|
|||
// QueryContractInfoRequest is the request type for the Query/ContractInfo RPC method
|
||||
message QueryContractInfoRequest {
|
||||
// address is the address of the contract to query
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
}
|
||||
// QueryContractInfoResponse is the response type for the Query/ContractInfo RPC method
|
||||
message QueryContractInfoResponse {
|
||||
// address is the address of the contract
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
ContractInfo contract_info = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""];
|
||||
}
|
||||
|
||||
// QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method
|
||||
message QueryContractHistoryRequest {
|
||||
// address is the address of the contract to query
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
// QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method
|
||||
|
@ -75,7 +75,7 @@ message QueryContractsByCodeRequest {
|
|||
|
||||
// ContractInfoWithAddress adds the address (key) to the ContractInfo representation
|
||||
message ContractInfoWithAddress {
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
ContractInfo contract_info = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""];
|
||||
}
|
||||
// QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method
|
||||
|
@ -86,7 +86,7 @@ message QueryContractsByCodeResponse {
|
|||
// QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method
|
||||
message QueryAllContractStateRequest {
|
||||
// address is the address of the contract
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
// QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method
|
||||
|
@ -97,7 +97,7 @@ message QueryAllContractStateResponse {
|
|||
// QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method
|
||||
message QueryRawContractStateRequest {
|
||||
// address is the address of the contract
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
bytes query_data = 2;
|
||||
}
|
||||
// QueryRawContractStateResponse is the response type for the Query/RawContractState RPC method
|
||||
|
@ -109,7 +109,7 @@ message QueryRawContractStateResponse {
|
|||
// QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method
|
||||
message QuerySmartContractStateRequest {
|
||||
// address is the address of the contract
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string address = 1;
|
||||
// QueryData contains the query data passed to the contract
|
||||
bytes query_data = 2;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ message QueryCodeRequest {
|
|||
// CodeInfoResponse contains code meta data from CodeInfo
|
||||
message CodeInfoResponse {
|
||||
uint64 code_id = 1 [(gogoproto.customname) = "CodeID", (gogoproto.jsontag) = "id"]; // id for legacy support
|
||||
bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string creator = 2;
|
||||
bytes data_hash = 3 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"];
|
||||
string source = 4;
|
||||
string builder = 5;
|
||||
|
|
|
@ -64,7 +64,7 @@ func CodeFixture(mutators ...func(*Code)) Code {
|
|||
func CodeInfoFixture(mutators ...func(*CodeInfo)) CodeInfo {
|
||||
wasmCode := bytes.Repeat([]byte{0x1}, 10)
|
||||
codeHash := sha256.Sum256(wasmCode)
|
||||
anyAddress := make([]byte, 20)
|
||||
const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
fixture := CodeInfo{
|
||||
CodeHash: codeHash[:],
|
||||
Creator: anyAddress,
|
||||
|
@ -79,7 +79,8 @@ func CodeInfoFixture(mutators ...func(*CodeInfo)) CodeInfo {
|
|||
}
|
||||
|
||||
func ContractFixture(mutators ...func(*Contract)) Contract {
|
||||
anyAddress := make([]byte, 20)
|
||||
const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
|
||||
fixture := Contract{
|
||||
ContractAddress: anyAddress,
|
||||
ContractInfo: ContractInfoFixture(OnlyGenesisFields),
|
||||
|
@ -97,7 +98,8 @@ func OnlyGenesisFields(info *ContractInfo) {
|
|||
}
|
||||
|
||||
func ContractInfoFixture(mutators ...func(*ContractInfo)) ContractInfo {
|
||||
anyAddress := make([]byte, 20)
|
||||
const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
|
||||
fixture := ContractInfo{
|
||||
CodeID: 1,
|
||||
Creator: anyAddress,
|
||||
|
@ -119,11 +121,11 @@ func WithSHA256CodeHash(wasmCode []byte) func(info *CodeInfo) {
|
|||
}
|
||||
|
||||
func StoreCodeProposalFixture(mutators ...func(*StoreCodeProposal)) *StoreCodeProposal {
|
||||
var anyValidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen)
|
||||
const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
p := &StoreCodeProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
RunAs: anyValidAddress,
|
||||
RunAs: anyAddress,
|
||||
WASMByteCode: []byte{0x0},
|
||||
Source: "https://example.com/code",
|
||||
Builder: "foo/bar:latest",
|
||||
|
@ -146,6 +148,7 @@ func InstantiateContractProposalFixture(mutators ...func(p *InstantiateContractP
|
|||
Beneficiary: anyValidAddress,
|
||||
}
|
||||
)
|
||||
const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
if err != nil {
|
||||
|
@ -154,8 +157,8 @@ func InstantiateContractProposalFixture(mutators ...func(p *InstantiateContractP
|
|||
p := &InstantiateContractProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
RunAs: anyValidAddress,
|
||||
Admin: anyValidAddress,
|
||||
RunAs: anyAddress,
|
||||
Admin: anyAddress,
|
||||
CodeID: 1,
|
||||
Label: "testing",
|
||||
InitMsg: initMsgBz,
|
||||
|
@ -181,18 +184,17 @@ func MigrateContractProposalFixture(mutators ...func(p *MigrateContractProposal)
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
contractAddr, err := sdk.AccAddressFromBech32("cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
const (
|
||||
contractAddr = "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5"
|
||||
anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
)
|
||||
p := &MigrateContractProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
Contract: contractAddr,
|
||||
CodeID: 1,
|
||||
MigrateMsg: migMsgBz,
|
||||
RunAs: anyValidAddress,
|
||||
RunAs: anyAddress,
|
||||
}
|
||||
|
||||
for _, m := range mutators {
|
||||
|
@ -202,17 +204,15 @@ func MigrateContractProposalFixture(mutators ...func(p *MigrateContractProposal)
|
|||
}
|
||||
|
||||
func UpdateAdminProposalFixture(mutators ...func(p *UpdateAdminProposal)) *UpdateAdminProposal {
|
||||
var anyValidAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, sdk.AddrLen)
|
||||
|
||||
contractAddr, err := sdk.AccAddressFromBech32("cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
const (
|
||||
contractAddr = "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5"
|
||||
anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du"
|
||||
)
|
||||
|
||||
p := &UpdateAdminProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
NewAdmin: anyValidAddress,
|
||||
NewAdmin: anyAddress,
|
||||
Contract: contractAddr,
|
||||
}
|
||||
for _, m := range mutators {
|
||||
|
@ -222,11 +222,7 @@ func UpdateAdminProposalFixture(mutators ...func(p *UpdateAdminProposal)) *Updat
|
|||
}
|
||||
|
||||
func ClearAdminProposalFixture(mutators ...func(p *ClearAdminProposal)) *ClearAdminProposal {
|
||||
contractAddr, err := sdk.AccAddressFromBech32("cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
const contractAddr = "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5"
|
||||
p := &ClearAdminProposal{
|
||||
Title: "Foo",
|
||||
Description: "Bar",
|
||||
|
|
|
@ -23,7 +23,7 @@ func (c CodeInfo) ValidateBasic() error {
|
|||
if len(c.CodeHash) == 0 {
|
||||
return sdkerrors.Wrap(ErrEmpty, "code hash")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(c.Creator); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(c.Creator); err != nil {
|
||||
return sdkerrors.Wrap(err, "creator")
|
||||
}
|
||||
if err := validateSourceURL(c.Source); err != nil {
|
||||
|
@ -42,7 +42,7 @@ func (c CodeInfo) ValidateBasic() error {
|
|||
func NewCodeInfo(codeHash []byte, creator sdk.AccAddress, source string, builder string, instantiatePermission AccessConfig) CodeInfo {
|
||||
return CodeInfo{
|
||||
CodeHash: codeHash,
|
||||
Creator: creator,
|
||||
Creator: creator.String(),
|
||||
Source: source,
|
||||
Builder: builder,
|
||||
InstantiateConfig: instantiatePermission,
|
||||
|
@ -57,10 +57,14 @@ func (c *ContractHistory) AppendCodeHistory(newEntries ...ContractCodeHistoryEnt
|
|||
|
||||
// NewContractInfo creates a new instance of a given WASM contract info
|
||||
func NewContractInfo(codeID uint64, creator, admin sdk.AccAddress, label string, createdAt *AbsoluteTxPosition) ContractInfo {
|
||||
var adminAddr string
|
||||
if !admin.Empty() {
|
||||
adminAddr = admin.String()
|
||||
}
|
||||
return ContractInfo{
|
||||
CodeID: codeID,
|
||||
Creator: creator,
|
||||
Admin: admin,
|
||||
Creator: creator.String(),
|
||||
Admin: adminAddr,
|
||||
Label: label,
|
||||
Created: createdAt,
|
||||
}
|
||||
|
@ -70,11 +74,11 @@ func (c *ContractInfo) ValidateBasic() error {
|
|||
if c.CodeID == 0 {
|
||||
return sdkerrors.Wrap(ErrEmpty, "code id")
|
||||
}
|
||||
if err := sdk.VerifyAddressFormat(c.Creator); err != nil {
|
||||
if _, err := sdk.AccAddressFromBech32(c.Creator); err != nil {
|
||||
return sdkerrors.Wrap(err, "creator")
|
||||
}
|
||||
if c.Admin != nil {
|
||||
if err := sdk.VerifyAddressFormat(c.Admin); err != nil {
|
||||
if len(c.Admin) != 0 {
|
||||
if _, err := sdk.AccAddressFromBech32(c.Admin); err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +118,18 @@ func (c *ContractInfo) ResetFromGenesis(ctx sdk.Context) ContractCodeHistoryEntr
|
|||
}
|
||||
}
|
||||
|
||||
// AdminAddr convert into sdk.AccAddress or nil when not set
|
||||
func (c *ContractInfo) AdminAddr() sdk.AccAddress {
|
||||
if c.Admin == "" {
|
||||
return nil
|
||||
}
|
||||
admin, err := sdk.AccAddressFromBech32(c.Admin)
|
||||
if err != nil { // should never happen
|
||||
panic(err.Error())
|
||||
}
|
||||
return admin
|
||||
}
|
||||
|
||||
// LessThan can be used to sort
|
||||
func (a *AbsoluteTxPosition) LessThan(b *AbsoluteTxPosition) bool {
|
||||
if a == nil {
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
bytes "bytes"
|
||||
encoding_json "encoding/json"
|
||||
fmt "fmt"
|
||||
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
|
||||
|
@ -135,8 +134,8 @@ var xxx_messageInfo_AccessTypeParam proto.InternalMessageInfo
|
|||
|
||||
// AccessConfig access control type.
|
||||
type AccessConfig struct {
|
||||
Permission AccessType `protobuf:"varint,1,opt,name=permission,proto3,enum=wasmd.x.wasmd.v1beta1.AccessType" json:"permission,omitempty" yaml:"permission"`
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty" yaml:"address"`
|
||||
Permission AccessType `protobuf:"varint,1,opt,name=permission,proto3,enum=wasmd.x.wasmd.v1beta1.AccessType" json:"permission,omitempty" yaml:"permission"`
|
||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" yaml:"address"`
|
||||
}
|
||||
|
||||
func (m *AccessConfig) Reset() { *m = AccessConfig{} }
|
||||
|
@ -216,7 +215,7 @@ type CodeInfo struct {
|
|||
// CodeHash is the unique CodeID
|
||||
CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"`
|
||||
// Creator address who initially stored the code
|
||||
Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"`
|
||||
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
// Source is a valid absolute HTTPS URI to the contract's source code, optional
|
||||
Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`
|
||||
// Builder is a valid docker image name with tag, optional
|
||||
|
@ -260,12 +259,12 @@ var xxx_messageInfo_CodeInfo proto.InternalMessageInfo
|
|||
|
||||
// ContractInfo stores a WASM contract instance
|
||||
type ContractInfo struct {
|
||||
// CodeID is the reference to the stored WASM code
|
||||
// CodeID is the reference to the stored Wasm code
|
||||
CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
// Creator address who initially instantiated the contract
|
||||
Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"`
|
||||
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
// Admin is an optional address that can execute migrations
|
||||
Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"`
|
||||
Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"`
|
||||
// Label is optional metadata to be stored with a contract instance.
|
||||
Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"`
|
||||
// Created Tx position when the contract was instantiated.
|
||||
|
@ -486,80 +485,78 @@ func init() {
|
|||
func init() { proto.RegisterFile("x/wasm/internal/types/types.proto", fileDescriptor_45de2b3fc8aff6aa) }
|
||||
|
||||
var fileDescriptor_45de2b3fc8aff6aa = []byte{
|
||||
// 1165 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x8f, 0xdb, 0xc4,
|
||||
0x17, 0x8f, 0x93, 0xfd, 0xd5, 0x69, 0xd4, 0xa6, 0xf3, 0xdd, 0xfd, 0x36, 0x0d, 0x25, 0xc9, 0xba,
|
||||
0x20, 0xb6, 0xbf, 0x92, 0x76, 0x41, 0x14, 0xf5, 0x96, 0x38, 0x66, 0xd7, 0x85, 0x4d, 0x56, 0x93,
|
||||
0x2c, 0xed, 0x22, 0x55, 0xd6, 0xc4, 0x9e, 0x4d, 0x86, 0xda, 0x9e, 0xc8, 0x33, 0x69, 0x93, 0x9e,
|
||||
0x38, 0xa2, 0x70, 0x41, 0x9c, 0xb8, 0x44, 0x42, 0xa2, 0x42, 0xfd, 0x53, 0x7a, 0x41, 0xea, 0x91,
|
||||
0x53, 0x04, 0x5b, 0x71, 0xe0, 0xba, 0xc7, 0x9e, 0x90, 0xc7, 0x8e, 0x62, 0x68, 0xb7, 0x1b, 0x2a,
|
||||
0x2e, 0xb6, 0xe7, 0xcd, 0xfb, 0x7c, 0xde, 0xbc, 0xcf, 0x7b, 0xcf, 0x36, 0x58, 0x1f, 0x94, 0x1f,
|
||||
0x61, 0xee, 0x96, 0xa9, 0x27, 0x88, 0xef, 0x61, 0xa7, 0x2c, 0x86, 0x3d, 0xc2, 0xc3, 0x6b, 0xa9,
|
||||
0xe7, 0x33, 0xc1, 0xe0, 0x5a, 0xe0, 0x60, 0x97, 0x06, 0xa5, 0xf0, 0xfe, 0xf0, 0x66, 0x9b, 0x08,
|
||||
0x7c, 0x33, 0xb7, 0xda, 0x61, 0x1d, 0x26, 0x3d, 0xca, 0xc1, 0x53, 0xe8, 0xac, 0xb6, 0xc1, 0xd9,
|
||||
0x8a, 0x65, 0x11, 0xce, 0x5b, 0xc3, 0x1e, 0xd9, 0xc5, 0x3e, 0x76, 0xa1, 0x01, 0x16, 0x1f, 0x62,
|
||||
0xa7, 0x4f, 0xb2, 0x4a, 0x51, 0xd9, 0x38, 0xb3, 0xb9, 0x5e, 0x7a, 0x2d, 0x5f, 0x69, 0x06, 0xab,
|
||||
0x66, 0x8e, 0x26, 0x85, 0xf4, 0x10, 0xbb, 0xce, 0x6d, 0x55, 0x22, 0x55, 0x14, 0x32, 0xdc, 0x5e,
|
||||
0xf8, 0xe1, 0xc7, 0x82, 0xa2, 0xfe, 0xa2, 0x80, 0x74, 0xe8, 0xad, 0x31, 0xef, 0x80, 0x76, 0xe0,
|
||||
0x3d, 0x00, 0x7a, 0xc4, 0x77, 0x29, 0xe7, 0x94, 0x79, 0xf3, 0x87, 0x59, 0x3b, 0x9a, 0x14, 0xce,
|
||||
0x85, 0x61, 0x66, 0x70, 0x15, 0xc5, 0xb8, 0xe0, 0x7d, 0xb0, 0x8c, 0x6d, 0xdb, 0x27, 0x9c, 0x67,
|
||||
0x93, 0x45, 0x65, 0x23, 0x5d, 0xd5, 0x8e, 0x26, 0x85, 0x33, 0x21, 0x26, 0xda, 0x50, 0x5f, 0x4e,
|
||||
0x0a, 0xd7, 0x3b, 0x54, 0x74, 0xfb, 0xed, 0x92, 0xc5, 0xdc, 0xb2, 0xc5, 0xb8, 0xcb, 0x78, 0x74,
|
||||
0xbb, 0xce, 0xed, 0x07, 0x91, 0x98, 0x15, 0xcb, 0xaa, 0x84, 0x08, 0x34, 0xe5, 0x8c, 0xf2, 0xf9,
|
||||
0x23, 0x09, 0x96, 0xa4, 0x54, 0x1c, 0x0a, 0x00, 0x2d, 0x66, 0x13, 0xb3, 0xdf, 0x73, 0x18, 0xb6,
|
||||
0x4d, 0x2c, 0x0f, 0x2b, 0x33, 0x3a, 0xbd, 0x79, 0xe9, 0x8d, 0x19, 0x85, 0x52, 0x54, 0xd7, 0x9f,
|
||||
0x4d, 0x0a, 0x89, 0xa3, 0x49, 0xe1, 0x42, 0x78, 0xc6, 0x57, 0xc9, 0x54, 0x94, 0x09, 0x8c, 0x7b,
|
||||
0xd2, 0x16, 0x42, 0xe1, 0xf7, 0x0a, 0xc8, 0x53, 0x8f, 0x0b, 0xec, 0x09, 0x8a, 0x05, 0x31, 0x6d,
|
||||
0x72, 0x80, 0xfb, 0x8e, 0x30, 0x63, 0xa2, 0x26, 0xe7, 0x15, 0xf5, 0xf2, 0xd1, 0xa4, 0xf0, 0x7e,
|
||||
0x18, 0xfc, 0xcd, 0x94, 0x2a, 0xba, 0x18, 0x73, 0xa8, 0x85, 0xfb, 0xbb, 0x33, 0xe9, 0xef, 0x00,
|
||||
0xe8, 0xe2, 0x81, 0x19, 0x04, 0x32, 0x65, 0x1a, 0x9c, 0x3e, 0x26, 0xd9, 0x54, 0x51, 0xd9, 0x58,
|
||||
0xa8, 0xbe, 0x3b, 0xcb, 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e5, 0xbb, 0x17, 0xf9, 0xc4, 0xf3, 0x17, 0xf9,
|
||||
0xc4, 0xaf, 0x2f, 0xf2, 0x89, 0x2f, 0x6f, 0xc4, 0xe6, 0x40, 0x63, 0xdc, 0x0d, 0x3e, 0xa6, 0xf2,
|
||||
0x3f, 0xd1, 0x2e, 0x0f, 0xa2, 0xfb, 0xdf, 0x7f, 0x18, 0xdb, 0x4b, 0xf2, 0xf7, 0xef, 0xc3, 0xbf,
|
||||
0x02, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x52, 0xdd, 0xfe, 0x50, 0x0a, 0x00, 0x00,
|
||||
// 1128 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf6, 0xda, 0xf9, 0x39, 0xb5, 0x5a, 0x77, 0x48, 0xa8, 0x6b, 0x8a, 0xed, 0x6c, 0x41, 0xa4,
|
||||
0x3f, 0x64, 0xb7, 0x01, 0x51, 0xd4, 0x9b, 0xbd, 0x5e, 0x9a, 0xad, 0x88, 0x6d, 0x8d, 0x1d, 0xda,
|
||||
0x20, 0xa1, 0xd5, 0xd8, 0x3b, 0xb1, 0x87, 0xae, 0x77, 0xac, 0x9d, 0x71, 0x6b, 0xf7, 0x2f, 0x40,
|
||||
0xe6, 0x82, 0x38, 0x71, 0xc0, 0x12, 0x12, 0x08, 0xf5, 0xaf, 0xe0, 0xdc, 0x0b, 0x52, 0x8f, 0x9c,
|
||||
0x2c, 0x48, 0xc5, 0x81, 0x6b, 0x8e, 0x3d, 0xa1, 0x9d, 0x59, 0xcb, 0x0b, 0x6d, 0x12, 0x73, 0xb1,
|
||||
0xf7, 0xbd, 0x79, 0xdf, 0xf7, 0xe6, 0x7b, 0x6f, 0xdf, 0xec, 0x80, 0xad, 0x61, 0xf1, 0x09, 0xe6,
|
||||
0xbd, 0x22, 0xf5, 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0xad, 0x01, 0x75,
|
||||
0x1d, 0xe2, 0xa7, 0x97, 0x14, 0x22, 0x34, 0xe1, 0x43, 0x00, 0xa3, 0x85, 0x68, 0xcb, 0x3e, 0xa5,
|
||||
0x97, 0x17, 0x6f, 0xe9, 0x52, 0xd0, 0x52, 0x74, 0x31, 0x42, 0xa2, 0x16, 0xf4, 0x5f, 0x35, 0x90,
|
||||
0x34, 0x98, 0x27, 0x7c, 0xdc, 0x16, 0x52, 0xd3, 0x55, 0xb0, 0x2a, 0x35, 0x51, 0x47, 0x2a, 0x5a,
|
||||
0x2a, 0x83, 0xa3, 0x69, 0x6e, 0x45, 0x4a, 0xae, 0xa0, 0x95, 0x60, 0xc9, 0x72, 0x4e, 0xd1, 0xb6,
|
||||
0x01, 0x96, 0xb1, 0xd3, 0xa3, 0x5e, 0x28, 0x4d, 0x19, 0x81, 0xd7, 0xc5, 0x2d, 0xe2, 0x86, 0xba,
|
||||
0x94, 0x01, 0x8d, 0x90, 0x85, 0x38, 0xa1, 0x94, 0x6b, 0x27, 0x49, 0x69, 0x71, 0xe6, 0x0e, 0x04,
|
||||
0x69, 0x0e, 0xeb, 0x8c, 0x53, 0x41, 0x99, 0x87, 0x66, 0x48, 0xfd, 0x29, 0xb8, 0x30, 0xdb, 0xff,
|
||||
0x2e, 0xe5, 0x82, 0xf9, 0x23, 0xd8, 0x01, 0x1b, 0xaa, 0x2d, 0xca, 0xb6, 0x89, 0x27, 0x7c, 0x4a,
|
||||
0x82, 0x11, 0x48, 0x6c, 0x9f, 0xdb, 0x29, 0x9e, 0x90, 0x64, 0xc6, 0x12, 0x48, 0x0d, 0x99, 0x4c,
|
||||
0x4f, 0xf8, 0xa3, 0xb0, 0x76, 0x72, 0xa6, 0x22, 0x7e, 0x4a, 0xb8, 0xfe, 0x4d, 0x1c, 0xa4, 0x4f,
|
||||
0x82, 0xc1, 0x7d, 0xb0, 0xce, 0xfa, 0xc4, 0xc7, 0x62, 0x7e, 0x3c, 0xdc, 0x59, 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, 0x08, 0x7e, 0x0c, 0x2e, 0x95,
|
||||
0x0c, 0xc3, 0x6c, 0x34, 0xec, 0xe6, 0x41, 0xdd, 0xb4, 0xf7, 0xab, 0x8d, 0xba, 0x69, 0x58, 0x9f,
|
||||
0x5a, 0x66, 0x25, 0x15, 0xcb, 0x5c, 0x1e, 0x4f, 0xf2, 0x9b, 0xf3, 0xe0, 0x7d, 0x8f, 0xf7, 0x49,
|
||||
0x9b, 0x1e, 0x52, 0xe2, 0xc0, 0x9b, 0x00, 0x46, 0x71, 0xd5, 0x5a, 0xb9, 0x56, 0x39, 0x48, 0x69,
|
||||
0x99, 0x8d, 0xf1, 0x24, 0x9f, 0x9a, 0x43, 0xaa, 0xac, 0xc5, 0x9c, 0x11, 0xbc, 0x03, 0xd2, 0xd1,
|
||||
0xe8, 0x5a, 0xf5, 0xb3, 0x03, 0xbb, 0x54, 0xa9, 0x20, 0xb3, 0xd1, 0x48, 0xc5, 0xff, 0x9b, 0xa6,
|
||||
0xe6, 0xb9, 0xa3, 0x92, 0x3a, 0xf5, 0xe1, 0x0e, 0xd8, 0x8c, 0x02, 0xcd, 0xcf, 0x4d, 0x74, 0x20,
|
||||
0x33, 0x25, 0x32, 0x97, 0xc6, 0x93, 0xfc, 0x5b, 0x73, 0x94, 0xf9, 0x98, 0xf8, 0xa3, 0x20, 0x59,
|
||||
0x66, 0xed, 0xeb, 0x9f, 0xb2, 0xb1, 0x67, 0x3f, 0x67, 0x63, 0xd7, 0x7f, 0x49, 0x80, 0xfc, 0x59,
|
||||
0x2f, 0x1d, 0x24, 0xe0, 0x96, 0x51, 0xab, 0x36, 0x51, 0xc9, 0x68, 0xda, 0x46, 0xad, 0x62, 0xda,
|
||||
0xbb, 0x56, 0xa3, 0x59, 0x43, 0x07, 0x76, 0xad, 0x6e, 0xa2, 0x52, 0xd3, 0xaa, 0x55, 0xdf, 0x54,
|
||||
0x9a, 0xe2, 0x78, 0x92, 0xbf, 0x71, 0x16, 0x77, 0xb4, 0x60, 0x0f, 0xc0, 0xb5, 0x85, 0xd2, 0x58,
|
||||
0x55, 0xab, 0x99, 0xd2, 0x32, 0xdb, 0xe3, 0x49, 0xfe, 0xbd, 0xb3, 0xf8, 0x2d, 0x8f, 0x0a, 0xf8,
|
||||
0x25, 0xb8, 0xb9, 0x10, 0xf1, 0x9e, 0x75, 0x0f, 0x95, 0x9a, 0x66, 0x2a, 0x9e, 0xb9, 0x31, 0x9e,
|
||||
0xe4, 0x3f, 0x38, 0x8b, 0x7b, 0x8f, 0x76, 0x7c, 0x2c, 0xc8, 0xc2, 0xf4, 0xf7, 0xcc, 0xaa, 0xd9,
|
||||
0xb0, 0x1a, 0xa9, 0xc4, 0x62, 0xf4, 0xf7, 0x88, 0x47, 0x38, 0xe5, 0x99, 0xa5, 0xa0, 0x59, 0x65,
|
||||
0xf4, 0xfc, 0xcf, 0x6c, 0xec, 0xd9, 0x51, 0x56, 0x7b, 0x7e, 0x94, 0xd5, 0x5e, 0x1c, 0x65, 0xb5,
|
||||
0x3f, 0x8e, 0xb2, 0xda, 0xb7, 0x2f, 0xb3, 0xb1, 0x17, 0x2f, 0xb3, 0xb1, 0xdf, 0x5f, 0x66, 0x63,
|
||||
0x5f, 0xdc, 0x8a, 0xcc, 0x81, 0xc1, 0x78, 0x2f, 0xf8, 0x66, 0xc9, 0xdb, 0x95, 0x53, 0x1c, 0x86,
|
||||
0xff, 0xff, 0xbe, 0x66, 0xb5, 0x56, 0xe4, 0xa5, 0xe9, 0xc3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff,
|
||||
0xf1, 0xf3, 0xe3, 0x09, 0x86, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *AccessTypeParam) Equal(that interface{}) bool {
|
||||
|
@ -608,7 +605,7 @@ func (this *AccessConfig) Equal(that interface{}) bool {
|
|||
if this.Permission != that1.Permission {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
if this.Address != that1.Address {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -665,7 +662,7 @@ func (this *CodeInfo) Equal(that interface{}) bool {
|
|||
if !bytes.Equal(this.CodeHash, that1.CodeHash) {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Creator, that1.Creator) {
|
||||
if this.Creator != that1.Creator {
|
||||
return false
|
||||
}
|
||||
if this.Source != that1.Source {
|
||||
|
@ -701,10 +698,10 @@ func (this *ContractInfo) Equal(that interface{}) bool {
|
|||
if this.CodeID != that1.CodeID {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Creator, that1.Creator) {
|
||||
if this.Creator != that1.Creator {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Admin, that1.Admin) {
|
||||
if this.Admin != that1.Admin {
|
||||
return false
|
||||
}
|
||||
if this.Label != that1.Label {
|
||||
|
@ -1529,7 +1526,7 @@ func (m *AccessConfig) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
|
@ -1539,25 +1536,23 @@ func (m *AccessConfig) 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 ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
m.Address = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -1774,7 +1769,7 @@ func (m *CodeInfo) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
|
@ -1784,25 +1779,23 @@ func (m *CodeInfo) 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 ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Creator = append(m.Creator[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Creator == nil {
|
||||
m.Creator = []byte{}
|
||||
}
|
||||
m.Creator = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
|
@ -1977,7 +1970,7 @@ func (m *ContractInfo) Unmarshal(dAtA []byte) error {
|
|||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
|
@ -1987,31 +1980,29 @@ func (m *ContractInfo) 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 ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Creator = append(m.Creator[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Creator == nil {
|
||||
m.Creator = []byte{}
|
||||
}
|
||||
m.Creator = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
|
@ -2021,25 +2012,23 @@ func (m *ContractInfo) 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 ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Admin = append(m.Admin[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Admin == nil {
|
||||
m.Admin = []byte{}
|
||||
}
|
||||
m.Admin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
|
@ -2133,6 +2122,7 @@ func (m *ContractInfo) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ContractHistory) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -31,7 +31,7 @@ message AccessTypeParam {
|
|||
message AccessConfig {
|
||||
option (gogoproto.goproto_stringer) = true;
|
||||
AccessType permission = 1 [(gogoproto.moretags) = "yaml:\"permission\""];
|
||||
bytes address = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", (gogoproto.moretags) = "yaml:\"address\""];
|
||||
string address = 2 [(gogoproto.moretags) = "yaml:\"address\""];
|
||||
}
|
||||
|
||||
// Params defines the set of wasm parameters.
|
||||
|
@ -47,7 +47,7 @@ message CodeInfo {
|
|||
// CodeHash is the unique CodeID
|
||||
bytes code_hash = 1;
|
||||
// Creator address who initially stored the code
|
||||
bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string creator = 2;
|
||||
// Source is a valid absolute HTTPS URI to the contract's source code, optional
|
||||
string source = 3;
|
||||
// Builder is a valid docker image name with tag, optional
|
||||
|
@ -61,9 +61,9 @@ message ContractInfo {
|
|||
// CodeID is the reference to the stored Wasm code
|
||||
uint64 code_id = 1 [(gogoproto.customname) = "CodeID"];
|
||||
// Creator address who initially instantiated the contract
|
||||
bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string creator = 2;
|
||||
// Admin is an optional address that can execute migrations
|
||||
bytes admin = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
string admin = 3;
|
||||
// Label is optional metadata to be stored with a contract instance.
|
||||
string label = 4;
|
||||
// Created Tx position when the contract was instantiated.
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -19,19 +18,19 @@ func TestContractInfoValidateBasic(t *testing.T) {
|
|||
expError: true,
|
||||
},
|
||||
"creator empty": {
|
||||
srcMutator: func(c *ContractInfo) { c.Creator = nil },
|
||||
srcMutator: func(c *ContractInfo) { c.Creator = "" },
|
||||
expError: true,
|
||||
},
|
||||
"creator not an address": {
|
||||
srcMutator: func(c *ContractInfo) { c.Creator = make([]byte, sdk.AddrLen-1) },
|
||||
srcMutator: func(c *ContractInfo) { c.Creator = "invalid address" },
|
||||
expError: true,
|
||||
},
|
||||
"admin empty": {
|
||||
srcMutator: func(c *ContractInfo) { c.Admin = nil },
|
||||
srcMutator: func(c *ContractInfo) { c.Admin = "" },
|
||||
expError: false,
|
||||
},
|
||||
"admin not an address": {
|
||||
srcMutator: func(c *ContractInfo) { c.Admin = make([]byte, sdk.AddrLen-1) },
|
||||
srcMutator: func(c *ContractInfo) { c.Admin = "invalid address" },
|
||||
expError: true,
|
||||
},
|
||||
"label empty": {
|
||||
|
@ -71,11 +70,11 @@ func TestCodeInfoValidateBasic(t *testing.T) {
|
|||
expError: true,
|
||||
},
|
||||
"creator empty": {
|
||||
srcMutator: func(c *CodeInfo) { c.Creator = nil },
|
||||
srcMutator: func(c *CodeInfo) { c.Creator = "" },
|
||||
expError: true,
|
||||
},
|
||||
"creator not an address": {
|
||||
srcMutator: func(c *CodeInfo) { c.Creator = make([]byte, sdk.AddrLen-1) },
|
||||
srcMutator: func(c *CodeInfo) { c.Creator = "invalid address" },
|
||||
expError: true,
|
||||
},
|
||||
"source empty": {
|
||||
|
|
|
@ -32,12 +32,12 @@ type testData struct {
|
|||
// returns a cleanup function, which must be defered on
|
||||
func setupTest(t *testing.T) testData {
|
||||
ctx, keepers := CreateTestInput(t, false, "staking", nil, nil)
|
||||
acctKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
acctKeeper, wasmKeeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
data := testData{
|
||||
module: NewAppModule(keeper),
|
||||
module: NewAppModule(wasmKeeper),
|
||||
ctx: ctx,
|
||||
acctKeeper: acctKeeper,
|
||||
keeper: *keeper,
|
||||
keeper: *wasmKeeper,
|
||||
bankKeeper: bankKeeper,
|
||||
}
|
||||
return data
|
||||
|
@ -59,10 +59,11 @@ func mustLoad(path string) []byte {
|
|||
}
|
||||
|
||||
var (
|
||||
key1, pub1, addr1 = keyPubAddr()
|
||||
testContract = mustLoad("./internal/keeper/testdata/hackatom.wasm")
|
||||
maskContract = mustLoad("./internal/keeper/testdata/reflect.wasm")
|
||||
oldContract = mustLoad("./testdata/escrow_0.7.wasm")
|
||||
_, _, addrAcc1 = keyPubAddr()
|
||||
addr1 = addrAcc1.String()
|
||||
testContract = mustLoad("./internal/keeper/testdata/hackatom.wasm")
|
||||
maskContract = mustLoad("./internal/keeper/testdata/reflect.wasm")
|
||||
oldContract = mustLoad("./testdata/escrow_0.7.wasm")
|
||||
)
|
||||
|
||||
func TestHandleCreate(t *testing.T) {
|
||||
|
@ -146,7 +147,7 @@ func TestHandleInstantiate(t *testing.T) {
|
|||
q := data.module.LegacyQuerierHandler(nil)
|
||||
|
||||
msg := &MsgStoreCode{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
WASMByteCode: testContract,
|
||||
}
|
||||
res, err := h(data.ctx, msg)
|
||||
|
@ -165,28 +166,28 @@ func TestHandleInstantiate(t *testing.T) {
|
|||
|
||||
// create with no balance is also legal
|
||||
initCmd := MsgInstantiateContract{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
CodeID: firstCodeID,
|
||||
InitMsg: initMsgBz,
|
||||
InitFunds: nil,
|
||||
}
|
||||
res, err = h(data.ctx, &initCmd)
|
||||
require.NoError(t, err)
|
||||
contractAddr := sdk.AccAddress(res.Data)
|
||||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractAddr.String())
|
||||
contractBech32Addr := string(res.Data)
|
||||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractBech32Addr)
|
||||
// this should be standard x/wasm init event, nothing from contract
|
||||
require.Equal(t, 2, len(res.Events), prettyEvents(res.Events))
|
||||
assert.Equal(t, "wasm", res.Events[0].Type)
|
||||
assertAttribute(t, "contract_address", contractAddr.String(), res.Events[0].Attributes[0])
|
||||
assertAttribute(t, "contract_address", contractBech32Addr, res.Events[0].Attributes[0])
|
||||
assert.Equal(t, "message", res.Events[1].Type)
|
||||
assertAttribute(t, "module", "wasm", res.Events[1].Attributes[0])
|
||||
|
||||
assertCodeList(t, q, data.ctx, 1)
|
||||
assertCodeBytes(t, q, data.ctx, 1, testContract)
|
||||
|
||||
assertContractList(t, q, data.ctx, 1, []string{contractAddr.String()})
|
||||
assertContractInfo(t, q, data.ctx, contractAddr, 1, creator)
|
||||
assertContractState(t, q, data.ctx, contractAddr, state{
|
||||
assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr})
|
||||
assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator)
|
||||
assertContractState(t, q, data.ctx, contractBech32Addr, state{
|
||||
Verifier: []byte(fred),
|
||||
Beneficiary: []byte(bob),
|
||||
Funder: []byte(creator),
|
||||
|
@ -205,7 +206,7 @@ func TestHandleExecute(t *testing.T) {
|
|||
q := data.module.LegacyQuerierHandler(nil)
|
||||
|
||||
msg := &MsgStoreCode{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
WASMByteCode: testContract,
|
||||
}
|
||||
res, err := h(data.ctx, msg)
|
||||
|
@ -221,20 +222,20 @@ func TestHandleExecute(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
initCmd := MsgInstantiateContract{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
CodeID: firstCodeID,
|
||||
InitMsg: initMsgBz,
|
||||
InitFunds: deposit,
|
||||
}
|
||||
res, err = h(data.ctx, &initCmd)
|
||||
require.NoError(t, err)
|
||||
contractAddr := sdk.AccAddress(res.Data)
|
||||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractAddr.String())
|
||||
contractBech32Addr := string(res.Data)
|
||||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractBech32Addr)
|
||||
// this should be standard x/wasm init event, plus a bank send event (2), with no custom contract events
|
||||
require.Equal(t, 3, len(res.Events), prettyEvents(res.Events))
|
||||
assert.Equal(t, "transfer", res.Events[0].Type)
|
||||
assert.Equal(t, "wasm", res.Events[1].Type)
|
||||
assertAttribute(t, "contract_address", contractAddr.String(), res.Events[1].Attributes[0])
|
||||
assertAttribute(t, "contract_address", contractBech32Addr, res.Events[1].Attributes[0])
|
||||
assert.Equal(t, "message", res.Events[2].Type)
|
||||
assertAttribute(t, "module", "wasm", res.Events[2].Attributes[0])
|
||||
|
||||
|
@ -249,13 +250,14 @@ func TestHandleExecute(t *testing.T) {
|
|||
assert.Equal(t, deposit, data.bankKeeper.GetAllBalances(data.ctx, creatorAcct.GetAddress()))
|
||||
|
||||
// ensure contract has updated balance
|
||||
contractAddr, _ := sdk.AccAddressFromBech32(contractBech32Addr)
|
||||
contractAcct := data.acctKeeper.GetAccount(data.ctx, contractAddr)
|
||||
require.NotNil(t, contractAcct)
|
||||
assert.Equal(t, deposit, data.bankKeeper.GetAllBalances(data.ctx, contractAcct.GetAddress()))
|
||||
|
||||
execCmd := MsgExecuteContract{
|
||||
Sender: fred,
|
||||
Contract: contractAddr,
|
||||
Sender: fred.String(),
|
||||
Contract: contractBech32Addr,
|
||||
Msg: []byte(`{"release":{}}`),
|
||||
SentFunds: topUp,
|
||||
}
|
||||
|
@ -266,17 +268,17 @@ func TestHandleExecute(t *testing.T) {
|
|||
|
||||
require.Equal(t, "transfer", res.Events[0].Type)
|
||||
require.Len(t, res.Events[0].Attributes, 3)
|
||||
assertAttribute(t, "recipient", contractAddr.String(), res.Events[0].Attributes[0])
|
||||
assertAttribute(t, "recipient", contractBech32Addr, res.Events[0].Attributes[0])
|
||||
assertAttribute(t, "sender", fred.String(), res.Events[0].Attributes[1])
|
||||
assertAttribute(t, "amount", "5000denom", res.Events[0].Attributes[2])
|
||||
// custom contract event
|
||||
assert.Equal(t, "wasm", res.Events[1].Type)
|
||||
assertAttribute(t, "contract_address", contractAddr.String(), res.Events[1].Attributes[0])
|
||||
assertAttribute(t, "contract_address", contractBech32Addr, res.Events[1].Attributes[0])
|
||||
assertAttribute(t, "action", "release", res.Events[1].Attributes[1])
|
||||
// second transfer (this without conflicting message)
|
||||
assert.Equal(t, "transfer", res.Events[2].Type)
|
||||
assertAttribute(t, "recipient", bob.String(), res.Events[2].Attributes[0])
|
||||
assertAttribute(t, "sender", contractAddr.String(), res.Events[2].Attributes[1])
|
||||
assertAttribute(t, "sender", contractBech32Addr, res.Events[2].Attributes[1])
|
||||
assertAttribute(t, "amount", "105000denom", res.Events[2].Attributes[2])
|
||||
// finally, standard x/wasm tag
|
||||
assert.Equal(t, "message", res.Events[3].Type)
|
||||
|
@ -289,6 +291,7 @@ func TestHandleExecute(t *testing.T) {
|
|||
assert.Equal(t, deposit.Add(topUp...), balance)
|
||||
|
||||
// ensure contract has updated balance
|
||||
|
||||
contractAcct = data.acctKeeper.GetAccount(data.ctx, contractAddr)
|
||||
require.NotNil(t, contractAcct)
|
||||
assert.Equal(t, sdk.Coins(nil), data.bankKeeper.GetAllBalances(data.ctx, contractAcct.GetAddress()))
|
||||
|
@ -297,9 +300,9 @@ func TestHandleExecute(t *testing.T) {
|
|||
assertCodeList(t, q, data.ctx, 1)
|
||||
assertCodeBytes(t, q, data.ctx, 1, testContract)
|
||||
|
||||
assertContractList(t, q, data.ctx, 1, []string{contractAddr.String()})
|
||||
assertContractInfo(t, q, data.ctx, contractAddr, 1, creator)
|
||||
assertContractState(t, q, data.ctx, contractAddr, state{
|
||||
assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr})
|
||||
assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator)
|
||||
assertContractState(t, q, data.ctx, contractBech32Addr, state{
|
||||
Verifier: []byte(fred),
|
||||
Beneficiary: []byte(bob),
|
||||
Funder: []byte(creator),
|
||||
|
@ -317,7 +320,7 @@ func TestHandleExecuteEscrow(t *testing.T) {
|
|||
h := data.module.Route().Handler()
|
||||
|
||||
msg := &MsgStoreCode{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
WASMByteCode: testContract,
|
||||
}
|
||||
res, err := h(data.ctx, msg)
|
||||
|
@ -333,15 +336,15 @@ func TestHandleExecuteEscrow(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
initCmd := MsgInstantiateContract{
|
||||
Sender: creator,
|
||||
Sender: creator.String(),
|
||||
CodeID: firstCodeID,
|
||||
InitMsg: initMsgBz,
|
||||
InitFunds: deposit,
|
||||
}
|
||||
res, err = h(data.ctx, &initCmd)
|
||||
require.NoError(t, err)
|
||||
contractAddr := sdk.AccAddress(res.Data)
|
||||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractAddr.String())
|
||||
contractBech32Addr := string(res.Data)
|
||||
require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractBech32Addr)
|
||||
|
||||
handleMsg := map[string]interface{}{
|
||||
"release": map[string]interface{}{},
|
||||
|
@ -350,8 +353,8 @@ func TestHandleExecuteEscrow(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
execCmd := MsgExecuteContract{
|
||||
Sender: fred,
|
||||
Contract: contractAddr,
|
||||
Sender: fred.String(),
|
||||
Contract: contractBech32Addr,
|
||||
Msg: handleMsgBz,
|
||||
SentFunds: topUp,
|
||||
}
|
||||
|
@ -365,6 +368,7 @@ func TestHandleExecuteEscrow(t *testing.T) {
|
|||
assert.Equal(t, deposit.Add(topUp...), balance)
|
||||
|
||||
// ensure contract has updated balance
|
||||
contractAddr, _ := sdk.AccAddressFromBech32(contractBech32Addr)
|
||||
contractAcct := data.acctKeeper.GetAccount(data.ctx, contractAddr)
|
||||
require.NotNil(t, contractAcct)
|
||||
assert.Equal(t, sdk.Coins(nil), data.bankKeeper.GetAllBalances(data.ctx, contractAcct.GetAddress()))
|
||||
|
@ -512,15 +516,15 @@ func assertContractList(t *testing.T, q sdk.Querier, ctx sdk.Context, codeID uin
|
|||
|
||||
var hasAddrs = make([]string, len(res))
|
||||
for i, r := range res {
|
||||
hasAddrs[i] = r.Address.String()
|
||||
hasAddrs[i] = r.Address
|
||||
}
|
||||
|
||||
assert.Equal(t, hasAddrs, addrs)
|
||||
}
|
||||
|
||||
func assertContractState(t *testing.T, q sdk.Querier, ctx sdk.Context, addr sdk.AccAddress, expected state) {
|
||||
func assertContractState(t *testing.T, q sdk.Querier, ctx sdk.Context, contractBech32Addr string, expected state) {
|
||||
t.Helper()
|
||||
path := []string{QueryGetContractState, addr.String(), keeper.QueryMethodContractStateAll}
|
||||
path := []string{QueryGetContractState, contractBech32Addr, keeper.QueryMethodContractStateAll}
|
||||
bz, sdkerr := q(ctx, path, abci.RequestQuery{})
|
||||
require.NoError(t, sdkerr)
|
||||
|
||||
|
@ -535,9 +539,9 @@ func assertContractState(t *testing.T, q sdk.Querier, ctx sdk.Context, addr sdk.
|
|||
assert.Equal(t, expectedBz, res[0].Value)
|
||||
}
|
||||
|
||||
func assertContractInfo(t *testing.T, q sdk.Querier, ctx sdk.Context, addr sdk.AccAddress, codeID uint64, creator sdk.AccAddress) {
|
||||
func assertContractInfo(t *testing.T, q sdk.Querier, ctx sdk.Context, contractBech32Addr string, codeID uint64, creator sdk.AccAddress) {
|
||||
t.Helper()
|
||||
path := []string{QueryGetContract, addr.String()}
|
||||
path := []string{QueryGetContract, contractBech32Addr}
|
||||
bz, sdkerr := q(ctx, path, abci.RequestQuery{})
|
||||
require.NoError(t, sdkerr)
|
||||
|
||||
|
@ -546,7 +550,7 @@ func assertContractInfo(t *testing.T, q sdk.Querier, ctx sdk.Context, addr sdk.A
|
|||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, codeID, res.CodeID)
|
||||
assert.Equal(t, creator, res.Creator)
|
||||
assert.Equal(t, creator.String(), res.Creator)
|
||||
}
|
||||
|
||||
func createFakeFundedAccount(t *testing.T, ctx sdk.Context, am authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, coins sdk.Coins) sdk.AccAddress {
|
||||
|
|
Loading…
Reference in New Issue