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

feat: add inactive contract management in wasm #655

Merged
merged 18 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 10 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/collection) [\#608](https://github.com/line/lbm-sdk/pull/608) remove new APIs on x/collection
* (x/token) [\#609](https://github.com/line/lbm-sdk/pull/609) remove new APIs on x/token
* (x/wasm) [\#625](https://github.com/line/lbm-sdk/pull/625) detaching `StoreCodeAndInstantiateContract` from wasm's tx.proto
* (x/wasm) [\#655](https://github.com/line/lbm-sdk/pull/655) add inactive contract management in wasm (This replaces the contract blacklist function of contractStatus)

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path
Expand Down
3 changes: 3 additions & 0 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@
"Params": "FeegrantParams"
}
}
},
{
"url": "./tmp-swagger-gen/lbm/wasm/v1/query.swagger.json"
}
]
}
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

148 changes: 148 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44031,6 +44031,125 @@ paths:
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
format: boolean
tags:
- Query
/lbm/wasm/v1/inactive_contracts:
get:
summary: InactiveContracts queries all inactive contracts.
operationId: InactiveContracts
responses:
'200':
description: A successful response.
schema:
type: object
properties:
addresses:
type: array
items:
type: string
title: addresses is the inactive address list
pagination:
description: pagination defines the pagination in the response.
type: object
properties:
next_key:
type: string
format: byte
title: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
title: >-
QueryInactiveContractsResponse is the response type for the
Query/InactiveContract RPC method
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

is set.
in: query
required: false
type: boolean
format: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
Expand Down Expand Up @@ -70353,3 +70472,32 @@ definitions:
description: >-
QueryAllowancesResponse is the response type for the Query/Allowances RPC
method.
lbm.wasm.v1.QueryInactiveContractsResponse:
type: object
properties:
addresses:
type: array
items:
type: string
title: addresses is the inactive address list
pagination:
description: pagination defines the pagination in the response.
type: object
properties:
next_key:
type: string
format: byte
title: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
title: >-
QueryInactiveContractsResponse is the response type for the
Query/InactiveContract RPC method
142 changes: 118 additions & 24 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1225,11 +1225,19 @@

- [Msg](#lbm.token.v1.Msg)

- [lbm/wasm/v1/types.proto](#lbm/wasm/v1/types.proto)
- [Params](#lbm.wasm.v1.Params)
- [lbm/wasm/v1/event.proto](#lbm/wasm/v1/event.proto)
- [EventActivateContractProposal](#lbm.wasm.v1.EventActivateContractProposal)
- [EventDeactivateContractProposal](#lbm.wasm.v1.EventDeactivateContractProposal)

- [lbm/wasm/v1/genesis.proto](#lbm/wasm/v1/genesis.proto)
- [GenesisState](#lbm.wasm.v1.GenesisState)
- [lbm/wasm/v1/proposal.proto](#lbm/wasm/v1/proposal.proto)
- [ActivateContractProposal](#lbm.wasm.v1.ActivateContractProposal)
- [DeactivateContractProposal](#lbm.wasm.v1.DeactivateContractProposal)

- [lbm/wasm/v1/query.proto](#lbm/wasm/v1/query.proto)
- [QueryInactiveContractsRequest](#lbm.wasm.v1.QueryInactiveContractsRequest)
- [QueryInactiveContractsResponse](#lbm.wasm.v1.QueryInactiveContractsResponse)

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

- [lbm/wasm/v1/tx.proto](#lbm/wasm/v1/tx.proto)
- [MsgStoreCodeAndInstantiateContract](#lbm.wasm.v1.MsgStoreCodeAndInstantiateContract)
Expand Down Expand Up @@ -9071,6 +9079,9 @@ Params defines the set of wasm parameters.
| ----- | ---- | ----- | ----------- |
| `code_upload_access` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | |
| `instantiate_default_permission` | [AccessType](#cosmwasm.wasm.v1.AccessType) | | |
| `gas_multiplier` | [uint64](#uint64) | | |
| `instance_cost` | [uint64](#uint64) | | |
| `compile_cost` | [uint64](#uint64) | | |



Expand Down Expand Up @@ -9388,6 +9399,7 @@ GenesisState - genesis state of x/wasm
| `contracts` | [Contract](#cosmwasm.wasm.v1.Contract) | repeated | |
| `sequences` | [Sequence](#cosmwasm.wasm.v1.Sequence) | repeated | |
| `gen_msgs` | [GenesisState.GenMsgs](#cosmwasm.wasm.v1.GenesisState.GenMsgs) | repeated | |
| `inactive_contract_addresses` | [string](#string) | repeated | InactiveContractAddresses is a list of contract address that set inactive |



Expand Down Expand Up @@ -18510,26 +18522,37 @@ Msg defines the token Msg service.



<a name="lbm/wasm/v1/types.proto"></a>
<a name="lbm/wasm/v1/event.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/wasm/v1/types.proto
## lbm/wasm/v1/event.proto



<a name="lbm.wasm.v1.Params"></a>
<a name="lbm.wasm.v1.EventActivateContractProposal"></a>

### Params
Params defines the set of wasm parameters.
### EventActivateContractProposal
EventActivateContractProposal is the event that is emitted when the contract is activates.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `code_upload_access` | [cosmwasm.wasm.v1.AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | |
| `instantiate_default_permission` | [cosmwasm.wasm.v1.AccessType](#cosmwasm.wasm.v1.AccessType) | | |
| `gas_multiplier` | [uint64](#uint64) | | |
| `instance_cost` | [uint64](#uint64) | | |
| `compile_cost` | [uint64](#uint64) | | |
| `contractAddress` | [string](#string) | | contractAddress is the smart contract's address |






<a name="lbm.wasm.v1.EventDeactivateContractProposal"></a>

### EventDeactivateContractProposal
EventDeactivateContractProposal is the event that is emitted when the contract is deactivate


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `contractAddress` | [string](#string) | | contractAddress is the smart contract's address |



Expand All @@ -18545,27 +18568,88 @@ Params defines the set of wasm parameters.



<a name="lbm/wasm/v1/genesis.proto"></a>
<a name="lbm/wasm/v1/proposal.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/wasm/v1/genesis.proto
## lbm/wasm/v1/proposal.proto



<a name="lbm.wasm.v1.GenesisState"></a>
<a name="lbm.wasm.v1.ActivateContractProposal"></a>

### ActivateContractProposal
ActivateContractProposal gov proposal content type deletes a contract from inactive list


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | Title is a short summary |
| `description` | [string](#string) | | Description is a human readable text |
| `contract` | [string](#string) | | Contract is the smart contract address to activate. |



### GenesisState



<a name="lbm.wasm.v1.DeactivateContractProposal"></a>

### DeactivateContractProposal
DeactivateContractProposal gov proposal content type adds a contract to inactive list.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#lbm.wasm.v1.Params) | | Params sdk type Params for wasm |
| `codes` | [cosmwasm.wasm.v1.Code](#cosmwasm.wasm.v1.Code) | repeated | Codes has all stored wasm codes and metadata |
| `contracts` | [cosmwasm.wasm.v1.Contract](#cosmwasm.wasm.v1.Contract) | repeated | Contracts contains all instantiated contracts, state and metadata |
| `sequences` | [cosmwasm.wasm.v1.Sequence](#cosmwasm.wasm.v1.Sequence) | repeated | Sequences names and values |
| `gen_msgs` | [cosmwasm.wasm.v1.GenesisState.GenMsgs](#cosmwasm.wasm.v1.GenesisState.GenMsgs) | repeated | GenMsgs has wasmd sdk type messages to execute in the genesis phase |
| `inactive_contract_addresses` | [string](#string) | repeated | InactiveContractAddresses is a list of contract address that set inactive |
| `title` | [string](#string) | | Title is a short summary |
| `description` | [string](#string) | | Description is a human readable text |
| `contract` | [string](#string) | | Contract is the smart contract address to deactivate. |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/wasm/v1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/wasm/v1/query.proto



<a name="lbm.wasm.v1.QueryInactiveContractsRequest"></a>

### QueryInactiveContractsRequest
QueryInactiveContractsRequest is the request type for Query/InactiveContract RPC method


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |






<a name="lbm.wasm.v1.QueryInactiveContractsResponse"></a>

### QueryInactiveContractsResponse
QueryInactiveContractsResponse is the response type for the Query/InactiveContract RPC method


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `addresses` | [string](#string) | repeated | addresses is the inactive address list |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |



Expand All @@ -18577,6 +18661,16 @@ Params defines the set of wasm parameters.

<!-- end HasExtensions -->


<a name="lbm.wasm.v1.Query"></a>

### Query
Query defines the gRPC querier service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `InactiveContracts` | [QueryInactiveContractsRequest](#lbm.wasm.v1.QueryInactiveContractsRequest) | [QueryInactiveContractsResponse](#lbm.wasm.v1.QueryInactiveContractsResponse) | InactiveContracts queries all inactive contracts. | GET|/lbm/wasm/v1/inactive_contracts|

<!-- end services -->


Expand Down
3 changes: 3 additions & 0 deletions proto/cosmwasm/wasm/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ message GenesisState {
repeated Sequence sequences = 4 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "sequences,omitempty"];
repeated GenMsgs gen_msgs = 5 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "gen_msgs,omitempty"];

// InactiveContractAddresses is a list of contract address that set inactive
repeated string inactive_contract_addresses = 6 [(gogoproto.jsontag) = "inactive_contract_address, omitempty"];

// GenMsgs define the messages that can be executed during genesis phase in order.
// The intention is to have more human readable data that is auditable.
message GenMsgs {
Expand Down
Loading