Skip to content

Commit

Permalink
feat: add upgrade/migration (#377)
Browse files Browse the repository at this point in the history
* feat: add upgrade/migration

* feat: add upgrade/migration

* feat: add upgrade/migration change comment type

* feat: add upgrade/migration delete test sh file

* add upgrade/migrate cli command

* feat: add upgrade/migration fix lint and compile error

* add upgrade/migration version map

* change CHANGELOG pull number

* fix ST1022 lint

* remove non-deterministic upgrade order

* apply ostraconv1.0.1

* remove unintended commands about keyring
  • Loading branch information
dudong2 authored Nov 12, 2021
1 parent 8cec5b9 commit e9ec7d2
Show file tree
Hide file tree
Showing 72 changed files with 2,749 additions and 134 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features
* (feat) [\#352] (https://github.com/line/lbm-sdk/pull/352) iavl, db & disk stats logging
* (x/gov) [\#368](https://github.com/line/lbm-sdk/pull/368) Governance Split Votes, use `MsgWeightedVote` to send a split vote. Sending a regular `MsgVote` will convert the underlying vote option into a weighted vote with weight 1.
* (x/upgrade) [\#377] (https://github.com/line/lbm-sdk/pull/377) To smoothen the update to the latest stable release, the SDK includes vesion map for managing migrations between SDK versions.

### Improvements
* (slashing) [\#347](https://github.com/line/lbm-sdk/pull/347) Introduce VoterSetCounter
Expand Down
266 changes: 266 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21989,6 +21989,237 @@ paths:
}
tags:
- Query
/lbm/upgrade/v1/module_versions:
get:
summary: ModuleVersions queries the list of module versions from state.
operationId: ModuleVersions
responses:
'200':
description: A successful response.
schema:
type: object
properties:
module_versions:
type: array
items:
type: object
properties:
name:
type: string
title: name of the app module
version:
type: string
format: uint64
title: consensus version of the app module
description: ModuleVersion specifies a module and its consensus version.
description: >-
module_versions is a list of module names with their consensus
versions.
description: >-
QueryModuleVersionsResponse is the response type for the
Query/ModuleVersions

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
description: >-
A URL/resource name that uniquely identifies the type of
the serialized

protocol buffer message. This string must contain at
least

one "/" character. The last segment of the URL's path
must represent

the fully qualified name of the type (as in

`path/google.protobuf.Duration`). The name should be in
a canonical form

(e.g., leading "." is not accepted).


In practice, teams usually precompile into the binary
all types that they

expect it to use in the context of Any. However, for
URLs which use the

scheme `http`, `https`, or no scheme, one can optionally
set up a type

server that maps type URLs to message definitions as
follows:


* If no scheme is provided, `https` is assumed.

* An HTTP GET on the URL must yield a
[google.protobuf.Type][]
value in binary format, or produce an error.
* Applications are allowed to cache lookup results based
on the
URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)

Note: this functionality is not currently available in
the official

protobuf release, and it is not used for type URLs
beginning with

type.googleapis.com.


Schemes other than `http`, `https` (or the empty scheme)
might be

used with implementation specific semantics.
value:
type: string
format: byte
description: >-
Must be a valid serialized protocol buffer of the above
specified type.
description: >-
`Any` contains an arbitrary serialized protocol buffer
message along with a

URL that describes the type of the serialized message.


Protobuf library provides support to pack/unpack Any values
in the form

of utility functions or additional generated methods of the
Any type.


Example 1: Pack and unpack a message in C++.

Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}

Example 2: Pack and unpack a message in Java.

Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}

Example 3: Pack and unpack a message in Python.

foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...

Example 4: Pack and unpack a message in Go

foo := &pb.Foo{...}
any, err := ptypes.MarshalAny(foo)
...
foo := &pb.Foo{}
if err := ptypes.UnmarshalAny(any, foo); err != nil {
...
}

The pack methods provided by protobuf library will by
default use

'type.googleapis.com/full.type.name' as the type URL and the
unpack

methods only use the fully qualified type name after the
last '/'

in the type URL, for example "foo.bar.com/x/y.z" will yield
type

name "y.z".



JSON

====

The JSON representation of an `Any` value uses the regular

representation of the deserialized, embedded message, with
an

additional field `@type` which contains the type URL.
Example:

package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}

{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}

If the embedded message type is well-known and has a custom
JSON

representation, that representation will be embedded adding
a field

`value` which holds the custom JSON in addition to the
`@type`

field. Example (for message [google.protobuf.Duration][]):

{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
parameters:
- name: module_name
description: |-
module_name is a field to query a specific module
consensus version from state. Leaving this empty will
fetch the full list of module versions from state.
in: query
required: false
type: string
tags:
- Query
'/lbm/upgrade/v1/upgraded_consensus_state/{last_height}':
get:
summary: |-
Expand Down Expand Up @@ -49077,6 +49308,17 @@ definitions:

and can't be handled, they will be ignored
description: TxBody is the body of a transaction that all signers sign over.
lbm.upgrade.v1.ModuleVersion:
type: object
properties:
name:
type: string
title: name of the app module
version:
type: string
format: uint64
title: consensus version of the app module
description: ModuleVersion specifies a module and its consensus version.
lbm.upgrade.v1.Plan:
type: object
properties:
Expand Down Expand Up @@ -49537,6 +49779,30 @@ definitions:
RPC

method.
lbm.upgrade.v1.QueryModuleVersionsResponse:
type: object
properties:
module_versions:
type: array
items:
type: object
properties:
name:
type: string
title: name of the app module
version:
type: string
format: uint64
title: consensus version of the app module
description: ModuleVersion specifies a module and its consensus version.
description: >-
module_versions is a list of module names with their consensus
versions.
description: >-
QueryModuleVersionsResponse is the response type for the
Query/ModuleVersions

RPC method.
lbm.upgrade.v1.QueryUpgradedConsensusStateResponse:
type: object
properties:
Expand Down
52 changes: 52 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@

- [lbm/upgrade/v1/upgrade.proto](#lbm/upgrade/v1/upgrade.proto)
- [CancelSoftwareUpgradeProposal](#lbm.upgrade.v1.CancelSoftwareUpgradeProposal)
- [ModuleVersion](#lbm.upgrade.v1.ModuleVersion)
- [Plan](#lbm.upgrade.v1.Plan)
- [SoftwareUpgradeProposal](#lbm.upgrade.v1.SoftwareUpgradeProposal)

Expand All @@ -681,6 +682,8 @@
- [QueryAppliedPlanResponse](#lbm.upgrade.v1.QueryAppliedPlanResponse)
- [QueryCurrentPlanRequest](#lbm.upgrade.v1.QueryCurrentPlanRequest)
- [QueryCurrentPlanResponse](#lbm.upgrade.v1.QueryCurrentPlanResponse)
- [QueryModuleVersionsRequest](#lbm.upgrade.v1.QueryModuleVersionsRequest)
- [QueryModuleVersionsResponse](#lbm.upgrade.v1.QueryModuleVersionsResponse)
- [QueryUpgradedConsensusStateRequest](#lbm.upgrade.v1.QueryUpgradedConsensusStateRequest)
- [QueryUpgradedConsensusStateResponse](#lbm.upgrade.v1.QueryUpgradedConsensusStateResponse)

Expand Down Expand Up @@ -9894,6 +9897,22 @@ upgrade.



<a name="lbm.upgrade.v1.ModuleVersion"></a>

### ModuleVersion
ModuleVersion specifies a module and its consensus version.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `name` | [string](#string) | | name of the app module |
| `version` | [uint64](#uint64) | | consensus version of the app module |






<a name="lbm.upgrade.v1.Plan"></a>

### Plan
Expand Down Expand Up @@ -10006,6 +10025,38 @@ method.



<a name="lbm.upgrade.v1.QueryModuleVersionsRequest"></a>

### QueryModuleVersionsRequest
QueryModuleVersionsRequest is the request type for the Query/ModuleVersions
RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `module_name` | [string](#string) | | module_name is a field to query a specific module consensus version from state. Leaving this empty will fetch the full list of module versions from state |






<a name="lbm.upgrade.v1.QueryModuleVersionsResponse"></a>

### QueryModuleVersionsResponse
QueryModuleVersionsResponse is the response type for the Query/ModuleVersions
RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `module_versions` | [ModuleVersion](#lbm.upgrade.v1.ModuleVersion) | repeated | module_versions is a list of module names with their consensus versions. |






<a name="lbm.upgrade.v1.QueryUpgradedConsensusStateRequest"></a>

### QueryUpgradedConsensusStateRequest
Expand Down Expand Up @@ -10054,6 +10105,7 @@ Query defines the gRPC upgrade querier service.
| `CurrentPlan` | [QueryCurrentPlanRequest](#lbm.upgrade.v1.QueryCurrentPlanRequest) | [QueryCurrentPlanResponse](#lbm.upgrade.v1.QueryCurrentPlanResponse) | CurrentPlan queries the current upgrade plan. | GET|/lbm/upgrade/v1/current_plan|
| `AppliedPlan` | [QueryAppliedPlanRequest](#lbm.upgrade.v1.QueryAppliedPlanRequest) | [QueryAppliedPlanResponse](#lbm.upgrade.v1.QueryAppliedPlanResponse) | AppliedPlan queries a previously applied upgrade plan by its name. | GET|/lbm/upgrade/v1/applied_plan/{name}|
| `UpgradedConsensusState` | [QueryUpgradedConsensusStateRequest](#lbm.upgrade.v1.QueryUpgradedConsensusStateRequest) | [QueryUpgradedConsensusStateResponse](#lbm.upgrade.v1.QueryUpgradedConsensusStateResponse) | UpgradedConsensusState queries the consensus state that will serve as a trusted kernel for the next version of this chain. It will only be stored at the last height of this chain. UpgradedConsensusState RPC not supported with legacy querier | GET|/lbm/upgrade/v1/upgraded_consensus_state/{last_height}|
| `ModuleVersions` | [QueryModuleVersionsRequest](#lbm.upgrade.v1.QueryModuleVersionsRequest) | [QueryModuleVersionsResponse](#lbm.upgrade.v1.QueryModuleVersionsResponse) | ModuleVersions queries the list of module versions from state. | GET|/lbm/upgrade/v1/module_versions|

<!-- end services -->

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/line/iavl/v2 v2.0.0-init.1.0.20211019080724-001e2272a25d
github.com/line/ostracon v1.0.1
github.com/line/ostracon v1.0.2
github.com/line/tm-db/v2 v2.0.0-init.1.0.20210824011847-fcfa67dd3c70
github.com/line/wasmvm v0.14.0-0.8.0
github.com/magiconair/properties v1.8.5
Expand Down
Loading

0 comments on commit e9ec7d2

Please sign in to comment.