Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customizable WasmLimits #1989

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
- [QueryRawContractStateResponse](#cosmwasm.wasm.v1.QueryRawContractStateResponse)
- [QuerySmartContractStateRequest](#cosmwasm.wasm.v1.QuerySmartContractStateRequest)
- [QuerySmartContractStateResponse](#cosmwasm.wasm.v1.QuerySmartContractStateResponse)
- [QueryWasmLimitsConfigRequest](#cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest)
- [QueryWasmLimitsConfigResponse](#cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse)

- [Query](#cosmwasm.wasm.v1.Query)

Expand Down Expand Up @@ -1421,6 +1423,34 @@ Query/SmartContractState RPC method




<a name="cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest"></a>

### QueryWasmLimitsConfigRequest
QueryWasmLimitsConfigRequest is the request type for the
Query/WasmLimitsConfig RPC method.






<a name="cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse"></a>

### QueryWasmLimitsConfigResponse
QueryWasmLimitsConfigResponse is the response type for the
Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for
static validation of Wasm files.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `config` | [string](#string) | | |





<!-- end messages -->

<!-- end enums -->
Expand All @@ -1447,6 +1477,7 @@ Query provides defines the gRPC querier service
| `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned|
| `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params|
| `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}|
| `WasmLimitsConfig` | [QueryWasmLimitsConfigRequest](#cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest) | [QueryWasmLimitsConfigResponse](#cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse) | WasmLimitsConfig gets the configured limits for static validation of Wasm files, encoded in JSON. | GET|/cosmwasm/wasm/v1/wasm-limits-config|
| `BuildAddress` | [QueryBuildAddressRequest](#cosmwasm.wasm.v1.QueryBuildAddressRequest) | [QueryBuildAddressResponse](#cosmwasm.wasm.v1.QueryBuildAddressResponse) | BuildAddress builds a contract address | GET|/cosmwasm/wasm/v1/contract/build_address|

<!-- end services -->
Expand Down
16 changes: 16 additions & 0 deletions proto/cosmwasm/wasm/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ service Query {
"/cosmwasm/wasm/v1/contracts/creator/{creator_address}";
}

// WasmLimitsConfig gets the configured limits for static validation of Wasm
// files, encoded in JSON.
rpc WasmLimitsConfig(QueryWasmLimitsConfigRequest)
returns (QueryWasmLimitsConfigResponse) {
option (google.api.http).get = "/cosmwasm/wasm/v1/wasm-limits-config";
}

// BuildAddress builds a contract address
rpc BuildAddress(QueryBuildAddressRequest)
returns (QueryBuildAddressResponse) {
Expand Down Expand Up @@ -317,6 +324,15 @@ message QueryContractsByCreatorResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryWasmLimitsConfigRequest is the request type for the
// Query/WasmLimitsConfig RPC method.
message QueryWasmLimitsConfigRequest {}

// QueryWasmLimitsConfigResponse is the response type for the
// Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for
// static validation of Wasm files.
message QueryWasmLimitsConfigResponse { string config = 1; }

// QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC
// method.
message QueryBuildAddressRequest {
Expand Down
6 changes: 6 additions & 0 deletions x/wasm/keeper/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@
return req, nil
}

func (q GrpcQuerier) WasmLimitsConfig(c context.Context, req *types.QueryWasmLimitsConfigRequest) (*types.QueryWasmLimitsConfigResponse, error) {
return &types.QueryWasmLimitsConfigResponse{
Config: "{\"todo\": \"put serialized limits here\"}", // TODO: implement
}, nil

Check warning on line 445 in x/wasm/keeper/querier.go

View check run for this annotation

Codecov / codecov/patch

x/wasm/keeper/querier.go#L442-L445

Added lines #L442 - L445 were not covered by tests
}

func (q GrpcQuerier) BuildAddress(c context.Context, req *types.QueryBuildAddressRequest) (*types.QueryBuildAddressResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
Expand Down
Loading