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

Merged
merged 11 commits into from
Nov 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update protobuf
chipshort committed Nov 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 6b0e3fef525ea8ffb5c3f41ddeb95813e00057fa
6 changes: 3 additions & 3 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
@@ -1439,13 +1439,13 @@ Query/WasmLimitsConfig RPC method.

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


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



@@ -1477,7 +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 MsgPack. | GET|/cosmwasm/wasm/v1/wasm-limits-config|
| `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 -->
6 changes: 3 additions & 3 deletions proto/cosmwasm/wasm/v1/query.proto
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ service Query {
}

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a specific struct that we can define for config or we want to keep it flexible?
In that case, we could evaluate using bytes instead of string. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in our chat, I want to keep it flexible. The reason for string instead of bytes is that I want to make it easy for contract devs to copy and paste the limits. They need pass them into cosmwasm-check. See here: https://github.com/CosmWasm/cosmwasm/blob/cf413c5ad6a58a87e0be894584f01506f3b2e0af/packages/check/src/main.rs#L41-L50


// QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC
// method.
2 changes: 1 addition & 1 deletion x/wasm/keeper/querier.go
Original file line number Diff line number Diff line change
@@ -441,7 +441,7 @@ func ensurePaginationParams(req *query.PageRequest) (*query.PageRequest, error)

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

96 changes: 47 additions & 49 deletions x/wasm/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.