Thanks for taking the time to contribute to node!
Please follow the guidelines below when contributing. If you have any questions, please feel free to reach out to us on Discord or use the discussions feature on GitHub.
Discussions are for general discussions related to node. This can be to discuss tn-db architecture, important tradeoffs / considerations, or any topics that cannot be directly closed by a pull request.
Examples of good discussions:
- Discussing potental ways to price queries in tn-db
- Discussing potential procedures for handling consensus failures & changes (and a future issue if the discussion determines we need a feature, bug fix, or documentation change).
Discussions can lead to an issue if they determine that a feature, bug fix, or documentation change is needed.
Issues are for reporting bugs, requesting features, requesting repository documentation, or discussing any other changes that can be directly resolved with a pull request to the tn-db repository.
For general discussions, or discussions where it is unclear how the discussion would be closed by a pull request, please use the discussion section.
For opening issues, please follow the following guidelines:
- Use templates for creating issues about bugs, feature requests, or documentation requests.
- Search the issue tracker before opening an issue to avoid duplicates.
- Be clear & detailed about what you are reporting. If reporting a bug, please include a minimal reproducible example, a detailed explanation of your KwilD configuration, and any logs or error messages that may be relevant.
We strongly recommended submitting an issue before submitting a pull request, especially for pull requests that will require significant effort on your part. This is to ensure that the issue is not already being worked on and that your pull request will be accepted. Some features or fixes are intentionally not included in tn-db - use issues to check with maintainers and save time!
tn-db uses recommended Go commit messages, with breaking changes and deprecations to be noted in the commit message footer. Commits should follow the following format:
[Package/File/Directory Name]: [Concise and concrete description of the PR/Issue]
[Longer description of the PR/Issue, if necessary]
[Optional: Issues Tagged + Breaking changes/deprecations]
For example:
feat: Add new exntension to do something
This PR adds a new exntension to do something. It also adds a new flag to the existing command to do something else.
Resolves #123
BREAKING CHANGE: This PR changes the behavior of the foo command. It now does something else.
There are two types of breaking changes: API breaking changes and consensus breaking changes. API breaking changes are any changes that effect the external API of packages that are consumed outside of tn-db. Consensus breaking changes are any changes that effect the consensus protocol of tn-db (i.e. changes to the extension, or changes to the consensus protocol in internal).
Changes to internal packages (i.e. deployments, internal, and scripts) that do not affect the database or consensus are not considered breaking changes and do not need to be tagged in the commit footer.
Please ensure that your contributions adhere to the following coding guidelines:
- Code should adhere to the official Go formatting guidelines (i.e. use
gofmtortask fmtto format code). - Code must be documented adhering to the Go commentary guidelines and Go Doc comments.
- Code should be tested as much as possible. Tests should be placed in the same package as the code they are testing, in a file named
*_test.go(e.g.foo.goshould have a correspondingfoo_test.go).
- Fork the repository by clicking the "Fork" button on the top right of the repository page. Clone the tn-db repository and add your fork as a remote.
git clone https://github.com/trufnetwork/node
cd tn-db
git checkout main
git remote add <your-origin-name> <your-fork-url>
git fetch <your-origin-name>- Create a new branch from the main branch, and add your changes to the new branch. Ensure that your code and commits follow the coding style and commit message guidelines above.
git checkout main
git pull
git checkout -b <branch-name>- Ensure that your PR is ready to be merged and all unit and acceptance tests pass:
task lint
task coverage- Push your branch to github.
git add -u # Add all changes
git add <file> # Add specific files, if necessary
git commit -m "Your commit message"
git push -u <your-origin-name> <branch-name>Please ensure that all the commits in your git history match the commit message guidelines above. You can use git rebase -i to edit your commit history.
-
Open a pull request to the
mainbranch of the tn-db repository. Please follow the PR template. Ifmainupdates while the PR is open, please update the branch with latestmain(rebase or merge). -
Wait for a maintainer to review your PR. If there are any issues, you will be notified and you can make the necessary changes.
By contributing to tn-db, you agree that your contributions will be licensed under its Apache 2.0 License.