Skip to content

Commit

Permalink
Merge branch 'main' into ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani authored Oct 27, 2022
2 parents 992ea8e + 4f93f23 commit 94b6955
Show file tree
Hide file tree
Showing 10 changed files with 431 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

test-e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
timeout-minutes: 45
steps:
- uses: actions/[email protected]
with:
Expand Down
3 changes: 1 addition & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"github.com/cosmos/gaia/v8/app/keepers"
gaiaappparams "github.com/cosmos/gaia/v8/app/params"
"github.com/cosmos/gaia/v8/app/upgrades"
v7 "github.com/cosmos/gaia/v8/app/upgrades/v7"
v8 "github.com/cosmos/gaia/v8/app/upgrades/v8"
"github.com/cosmos/gaia/v8/x/globalfee"
gaiafeeante "github.com/cosmos/gaia/v8/x/globalfee/ante"
Expand All @@ -55,7 +54,7 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v7.Upgrade, v8.Upgrade}
Upgrades = []upgrades.Upgrade{v8.Upgrade}
)

var (
Expand Down
11 changes: 10 additions & 1 deletion app/upgrades/v8/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package v8

import (
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/x/group"
icacontrollertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"

"github.com/cosmos/gaia/v8/app/upgrades"
"github.com/cosmos/gaia/v8/x/globalfee"
icamauth "github.com/cosmos/gaia/v8/x/icamauth/types"
)

const (
Expand All @@ -15,6 +19,11 @@ var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
Added: []string{
globalfee.ModuleName,
group.ModuleName,
icamauth.ModuleName,
icacontrollertypes.StoreKey,
},
},
}
21 changes: 19 additions & 2 deletions app/upgrades/v8/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icacontrollertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/types"

"github.com/cosmos/gaia/v8/app/keepers"
)
Expand All @@ -16,8 +18,6 @@ func CreateUpgradeHandler(
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("start to run module migrations...")

// Add atom name and symbol into the bank keeper
atomMetaData, found := keepers.BankKeeper.GetDenomMetaData(ctx, "uatom")
if !found {
Expand All @@ -27,6 +27,23 @@ func CreateUpgradeHandler(
atomMetaData.Symbol = "ATOM"
keepers.BankKeeper.SetDenomMetaData(ctx, atomMetaData)

// Enable controller chain
controllerParams := icacontrollertypes.Params{
ControllerEnabled: true,
}

// Change hostParams allow_messages = [*] instead of whitelisting individual messages
hostParams := icahosttypes.Params{
HostEnabled: true,
AllowMessages: []string{"*"},
}

// Update params for host & controller keepers
keepers.ICAHostKeeper.SetParams(ctx, hostParams)
keepers.ICAControllerKeeper.SetParams(ctx, controllerParams)

ctx.Logger().Info("start to run module migrations...")

return mm.RunMigrations(ctx, configurator, vm)
}
}
11 changes: 11 additions & 0 deletions docs/modules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Gaia Modules

Here you can find an overview of the modules included on the Cosmos Hub (gaia) blockchain with relevant info and
links for each one.

Updated Modules in V8 Rho
- [Gov](./gov.md)

## New Modules in Rho V8
- [Group](./group.md)

227 changes: 227 additions & 0 deletions docs/modules/gov.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
# Gov Module

**The `gov` module enables token holders to participate in on-chain governance.**

## Overview

Users can submit and vote on the following types of governance proposals:

1. Software Upgrade Proposal
2. Signaling Proposal
3. Param Change Proposal
4. Community Spend Proposal
5. IBC Client Upgrade Proposal

See the following resources for additional information on using the `gov` module.
- [Cosmos SDK Gov Module Docs](https://docs.cosmos.network/v0.46/modules/gov/)
- [Hub Gov Tutorial]()

#### Forum

The **[Cosmos Hub Forum](https://forum.cosmos.network/)** is the main discussion space for Cosmos Hub Governance. Community members can discuss, share thoughts, and solicit feedback for ideas, drafts and upcoming or active proposals. For more information on active Cosmos Hub governance, visit the [proposal directory](https://forum.cosmos.network/c/hub-proposals/25), or the [forum participation guide](https://forum.cosmos.network/t/start-here-participating-in-the-forum/5993) to get started.

#### Submission Updates

Additionally the new gov module now accommodates proposals with multiple arbitrary message execution. For `v0.46` of the Cosmos SDK, only `MsgSend`, `MsgSoftwareUpgrade`, and `MsgCancelUpgrade` are supported by executing `submit-proposal`. Signaling proposals can also be submitted with the new api by leaving the messages field empty and populating the metadata field with the corresponding proposal text. The remaining proposal types must use `submit-legacy-proposal` until more message types are supported.

This means that a single proposal could execute multiple bank send messages, or both a software upgrade and bank send message.

**Note:** It is only possible to execute a MsgSend transaction if the `gov` module account holds a token balance. Theoretically there could be a community spend proposal to fund the `gov` module account, or assign staking rewards to the account as well.

#### Voting

Once a proposal has been submitted and the token deposit has reached the `min_deposit` amount, the voting period begins. Users can vote with a single option like `yes`, `no`, `no_with_veto`, and `abstain`. Users can also split their vote with `weighted-vote`. This means a token holder could submit a weighted vote for a proposal with 0.5 of their vote counting as `yes`, 0.1 `no`, and 0.4 `abstain`.

## Governance Lifecycle

**Network Parameters**

The network parameters define the time and threshold constraints of the governance lifecycle on the Cosmos Hub.

- `voting_period` - Denominated in nanoseconds; the amount of time from the end of the deposit period that token holders have to vote on an active proposal.
- `tally_params` - Vote tally Parameters
- `quorum` - Minimum percentage of total voting power that must be cast in order for a proposal to be valid.
- `threshold` - Minimum percentage of `yes` out of the total votes for the proposal to pass.
- `veto_threshold` - Minimum percentage of total votes cast for the proposal to be vetoed and fail.
- `deposit_params` - Deposit Parameters
- `min_deposit` - Minimum denominated token amount deposited to a proposal in order for it to move to voting.
- `max_deposit_period` - Maximum amount of time denominated in nanoseconds that a proposal can accept deposits.


Run `gaiad q gov params` to retrieve the current network parameters for the Cosmos Hub

```json
{
"voting_params": {
"voting_period": "1209600000000000"
},
"tally_params": {
"quorum": "0.400000000000000000",
"threshold": "0.500000000000000000",
"veto_threshold": "0.334000000000000000"
},
"deposit_params": {
"min_deposit": [
{
"denom": "uatom",
"amount": "64000000"
}
],
"max_deposit_period": "1209600000000000"
}
}
```

**1 - Proposal Submission**

After discussion on the [Cosmos Hub Forum](https://forum.cosmos.network/c/hub-proposals/25), a proposal is ready for submission. Users can submit their proposal with a partial or full deposit.

**2 - Deposit Period**

The current deposit period duration is 2 weeks. A proposal must have passed the `min_deposit` threshold of 64 atoms to be voted on.

**2 - Voting Period**

The current voting period duration is 2 weeks. A proposal must have met a 40% quorum of total voting power and 50% yes votes out of the total number of votes to pass. Conversely, a proposal can fail if it surpasses a 33% veto out of total number of votes.

## Usage

### New Proposals
To submit a new `gov` proposal, expect to run `gaiad tx gov submit-proposal [path/to/proposal.json] [flags]`. See below for a few examples of different proposal json definitions:

**`MsgSend` Proposal**
```json
{
"messages": [
{
"@type": "/cosmos.bank.v1beta1.MsgSend",
"from_address": "cosmos10....",
"to_address": "cosmos1w...",
"amount":[{"denom": "uatom","amount": "100"}]
}
],
"metadata": "VGVzdGluZyAxLCAyLCAzIQ==",
"deposit": "5000uatom"
}
```

**`SoftwareUpgrade` Proposal**
> Note: The authority in this proposal must be the gov module address.
```json
{
"messages": [
{
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
"authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn",
"plan": {
"name": "rho",
"height": 20,
"info": "More information..."
}
}
],
"metadata": "VGVzdGluZyAxLCAyLCAzIQ==",
"deposit": "5000uatom"
}
```

**`CancelSoftwareUpgrade` Proposal**

```json
{
"messages": [
{
"@type": "/cosmos.upgrade.v1beta1.MsgCancelUpgrade",
"authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn"
}
],
"metadata": "VGVzdGluZyAxLCAyLCAzIQ==",
"deposit": "5000uatom"
}
```

**Signaling Proposal**

A simple signaling/text proposal can use the new `submit-proposal` by populating the metadata field with the appropriate text and leaving the `messages` collection empty.

```json
{
"messages": [],
"metadata": "Proposal Text Link",
"deposit": "1000000uatom"
}
```

### Legacy Proposals
For the remaining proposal types, it is necessary to use the `legacy-proposal` api. The available sub-commands are:
```
cancel-software-upgrade Cancel the current software upgrade proposal
community-pool-spend Submit a community pool spend proposal
ibc-upgrade Submit an IBC upgrade proposal
param-change Submit a parameter change proposal
software-upgrade Submit a software upgrade proposal
update-client Submit an update IBC client proposal
```

It is possible to submit legacy proposals with each field in the command. However, it is also possible to pass a json file with the proposal field definitions instead. See the following legacy proposal cli api definitions:

**Community Spend Proposal**

`gaiad tx gov submit-legacy-proposal community-pool-spend "path/to/proposal.json" --from signing_key [flags]`
```json
{
"title": "Community Pool Spend",
"description": "Fund Gov Module Account",
"recipient": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn",
"amount": "10000000uatom",
"deposit": "1000000uatom"
}
```

**Param Change**

`gaiad tx gov submit-legacy-proposal param-change "path/to/proposal.json" --from signing_key [flags]`

```json
{
"title": "Staking Param Change",
"description": "Update max validators",
"changes": [
{
"subspace": "staking",
"key": "MaxValidators",
"value": 105
}
],
"deposit": "1000000uatom"
}
```

**IBC Client Update**

`gaiad tx gov submit-legacy-proposal update-client [subject-client-id] [substitute-client-id] [flags]`

**IBC Upgrade**
See the [IBC Upgrade via Gov Proposal Docs](https://ibc.cosmos.network/main/ibc/proposals.html) for more a more comprehensive guide.

` gaiad tx gov submit-legacy-proposal ibc-upgrade [name] [height] [path/to/upgraded_client_state.json] [flags]`

### Queries

Current CLI Queries expose the following information. For more information on using the query cli api visit the [SDK Gov Module Docs](https://docs.cosmos.network/v0.46/modules/gov/07_client.html#query)
```
deposit Query details of a deposit
deposits Query deposits on a proposal
param Query the parameters (voting|tallying|deposit) of the governance process
params Query the parameters of the governance process
proposal Query details of a single proposal
proposals Query proposals with optional filters
proposer Query the proposer of a governance proposal
tally Get the tally of a proposal vote
vote Query details of a single vote
votes Query votes on a proposal
```

### HTTP & gRPC
Queries via the gRPC and REST endpoints are available if enabled in `app.toml`. See the [REST](https://docs.cosmos.network/v0.46/modules/gov/07_client.html#rest) and [gRPC](https://docs.cosmos.network/v0.46/modules/gov/07_client.html#grpc) specs in the SDK docs about both api definitions.
Loading

0 comments on commit 94b6955

Please sign in to comment.