Skip to content

Commit 64d8400

Browse files
author
Alex | Interchain Labs
authored
Merge branch 'main' into main
2 parents e4a9031 + ef25036 commit 64d8400

9 files changed

+71
-71
lines changed

docs/architecture/adr-016-validator-consensus-key-rotation.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,42 @@
99

1010
Validator consensus key rotation feature has been discussed and requested for a long time, for the sake of safer validator key management policy (e.g. https://github.com/tendermint/tendermint/issues/1136). So, we suggest one of the simplest form of validator consensus key rotation implementation mostly onto Cosmos SDK.
1111

12-
We don't need to make any update on consensus logic in Tendermint because Tendermint does not have any mapping information of consensus key and validator operator key, meaning that from Tendermint point of view, a consensus key rotation of a validator is simply a replacement of a consensus key to another.
12+
We don't need to make any update on consensus logic in Tendermint because Tendermint does not have any mapping information of consensus key and validator operator key, meaning that from Tendermint's point of view, a consensus key rotation of a validator is simply a replacement of a consensus key to another.
1313

14-
Also, it should be noted that this ADR includes only the simplest form of consensus key rotation without considering multiple consensus keys concept. Such multiple consensus keys concept shall remain a long term goal of Tendermint and Cosmos SDK.
14+
Also, it should be noted that this ADR includes only the simplest form of consensus key rotation without considering the multiple consensus keys concept. Such multiple consensus keys concept shall remain a long term goal of Tendermint and Cosmos SDK.
1515

1616
## Decision
1717

1818
### Pseudo procedure for consensus key rotation
1919

2020
* create new random consensus key.
21-
* create and broadcast a transaction with a `MsgRotateConsPubKey` that states the new consensus key is now coupled with the validator operator with signature from the validator's operator key.
21+
* create and broadcast a transaction with a `MsgRotateConsPubKey` that states the new consensus key is now coupled with the validator operator with a signature from the validator's operator key.
2222
* old consensus key becomes unable to participate on consensus immediately after the update of key mapping state on-chain.
2323
* start validating with new consensus key.
24-
* validators using HSM and KMS should update the consensus key in HSM to use the new rotated key after the height `h` when `MsgRotateConsPubKey` committed to the blockchain.
24+
* validators using HSM and KMS should update the consensus key in HSM to use the new rotated key after the height `h` when `MsgRotateConsPubKey` is committed to the blockchain.
2525

2626
### Considerations
2727

2828
* consensus key mapping information management strategy
2929
* store history of each key mapping changes in the kvstore.
30-
* the state machine can search corresponding consensus key paired with given validator operator for any arbitrary height in a recent unbonding period.
30+
* the state machine can search corresponding consensus key paired with the given validator operator for any arbitrary height in a recent unbonding period.
3131
* the state machine does not need any historical mapping information which is past more than unbonding period.
3232
* key rotation costs related to LCD and IBC
33-
* LCD and IBC will have traffic/computation burden when there exists frequent power changes
33+
* LCD and IBC will have a traffic/computation burden when there exists frequent power changes
3434
* In current Tendermint design, consensus key rotations are seen as power changes from LCD or IBC perspective
35-
* Therefore, to minimize unnecessary frequent key rotation behavior, we limited maximum number of rotation in recent unbonding period and also applied exponentially increasing rotation fee
35+
* Therefore, to minimize unnecessary frequent key rotation behavior, we limited the maximum number of rotation in recent unbonding period and also applied exponentially increasing rotation fee
3636
* limits
3737
* a validator cannot rotate its consensus key more than `MaxConsPubKeyRotations` time for any unbonding period, to prevent spam.
3838
* parameters can be decided by governance and stored in genesis file.
3939
* key rotation fee
4040
* a validator should pay `KeyRotationFee` to rotate the consensus key which is calculated as below
4141
* `KeyRotationFee` = (max(`VotingPowerPercentage` *100, 1)* `InitialKeyRotationFee`) * 2^(number of rotations in `ConsPubKeyRotationHistory` in recent unbonding period)
4242
* evidence module
43-
* evidence module can search corresponding consensus key for any height from slashing keeper so that it can decide which consensus key is supposed to be used for given height.
43+
* evidence module can search corresponding consensus key for any height from slashing keeper so that it can decide which consensus key is supposed to be used for the given height.
4444
* abci.ValidatorUpdate
4545
* tendermint already has ability to change a consensus key by ABCI communication(`ValidatorUpdate`).
4646
* validator consensus key update can be done via creating new + delete old by change the power to zero.
47-
* therefore, we expect we even do not need to change tendermint codebase at all to implement this feature.
47+
* therefore, we expect we do not even need to change Tendermint codebase at all to implement this feature.
4848
* new genesis parameters in `staking` module
4949
* `MaxConsPubKeyRotations` : maximum number of rotation can be executed by a validator in recent unbonding period. default value 10 is suggested(11th key rotation will be rejected)
5050
* `InitialKeyRotationFee` : the initial key rotation fee when no key rotation has happened in recent unbonding period. default value 1atom is suggested(1atom fee for the first key rotation in recent unbonding period)
@@ -108,12 +108,12 @@ Proposed
108108

109109
### Positive
110110

111-
* Validators can immediately or periodically rotate their consensus key to have better security policy
111+
* Validators can immediately or periodically rotate their consensus key to have a better security policy
112112
* improved security against Long-Range attacks (https://nearprotocol.com/blog/long-range-attacks-and-a-new-fork-choice-rule) given a validator throws away the old consensus key(s)
113113

114114
### Negative
115115

116-
* Slash module needs more computation because it needs to lookup corresponding consensus key of validators for each height
116+
* Slash module needs more computation because it needs to look up the corresponding consensus key of validators for each height
117117
* frequent key rotations will make light client bisection less efficient
118118

119119
### Neutral

docs/architecture/adr-019-protobuf-state-encoding.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ From the Amino docs:
2828
2929
Amino also aims to have the following goals (not a complete list):
3030

31-
* Binary bytes must be decode-able with a schema.
31+
* Binary bytes must be decodable with a schema.
3232
* Schema must be upgradeable.
3333
* The encoder and decoder logic must be reasonably simple.
3434

@@ -65,7 +65,7 @@ will provide two concrete implementations of the `Marshaler` interface: `AminoCo
6565
* `AminoCodec`: Uses Amino for both binary and JSON encoding.
6666
* `ProtoCodec`: Uses Protobuf for both binary and JSON encoding.
6767

68-
Modules will use whichever codec that is instantiated in the app. By default, the Cosmos SDK's `simapp`
68+
Modules will use whichever codec is instantiated in the app. By default, the Cosmos SDK's `simapp`
6969
instantiates a `ProtoCodec` as the concrete implementation of `Marshaler`, inside the `MakeTestEncodingConfig`
7070
function. This can be easily overwritten by app developers if they so desire.
7171

@@ -144,7 +144,7 @@ above, apps can still choose to use `oneof` to encode state and transactions
144144
but it is not the recommended approach. If apps do choose to use `oneof`s
145145
instead of `Any` they will likely lose compatibility with client apps that
146146
support multiple chains. Thus developers should think carefully about whether
147-
they care more about what is possibly a pre-mature optimization or end-user
147+
they care more about what is possibly a premature optimization or end-user
148148
and client developer UX.
149149

150150
### Safe usage of `Any`
@@ -169,7 +169,7 @@ type InterfaceRegistry interface {
169169
// registry.RegisterInterface("cosmos_sdk.Msg", (*sdk.Msg)(nil))
170170
RegisterInterface(protoName string, iface interface{})
171171

172-
// RegisterImplementations registers impls as a concrete implementations of
172+
// RegisterImplementations registers impls as concrete implementations of
173173
// the interface iface
174174
// Ex:
175175
// registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}, &MsgMultiSend{})
@@ -226,7 +226,7 @@ every module that implements it in order to populate the `InterfaceRegistry`.
226226

227227
### Using `Any` to encode state
228228

229-
The Cosmos SDK will provide support methods `MarshalInterface` and `UnmarshalInterface` to hide a complexity of wrapping interface types into `Any` and allow easy serialization.
229+
The Cosmos SDK will provide support methods `MarshalInterface` and `UnmarshalInterface` to hide the complexity of wrapping interface types into `Any` and allow easy serialization.
230230

231231
```go
232232
import "github.com/cosmos/cosmos-sdk/codec"
@@ -245,7 +245,7 @@ func UnmarshalEvidence(cdc codec.BinaryCodec, bz []byte) (eviexported.Evidence,
245245

246246
### Using `Any` in `sdk.Msg`s
247247

248-
A similar concept is to be applied for messages that contain interfaces fields.
248+
A similar concept is to be applied for messages that contain interface fields.
249249
For example, we can define `MsgSubmitEvidence` as follows where `Evidence` is
250250
an interface:
251251

@@ -333,7 +333,7 @@ For a more complete comparison to alternative protocols, see [here](https://code
333333
### Cap'n Proto
334334

335335
While [Cap’n Proto](https://capnproto.org/) does seem like an advantageous alternative to Protobuf
336-
due to it's native support for interfaces/generics and built in canonicalization, it does lack the
336+
due to its native support for interfaces/generics and built-in canonicalization, it does lack the
337337
rich client ecosystem compared to Protobuf and is a bit less mature.
338338

339339
### FlatBuffers
@@ -342,7 +342,7 @@ rich client ecosystem compared to Protobuf and is a bit less mature.
342342
primary difference being that FlatBuffers does not need a parsing/unpacking step to a secondary
343343
representation before you can access data, often coupled with per-object memory allocation.
344344

345-
However, it would require great efforts into research and full understanding the scope of the migration
345+
However, it would require great efforts into research and a full understanding the scope of the migration
346346
and path forward -- which isn't immediately clear. In addition, FlatBuffers aren't designed for
347347
untrusted inputs.
348348

docs/architecture/adr-020-protobuf-transaction-encoding.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ approach to the approach described below.
4444
### Transactions
4545

4646
Since interface values are encoded with `google.protobuf.Any` in state (see [ADR 019](adr-019-protobuf-state-encoding.md)),
47-
`sdk.Msg`s are encoding with `Any` in transactions.
47+
`sdk.Msg`s are encoded with `Any` in transactions.
4848

4949
One of the main goals of using `Any` to encode interface values is to have a
5050
core set of types which is reused by apps so that
5151
clients can safely be compatible with as many chains as possible.
5252

5353
It is one of the goals of this specification to provide a flexible cross-chain transaction
54-
format that can serve a wide variety of use cases without breaking client
54+
format that can serve a wide variety of use cases without breaking the client
5555
compatibility.
5656

5757
In order to facilitate signing, transactions are separated into `TxBody`,
58-
which will be re-used by `SignDoc` below, and `signatures`:
58+
which will be reused by `SignDoc` below, and `signatures`:
5959

6060
```protobuf
6161
// types/types.proto
@@ -173,7 +173,7 @@ All of the signing modes below aim to provide the following guarantees:
173173
* **Predictable Gas**: if I am signing a transaction where I am paying a fee,
174174
the final gas is fully dependent on what I am signing
175175

176-
These guarantees give the maximum amount confidence to message signers that
176+
These guarantees give the maximum amount of confidence to message signers that
177177
manipulation of `Tx`s by intermediaries can't result in any meaningful changes.
178178

179179
#### `SIGN_MODE_DIRECT`
@@ -228,7 +228,7 @@ Signature verifiers do:
228228

229229
In order to support legacy wallets and exchanges, Amino JSON will be temporarily
230230
supported transaction signing. Once wallets and exchanges have had a
231-
chance to upgrade to protobuf based signing, this option will be disabled. In
231+
chance to upgrade to protobuf-based signing, this option will be disabled. In
232232
the meantime, it is foreseen that disabling the current Amino signing would cause
233233
too much breakage to be feasible. Note that this is mainly a requirement of the
234234
Cosmos Hub and other chains may choose to disable Amino signing immediately.
@@ -260,7 +260,7 @@ by `SIGN_MODE_TEXTUAL` when it is implemented.
260260

261261
### Unknown Field Filtering
262262

263-
Unknown fields in protobuf messages should generally be rejected by transaction
263+
Unknown fields in protobuf messages should generally be rejected by the transaction
264264
processors because:
265265

266266
* important data may be present in the unknown fields, that if ignored, will
@@ -415,7 +415,7 @@ To generate a signature in `SIGN_MODE_DIRECT_AUX` these steps would be followed:
415415
// PublicKey is included in SignDocAux :
416416
// 1. as a special case for multisig public keys. For multisig public keys,
417417
// the signer should use the top-level multisig public key they are signing
418-
// against, not their own public key. This is to prevent against a form
418+
// against, not their own public key. This is to prevent a form
419419
// of malleability where a signature could be taken out of context of the
420420
// multisig key that was intended to be signed for
421421
// 2. to guard against scenario where configuration information is encoded
@@ -431,7 +431,7 @@ To generate a signature in `SIGN_MODE_DIRECT_AUX` these steps would be followed:
431431
```
432432
433433
2. Sign the encoded `SignDocAux` bytes
434-
3. Send their signature and `SignerInfo` to primary signer who will then
434+
3. Send their signature and `SignerInfo` to the primary signer who will then
435435
sign and broadcast the final transaction (with `SIGN_MODE_DIRECT` and `AuthInfo`
436436
added) once enough signatures have been collected
437437

docs/architecture/adr-021-protobuf-query-encoding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ provide query methods that expose these interfaces via `google.protobuf.Any`.
5050
There is a concern on the transaction level that the overhead of `Any` is too
5151
high to justify its usage. However for queries this is not a concern, and
5252
providing generic module-level queries that use `Any` does not preclude apps
53-
from also providing app-level queries that return use the app-level `oneof`s.
53+
from also providing app-level queries that return using the app-level `oneof`s.
5454

5555
A hypothetical example for the `gov` module would look something like:
5656

@@ -205,7 +205,7 @@ type QueryClient interface {
205205
```
206206

207207
Via a small patch to gogo protobuf ([gogo/protobuf#675](https://github.com/gogo/protobuf/pull/675))
208-
we have tweaked the grpc codegen to use an interface rather than concrete type
208+
we have tweaked the grpc codegen to use an interface rather than a concrete type
209209
for the generated client struct. This allows us to also reuse the GRPC infrastructure
210210
for ABCI client queries.
211211

docs/architecture/adr-022-custom-panic-handling.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ It will also make `OutOfGas` case and `default` case one of the middlewares.
2727

2828
Our project has a sidecar service running alongside the blockchain node (smart contracts virtual machine). It is
2929
essential that node <-> sidecar connectivity stays stable for TXs processing. So when the communication breaks we need
30-
to crash the node and reboot it once the problem is solved. That behaviour makes node's state machine execution
30+
to crash the node and reboot it once the problem is solved. That behaviour makes the node's state machine execution
3131
deterministic. As all keeper panics are caught by runTx's `defer()` handler, we have to adjust the BaseApp code
3232
in order to customize it.
3333

@@ -37,8 +37,8 @@ in order to customize it.
3737

3838
#### Overview
3939

40-
Instead of hardcoding custom error handling into BaseApp we suggest using set of middlewares which can be customized
41-
externally and will allow developers use as many custom error handlers as they want. Implementation with tests
40+
Instead of hardcoding custom error handling into BaseApp we suggest using a set of middlewares which can be customized
41+
externally and will allow developers to use as many custom error handlers as they want. Implementation with tests
4242
can be found [here](https://github.com/cosmos/cosmos-sdk/pull/6053).
4343

4444
#### Implementation details
@@ -52,9 +52,9 @@ New `RecoveryHandler` type added. `recoveryObj` input argument is an object retu
5252
type RecoveryHandler func(recoveryObj interface{}) error
5353
```
5454

55-
Handler should type assert (or other methods) an object to define if object should be handled.
56-
`nil` should be returned if input object can't be handled by that `RecoveryHandler` (not a handler's target type).
57-
Not `nil` error should be returned if input object was handled and middleware chain execution should be stopped.
55+
Handler should type assert (or other methods) an object to define if the object should be handled.
56+
`nil` should be returned if the input object can't be handled by that `RecoveryHandler` (not a handler's target type).
57+
Not `nil` error should be returned if the input object was handled and the middleware chain execution should be stopped.
5858

5959
An example:
6060

@@ -196,11 +196,11 @@ This method would prepend handlers to an existing chain.
196196

197197
### Positive
198198

199-
* Developers of Cosmos SDK based projects can add custom panic handlers to:
199+
* Developers of Cosmos SDK-based projects can add custom panic handlers to:
200200
* add error context for custom panic sources (panic inside of custom keepers);
201201
* emit `panic()`: passthrough recovery object to the Tendermint core;
202202
* other necessary handling;
203-
* Developers can use standard Cosmos SDK `BaseApp` implementation, rather that rewriting it in their projects;
203+
* Developers can use standard Cosmos SDK `BaseApp` implementation, rather than rewriting it in their projects;
204204
* Proposed solution doesn't break the current "standard" `runTx()` flow;
205205

206206
### Negative

docs/architecture/adr-023-protobuf-naming.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ stable package (i.e. `v1` or `v2`) should be preferred
135135
* a package _should_ be marked as `alpha` _if and only if_ there are active discussions to remove
136136
or significantly alter the package in the near future
137137
* a package _should_ be marked as `beta` _if and only if_ there is an active discussion to
138-
significantly refactor/rework the functionality in the near future but not remove it
138+
significantly refactor/rework the functionality in the near future but do not remove it
139139
* modules _can and should_ have types in both stable (i.e. `v1` or `v2`) and unstable (`alpha` or `beta`) packages.
140140

141141
_`alpha` and `beta` should not be used to avoid responsibility for maintaining compatibility._
142142
Whenever code is released into the wild, especially on a blockchain, there is a high cost to changing things. In some
143143
cases, for instance with immutable smart contracts, a breaking change may be impossible to fix.
144144

145-
When marking something as `alpha` or `beta`, maintainers should ask the questions:
145+
When marking something as `alpha` or `beta`, maintainers should ask the following questions:
146146

147147
* what is the cost of asking others to change their code vs the benefit of us maintaining the optionality to change it?
148148
* what is the plan for moving this to `v1` and how will that affect users?
@@ -174,7 +174,7 @@ or `.v3`.
174174

175175
#### Adopt a short, unique top-level package name
176176

177-
Top-level packages should adopt a short name that is known to not collide with
177+
Top-level packages should adopt a short name that is known not to collide with
178178
other names in common usage within the Cosmos ecosystem. In the near future, a
179179
registry should be created to reserve and index top-level package names used
180180
within the Cosmos ecosystem. Because the Cosmos SDK is intended to provide
@@ -200,7 +200,7 @@ go package names, i.e. the `cosmos.bank` protobuf package will still live in
200200

201201
### Message Naming
202202

203-
Message type names should be as as concise possible without losing clarity. `sdk.Msg`
203+
Message type names should be as concise as possible without losing clarity. `sdk.Msg`
204204
types which are used in transactions will retain the `Msg` prefix as that provides
205205
helpful context.
206206

0 commit comments

Comments
 (0)