Skip to content

Commit

Permalink
chore: update documentation from cosmos-sdk/docs (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 25, 2024
1 parent 0dfc11b commit e01f626
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 12 deletions.
18 changes: 9 additions & 9 deletions docs/build/building-apps/05-app-testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ We allow developers to take the state from their mainnet and run tests against t
We will be breaking down the steps to create a testnet from mainnet state.

```go
// InitMerlinAppForTestnet is broken down into two sections:
// InitSimAppForTestnet is broken down into two sections:
// Required Changes: Changes that, if not made, will cause the testnet to halt or panic
// Optional Changes: Changes to customize the testnet to one's liking (lower vote times, fund accounts, etc)
func InitMerlinAppForTestnet(app *MerlinApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *MerlinApp {
func InitSimAppForTestnet(app *SimApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *SimApp {
...
}
```
Expand Down Expand Up @@ -137,7 +137,7 @@ It is useful to create new accounts for your testing purposes. This avoids the n

defaultCoins := sdk.NewCoins(sdk.NewInt64Coin("ustake", 1000000000000))

localMerlinAccounts := []sdk.AccAddress{
localSimAppAccounts := []sdk.AccAddress{
sdk.MustAccAddressFromBech32("cosmos12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"),
sdk.MustAccAddressFromBech32("cosmos1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"),
sdk.MustAccAddressFromBech32("cosmos18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"),
Expand All @@ -151,8 +151,8 @@ It is useful to create new accounts for your testing purposes. This avoids the n
sdk.MustAccAddressFromBech32("cosmos14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"),
sdk.MustAccAddressFromBech32("cosmos1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")}

// Fund localMerlin accounts
for _, account := range localMerlinAccounts {
// Fund localSimApp accounts
for _, account := range localSimAppAccounts {
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins)
if err != nil {
tmos.Exit(err.Error())
Expand Down Expand Up @@ -195,7 +195,7 @@ Before we can run the testnet we must plug everything together.
in `root.go`, in the `initRootCmd` function we add:

```diff
server.AddCommands(rootCmd, simapp.DefaultNodeHome, newApp, createMerlinAppAndExport)
server.AddCommands(rootCmd, simapp.DefaultNodeHome, newApp, createSimAppAndExport)
+server.AddTestnetCreatorCommand(rootCmd, simapp.DefaultNodeHome, newTestnetApp)
```

Expand All @@ -205,7 +205,7 @@ Next we will add a newTestnetApp helper function:
// newTestnetApp starts by running the normal newApp method. From there, the app interface returned is modified in order
// for a testnet to be created from the provided app.
func newTestnetApp(logger log.Logger, db cometbftdb.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application {
// Create an app and type cast to an MerlinApp
// Create an app and type cast to an SimApp
app := newApp(logger, db, traceStore, appOpts)
simApp, ok := app.(*simapp.SimApp)
if !ok {
Expand All @@ -229,7 +229,7 @@ func newTestnetApp(logger log.Logger, db cometbftdb.DB, traceStore io.Writer, ap
panic("upgradeToTrigger is not of type string")
}

// Make modifications to the normal MerlinApp required to run the network locally
return meriln.InitMerlinAppForTestnet(simApp, newValAddr, newValPubKey, newOperatorAddress, upgradeToTrigger)
// Make modifications to the normal SimApp required to run the network locally
return simapp.InitSimAppForTestnet(simApp, newValAddr, newValPubKey, newOperatorAddress, upgradeToTrigger)
}
```
49 changes: 49 additions & 0 deletions docs/build/migrations/02-upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,55 @@ To find out more please read the [signer field](https://github.com/cosmos/cosmos

For ante handler construction via `ante.NewAnteHandler`, the field `ante.HandlerOptions.SignModeHandler` has been updated to `x/tx/signing/HandlerMap` from `x/auth/signing/SignModeHandler`. Callers typically fetch this value from `client.TxConfig.SignModeHandler()` (which is also changed) so this change should be transparent to most users.

##### Account Migration Guide: x/auth to x/accounts

Users can now migrate accounts from `x/auth` to `x/accounts` using the `auth.MsgMigrateAccount` message. Currently, this migration is only supported for `BaseAccount` due to security considerations.

###### Migration Process

The migration process allows an auth BaseAccount to migrate to any kind of x/accounts supported account type, here we will show how to migrate from a legacy x/auth `BaseAccount` to a `x/accounts` `BaseAccount`

####### Migrating to x/accounts/defaults/base

To migrate to the `BaseAccount` in `x/accounts`, follow these steps:

1. Send a `basev1.MsgInit` message.
2. This process allows you to:
- Switch to a new public key
- Reset your sequence number

> **Important**: If you intend to keep the same public key, ensure you use your current sequence number.

###### Example: x/auth.MsgMigrateAccount

Here's an example of the `x/auth.MsgMigrateAccount` message structure:

```json
{
"signer": "cosmos1w43tr39v3lzvxz969e4ty9a74rq9nw7563tqvy",
"account_type": "base",
"account_init_msg": {
"@type": "/cosmos.accounts.defaults.base.v1.MsgInit",
"pub_key": {
"@type": "/cosmos.crypto.secp256k1.PubKey",
"key": "AkeoE1z32tlQyE7xpx3v+JE9XJL0trVQBFoDCn0pGl3w"
},
"init_sequence": "100"
}
}
```

**Field Descriptions**

- `signer`: The address of the account you want to migrate from.
- `account_type`: The new account type you want to migrate to (depends on what's installed on the chain).
- `account_init_msg`: The custom initialization message for the new account.
- `@type`: Specifies the type of account (in this case, x/accounts base account).
- `pub_key`: The public key for the account. You can migrate to a different public key if desired.
- `init_sequence`: The new sequence number for the account.

> **Warning**: If you're keeping the same public key, make sure to use your current sequence number to prevent potential replay attacks.

#### `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.
Expand Down
16 changes: 13 additions & 3 deletions versioned_docs/version-0.50/user/run-node/01-run-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,26 @@ and set `rpc.laddr` in `config.toml` to the CometBFT node's RPC address.

## Logging

Logging provides a way to see what is going on with a node. By default the info level is set. This is a global level and all info logs will be outputted to the terminal. If you would like to filter specific logs to the terminal instead of all, then setting `module:log_level` is how this can work.
Logging provides a way to see what is going on with a node. By default the `info` level is set. This is a global level and all info logs will be outputted to the terminal.

If you would like to filter specific logs to the terminal instead of all, then setting `<module>:<log_level>` is how this can work.
Example:

In config.toml:
In `config.toml`:

```toml
log_level: "state:info,p2p:info,consensus:info,x/staking:info,x/ibc:info,*error"
log_level: "state:info,p2p:info,consensus:info,x/staking:info,x/ibc:info,*:error"
```

Or directly in the command line:

```bash
<appd> start --log_level "state:info,p2p:info,consensus:info,x/staking:info,x/ibc:info,*:error"
```

The above will show info logs for the state, p2p, consensus, staking, and ibc modules, and error logs for all other modules.
When no log filtering is required, simply use one of the supported global log levels: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `panic` or `disabled`.

## State Sync

State sync is the act in which a node syncs the latest or close to the latest state of a blockchain. This is useful for users who don't want to sync all the blocks in history. Read more in [CometBFT documentation](https://docs.cometbft.com/v0.37/core/state-sync).
Expand Down

0 comments on commit e01f626

Please sign in to comment.