bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 73쪽
--yes
```
Check progress with `exampled query gov proposals`.
<Note>
The local chain uses the default 48 hour `voting_period`, so a proposal submitted this way sits in
`PROPOSAL_STATUS_VOTING_PERIOD` for two days and the params do not change during a normal dev session.
</Note>
To watch a param change actually take effect locally, shorten the voting period. Editing
`genesis.json` before `make start` does not work, because `scripts/local_node.sh` deletes the whole
home directory on every run. Let `make start` create the chain first, then stop it and edit in place:
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
# 1. Let make start create ~/.exampleapp, then stop it with Ctrl+C
make start
# 2. Lower both governance voting periods in the generated genesis.
# app_state.gov.params.voting_period, for example "20s"
# app_state.gov.params.expedited_voting_period must stay strictly shorter, for example "10s"
vi ~/.exampleapp/config/genesis.json
# 3. Wipe block history so the edited genesis is re-read, keeping keys and config
exampled comet unsafe-reset-all
# 4. Start the node directly. Do not use make start again, it would delete your edit
exampled start
```
Submit and vote as above, wait out the shortened period, and the proposal reaches
`PROPOSAL_STATUS_PASSED` and `exampled query counter params` reflects the new values.
`exampled tx gov draft-proposal` can generate a skeleton, but it is an interactive terminal picker rather
than a scriptable command. Its top-level list offers only `text`, `community-pool-spend`,
`software-upgrade`, `cancel-software-upgrade`, and `other`, and choosing `other` opens a scroll-only list
of fully qualified message type URLs that typing does not filter. Writing the JSON by hand, as above, is
the more direct path.
### Useful flags
These flags are the ones you'll use most often while iterating locally.
| Flag | Description |
| - | - |
| `--from` | Key name or address to sign with |
| `--chain-id` | Chain ID (use `demo` for local) |
| `--yes` | Skip confirmation prompt |
| `--gas` | Gas limit for the transaction |
| `--node` | RPC endpoint (default: `tcp://localhost:26657`) |
| `--output json` | Output response as JSON |
## Node Configuration
When you run `make start`, the chain creates `~/.exampleapp/config/` automatically and initializes two config files inside it:
| File | What it controls |
| - | - |
| `app.toml` | SDK application settings: gas prices, pruning, API/gRPC servers, telemetry |
| `config.toml` | CometBFT settings: peer networking, consensus timeouts, mempool, RPC |
### app.toml
The most common settings to change during development:
| Setting | Default | Description |
| - | - | - |
| `minimum-gas-prices` | `"0stake"` | Minimum fee the node accepts before processing a transaction. Set by this chain in `exampled/cmd/commands.go`, not by the SDK, whose own default is empty |
| `pruning` | `"default"` | How much historical state to keep (`default`, `nothing`, `everything`, `custom`) |
| `api.enable` | `true` after `make start` | Enables the REST API on port 1317. The SDK default is `false`; `scripts/local_node.sh` turns it on for local development |
| `grpc.enable` | `true` | Enables the gRPC server on port 9090 |
### config.toml
The settings most likely to change during development:
| Setting | Default | Description |
| - | - | - |
| `moniker` | `"test"` | Human-readable name for the node |
| `log_level` | `"info"` | Log verbosity (`debug`, `info`, `error`) |
| `consensus.timeout_commit` | `"5s"` | How long to wait after a block is committed before starting the next one. The SDK raises CometBFT's own 1s default to 5s |
| `p2p.seeds` | `""` | Seed nodes to connect to on a live network |
| `p2p.persistent_peers` | `""` | Peers to maintain permanent connections to |
## Unit tests
Start here when you want fast feedback on module logic without running a chain. These tests isolate the [keeper](/sdk/latest/learn/concepts/testing#keeper-unit-tests) and gRPC servers from the rest of the app.
The unit test logic lives in the counter keeper package on `main`: the shared suite setup is in [x/counter/keeper/keeper\_test.go](https://github.com/cosmos/example/blob/main/x/counter/keeper/keeper_test.go), message-path tests are in [x/counter/keeper/msg\_server\_test.go](https://github.com/cosmos/example/blob/main/x/counter/keeper/msg_server_test.go), and query-path tests are in [x/counter/keeper/query\_server\_test.go](https://github.com/cosmos/example/blob/main/x/counter/keeper/query_server_test.go).
The keeper test suite covers the keeper, msg server, and query server in isolation using an in-memory store and a mock bank keeper. No running chain is required.
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
go test ./x/counter/...
```
To run with verbose output:
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
go test -v ./x/counter/...
```
To run a specific test:
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
go test -v -run TestKeeperTestSuite/TestAddCount ./x/counter/...
```
The test suite is structured around three files:
| File | Tests |
| - | - |
| `keeper/keeper_test.go` | Genesis, `GetCount`, `AddCount`, `SetParams` |
| `keeper/msg_server_test.go` | `MsgAdd`, event emission, `MsgUpdateParams` |
| `keeper/query_server_test.go` | `QueryCount`, `QueryParams` |
## E2E tests
Run [E2E tests](/sdk/latest/learn/concepts/testing#integration-tests) when you want to verify the full request path against a real node. They give you higher confidence than unit tests, but take longer to complete.
The E2E logic lives on `main` in [tests/counter\_test.go](https://github.com/cosmos/example/blob/main/tests/counter_test.go), which starts an in-process network, builds signed transactions, and verifies query results. The shared network fixture it uses is defined in [tests/test\_helpers.go](https://github.com/cosmos/example/blob/main/tests/test_helpers.go).
The E2E test suite starts a real in-process validator network and submits actual transactions against it. This tests the full stack: transaction encoding, message routing, keeper logic, and query responses.
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
go test -v -run TestE2ETestSuite ./tests/...
```
E2E tests take longer than unit tests because they spin up a real node. Run them before merging significant changes.
## Simulation tests
[Simulation tests](/sdk/latest/learn/concepts/testing#simulation-tests) stress the chain with randomized activity to catch edge cases that targeted tests can miss. In this repo, that simulation flow is built with `simsx`, the Cosmos SDK's higher-level simulation framework for defining random on-chain activity at the module level.
The top-level simulation test commands on `main` run through [sim\_test.go](https://github.com/cosmos/example/blob/main/sim_test.go). The counter module's `simsx` registration lives in [x/counter/module.go](https://github.com/cosmos/example/blob/main/x/counter/module.go), the random `MsgAdd` generation lives in [x/counter/simulation/msg\_factory.go](https://github.com/cosmos/example/blob/main/x/counter/simulation/msg_factory.go), and randomized counter genesis lives in [x/counter/simulation/genesis.go](https://github.com/cosmos/example/blob/main/x/counter/simulation/genesis.go).
In practice, `simsx` lets each module describe three things: how to generate random starting state, which operations can happen during simulation, and how often each operation should be chosen. For `x/counter`, that means generating a random initial counter value, registering `MsgAdd` as a simulation operation, and assigning it a weight so the simulator knows how frequently to try it relative to other module operations.
When you run a simulation target, the test harness repeatedly builds app instances, creates random accounts and balances, generates random transactions from the registered module operations, and executes them over many blocks. That makes `simsx` useful for catching issues that are hard to cover with hand-written tests, like state machine bugs, unexpected panics, invariant violations, and non-deterministic behavior across runs.
Simulation runs the chain with randomly generated transactions to detect non-determinism and invariant violations.
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
# Full simulation
make test-sim-full
# Determinism check
make test-sim-determinism
# All simulation tests
make test-sim
```
Simulation requires the `sims` build tag, which the Makefile targets handle automatically.
Each of these runs the simulation across 38 built-in seeds, so expect roughly ten minutes per target. The Makefile deliberately uses smaller values than the SDK defaults of 500 blocks and 200 operations per block, which across 38 seeds take hours. To simulate more deeply, override them:
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
make test-sim-full SIM_NUM_BLOCKS=500 SIM_BLOCK_SIZE=200 SIM_TIMEOUT=4h
```
## Lint
Linting is the quickest way to catch style problems and common code-quality issues before CI or code review does.
The lint commands are defined in the repo [Makefile](https://github.com/cosmos/example/blob/main/Makefile), which installs `golangci-lint` and runs it across the full module tree.
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
make lint
```
This installs and runs `golangci-lint` across the repository. To auto-fix issues where possible:
```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
make lint-fix
```
## Test summary
Use this table as a quick reference for choosing the right validation command for the kind of change you made.
| Command | What it validates | Typical runtime |
| - | - | - |
| `go test ./x/counter/...` | Keeper, MsgServer, QueryServer in isolation | seconds |
| `go test -run TestE2ETestSuite ./tests/...` | Full transaction and query flow on a live node | under a minute |
| `make test-sim-full` | Non-determinism and invariant violations | around ten minutes |
| `make lint` | Code style and static analysis | a few minutes |
# v0.54 Upgrade Guide
Source: https://docs.cosmos.network/sdk/latest/upgrade/v0.54
Reference for upgrading from v0.53 to v0.54 of Cosmos SDK
This document provides a reference for upgrading from `v0.53.x` to `v0.54.x` of Cosmos SDK.
However, this guide is not exhaustive for all breaking changes. For a comprehensive list of all breaking changes in v0.54.0, see the [Changelog](https://github.com/cosmos/cosmos-sdk/blob/release/v0.54.x/CHANGELOG.md).
Always read the [App Wiring Changes](#app-wiring-changes) section for more information on application wiring updates.
## Table of Contents
* [Upgrade Checklist](#upgrade-checklist)
* [Required Changes](#required-changes)
* [App Wiring Changes](#app-wiring-changes)
* [x/gov](#x/gov)
* [Keeper Initialization](#keeper-initialization)
* [GovHooks Interface](#govhooks-interface)
* [x/epochs](#x/epochs)
* [x/bank](#x/bank)
* [NodeService](#nodeservice)
* [Removed Go Modules](#removed-go-modules)
* [Renamed Go Modules](#renamed-go-modules)
* [Module Version Updates](#module-version-updates)
* [Log v2](#log-v2)
* [Store v2](#store-v2)
* [Conditional Changes](#conditional-changes)
* [Module Deprecations](#module-deprecations)
* [x/circuit](#x/circuit)
* [x/nft](#x/nft)
* [x/crisis](#x/crisis)
* [Cosmos Enterprise](#cosmos-enterprise)
* [Groups Module](#groups-module)
* [PoA Module](#poa-module)
* [New Features and Non-Breaking Changes](#new-features-and-non-breaking-changes)
* [Telemetry](#telemetry)
* [OpenTelemetry](#opentelemetry)
* [Centralized Authority via Consensus Params](#centralized-authority-via-consensus-params)
* [How AuthorityParams Works](#how-authorityparams-works)
* [Upgrade Handler](#upgrade-handler)
* [IBC v11 Updates](#ibc-v11-updates)
* [Cosmos Performance Upgrades (Experimental)](#cosmos-performance-upgrades-experimental)
* [Cosmos SDK](#cosmos-sdk)
* [BlockSTM](#blockstm)
* [CometBFT v0.39 Updates](#cometbft-v039-updates)
* [LibP2P](#libp2p)
* [`AdaptiveSync`](#adaptivesync)
## Upgrade Checklist
Use this checklist first, then read the linked sections for the exact code or wiring changes.
* [ ] Update `x/gov` keeper wiring, as the `x/gov` module has been decoupled from `x/staking`. See [Keeper Initialization](#keeper-initialization).
* [ ] Update your governance hooks if you implement `AfterProposalSubmission`. See [GovHooks Interface](#govhooks-interface).
* [ ] Update `x/epochs.NewAppModule` if your app includes `x/epochs`. See [x/epochs](#x/epochs).
* [ ] Put `x/bank` first in `SetOrderEndBlockers`. See [x/bank](#x/bank).
* [ ] Update your node service registration if your app exposes `NodeService`. See [NodeService](#nodeservice).
* [ ] Migrate imports for removed `x/` Go modules. See [Removed Go Modules](#removed-go-modules).
* [ ] Update required Cosmos SDK Go module dependencies. See [Module Version Updates](#module-version-updates).
* [ ] Migrate to `contrib/` imports if you use `x/circuit`, `x/nft`, or `x/crisis`. See [Module Deprecations](#module-deprecations).
* [ ] Migrate to Cosmos Enterprise if you use the `x/group` module. See [Groups Module](#groups-module).
* [ ] Update imports to `cosmossdk.io/log/v2` if your app imports the log package directly. See [Log v2](#log-v2).
* [ ] Migrate imports to `github.com/cosmos/cosmos-sdk/store/v2`. See [Store v2](#store-v2).
* [ ] Migrate any remaining `BaseApp.NewUncachedContext()` usage. See [Store v2](#store-v2).
* [ ] If using `systemtests` update import to `github.com/cosmos/cosmos-sdk/tools/systemtests`. See [Renamed Go Modules](#renamed-go-modules).
* [ ] Review [IBC v11 Updates](#ibc-v11-updates) if your chain uses IBC. Several APIs have been removed.
* [ ] Review [Centralized Authority via Consensus Params](#centralized-authority-via-consensus-params). No upgrade action is required to keep using per-keeper authorities.
* [ ] Review [Telemetry](#telemetry). No upgrade action is required to keep existing telemetry wiring, but upgrading to OpenTelemetry is strongly encouraged.
* [ ] Review [PoA Module](#poa-module) if you are interested in adopting the new Cosmos Enterprise Proof of Authority module.
* [ ] Review [Cosmos Performance Upgrades (Experimental)](#cosmos-performance-upgrades-experimental) if you are interested in experimenting with BlockSTM, LibP2P, or AdaptiveSync.
## Required Changes
All chains upgrading to `v0.54.x` should review and apply the changes in this section.
This guide provides an overview of the major changes in v0.54.0. However, this guide is not exhaustive for all breaking changes. For a comprehensive list of all breaking changes in v0.54.0, see the [Changelog](https://github.com/cosmos/cosmos-sdk/blob/release/v0.54.x/CHANGELOG.md).
### App Wiring Changes
#### x/gov
##### Keeper Initialization
The `x/gov` module has been decoupled from `x/staking`. The `keeper.NewKeeper` constructor now requires a `CalculateVoteResultsAndVotingPowerFn` parameter instead of a `StakingKeeper`.
**Before:**
```go theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
govKeeper := govkeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[govtypes.StoreKey]),
app.AccountKeeper,
app.BankKeeper,
app.StakingKeeper, // REMOVED IN v0.54
app.DistrKeeper,
app.MsgServiceRouter(),
govConfig,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
```
**After:**
```go theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
govKeeper := govkeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[govtypes.StoreKey]),
app.AccountKeeper,
app.BankKeeper,
app.DistrKeeper,
app.MsgServiceRouter(),
govConfig,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
govkeeper.NewDefaultCalculateVoteResultsAndVotingPower(app.StakingKeeper), // ADDED IN v0.54
)
```
For applications using depinject, the governance module now accepts an optional `CalculateVoteResultsAndVotingPowerFn`. If not provided, it will use the `StakingKeeper` (also optional) to create the default function.
##### GovHooks Interface
The `AfterProposalSubmission` hook now includes the proposer address as a parameter.
**Before:**
```go theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
func (h MyGovHooks) AfterProposalSubmission(ctx context.Context, proposalID uint64) error {
// implementation
}
```
**After:**
```go theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
func (h MyGovHooks) AfterProposalSubmission(ctx context.Context, proposalID uint64, proposerAddr sdk.AccAddress) error {
// implementation
}
```
#### x/epochs
The epochs module's `NewAppModule` function now requires the epoch keeper by pointer instead of value, fixing a bug related to setting hooks via depinject.
#### x/bank
The bank module now contains an `EndBlock` method to support the new BlockSTM experimental package. BlockSTM requires coordinating object store access across parallel execution workers, and `x/bank`'s `EndBlock` handles the finalization step for that. **All applications must make this change**, whether or not they enable BlockSTM, because the `EndBlock` registration is now part of the module's standard lifecycle.
```go theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
app.ModuleManager.SetOrderEndBlockers(
banktypes.ModuleName,
// other modules...
)
```
#### NodeService
The node service has been updated to return the node's earliest store height in the `Status` query. Please update your registration with the following code (make sure you are already updated to `github.com/cosmos/cosmos-sdk/store/v2`):
```go theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
func (app *SimApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg, func() int64 {
return app.CommitMultiStore().EarliestVersion()
})
}
```
### Removed Go Modules
Most `cosmossdk.io` vanity URLs for modules under `x/` have been removed. These separate Go modules caused dependency version management to be unpredictable; different modules could be pinned to different SDK versions, leading to compatibility issues. Consolidating everything under `github.com/cosmos/cosmos-sdk` gives developers a single, versioned dependency to manage.
The following must be updated:
* `cosmossdk.io/x/evidence` -> `github.com/cosmos/cosmos-sdk/x/evidence`
* `cosmossdk.io/x/feegrant` -> `github.com/cosmos/cosmos-sdk/x/feegrant`
* `cosmossdk.io/x/upgrade` -> `github.com/cosmos/cosmos-sdk/x/upgrade`
* `cosmossdk.io/x/tx` -> `github.com/cosmos/cosmos-sdk/x/tx`
### Renamed Go Modules
The `cosmossdk.io/systemtests` go module is now named `github.com/cosmos/cosmos-sdk/tools/systemtests`.
### Module Version Updates
* `cosmossdk.io/client/v2` has been updated to v2.11.0
### Log v2
The log package has been updated to `v2`. Applications using v0.54.0+ of Cosmos SDK will be required to update imports to `cosmossdk.io/log/v2`. Usage of the logger itself does not need to be updated.
The v2 release of log adds contextual methods to the logger interface (InfoContext, DebugContext, etc.), allowing logs to be correlated with OpenTelemetry traces.
To learn more about the new features offered in `log/v2`, as well as setting up log correlation, see the [log package documentation](https://docs.cosmos.network/sdk/latest/guides/testing/log).
### Store v2
Store v2 introduces breaking changes. F프로젝트로 돌아가기