Skip to content

Commit

Permalink
updates and dependabot (#65)
Browse files Browse the repository at this point in the history
* updates and dependabot

* fix build

* fix build
  • Loading branch information
tac0turtle authored Oct 9, 2023
1 parent 32641a8 commit 7771f96
Show file tree
Hide file tree
Showing 16 changed files with 208 additions and 97 deletions.
9 changes: 9 additions & 0 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'yarn'
directory: '/'
schedule:
interval: 'daily'
12 changes: 6 additions & 6 deletions docs/build/building-apps/04-vote-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ sidebar_position: 1
# Vote Extensions

:::note Synopsis
This sections describes how the application can define and use vote extensions
This section describes how the application can define and use vote extensions
defined in ABCI++.
:::

## Extend Vote

ABCI++ allows an application to extend a pre-commit vote with arbitrary data. This
process does NOT have be deterministic and the data returned can be unique to the
process does NOT have to be deterministic, and the data returned can be unique to the
validator process. The Cosmos SDK defines `baseapp.ExtendVoteHandler`:

```go
Expand Down Expand Up @@ -62,13 +62,13 @@ these vote extensions manually in the block proposal itself. This can be done by
"injecting" them into the block proposal, since the `Txs` field in `PrepareProposal`
is just a slice of byte slices.

`FinalizeBlock` will ignore any byte slice that doesn't implement an `sdk.Tx` so
`FinalizeBlock` will ignore any byte slice that doesn't implement an `sdk.Tx`, so
any injected vote extensions will safely be ignored in `FinalizeBlock`. For more
details on propagation, see the [ABCI++ 2.0 ADR](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-064-abci-2.0.md#vote-extension-propagation--verification).

### Recovery of injected Vote Extensions

As stated before, vote extensions can be injected in a block proposal (along with
As stated before, vote extensions can be injected into a block proposal (along with
other transactions in the `Txs` field). The Cosmos SDK provides a pre-FinalizeBlock
hook to allow applications to recover vote extensions, perform any necessary
computation on them, and then store the results in the cached store. These results
Expand Down Expand Up @@ -102,7 +102,7 @@ app.SetPreBlocker(func(ctx sdk.Context, req *abci.RequestFinalizeBlock) error {

```

Then in an app's module the application can retrieve the result of the computation
Then, in an app's module, the application can retrieve the result of the computation
of vote extensions from the cached store:

```go
Expand All @@ -118,4 +118,4 @@ func (k Keeper) BeginBlocker(ctx context.Context) error {

return nil
}
```
```
6 changes: 5 additions & 1 deletion docs/build/migrations/02-upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Note, always read the **SimApp** section for more information on application wir

### Params

Params Migrations were removed. It is required to migrate to 0.50 prior to upgrading to .51.
* Params Migrations were removed. It is required to migrate to 0.50 prior to upgrading to .51.

### SimApp

Expand All @@ -34,6 +34,10 @@ Refer to SimApp `root_v2.go` and `root.go` for an example with an app v2 and a l

### Modules

#### Params

A standalone Go module was created and it is accessible at "cosmossdk.io/x/params".

#### `**all**`

##### Genesis Interface
Expand Down
1 change: 1 addition & 0 deletions docs/build/modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Here are some production-grade modules that can be used in Cosmos SDK applicatio
* [Governance](./gov/README.md) - On-chain proposals and voting.
* [Mint](./mint/README.md) - Creation of new units of staking token.
* [Params](./params/README.md) - Globally available parameter store.
* [Protocolpool](./protocolpool/README.md) - Functionalities handling community pool funds.
* [Slashing](./slashing/README.md) - Validator punishment mechanisms.
* [Staking](./staking/README.md) - Proof-of-Stake layer for public blockchains.
* [Upgrade](./upgrade/README.md) - Software upgrades handling and coordination.
Expand Down
73 changes: 61 additions & 12 deletions docs/build/modules/protocolpool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,79 @@ sidebar_position: 1

# `x/protocolpool`

Functionality to handle community pool funds. This provides a separate module account for community pool making it easier to track the pool assets. We no longer track community pool assets in distribution module, but instead in this protocolpool module. Funds are migrated from the distribution module's community pool to protocolpool's module account.

## Concepts

## State
Protopool is a module that handle functionality around community pool funds. This provides a separate module account for community pool making it easier to track the pool assets. We no longer track community pool assets in distribution module, but instead in this protocolpool module. Funds are migrated from the distribution module's community pool to protocolpool's module account.

## State Transitions

### FundCommunityPool

FundCommunityPool can be called by any valid account to send funds to the protocolpool module account.

```protobuf
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);
```

### CommunityPoolSpend

CommunityPoolSpend can be called by the module authority (default governance module account) or any account with authorization to spend funds from the protocolpool module account to a receiver address.

```protobuf
// CommunityPoolSpend defines a governance operation for sending tokens from
// the community pool in the x/protocolpool module to another account, which
// could be the governance module itself. The authority is defined in the
// keeper.
rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse);
```

## Messages

## Begin Block
### MsgFundCommunityPool

## End Block
This message sends coins directly from the sender to the community pool.

## Hooks
:::tip
If you know the protocolpool module account address, you can directly use bank `send` transaction instead.
::::

## Events
```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/9dd34510e27376005e7e7ff3628eab9dbc8ad6dc/proto/cosmos/protocolpool/v1/tx.proto#L31-L41
```

## Client
* The msg will fail if the amount cannot be transferred from the sender to the protocolpool module account.

## Params
```go
func (k Keeper) FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error {
return k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amount)
}
```

## Future Improvements
### MsgCommunityPoolSpend

This message distributes funds from the protocolpool module account to the recipient using `DistributeFromFeePool` keeper method.

```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/9dd34510e27376005e7e7ff3628eab9dbc8ad6dc/proto/cosmos/protocolpool/v1/tx.proto#L46-L59
```

The message will fail under the following conditions:

* The amount cannot be transferred to the recipient from the protocolpool module account.
* The `recipient` address is restricted

```go
func (k Keeper) DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error {
return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, receiveAddr, amount)
}
```

## Client

## Tests
It takes the advantage of `AutoCLI`

## Appendix
```go reference
https://github.com/cosmos/cosmos-sdk/blob/9dd34510e27376005e7e7ff3628eab9dbc8ad6dc/x/protocolpool/autocli.go
```
50 changes: 25 additions & 25 deletions docs/build/modules/staking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ Store entries prefixed with "Last" must remain unchanged until EndBlock.

### ValidatorUpdates

ValidatorUpdates contains the validator updates returned to ABCI at the end of every block.
The values are overwritten in every block.
ValidatorUpdates contains the validator updates returned to ABCI at the end of every block.
The values are overwritten in every block.

* ValidatorUpdates `0x61 -> []abci.ValidatorUpdate`

### UnbondingID

UnbondingID stores the ID of the latest unbonding operation. It enables to create unique IDs for unbonding operation, i.e., UnbondingID is incremented every time a new unbonding operation (validator unbonding, unbonding delegation, redelegation) is initiated.
UnbondingID stores the ID of the latest unbonding operation. It enables creating unique IDs for unbonding operations, i.e., UnbondingID is incremented every time a new unbonding operation (validator unbonding, unbonding delegation, redelegation) is initiated.

* UnbondingID: `0x37 -> uint64`

Expand Down Expand Up @@ -115,7 +115,7 @@ Validators can have one of three statuses
before their tokens are moved to their accounts from the `BondedPool`.

:::warning
Tombstoning is permanent, once tombstoned a validators consensus key can not be reused within the chain where the tombstoning happened.
Tombstoning is permanent, once tombstoned a validator's consensus key can not be reused within the chain where the tombstoning happened.
:::

Validators objects should be primarily stored and accessed by the
Expand All @@ -137,7 +137,7 @@ associated validator, where the public key of that validator can change in the
future. Delegators can refer to the immutable operator of the validator, without
concern for the changing public key.

`ValidatorsByUnbondingID` is an additional index that enables lookups for
`ValidatorsByUnbondingID` is an additional index that enables lookups for
validators by the unbonding IDs corresponding to their current unbonding.

`ValidatorByConsAddr` is an additional index that enables lookups for slashing.
Expand Down Expand Up @@ -182,7 +182,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1bet

#### Delegator Shares

When one Delegates tokens to a Validator they are issued a number of delegator shares based on a
When one delegates tokens to a Validator, they are issued a number of delegator shares based on a
dynamic exchange rate, calculated as follows from the total number of tokens delegated to the
validator and the number of shares issued so far:

Expand All @@ -196,7 +196,7 @@ hold and the inverse exchange rate:

These `Shares` are simply an accounting mechanism. They are not a fungible asset. The reason for
this mechanism is to simplify the accounting around slashing. Rather than iteratively slashing the
tokens of every delegation entry, instead the Validators total bonded tokens can be slashed,
tokens of every delegation entry, instead the Validator's total bonded tokens can be slashed,
effectively reducing the value of each issued delegator share.

### UnbondingDelegation
Expand All @@ -217,8 +217,8 @@ detected.
unbonding delegations associated with a given validator that need to be
slashed.

`UnbondingDelegationByUnbondingId` is an additional index that enables
lookups for unbonding delegations by the unbonding IDs of the containing
`UnbondingDelegationByUnbondingId` is an additional index that enables
lookups for unbonding delegations by the unbonding IDs of the containing
unbonding delegation entries.


Expand Down Expand Up @@ -254,8 +254,8 @@ The first map here is used for queries, to lookup all redelegations for a given
delegator. The second map is used for slashing based on the `ValidatorSrcAddr`,
while the third map is for slashing based on the `ValidatorDstAddr`.

`RedelegationByUnbondingId` is an additional index that enables
lookups for redelegations by the unbonding IDs of the containing
`RedelegationByUnbondingId` is an additional index that enables
lookups for redelegations by the unbonding IDs of the containing
redelegation entries.

A redelegation object is created every time a redelegation occurs. To prevent
Expand All @@ -272,13 +272,13 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1bet

### Queues

All queues objects are sorted by timestamp. The time used within any queue is
first rounded to the nearest nanosecond then sorted. The sortable time format
All queue objects are sorted by timestamp. The time used within any queue is
firstly converted to UTC, rounded to the nearest nanosecond then sorted. The sortable time format
used is a slight modification of the RFC3339Nano and uses the format string
`"2006-01-02T15:04:05.000000000"`. Notably this format:

* right pads all zeros
* drops the time zone info (uses UTC)
* drops the time zone info (we already use UTC)

In all cases, the stored timestamp represents the maturation time of the queue
element.
Expand Down Expand Up @@ -312,7 +312,7 @@ queue is kept.

* ValidatorQueueTime: `0x43 | format(time) -> []sdk.ValAddress`

The stored object as each key is an array of validator operator addresses from
The stored object by each key is an array of validator operator addresses from
which the validator object can be accessed. Typically it is expected that only
a single validator record will be associated with a given timestamp however it is possible
that multiple validators exist in the queue at the same location.
Expand Down Expand Up @@ -415,16 +415,16 @@ Delegation may be called.
shares from the `BondedPool` to the `NotBondedPool` `ModuleAccount`
* remove the validator if it is unbonded and there are no more delegation shares.
* remove the validator if it is unbonded and there are no more delegation shares
* get a unique `unbondingId` and map it to the `UnbondingDelegationEntry` in `UnbondingDelegationByUnbondingId`
* get a unique `unbondingId` and map it to the `UnbondingDelegationEntry` in `UnbondingDelegationByUnbondingId`
* call the `AfterUnbondingInitiated(unbondingId)` hook
* add the unbonding delegation to `UnbondingDelegationQueue` with the completion time set to `UnbondingTime`

#### Cancel an `UnbondingDelegation` Entry
#### Cancel an `UnbondingDelegation` Entry

When a `cancel unbond delegation` occurs both the `validator`, the `delegation` and an `UnbondingDelegationQueue` state will be updated.

* if cancel unbonding delegation amount equals to the `UnbondingDelegation` entry `balance`, then the `UnbondingDelegation` entry deleted from `UnbondingDelegationQueue`.
* if the `cancel unbonding delegation amount is less than the `UnbondingDelegation` entry balance, then the `UnbondingDelegation` entry will be updated with new balance in the `UnbondingDelegationQueue`.
* if the `cancel unbonding delegation amount is less than the `UnbondingDelegation` entry balance, then the `UnbondingDelegation` entry will be updated with new balance in the `UnbondingDelegationQueue`.
* cancel `amount` is [Delegated](#delegations) back to the original `validator`.

#### Complete Unbonding
Expand Down Expand Up @@ -661,7 +661,7 @@ This message is expected to fail if:

When this message is processed the following actions occur:

* if the `unbondingDelegation` Entry balance is zero
* if the `unbondingDelegation` Entry balance is zero
* in this condition `unbondingDelegation` entry will be removed from `unbondingDelegationQueue`.
* otherwise `unbondingDelegationQueue` will be updated with new `unbondingDelegation` entry balance and initial balance
* the validator's `DelegatorShares` and the delegation's `Shares` are both increased by the message `Amount`.
Expand Down Expand Up @@ -791,11 +791,11 @@ validators that still have remaining delegations, the `validator.Status` is
switched from `types.Unbonding` to
`types.Unbonded`.

Unbonding operations can be put on hold by external modules via the `PutUnbondingOnHold(unbondingId)` method.
As a result, an unbonding operation (e.g., an unbonding delegation) that is on hold, cannot complete
even if it reaches maturity. For an unbonding operation with `unbondingId` to eventually complete
(after it reaches maturity), every call to `PutUnbondingOnHold(unbondingId)` must be matched
by a call to `UnbondingCanComplete(unbondingId)`.
Unbonding operations can be put on hold by external modules via the `PutUnbondingOnHold(unbondingId)` method.
As a result, an unbonding operation (e.g., an unbonding delegation) that is on hold, cannot complete
even if it reaches maturity. For an unbonding operation with `unbondingId` to eventually complete
(after it reaches maturity), every call to `PutUnbondingOnHold(unbondingId)` must be matched
by a call to `UnbondingCanComplete(unbondingId)`.

#### Unbonding Delegations

Expand Down Expand Up @@ -1666,7 +1666,7 @@ Example:
simd tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from mykey
```

##### cancel unbond
##### cancel unbond

The command `cancel-unbond` allow users to cancel the unbonding delegation entry and delegate back to the original validator.

Expand Down
17 changes: 12 additions & 5 deletions docs/build/tooling/02-confix.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ To use Confix standalone, without having to add it in your application, install
go install cosmossdk.io/tools/confix/cmd/confix@latest
```

:::warning
Currently, due to the replace directive in the Confix go.mod, it is not possible to use `go install`.
Building from source or importing in an application is required until that replace directive is removed.
:::

Alternatively, for building from source, simply run `make confix`. The binary will be located in `tools/confix`.

## Usage
Expand Down Expand Up @@ -120,6 +115,18 @@ simd config diff v0.47 # gets the diff between defaultHome/config/app.toml and t
confix diff v0.47 ~/.simapp/config/app.toml # gets the diff between ~/.simapp/config/app.toml and the latest v0.47 config
```

### View

View a configuration file, e.g:

```shell
simd config view client # views the current app client config
```

```shell
confix view ~/.simapp/config/client.toml # views the current app client conf
```

### Maintainer

At each SDK modification of the default configuration, add the default SDK config under `data/v0.XX-app.toml`.
Expand Down
2 changes: 1 addition & 1 deletion docs/learn/advanced/00-baseapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/abci_utils.go#

### VerifyVoteExtension

`VerifyVoteExtension` allows an application to verify that the data returned by `ExtendVote` is valid. This process does NOT have to be deterministic and the data returned can be unique to the validator process.
`VerifyVoteExtension` allows an application to verify that the data returned by `ExtendVote` is valid. This process MUST be deterministic. Moreover, the value of ResponseVerifyVoteExtension.status MUST exclusively depend on the parameters passed in the call to RequestVerifyVoteExtension, and the last committed Application state.

In the Cosmos-SDK this is implemented as a NoOp:

Expand Down
Loading

0 comments on commit 7771f96

Please sign in to comment.