Skip to content

Commit 479485f

Browse files
style: lint go and markdown (cosmos#10060)
## Description + fixing `x/bank/migrations/v44.migrateDenomMetadata` - we could potentially put a wrong data in a new key if the old keys have variable length. + linting the code Putting in the same PR because i found the issue when running a linter. Depends on: cosmos#10112 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
1 parent bc3cda6 commit 479485f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+197
-178
lines changed

CODING_GUIDELINES.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ This document is an extension to [CONTRIBUTING](./CONTRIBUTING.md) and provides
55
## API & Design
66

77
+ Code must be well structured:
8-
+ packages must have a limited responsibility (different concerns can go to different packages),
9-
+ types must be easy to compose,
10-
+ think about maintainbility and testability.
8+
+ packages must have a limited responsibility (different concerns can go to different packages),
9+
+ types must be easy to compose,
10+
+ think about maintainbility and testability.
1111
+ "Depend upon abstractions, [not] concretions".
1212
+ Try to limit the number of methods you are exposing. It's easier to expose something later than to hide it.
1313
+ Take advantage of `internal` package concept.
@@ -19,20 +19,22 @@ This document is an extension to [CONTRIBUTING](./CONTRIBUTING.md) and provides
1919
+ Limit third-party dependencies.
2020

2121
Performance:
22+
2223
+ Avoid unnecessary operations or memory allocations.
2324

2425
Security:
26+
2527
+ Pay proper attention to exploits involving:
26-
+ gas usage
27-
+ transaction verification and signatures
28-
+ malleability
29-
+ code must be always deterministic
28+
+ gas usage
29+
+ transaction verification and signatures
30+
+ malleability
31+
+ code must be always deterministic
3032
+ Thread safety. If some functionality is not thread-safe, or uses something that is not thread-safe, then clearly indicate the risk on each level.
3133

32-
3334
## Testing
3435

3536
Make sure your code is well tested:
37+
3638
+ Provide unit tests for every unit of your code if possible. Unit tests are expected to comprise 70%-80% of your tests.
3739
+ Describe the test scenarios you are implementing for integration tests.
3840
+ Create integration tests for queries and msgs.
@@ -64,6 +66,7 @@ for tcIndex, tc := range cases {
6466
## Quality Assurance
6567
6668
We are forming a QA team that will support the core Cosmos SDK team and collaborators by:
69+
6770
- Improving the Cosmos SDK QA Processes
6871
- Improving automation in QA and testing
6972
- Defining high-quality metrics
@@ -83,5 +86,4 @@ Desired outcomes:
8386
- Releases are more predictable.
8487
- QA reports. Goal is to guide with new tasks and be one of the QA measures.
8588
86-
8789
As a developer, you must help the QA team by providing instructions for User Experience (UX) and functional testing.

CONTRIBUTING.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ discussion or proposing code changes. To ensure a smooth workflow for all
2323
contributors, the general procedure for contributing has been established:
2424

2525
1. Start by browsing [new issues](https://github.com/cosmos/cosmos-sdk/issues) and [discussions](https://github.com/cosmos/cosmos-sdk/discussions). If you are looking for something interesting or if you have something in your mind, there is a chance it was has been discussed.
26-
- Looking for a good place to start contributing? How about checking out some [good first issues](https://github.com/cosmos/cosmos-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)?
26+
27+
- Looking for a good place to start contributing? How about checking out some [good first issues](https://github.com/cosmos/cosmos-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)?
28+
2729
2. Determine whether a GitHub issue or discussion is more appropriate for your needs:
28-
1. If want to propose something new that requires specification or an additional design, or you would like to change a process, start with a [new discussion](https://github.com/cosmos/cosmos-sdk/discussions/new). With discussions, we can better handle the design process using discussion threads. A discussion usually leads to one or more issues.
29-
2. If the issue you want addressed is a specific proposal or a bug, then open a [new issue](https://github.com/cosmos/cosmos-sdk/issues/new/choose).
30-
3. Review existing [issues](https://github.com/cosmos/cosmos-sdk/issues) to find an issue you'd like to help with.
30+
1. If want to propose something new that requires specification or an additional design, or you would like to change a process, start with a [new discussion](https://github.com/cosmos/cosmos-sdk/discussions/new). With discussions, we can better handle the design process using discussion threads. A discussion usually leads to one or more issues.
31+
2. If the issue you want addressed is a specific proposal or a bug, then open a [new issue](https://github.com/cosmos/cosmos-sdk/issues/new/choose).
32+
3. Review existing [issues](https://github.com/cosmos/cosmos-sdk/issues) to find an issue you'd like to help with.
3133
3. Participate in thoughtful discussion on that issue.
3234
4. If you would like to contribute:
3335
1. Ensure that the proposal has been accepted.
@@ -38,7 +40,7 @@ contributors, the general procedure for contributing has been established:
3840
to begin work.
3941
5. To submit your work as a contribution to the repository follow standard GitHub best practices. See [pull request guideline](#pull-requests) below.
4042

41-
**Note: ** For very small or blatantly obvious problems such as typos, you are
43+
**Note:** For very small or blatantly obvious problems such as typos, you are
4244
not required to an open issue to submit a PR, but be aware that for more complex
4345
problems/features, if a PR is opened before an adequate design discussion has
4446
taken place in a GitHub issue, that PR runs a high likelihood of being rejected.
@@ -52,14 +54,14 @@ The developers are organized in working groups which are listed on a ["Working G
5254
The important development announcements are shared on [Discord](https://discord.com/invite/cosmosnetwork) in the \#dev-announcements channel.
5355

5456
To synchronize we have few major meetings:
57+
5558
+ Architecture calls: bi-weekly on Fridays at 14:00 UTC (alternating with the grooming meeting below).
5659
+ Grooming / Planning: bi-weekly on Fridays at 14:00 UTC (alternating with the architecture meeting above).
5760
+ Cosmos Community SDK Development Call on the last Wednesday of every month at 17:00 UTC.
5861
+ Cosmos Roadmap Prioritization every 4 weeks on Tuesday at 15:00 UTC (limited participation).
5962

6063
If you would like to join one of those calls, then please contact us on [Discord](https://discord.com/invite/cosmosnetwork) or reach out directly to Cory Levinson from Regen Network ([email protected]).
6164

62-
6365
## Architecture Decision Records (ADR)
6466

6567
When proposing an architecture decision for the Cosmos SDK, please start by opening an [issue](https://github.com/cosmos/cosmos-sdk/issues/new/choose) or a [discussion](https://github.com/cosmos/cosmos-sdk/discussions/new) with a summary of the proposal. Once the proposal has been discussed and there is rough alignment on a high-level approach to the design, the [ADR creation process](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/PROCESS.md) can begin. We are following this process to ensure all involved parties are in agreement before any party begins coding the proposed implementation. If you would like to see examples of how these are written, please refer to the current [ADRs](https://github.com/cosmos/cosmos-sdk/tree/master/docs/architecture).
@@ -70,11 +72,11 @@ When proposing an architecture decision for the Cosmos SDK, please start by open
7072
- `master` must never fail `make lint test test-race`.
7173
- No `--force` onto `master` (except when reverting a broken commit, which should seldom happen).
7274
- Create a branch to start a wok:
73-
- Fork the repo (core developers must create a branch directly in the Cosmos SDK repo),
75+
- Fork the repo (core developers must create a branch directly in the Cosmos SDK repo),
7476
branch from the HEAD of `master`, make some commits, and submit a PR to `master`.
75-
- For core developers working within the `cosmos-sdk` repo, follow branch name conventions to ensure a clear
77+
- For core developers working within the `cosmos-sdk` repo, follow branch name conventions to ensure a clear
7678
ownership of branches: `{moniker}/{issue#}-branch-name`.
77-
- See [Branching Model](#branching-model-and-release) for more details.
79+
- See [Branching Model](#branching-model-and-release) for more details.
7880
- Be sure to run `make format` before every commit. The easiest way
7981
to do this is have your editor run it for you upon saving a file (most of the editors
8082
will do it anyway using a pre-configured setup of the programming language mode).
@@ -92,10 +94,12 @@ Tests can be executed by running `make test` at the top level of the Cosmos SDK
9294
### Pull Requests
9395

9496
Before submitting a pull request:
97+
9598
- merge the latest master `git merge origin/master`,
9699
- run `make lint test` to ensure that all checks and tests pass.
97100

98101
Then:
102+
99103
1. If you have something to show, **start with a `Draft` PR**. It's good to have early validation of your work and we highly recommend this practice. A Draft PR also indicates to the community that the work is in progress.
100104
Draft PRs also helps the core team provide early feedback and ensure the work is in the right direction.
101105
2. When the code is complete, change your PR from `Draft` to `Ready for Review`.

RELEASE_PROCESS.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,35 @@ This document outlines the process for releasing a new version of Cosmos SDK, wh
77
A _major release_ is an increment of the first number (eg: `v1.2``v2.0.0`) or the _point number_ (eg: `v1.1 → v1.2.0`, also called _point release_). Each major release opens a _stable release series_ and receives updates outlined in the [Major Release Maintenance](#major-release-maintenance)_section.
88

99
Before making a new _major_ release we do beta and release candidate releases. For example, for release 1.0.0:
10+
1011
```
1112
v1.0.0-beta1 → v1.0.0-beta2 → ... → v1.0.0-rc1 → v1.0.0-rc2 → ... → v1.0.0
1213
```
1314

1415
- Release a first beta version on the `master` branch and freeze `master` from receiving any new features. After beta is released, we focus on releasing the release candidate:
15-
- finish audits and reviews
16-
- kick off a large round of simulation testing (e.g. 400 seeds for 2k blocks)
17-
- perform functional tests
18-
- add more tests
19-
- release new beta version as the bugs are discovered and fixed.
16+
- finish audits and reviews
17+
- kick off a large round of simulation testing (e.g. 400 seeds for 2k blocks)
18+
- perform functional tests
19+
- add more tests
20+
- release new beta version as the bugs are discovered and fixed.
2021
- After the team feels that the `master` works fine we create a `release/vY` branch (going forward known a release branch), where `Y` is the version number, with the patch part substituted to `x` (eg: 0.42.x, 1.0.x). Ensure the release branch is protected so that pushes against the release branch are permitted only by the release manager or release coordinator.
2122
- **PRs targeting this branch can be merged _only_ when exceptional circumstances arise**
2223
- update the GitHub mergify integration by adding instructions for automatically backporting commits from `master` to the `release/vY` using the `backport/Y` label.
2324
- In the release branch, prepare a new version section in the `CHANGELOG.md`
2425
- All links must be link-ified: `$ python ./scripts/linkify_changelog.py CHANGELOG.md`
2526
- Copy the entries into a `RELEASE_CHANGELOG.md`, this is needed so the bot knows which entries to add to the release page on GitHub.
2627
- Create a new annotated git tag for a release candidate (eg: `git tag -a v1.1.0-rc1`) in the release branch.
27-
- from this point we unfreeze master.
28-
- the SDK teams collaborate and do their best to run testnets in order to validate the release.
29-
- when bugs are found, create a PR for `master`, and backport fixes to the release branch.
30-
- create new release candidate tags after bugs are fixed.
28+
- from this point we unfreeze master.
29+
- the SDK teams collaborate and do their best to run testnets in order to validate the release.
30+
- when bugs are found, create a PR for `master`, and backport fixes to the release branch.
31+
- create new release candidate tags after bugs are fixed.
3132
- After the team feels the release branch is stable and everything works, create a full release:
32-
- update `CHANGELOG.md`.
33-
- create a new annotated git tag (eg `git -a v1.1.0`) in the release branch.
34-
- Create a GitHub release.
33+
- update `CHANGELOG.md`.
34+
- create a new annotated git tag (eg `git -a v1.1.0`) in the release branch.
35+
- Create a GitHub release.
3536

3637
Following _semver_ philosophy, point releases after `v1.0`:
38+
3739
- must not break API
3840
- can break consensus
3941

@@ -54,11 +56,11 @@ Lastly, it is core team's responsibility to ensure that the PR meets all the SRU
5456
Point Release must follow the [Stable Release Policy](#stable-release-policy).
5557

5658
After the release branch has all commits required for the next patch release:
59+
5760
- update `CHANGELOG.md`.
5861
- create a new annotated git tag (eg `git -a v1.1.0`) in the release branch.
5962
- Create a GitHub release.
6063

61-
6264
## Major Release Maintenance
6365

6466
Major Release series continue to receive bug fixes (released as a Patch Release) until they reach **End Of Life**.
@@ -70,7 +72,6 @@ Only the following major release series have a stable release status:
7072
* **0.42 «Stargate»** will be supported until 6 months after **0.43.0** is published. A fairly strict **bugfix-only** rule applies to pull requests that are requested to be included into a stable point-release.
7173
* **0.44** is the latest major release.
7274

73-
7475
## Stable Release Policy
7576

7677
### Patch Releases

contrib/rosetta/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Contains the required files to set up rosetta cli and make it work against its w
2020
Contains the files for a deterministic network, with fixed keys and some actions on there, to test parsing of msgs and historical balances. This image is used to run a simapp node and to run the rosetta server.
2121

2222
## Rosetta-cli
23+
2324
The docker image for ./rosetta-cli/Dockerfile is on [docker hub](https://hub.docker.com/r/tendermintdev/rosetta-cli). Whenever rosetta-cli releases a new version, rosetta-cli/Dockerfile should be updated to reflect the new version and pushed to docker hub.
2425

2526
## Notes

cosmovisor/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#### Design
66

77
Cosmovisor is designed to be used as a wrapper for a `Cosmos SDK` app:
8+
89
* it will pass arguments to the associated app (configured by `DAEMON_NAME` env variable).
910
Running `cosmovisor run arg1 arg2 ....` will run `app arg1 arg2 ...`;
1011
* it will manage an app by restarting and upgrading if needed;
@@ -47,6 +48,7 @@ git checkout cosmovisor/vx.x.x
4748
cd cosmovisor
4849
make
4950
```
51+
5052
This will build cosmovisor in your current directory. Afterwards you may want to put it into your machine's PATH like as follows:
5153

5254
```
@@ -58,6 +60,7 @@ cp cosmovisor ~/go/bin/cosmovisor
5860
### Command Line Arguments And Environment Variables
5961

6062
The first argument passed to `cosmovisor` is the action for `cosmovisor` to take. Options are:
63+
6164
* `help`, `--help`, or `-h` - Output `cosmovisor` help information and check your `cosmovisor` configuration.
6265
* `run` - Run the configured binary using the rest of the provided arguments.
6366
* `version`, or `--version` - Output the `cosmovisor` version and also run the binary with the `version` argument.
@@ -124,12 +127,14 @@ The `DAEMON` specific code and operations (e.g. tendermint config, the applicati
124127

125128
`cosmovisor` is polling the `$DAEMON_HOME/data/upgrade-info.json` file for new upgrade instructions. The file is created by the x/upgrade module in `BeginBlocker` when an upgrade is detected and the blockchain reaches the upgrade height.
126129
The following heuristic is applied to detect the upgrade:
130+
127131
+ When starting, `cosmovisor` doesn't know much about currently running upgrade, except the binary which is `current/bin/`. It tries to read the `current/update-info.json` file to get information about the current upgrade name.
128132
+ If neither `cosmovisor/current/upgrade-info.json` nor `data/upgrade-info.json` exist, then `cosmovisor` will wait for `data/upgrade-info.json` file to trigger an upgrade.
129133
+ If `cosmovisor/current/upgrade-info.json` doesn't exist but `data/upgrade-info.json` exists, then `cosmovisor` assumes that whatever is in `data/upgrade-info.json` is a valid upgrade request. In this case `cosmovisor` tries immediately to make an upgrade according to the `name` attribute in `data/upgrade-info.json`.
130134
+ Otherwise, `cosmovisor` waits for changes in `upgrade-info.json`. As soon as a new upgrade name is recorded in the file, `cosmovisor` will trigger an upgrade mechanism.
131135

132136
When the upgrade mechanism is triggered, `cosmovisor` will:
137+
133138
1. if `DAEMON_ALLOW_DOWNLOAD_BINARIES` is enabled, start by auto-downloading a new binary into `cosmovisor/<name>/bin` (where `<name>` is the `upgrade-info.json:name` attribute);
134139
2. update the `current` symbolic link to point to the new directory and save `data/upgrade-info.json` to `cosmovisor/current/upgrade-info.json`.
135140

crypto/keyring/keyring.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ func (ks keystore) List() ([]*Record, error) {
496496
return nil, err
497497
}
498498

499-
var res []*Record
499+
var res []*Record //nolint:prealloc
500500
sort.Strings(keys)
501501
for _, key := range keys {
502502
if strings.Contains(key, addressSuffix) {

crypto/keys/multisig/amino.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func tmToProto(tmPk tmMultisig) (*LegacyAminoPubKey, error) {
6464
}
6565

6666
// MarshalAminoJSON overrides amino JSON unmarshaling.
67-
func (m LegacyAminoPubKey) MarshalAminoJSON() (tmMultisig, error) { //nolint:golint
67+
func (m LegacyAminoPubKey) MarshalAminoJSON() (tmMultisig, error) { //nolint:revive
6868
return protoToTm(&m)
6969
}
7070

crypto/keys/secp256k1/secp256k1_nocgo.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !libsecp256k1
12
// +build !libsecp256k1
23

34
package secp256k1

crypto/ledger/ledger_notavail.go

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
//go:build !cgo || !ledger
12
// +build !cgo !ledger
3+
24
// test_ledger_mock
35

46
package ledger

0 commit comments

Comments
 (0)