| 1 | # Contributing to Monero |
| 2 | |
| 3 | A good way to help is to test, and report bugs. See |
| 4 | [How to Report Bugs Effectively (by Simon Tatham)](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html) |
| 5 | if you want to help that way. Testing is invaluable in making a piece |
| 6 | of software solid and usable. |
| 7 | |
| 8 | |
| 9 | ## General guidelines |
| 10 | |
| 11 | * Comments are encouraged. |
| 12 | * If modifying code for which Doxygen headers exist, that header must be modified to match. |
| 13 | * Tests would be nice to have if you're adding functionality. |
| 14 | |
| 15 | Patches are preferably to be sent via a GitHub pull request. If that |
| 16 | can't be done, patches in "git format-patch" format can be sent |
| 17 | (eg, posted to fpaste.org with a long enough timeout and a link |
| 18 | posted to #monero-dev on irc.libera.chat). |
| 19 | |
| 20 | Patches should be self contained. A good rule of thumb is to have |
| 21 | one patch per separate issue, feature, or logical change. Also, no |
| 22 | other changes, such as random whitespace changes, reindentation, |
| 23 | or fixing typos, spelling, or wording, unless user visible. |
| 24 | Following the code style of the particular chunk of code you're |
| 25 | modifying is encouraged. Proper squashing should be done (eg, if |
| 26 | you're making a buggy patch, then a later patch to fix the bug, |
| 27 | both patches should be merged). |
| 28 | |
| 29 | If you've made random unrelated changes (either because your editor |
| 30 | is annoying or you made them for other reasons), you can select |
| 31 | what changes go into the coming commit using git add -p, which |
| 32 | walks you through all the changes and asks whether or not to |
| 33 | include this particular change. This helps create clean patches |
| 34 | without any irrelevant changes. git diff will show you the changes |
| 35 | in your tree. git diff --cached will show what is currently staged |
| 36 | for commit. As you add hunks with git add -p, those hunks will |
| 37 | "move" from the git diff output to the git diff --cached output, |
| 38 | so you can see clearly what your commit is going to look like. |
| 39 | |
| 40 | ## Commits and pull requests |
| 41 | |
| 42 | Commit messages should be sensible. That means a subject line that |
| 43 | describes the patch, with an optional longer body that gives details, |
| 44 | documentation, etc. |
| 45 | |
| 46 | When submitting a pull request on GitHub, make sure your branch is |
| 47 | rebased. No merge commits nor stray commits from other people in |
| 48 | your submitted branch, please. You may be asked to rebase if there |
| 49 | are conflicts (even trivially resolvable ones). |
| 50 | |
| 51 | PGP signing commits is strongly encouraged. That should explain why |
| 52 | the previous paragraph is here. |
| 53 | |
| 54 | # [Code of Conduct (22/C4.1)](http://rfc.zeromq.org/spec:22) |
| 55 | |
| 56 | ## License |
| 57 | |
| 58 | Copyright (c) 2009-2015 Pieter Hintjens. |
| 59 | Copyright (c) 2017-2022, The Monero Project |
| 60 | |
| 61 | This Specification is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. |
| 62 | |
| 63 | This Specification is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 64 | |
| 65 | You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>. |
| 66 | |
| 67 | ## Language |
| 68 | |
| 69 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. |
| 70 | |
| 71 | The "Monero Maintainer Team" is defined in this document as the following users: |
| 72 | - fluffypony |
| 73 | - moneromooo |
| 74 | - hyc |
| 75 | |
| 76 | ## Goals |
| 77 | |
| 78 | C4 is meant to provide a reusable optimal collaboration model for open source software projects. It has these specific goals: |
| 79 | |
| 80 | - To maximize the scale and diversity of the community around a project, by reducing the friction for new Contributors and creating a scaled participation model with strong positive feedbacks; |
| 81 | - To relieve dependencies on key individuals by separating different skill sets so that there is a larger pool of competence in any required domain; |
| 82 | - To allow the project to develop faster and more accurately, by increasing the diversity of the decision making process; |
| 83 | - To support the natural life cycle of project versions from experimental through to stable, by allowing safe experimentation, rapid failure, and isolation of stable code; |
| 84 | - To reduce the internal complexity of project repositories, thus making it easier for Contributors to participate and reducing the scope for error; |
| 85 | - To enforce collective ownership of the project, which increases economic incentive to Contributors and reduces the risk of hijack by hostile entities. |
| 86 | |
| 87 | ## Design |
| 88 | |
| 89 | ### Preliminaries |
| 90 | |
| 91 | - The project MUST use the git distributed revision control system. |
| 92 | - The project MUST be hosted on github.com or equivalent, herein called the "Platform". |
| 93 | - The project MUST use the Platform issue tracker. |
| 94 | - Non-GitHub example: |
| 95 | - "Platform" could be a vanilla git repo and Trac hosted on the same machine/network. |
| 96 | - The Platform issue tracker would be Trac. |
| 97 | - The project SHOULD have clearly documented guidelines for code style. |
| 98 | - A "Contributor" is a person who wishes to provide a patch, being a set of commits that solve some clearly identified problem. |
| 99 | - A "Maintainer" is a person who merges patches to the project. Maintainers are not developers; their job is to enforce process. |
| 100 | - Contributors MUST NOT have commit access to the repository unless they are also Maintainers. |
| 101 | - Maintainers MUST have commit access to the repository. |
| 102 | - Everyone, without distinction or discrimination, MUST have an equal right to become a Contributor under the terms of this contract. |
| 103 | |
| 104 | ### Licensing and ownership |
| 105 | |
| 106 | - The project MUST use a share-alike license, such as BSD-3, the GPLv3 or a variant thereof (LGPL, AGPL), or the MPLv2. |
| 107 | - All contributions to the project source code ("patches") MUST use the same license as the project. |
| 108 | - All patches are owned by their authors. There MUST NOT be any copyright assignment process. |
| 109 | - The copyrights in the project MUST be owned collectively by all its Contributors. |
| 110 | - Each Contributor MUST be responsible for identifying themselves in the project Contributor list. |
| 111 | |
| 112 | ### Patch requirements |
| 113 | |
| 114 | - Maintainers MUST have a Platform account and SHOULD use their real names or a well-known alias. |
| 115 | - Contributors SHOULD have a Platform account and MAY use their real names or a well-known alias. |
| 116 | - A patch SHOULD be a minimal and accurate answer to exactly one identified and agreed problem. |
| 117 | - A patch MUST adhere to the code style guidelines of the project if these are defined. |
| 118 | - A patch MUST adhere to the "Evolution of Public Contracts" guidelines defined below. |
| 119 | - A patch MUST NOT include non-trivial code from other projects unless the Contributor is the original author of that code. |
| 120 | - A patch MUST compile cleanly and pass project self-tests on at least the principle target platform. |
| 121 | - A patch commit message SHOULD consist of a single short (less than 50 character) line summarizing the change, optionally followed by a blank line and then a more thorough description. |
| 122 | - A "Correct Patch" is one that satisfies the above requirements. |
| 123 | |
| 124 | ### Development process |
| 125 | |
| 126 | - Change on the project MUST be governed by the pattern of accurately identifying problems and applying minimal, accurate solutions to these problems. |
| 127 | - To request changes, a user SHOULD log an issue on the project Platform issue tracker. |
| 128 | - The user or Contributor SHOULD write the issue by describing the problem they face or observe. |
| 129 | - The user or Contributor SHOULD seek consensus on the accuracy of their observation, and the value of solving the problem. |
| 130 | - Users MUST NOT log feature requests, ideas, or suggestions unrelated to Monero code or Monero's dependency code or Monero's potential/future dependency code or research which successfully implements Monero. |
| 131 | - Users MUST NOT log any solutions to problems (verifiable or hypothetical) of which are not explicitly documented and/or not provable and/or cannot be reasonably proven. |
| 132 | - Thus, the release history of the project MUST be a list of meaningful issues logged and solved. |
| 133 | - To work on an issue, a Contributor MUST fork the project repository and then work on their forked repository. |
| 134 | - To submit a patch, a Contributor MUST create a Platform pull request back to the project. |
| 135 | - A Contributor MUST NOT commit changes directly to the project. |
| 136 | - To discuss a patch, people MAY comment on the Platform pull request, on the commit, or elsewhere. |
| 137 | - To accept or reject a patch, a Maintainer MUST use the Platform interface. |
| 138 | - Maintainers SHOULD NOT merge their own patches except in exceptional cases, such as non-responsiveness from other Maintainers for an extended period (more than 30 days) or unless urgent as defined by the Monero Maintainers Team. |
| 139 | - Maintainers MUST NOT make value judgments on correct patches unless the Maintainer (as may happen in rare circumstances) is a core code developer. |
| 140 | - Maintainers MUST NOT merge pull requests in less than 168 hours (1 week) unless deemed urgent by at least 2 people from the Monero Maintainer Team. |
| 141 | - The Contributor MAY tag an issue as "Ready" after making a pull request for the issue. |
| 142 | - The user who created an issue SHOULD close the issue after checking the patch is successful. |
| 143 | - Maintainers SHOULD ask for improvements to incorrect patches and SHOULD reject incorrect patches if the Contributor does not respond constructively. |
| 144 | - Any Contributor who has value judgments on a correct patch SHOULD express these via their own patches. |
| 145 | - Maintainers MAY commit changes to non-source documentation directly to the project. |
| 146 | |
| 147 | ### Creating stable releases |
| 148 | |
| 149 | - The project MUST have one branch ("master") that always holds the latest in-progress version and SHOULD always build. |
| 150 | - The project MUST NOT use topic branches for any reason. Personal forks MAY use topic branches. |
| 151 | - To make a stable release someone MUST fork the repository by copying it and thus become maintainer of this repository. |
| 152 | - Forking a project for stabilization MAY be done unilaterally and without agreement of project maintainers. |
| 153 | - A patch to a stabilization project declared "stable" MUST be accompanied by a reproducible test case. |
| 154 | |
| 155 | ### Evolution of public contracts |
| 156 | |
| 157 | - All Public Contracts (APIs or protocols) MUST be documented. |
| 158 | - All Public Contracts SHOULD have space for extensibility and experimentation. |
| 159 | - A patch that modifies a stable Public Contract SHOULD not break existing applications unless there is overriding consensus on the value of doing this. |
| 160 | - A patch that introduces new features to a Public Contract SHOULD do so using new names. |
| 161 | - Old names SHOULD be deprecated in a systematic fashion by marking new names as "experimental" until they are stable, then marking the old names as "deprecated". |
| 162 | - When sufficient time has passed, old deprecated names SHOULD be marked "legacy" and eventually removed. |
| 163 | - Old names MUST NOT be reused by new features. |
| 164 | - When old names are removed, their implementations MUST provoke an exception (assertion) if used by applications. |
| 165 | |
| 166 | ### Project administration |
| 167 | |
| 168 | - The project founders MUST act as Administrators to manage the set of project Maintainers. |
| 169 | - The Administrators MUST ensure their own succession over time by promoting the most effective Maintainers. |
| 170 | - A new Contributor who makes a correct patch MUST be invited to become a Maintainer. |
| 171 | - Administrators MAY remove Maintainers who are inactive for an extended period of time, or who repeatedly fail to apply this process accurately. |
| 172 | - Administrators SHOULD block or ban "bad actors" who cause stress and pain to others in the project. This should be done after public discussion, with a chance for all parties to speak. A bad actor is someone who repeatedly ignores the rules and culture of the project, who is needlessly argumentative or hostile, or who is offensive, and who is unable to self-correct their behavior when asked to do so by others. |