github.com/cosmos/cosmos-sdk@v0.50.10/CONTRIBUTING.md (about)

     1  # Contributing
     2  
     3  * [Teams Dev Calls](#teams-dev-calls)
     4  * [Architecture Decision Records (ADR)](#architecture-decision-records-adr)
     5  * [Development Procedure](#development-procedure)
     6      * [Testing](#testing)
     7      * [Pull Requests](#pull-requests)
     8      * [Pull Request Templates](#pull-request-templates)
     9      * [Requesting Reviews](#requesting-reviews)
    10      * [Updating Documentation](#updating-documentation)
    11      * [RFC & ADR](#RFC & ADR)
    12  * [Dependencies](#dependencies)
    13      * [`go.work`](#gowork)
    14      * [`go.mod`](#gomod)
    15  * [Protobuf](#protobuf)
    16  * [Branching Model and Release](#branching-model-and-release)
    17      * [PR Targeting](#pr-targeting)
    18  * [Code Owner Membership](#code-owner-membership)
    19  * [Concept & Feature Approval Process](#concept--feature-approval-process)
    20      * [Strategy Discovery](#strategy-discovery)
    21      * [Concept Approval](#concept-approval)
    22          * [Time Bound Period](#time-bound-period)
    23          * [Approval Committee & Decision Making](#approval-committee--decision-making)
    24          * [Committee Members](#committee-members)
    25          * [Committee Criteria](#committee-criteria)
    26      * [Implementation & Release Approval](#implementation--release-approval)
    27  
    28  Thank you for considering making contributions to the Cosmos SDK and related repositories!
    29  
    30  Contributing to this repo can mean many things, such as participating in
    31  discussion or proposing code changes. To ensure a smooth workflow for all
    32  contributors, the general procedure for contributing has been established:
    33  
    34  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 had been discussed.
    35     * 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) or [bugs](https://github.com/cosmos/cosmos-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22T%3A+Bug%22)?
    36  2. Determine whether a GitHub issue or discussion is more appropriate for your needs:
    37     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.
    38     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).
    39     3. Review existing [issues](https://github.com/cosmos/cosmos-sdk/issues) to find an issue you'd like to help with.
    40  3. Participate in thoughtful discussion on that issue.
    41  4. If you would like to contribute:
    42     1. Ensure that the proposal has been accepted.
    43     2. Ensure that nobody else has already begun working on this issue. If they have,
    44        make sure to contact them to collaborate.
    45     3. If nobody has been assigned for the issue and you would like to work on it,
    46        make a comment on the issue to inform the community of your intentions
    47        to begin work.
    48  5. To submit your work as a contribution to the repository follow standard GitHub best practices. See [pull request guideline](#pull-requests) below.
    49  
    50  **Note:** For very small or blatantly obvious problems such as typos, you are
    51  not required to an open issue to submit a PR, but be aware that for more complex
    52  problems/features, if a PR is opened before an adequate design discussion has
    53  taken place in a GitHub issue, that PR runs a high likelihood of being rejected.
    54  
    55  ## Teams Dev Calls
    56  
    57  The Cosmos SDK has many stakeholders contributing and shaping the project. The Core SDK team is composed of Interchain GmbH and Regen Network Development developers. Any long-term contributors and additional maintainers from other projects are welcome. We use self-organizing principles to coordinate and collaborate across organizations in structured "EPIC" that focus on specific problem domains or architectural components of the Cosmos SDK.
    58  
    59  The developers work in sprints, which are available in a [GitHub Project](https://github.com/orgs/cosmos/projects/26/views/22). The current EPICs are pinned at the top of the [issues list](https://github.com/cosmos/cosmos-sdk/issues).
    60  
    61  The important development announcements are shared on [Discord](https://discord.com/invite/cosmosnetwork) in the `#dev-announcements` channel.
    62  
    63  To synchronize we have few major meetings:
    64  
    65  * Cosmos SDK Sprint Review on Monday and Thursday at 14:00 UTC (limited participation to core devs).
    66  * Cosmos SDK Community Call on Thursday at 16:00 UTC.
    67  
    68  If you would like to join one of the community call, then please contact us on [Discord](https://discord.com/invite/cosmosnetwork) or reach out directly to Marko (@tac0turtle).
    69  
    70  ## Architecture Decision Records (ADR)
    71  
    72  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/main/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/main/docs/architecture).
    73  
    74  ## Development Procedure
    75  
    76  * The latest state of development is on `main`.
    77  * `main` must never fail `make lint test test-race`.
    78  * No `--force` onto `main` (except when reverting a broken commit, which should seldom happen).
    79  * Create a branch to start work:
    80      * Fork the repo (core developers must create a branch directly in the Cosmos SDK repo),
    81      branch from the HEAD of `main`, make some commits, and submit a PR to `main`.
    82      * For core developers working within the `cosmos-sdk` repo, follow branch name conventions to ensure a clear
    83      ownership of branches: `{moniker}/{issue#}-branch-name`.
    84      * See [Branching Model](#branching-model-and-release) for more details.
    85  * Be sure to run `make format` before every commit. The easiest way
    86    to do this is have your editor run it for you upon saving a file (most of the editors
    87    will do it anyway using a pre-configured setup of the programming language mode).
    88    Additionally, be sure that your code is lint compliant by running `make lint-fix`.
    89    A convenience git `pre-commit` hook that runs the formatters automatically
    90    before each commit is available in the `contrib/githooks/` directory.
    91  * Follow the [CODING GUIDELINES](CODING_GUIDELINES.md), which defines criteria for designing and coding a software.
    92  
    93  Code is merged into main through pull request procedure.
    94  
    95  ### Testing
    96  
    97  Tests can be executed by running `make test` at the top level of the Cosmos SDK repository.
    98  
    99  ### Pull Requests
   100  
   101  Before submitting a pull request:
   102  
   103  * merge the latest main `git merge origin/main`,
   104  * run `make lint test` to ensure that all checks and tests pass.
   105  
   106  Then:
   107  
   108  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.
   109     Draft PRs also helps the core team provide early feedback and ensure the work is in the right direction.
   110  2. When the code is complete, change your PR from `Draft` to `Ready for Review`.
   111  3. Go through the actions for each checkbox present in the PR template description. The PR actions are automatically provided for each new PR.
   112  4. Be sure to include a relevant changelog entry in the `Unreleased` section of `CHANGELOG.md` (see file for log format). The entry should be on top of all others changes in the section.
   113  
   114  PRs must have a category prefix that is based on the type of changes being made (for example, `fix`, `feat`,
   115  `refactor`, `docs`, and so on). The *type* must be included in the PR title as a prefix (for example,
   116  `fix: <description>`). This convention ensures that all changes that are committed to the base branch follow the
   117  [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
   118  Additionally, each PR should only address a single issue.
   119  
   120  Pull requests are merged automatically using [`A:automerge` action](https://mergify.io/features/auto-merge).
   121  
   122  NOTE: when merging, GitHub will squash commits and rebase on top of the main.
   123  
   124  ### Pull Request Templates
   125  
   126  There are three PR templates. The [default template](./.github/PULL_REQUEST_TEMPLATE.md) is for types `fix`, `feat`, and `refactor`. We also have a [docs template](./.github/PULL_REQUEST_TEMPLATE/docs.md) for documentation changes and an [other template](./.github/PULL_REQUEST_TEMPLATE/other.md) for changes that do not affect production code. When previewing a PR before it has been opened, you can change the template by adding one of the following parameters to the url:
   127  
   128  * `template=docs.md`
   129  * `template=other.md`
   130  
   131  ### Requesting Reviews
   132  
   133  In order to accommodate the review process, the author of the PR must complete the author checklist
   134  (from the pull request template)
   135  to the best of their abilities before marking the PR as "Ready for Review". If you would like to
   136  receive early feedback on the PR, open the PR as a "Draft" and leave a comment in the PR indicating
   137  that you would like early feedback and tagging whoever you would like to receive feedback from.
   138  
   139  Codeowners are marked automatically as the reviewers.
   140  
   141  All PRs require at least two review approvals before they can be merged (one review might be acceptable in
   142  the case of minor changes to [docs](./.github/PULL_REQUEST_TEMPLATE/docs.md) or [other](./.github/PULL_REQUEST_TEMPLATE/other.md) changes that do not affect production code). Each PR template has a reviewers checklist that must be completed before the PR can be merged. Each reviewer is responsible
   143  for all checked items unless they have indicated otherwise by leaving their handle next to specific
   144  items. In addition, use the following review explanations:
   145  
   146  * `LGTM` without an explicit approval means that the changes look good, but you haven't thoroughly reviewed the reviewer checklist items.
   147  * `Approval` means that you have completed some or all of the reviewer checklist items. If you only reviewed selected items, you must add your handle next to the items that you have reviewed. In addition, follow these guidelines:
   148      * You must also think through anything which ought to be included but is not
   149      * You must think through whether any added code could be partially combined (DRYed) with existing code
   150      * You must think through any potential security issues or incentive-compatibility flaws introduced by the changes
   151      * Naming must be consistent with conventions and the rest of the codebase
   152      * Code must live in a reasonable location, considering dependency structures (for example, not importing testing modules in production code, or including example code modules in production code).
   153      * If you approve the PR, you are responsible for any issues mentioned here and any issues that should have been addressed after thoroughly reviewing the reviewer checklist items in the pull request template.
   154  * If you sat down with the PR submitter and did a pairing review, add this information in the `Approval` or your PR comments.
   155  * If you are only making "surface level" reviews, submit notes as a `comment` review.
   156  
   157  ### Updating Documentation
   158  
   159  If you open a PR on the Cosmos SDK, it is mandatory to update the relevant documentation in `/docs`.
   160  
   161  * If your change relates to the core SDK (baseapp, store, ...), be sure to update the content in `docs/basics/`, `docs/core/` and/or `docs/building-modules/` folders.
   162  * If your changes relate to the core of the CLI (not specifically to module's CLI/Rest), then modify the content in the `docs/run-node/` folder.
   163  * If your changes relate to a module, then be sure to update the module's spec in `x/{moduleName}/README.md`.
   164  
   165  When writing documentation, follow the [Documentation Writing Guidelines](./docs/DOC_WRITING_GUIDELINES.md).
   166  
   167  ### RFC & ADR
   168  
   169  Within the Cosmos SDK we have two forms of documenting decisions, Request For Comment (RFC) & Architecture Design Record (ADR). They perform two different functions. The process for assessing if something needs an RFC is located in the respective folders: 
   170  
   171  * [RFC Process](./docs/rfc/process.md)
   172  * [ADR Process](./docs/adr/process.md) 
   173  
   174  
   175  ## Dependencies
   176  
   177  We use [Go Modules](https://github.com/golang/go/wiki/Modules) to manage
   178  dependency versions.
   179  
   180  The main branch of every Cosmos repository should just build with `go get`,
   181  which means they should be kept up-to-date with their dependencies, so we can
   182  get away with telling people they can just `go get` our software.
   183  
   184  Since some dependencies are not under our control, a third party may break our
   185  build, in which case we can fall back on `go mod tidy -v`.
   186  
   187  ### `go.work`
   188  
   189  The Cosmos SDK is a multi-module repo, for this reason, the use of a `go.work` file is handy. 
   190  We provide a [`go.work.example`](./go.work.example) that contains all the modules used in the SDK.
   191  Do note that contributions modifying multiple Go modules should be submitted as separate PRs, this allows us to tag the changes and avoid `replace`s.
   192  For consistency between our CI and the local tests, `GOWORK=off` is set in the `Makefile`. This means that the `go.work` file is not used when using `make test` or any other `make` command.
   193  
   194  ### `go.mod`
   195  
   196  When extracting a package to its own go modules, some extra steps are required, for keeping our CI checks and Dev UX:
   197  
   198  * Add a CHANGELOG.md / README.md under the new package folder
   199  * Add the package in [`labeler.yml`](./.github/labeler.yml)
   200  * Add the package in [`go.work.example`](./go.work.example)
   201  * Add weekly dependabot checks (see [dependabot.yml](./.github/dependabot.yml))
   202  * Add tests to github workflow [test.yml](.github/workflows/test.yml) (under submodules)
   203  * Configure SonarCloud
   204      * Add `sonar-projects.properties` (see math [sonar-projects.properties](./math/sonar-projects.properties) for example)
   205      * Add a GitHub Workflow entry for running the scans (see [test.yml](.github/workflows/test.yml))
   206      * Ask the team to add the project to SonarCloud
   207  * (optional) Configure a `cosmossdk.io` vanity url by submitting a PR to [cosmos/vanity](https://github.com/cosmos/vanity).
   208  
   209  ## Protobuf
   210  
   211  We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [gogoproto](https://github.com/cosmos/gogoproto) to generate code for use in Cosmos SDK.
   212  
   213  For deterministic behavior around Protobuf tooling, everything is containerized using Docker. Make sure to have Docker installed on your machine, or head to [Docker's website](https://docs.docker.com/get-docker/) to install it.
   214  
   215  For formatting code in `.proto` files, you can run `make proto-format` command.
   216  
   217  For linting and checking breaking changes, we use [buf](https://buf.build/). You can use the commands `make proto-lint` and `make proto-check-breaking` to respectively lint your proto files and check for breaking changes.
   218  
   219  To generate the protobuf stubs, you can run `make proto-gen`.
   220  
   221  We also added the `make proto-all` command to run all the above commands sequentially.
   222  
   223  In order for imports to properly compile in your IDE, you may need to manually set your protobuf path in your IDE's workspace settings/config.
   224  
   225  For example, in vscode your `.vscode/settings.json` should look like:
   226  
   227  ```json
   228  {
   229      "protoc": {
   230          "options": [
   231          "--proto_path=${workspaceRoot}/proto",
   232          ]
   233      }
   234  }
   235  ```
   236  
   237  ## Branching Model and Release
   238  
   239  User-facing repos should adhere to the trunk based development branching model: https://trunkbaseddevelopment.com. User branches should start with a user name, example: `{moniker}/{issue#}-branch-name`.
   240  
   241  The Cosmos SDK repository is a [multi Go module](https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository) repository. It means that we have more than one Go module in a single repository.
   242  
   243  The Cosmos SDK utilizes [semantic versioning](https://semver.org/).
   244  
   245  ### PR Targeting
   246  
   247  Ensure that you base and target your PR on the `main` branch.
   248  
   249  All feature additions and all bug fixes must be targeted against `main`. Exception is for bug fixes which are only related to a released version. In that case, the related bug fix PRs must target against the release branch.
   250  
   251  If needed, we backport a commit from `main` to a release branch (excluding consensus breaking feature, API breaking and similar).
   252  
   253  ## Code Owner Membership
   254  
   255  In the ethos of open-source projects, and out of necessity to keep the code
   256  alive, the core contributor team will strive to permit special repo privileges
   257  to developers who show an aptitude towards developing with this code base.
   258  
   259  Several different kinds of privileges may be granted however most common
   260  privileges to be granted are merge rights to either part of, or the entirety of the
   261  code base (through the GitHub `CODEOWNERS` file). The on-boarding process for
   262  new code owners is as follows: On a bi-monthly basis (or more frequently if
   263  agreeable) all the existing code owners will privately convene to discuss
   264  potential new candidates as well as the potential for existing code-owners to
   265  exit or "pass on the torch". This private meeting is to be a held as a
   266  phone/video meeting.
   267  
   268  Subsequently after the meeting, and pending final approval from the ICF,
   269  one of the existing code owners should open a PR modifying the `CODEOWNERS` file.
   270  The other code owners should then all approve this PR to publicly display their support.
   271  
   272  Only if unanimous consensus is reached among all the existing code-owners will
   273  an invitation be extended to a new potential-member. Likewise, when an existing
   274  member is suggested to be removed/or have their privileges reduced, the member
   275  in question must agree to the decision for their removal or else no action
   276  should be taken. If however, a code-owner is demonstrably shown to intentionally
   277  have had acted maliciously or grossly negligent, code-owner privileges may be
   278  stripped with no prior warning or consent from the member in question.
   279  
   280  Other potential removal criteria:
   281  
   282  * Missing 3 scheduled meetings results in ICF evaluating whether the member should be
   283      removed / replaced
   284  * Violation of Code of Conduct
   285  
   286  Earning this privilege should be considered to be no small feat and is by no
   287  means guaranteed by any quantifiable metric. Serving as a code owner is a symbol of great trust from
   288  the community of this project.
   289  
   290  ## Concept & Feature Approval Process
   291  
   292  The process for how Cosmos SDK maintainers take features and ADRs from concept to release
   293  is broken up into three distinct stages: **Strategy Discovery**, **Concept Approval**, and
   294  **Implementation & Release Approval**
   295  
   296  ### Strategy Discovery
   297  
   298  * Develop long term priorities, strategy and roadmap for the Cosmos SDK
   299  * Release committee not yet defined as there is already a roadmap that can be used for the time being
   300  
   301  ### Concept Approval
   302  
   303  * Architecture Decision Records (ADRs) may be proposed by any contributors or maintainers of the Cosmos SDK,
   304      and should follow the guidelines outlined in the
   305      [ADR Creation Process](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/PROCESS.md)
   306  * After proposal, a time bound period for Request for Comment (RFC) on ADRs commences
   307  * ADRs are intended to be iterative, and may be merged into `main` while still in a `Proposed` status
   308  
   309  #### Time Bound Period
   310  
   311  * Once a PR for an ADR is opened, reviewers are expected to perform a first review within 1 week of pull request being open
   312  * Time bound period for individual ADR Pull Requests to be merged should not exceed 2 weeks
   313  * Total time bound period for an ADR to reach a decision (`ABANDONED | ACCEPTED | REJECTED`) should not exceed 4 weeks
   314  
   315  If an individual Pull Request for an ADR needs more time than 2 weeks to reach resolution, it should be merged
   316  in current state (`Draft` or `Proposed`), with its contents updated to summarize
   317  the current state of its discussion.
   318  
   319  If an ADR is taking longer than 4 weeks to reach a final conclusion, the **Concept Approval Committee**
   320  should convene to rectify the situation by either:
   321  
   322  * unanimously setting a new time bound period for this ADR
   323  * making changes to the Concept Approval Process (as outlined here)
   324  * making changes to the members of the Concept Approval Committee
   325  
   326  #### Approval Committee & Decision Making
   327  
   328  In absence of general consensus, decision making requires 1/2 vote from the two members
   329  of the **Concept Approval Committee**.
   330  
   331  #### Committee Members
   332  
   333  * Core Members: **Aaron** (Regen), **Bez** (IG)
   334  
   335  #### Committee Criteria
   336  
   337  Members must:
   338  
   339  * Participate in all or almost all ADR discussions, both on GitHub as well as in bi-weekly Architecture Review
   340    meetings
   341  * Be active contributors to the Cosmos SDK, and furthermore should be continuously making substantial contributions
   342    to the project's codebase, review process, documentation and ADRs
   343  * Have stake in the Cosmos SDK project, represented by:
   344      * Being a client / user of the Comsos SDK
   345      * "[giving back](https://www.debian.org/social_contract)" to the software
   346  * Delegate representation in case of vacation or absence
   347  
   348  Code owners need to maintain participation in the process, ideally as members of **Concept Approval Committee**
   349  members, but at the very least as active participants in ADR discussions
   350  
   351  Removal criteria:
   352  
   353  * Missing 3 meetings results in ICF evaluating whether the member should be removed / replaced
   354  * Violation of Code of Conduct
   355  
   356  ### Implementation & Release Approval
   357  
   358  The following process should be adhered to both for implementation PRs corresponding to ADRs, as
   359  well as for PRs made as part of a release process:
   360  
   361  * Code reviewers should ensure the PR does exactly what the ADR said it should
   362  * Code reviewers should have more senior engineering capability
   363  * 1/2 approval is required from the **primary repo maintainers** in `CODEOWNERS`
   364  
   365  **Note**: For any major release series denoted as a "Stable Release" (e.g. v0.42 "Stargate"), a separate release
   366  committee is often established. Stable Releases, and their corresponding release committees are documented
   367  separately in [Stable Release Policy](./RELEASE_PROCESS.md#stable-release-policy)*