This guideline intends to make contribtuions to Caliper easier by:
- presenting a simple development workflow for contributors to follow;
- and providing a high-level description of the repository components.
If you have further suggestions about improving the guideline, then you can follow the presented workflow to make your contribution.
The project uses GitHub to manage issues (bug reports and feature requests) and contributions (in the form of pull requests).
For general queries and discussion, please use the #caliper channel on the Hyperledger Discord Server (Discord Id required) or the Caliper mailing list (LFID recommended).
The contribution process boils down to two major steps: opening an issue and submitting a pull request (PR). Opening issues before PRs serves the following purposes:
- Documenting bugs, related error logs, potential fixes, and/or workarounds that users can find using their favorite search engine.
- Providing a forum for discussions where both contributors and users can weigh in about new features and their potential design.
- Enabling easy traceability of contributions through the "Commit → PR → Issue" reference chain.
Opening issues can be omitted only in the case of trivial and small fixes (e.g., typo fixes, simple documentation enhancements, etc.).
Before opening an issue, make sure that:
- You read the documentation carefully, so the observed error does not stem from incorrect Caliper configuration or usage.
- You searched older issues (or other forums) for your question, maybe it is already answered/fixed.
- It is worth to ask around on Discord, maybe other users already encountered your issue/task, and managed to solve it.
When opening an issue about a potential bug or feature request, make sure to properly fill and format the issue contents!
Choose the issue template that suits your intent (bug report or feature request), then fill out the form as best as you can.
If you find the available issue templates too constraining, then you can still use the "blank" issue template for now (it will be deprecated in the future), and also let us know how we can improve the issue templates.
The details of the blank template should be filled according to the following guideline:
- Issue title: Should be a concise sentence summarising the details below, including which component or part of the benchmarking process is affected. For example:
Fabric contract deployment silently fails in generator CI test
- Context: A detailed description of the context of the issue. Should include information about, for example, how you encountered the issue, what were you trying to achieve, why you consider this a bug, and how it affected your work with Caliper?
- Expected Behavior: What was your expected outcome/behavior of the Caliper run?
- Actual Behavior: What was your actually observered outcome/behaviour instead of the expected one?
- Possible Fix: If you have already identified the source of the issue, you can also propose a possible fix for it. It does not necessarily have to be a working code, some general steps/ideas of a fix is also appreciated.
- Steps to Reproduce: This is perhaps the most important part of an issue. Since Caliper is highly configurable and can interact with multiple SUTs, it is crucial for the maintainers to know the exact steps to reproduce an issue. Always try to provide (or just describe) a minimal working example (MWE) that can reproduce the issue. Also, please attach the following information to the issues whenever possible (preferably using collapsable code blocks or GitHub gists):
- The benchmark configuration file content.
- The network configuration file content.
- The workload module implementation.
- The exact error logs (and their surroundings).
- Any other information you deem neccessary.
- Existing Issues: You can also provide links to similar (or the same) issues in other forums (GitHub issues, StackOverflow questions or Discord messages). Such cross-linking can help us ensure that we can broadcast the potential fixes to multiple instances of the question.
- Your Environment: Always include your execution environment information, including the used version/commit of Caliper, the operating system, Node.JS version, or any relevant information about your project that uses Caliper.
The following workflow should make your contribution process clean and straighforward (some deviations might be neccessary in exceptional cases):
The following list assumes that you use the
git
command line tool. IDEs and graphical git tools should also expose the same commands if you prefer those.
- Fork the Caliper repository. This needs to be done only once.
- Clone the fork repository to your local machine (ideally done once):
- Using the
HTTPS
method:git clone https://github.com/<username>/caliper.git
- or using the
SSH
method:git clone git@github.com:<username>/caliper.git
- Using the
- Add the upstream/original Caliper repository as a remote, using the name
upstream
(ideally done once). This will allow you to easily sync your fork with the original repository.git remote add upstream https://github.com/hyperledger/caliper.git
The following steps follow the "feature branch" development practice, and should be performed for each of your contribution:
- Checkout your
main
branch that will be the starting point/state of your contribution.git checkout main
- or
git checkout -b main
if the branch does not exist locally (only during your first checkout)
- Retrieve the new updates from the
upstream
Caliper repositorygit fetch upstream
(downloads the updates locally)- then
git rebase upstream/main
("adds" the updates to your localmain
brach)
This step is crucial to ensure that you always contribute based on the latest Caliper version, minimizing the chance of version control conflicts!
- (Optional) Push your updated
main
branch to your remote repository just to keep things in syncgit push
- Create a new feature branch (named
my-bug-fix
) from the updatedmain
branch:git checkout -b my-bug-fix
- then
git push --set-upstream origin my-bug-fix
to push the new branch to your remote repository
- Implement and test your contribution
- The
.build/checks-and-unit-tests.sh
script runs the basic tests for the repository - The
BENCHMARK=<test_name> .build/benchmark-integration-test-direct.sh
script can run one of the CI integration tests, depending on the value of<test_name>
:BESU
ETHEREUM
FABRIC
GENERATOR
Make sure that the tests pass locally before pushing your changes and opening a PR!
- The
- Commit your changes to your local feature branch, adding the DCO sign-off:
git commit -s -m "Commit message"
- or
git commit -s
(without the-m
parameter) to make git open up the configured text editor where you can write a detailed, multi-line commit message:- The first line is a concise description of the commit (its purpose, what does it fix, etc).
- After a blank line, you can go into details about the changes of the commit.
- Push your changes to your remote branch:
git push
- Open a PR using the GitHub webpage.
It is possible that the maintainers/reviewers request some changes before your PR can be merged. In that case, just add your changes to your feature branch using a new signed commit (based on the above workflow), then push it to your remote branch. The PR will automatically pick up the new commit.
The maintainers can/will squash commits before merging to keep a simpler commit history for the project.
The project is maintained as a Node.js monorepository. Accordingly, it can seem overwhelming at first to navigate its content. The following sections list and introduce the main components of the repository.
You can find the following main component types at the root of the repository:
- Project-related documentation files
- Linting- and formatting-related files
- Dependency- and build-related files/directories
- Main code-based components of Caliper in the packages/ directory
The packages/ directory contains the following public/published packages:
- caliper-cli: The command line interface (CLI) of Caliper.
- caliper-core: The core and common codebase of Caliper, used by the other packages.
- caliper-ethereum: The Ethereum and Hyperledger Besu connector implementation.
- caliper-fabric: The Hyperledger Fabric connector implementation.
- generator-caliper: The Yeaoman generator for Caliper configuration files.
The packages/ directory contains the following internal packages:
- caliper-publish: Utility CLI for publishing Caliper to NPM and DockerHub.
- caliper-tests-integration: Collection of CI integration tests.
Connectors are relatively heavy components in Caliper. Before you attempt to create a new connector for a new SUT type, consult with the Caliper maintainers (on Discord, or in the form of a feature request).
More importantly, make sure that you are overly familiar with the documentation page about implementing new connectors.
Hyperledger Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Hyperledger Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.