Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/cosmos/cosmos-sdk into likh…
Browse files Browse the repository at this point in the history
…ita/valQueue
  • Loading branch information
likhita-809 committed Sep 1, 2023
2 parents e037806 + 931ba5a commit d138a0a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 18 deletions.
9 changes: 8 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ body:
value: |
Thanks for taking the time to fill out this bug report!
Before smashing the submit button please review the template.
Please also ensure that this is not a duplicate issue :)
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search existing issues to avoid creating duplicates.
options:
- label: I have searched the existing issues
required: true

- type: markdown
attributes:
Expand Down
24 changes: 21 additions & 3 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ Following an exhaustive list:
* Package `client/grpc/tmservice` -> `client/grpc/cmtservice`

Additionally, the commands and flags mentioning `tendermint` have been renamed to `comet`.
However, these commands and flags are still supported for backward compatibility.
These commands and flags are still supported for backward compatibility.

For backward compatibility, the `**/tendermint/**` gRPC services are still supported.

Additionally, the SDK is starting its abstraction from CometBFT Go types thorought the codebase:

* The usage of the CometBFT logger has been replaced by the Cosmos SDK logger interface (`cosmossdk.io/log.Logger`).
* The usage of `github.com/cometbft/cometbft/libs/bytes.HexByte` has been replaced by `[]byte`.
* Usage of an application genesis (see [genutil](#xgenutil)).

#### Enable Vote Extensions

Expand Down Expand Up @@ -101,7 +102,6 @@ allows an application to define handlers for these methods via `ExtendVoteHandle
and `VerifyVoteExtensionHandler` respectively. Please see [here](https://docs.cosmos.network/v0.50/building-apps/vote-extensions)
for more info.


#### Upgrade

**Users using `depinject` / app v2 do not need any changes, this is abstracted for them.**
Expand Down Expand Up @@ -343,7 +343,25 @@ For ante handler construction via `ante.NewAnteHandler`, the field `ante.Handler

#### `x/capability`

Capability has been moved to [IBC-GO](https://github.com/cosmos/ibc-go). IBC v8 will contain the necessary changes to incorporate the new module location.
Capability has been moved to [IBC Go](https://github.com/cosmos/ibc-go). IBC v8 will contain the necessary changes to incorporate the new module location.

#### `x/genutil`

The Cosmos SDK has migrated from a CometBFT genesis to a application managed genesis file.
The genesis is now fully handled by `x/genutil`. This has no consequences for running chains:

* Importing a CometBFT genesis is still supported.
* Exporting a genesis now exports the genesis as an application genesis.

When needing to read an application genesis, use the following helpers from the `x/genutil/types` package:

```go
// AppGenesisFromReader reads the AppGenesis from the reader.
func AppGenesisFromReader(reader io.Reader) (*AppGenesis, error)

// AppGenesisFromFile reads the AppGenesis from the provided file.
func AppGenesisFromFile(genFile string) (*AppGenesis, error)
```

#### `x/gov`

Expand Down
28 changes: 16 additions & 12 deletions docs/docs/building-modules/01-module-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ There are 2 main application module interfaces:
The above interfaces are mostly embedding smaller interfaces (extension interfaces), that defines specific functionalities:

* (legacy) `module.HasName`: Allows the module to provide its own name for legacy purposes.
* (legacy) [`module.HasGenesis`](#modulehasgenesis) for inter-dependent genesis-related module functionalities.
* (legacy) [`module.HasABCIGenesis`](#modulehasabcigenesis) for inter-dependent genesis-related module functionalities.
* (legacy) [`module.HasGenesisBasics`](#modulehasgenesisbasics): The legacy interface for stateless genesis methods.
* (legacy) `module.GenesisOnlyAppModule`: Defines an `AppModule` that only has import/export functionality
* [`module.HasGenesis`](#modulehasgenesis) for inter-dependent genesis-related module functionalities.
* [`module.HasABCIGenesis`](#modulehasabcigenesis) for inter-dependent genesis-related module functionalities.
* [`appmodule.HasGenesis` / `module.HasGenesis`](#appmodulehasgenesis): The extension interface for stateful genesis methods.
* [`appmodule.HasBeginBlocker`](#hasbeginblocker): The extension interface that contains information about the `AppModule` and `BeginBlock`.
* [`appmodule.HasEndBlocker`](#hasendblocker): The extension interface that contains information about the `AppModule` and `EndBlock`.
Expand Down Expand Up @@ -83,7 +82,11 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/module/module.go

### Genesis

#### module.HasGenesisBasics
:::tip
For easily creating an `AppModule` that only has genesis functionalities, use `module.GenesisOnlyAppModule`.
:::

#### `module.HasGenesisBasics`

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/module/module.go#L76-L79
Expand All @@ -94,29 +97,30 @@ Let us go through the methods:
* `DefaultGenesis(codec.JSONCodec)`: Returns a default [`GenesisState`](./08-genesis.md#genesisstate) for the module, marshalled to `json.RawMessage`. The default `GenesisState` need to be defined by the module developer and is primarily used for testing.
* `ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage)`: Used to validate the `GenesisState` defined by a module, given in its `json.RawMessage` form. It will usually unmarshall the `json` before running a custom [`ValidateGenesis`](./08-genesis.md#validategenesis) function defined by the module developer.

#### module.HasGenesis
#### `module.HasGenesis`

`HasGenesis` is an extension interface for allowing modules to implement genesis functionalities.

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/module/module.go#L189-L193
https://github.com/cosmos/cosmos-sdk/blob/6ce2505/types/module/module.go#L184-L189
```

#### module.HasABCIGenesis`
#### `module.HasABCIGenesis`

`HasABCIGenesis` is an extension interface for allowing modules to implement genesis functionalities and returns validator set updates.

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/module/module.go#L189-L193
https://github.com/cosmos/cosmos-sdk/blob/6ce2505/types/module/module.go#L191-L196
```
<!-- TODO change link above after merge -->

## appmodule.HasGenesis
#### `appmodule.HasGenesis`

> Note: `appmodule.HasGenesis` is experimental and should be considered unstable, it is recommended to not use this interface at this time.
:::warning
`appmodule.HasGenesis` is experimental and should be considered unstable, it is recommended to not use this interface at this time.
:::

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/core/appmodule/genesis.go#L10-L24
https://github.com/cosmos/cosmos-sdk/blob/6ce2505/core/appmodule/genesis.go#L8-L25
```

### `AppModule`
Expand Down
22 changes: 21 additions & 1 deletion x/genutil/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,36 @@

## Concepts

The `genutil` package contains a variaety of genesis utility functionalities for usage within a blockchain application. Namely:
The `genutil` package contains a variety of genesis utility functionalities for usage within a blockchain application. Namely:

* Genesis transactions related (gentx)
* Commands for collection and creation of gentxs
* `InitChain` processing of gentxs
* Genesis file creation
* Genesis file validation
* Genesis file migration
* CometBFT related initialization
* Translation of an app genesis to a CometBFT genesis

## Genesis

Genutil contains the data structure that defines an application genesis.
An application genesis consist of a consensus genesis (g.e. CometBFT genesis) and application related genesis data.

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/x/genutil/types/genesis.go#L24-L34
```

The application genesis can then be translated to the consensus engine to the right format:

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/x/genutil/types/genesis.go#L126-L136
```

```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/server/start.go#L397-L407
```

## Client

### CLI
Expand Down
3 changes: 2 additions & 1 deletion x/upgrade/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ func (k Keeper) GetUpgradePlan(ctx context.Context) (plan types.Plan, err error)
func (k Keeper) setDone(ctx context.Context, name string) error {
store := k.storeService.OpenKVStore(ctx)
sdkCtx := sdk.UnwrapSDKContext(ctx)
fmt.Println("setting done", "height", sdkCtx.HeaderInfo().Height, "name", name)
k.Logger(ctx).Debug("setting done", "height", sdkCtx.HeaderInfo().Height, "name", name)

return store.Set(encodeDoneKey(name, sdkCtx.HeaderInfo().Height), []byte{1})
}

Expand Down

0 comments on commit d138a0a

Please sign in to comment.