cosmos-sdk/x
yihuang 0540ed2f06
fix: Dumping upgrade info interrupted by cosmovisor (#9384)
Solution:
- dumping upgrade info before emit `UPGRADED NEEDED` log which will
  cause cosmovisor to kill chain process

<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

The problematic procedure:

1. chain process output UPGRADE NEEDED log
2. cosmovisor see the message and kill the chain binary
3. chain process dump upgrade info and panic itself

the step 2 and 3 runs concurrently, so the dumping process can be interrupted by cosmovisor's terminate signal. The proposed solution is to dump upgrade info before emitting the log.
there are two problematic situation:
1. the upgrade info file is created, but content is not written or flushed before killed, when the chain process restart, it'll panic because of json parsing error.
2. the upgrade info file is not created at all, when the chain process restart, the [store upgrades](https://github.com/crypto-org-chain/chain-main/blob/master/app/app.go#L436) are not activated, will cause app hash mismatch error later on.

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [x] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [x] Review `Codecov Report` in the comment section below once CI passes
2021-06-21 12:48:15 +00:00
..
auth fix: query txs command adds output flag (#9540) 2021-06-21 10:40:56 +00:00
authz fix: collect all responses from authz/MsgExec (#9538) 2021-06-18 19:06:10 +00:00
bank refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
capability codec: Rename codec and marshaler interfaces (#9226) 2021-04-29 10:46:22 +00:00
crisis refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
distribution refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
evidence refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
feegrant refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
genutil refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
gov refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
mint refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
params perf: Speedup to params simulation (#9481) 2021-06-17 07:42:07 +00:00
simulation perf: Speedup to params simulation (#9481) 2021-06-17 07:42:07 +00:00
slashing refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498) 2021-06-11 11:49:39 +00:00
staking revert: Turn staking power reduction into an on-chain param (#9495) 2021-06-14 14:45:15 +00:00
upgrade fix: Dumping upgrade info interrupted by cosmovisor (#9384) 2021-06-21 12:48:15 +00:00
README.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00

README.md

List of Modules

Here are some production-grade modules that can be used in Cosmos SDK applications, along with their respective documentation:

  • Auth - Authentication of accounts and transactions for Cosmos SDK application.
  • Authz - Authorization for accounts to perform actions on behalf of other accounts.
  • Bank - Token transfer functionalities.
  • Capability - Object capability implementation.
  • Crisis - Halting the blockchain under certain circumstances (e.g. if an invariant is broken).
  • Distribution - Fee distribution, and staking token provision distribution.
  • Evidence - Evidence handling for double signing, misbehaviour, etc.
  • Governance - On-chain proposals and voting.
  • Mint - Creation of new units of staking token.
  • Params - Globally available parameter store.
  • Slashing - Validator punishment mechanisms.
  • Staking - Proof-of-Stake layer for public blockchains.
  • Upgrade - Software upgrades handling and coordination.

To learn more about the process of building modules, visit the building modules reference documentation.

IBC

The IBC module for the SDK has moved to its own repository.