This PR: - adds all the guides (in markdown format) that is published at https://docs.corelightning.org/docs - adds a github workflow to sync any future changes made to files inside the guides folder - does not include API reference (json-rpc commands). Those will be handled in a separate PR since they're used as manpages and will require a different github workflow Note that the guides do not exactly map to their related files in doc/, since we reorganized the overall documentation structure on readme for better readability and developer experience. For example, doc/FUZZING.md and doc/HACKING.md#Testing are merged into testing.md in the new docs. As on the creation date of this PR, content from each of the legacy documents has been synced with the new docs. Until this PR gets merged, I will continue to push any updates made to the legacy documents into the new docs. If this looks reasonable, I will add a separate PR to clean up the legacy documents from doc/ (or mark them deprecated) to avoid redundant upkeep and maintenance. Changelog-None
8.0 KiB
title, slug, excerpt, hidden, createdAt, updatedAt
| title | slug | excerpt | hidden | createdAt | updatedAt |
|---|---|---|---|---|---|
| Contributor Workflow | contributor-workflow | Learn the practical process and guidelines for contributing. | false | 2022-12-09T09:57:57.245Z | 2023-04-22T13:00:38.252Z |
Build and Development
Install the following dependencies for best results:
sudo apt update
sudo apt install valgrind cppcheck shellcheck libsecp256k1-dev libpq-dev
Re-run configure and build using make:
./configure --enable-developer
make -j$(nproc)
Debugging
You can build Core Lightning with DEVELOPER=1 to use dev commands listed in cli/lightning-cli help. ./configure --enable-developer will do that. You can log console messages with log_info() in lightningd and status_debug() in other subdaemons.
You can debug crashing subdaemons with the argument --dev-debugger=channeld, where channeld is the subdaemon name. It will run gnome-terminal by default with a gdb attached to the subdaemon when it starts. You can change the terminal used by setting the DEBUG_TERM environment variable, such as DEBUG_TERM="xterm -e" or DEBUG_TERM="konsole -e".
It will also print out (to stderr) the gdb command for manual connection. The subdaemon will be stopped (it sends itself a SIGSTOP); you'll need to continue in gdb.
./configure --enable-developer
make -j$(nproc)
Making BOLT Modifications
All of code for marshalling/unmarshalling BOLT protocol messages is generated directly from the spec. These are pegged to the BOLTVERSION, as specified in Makefile.
Source code analysis
An updated version of the NCC source code analysis tool is available at
https://github.com/bitonic-cjp/ncc
It can be used to analyze the lightningd source code by running make clean && make ncc. The output (which is built in parallel with the binaries) is stored in .nccout files. You can browse it, for instance, with a command like nccnav lightningd/lightningd.nccout.
Subtleties
There are a few subtleties you should be aware of as you modify deeper parts of the code:
ccan/structeq's STRUCTEQ_DEF will define safe comparison functionfoo_eq()for structfoo, failing the build if the structure has implied padding.command_success,command_fail, andcommand_fail_detailedwill free thecmdyou pass in.
This also means that if youtal-allocated anything from thecmd, they will also get freed at those points and will no longer be accessible afterwards.- When making a structure part of a list, you will instance a
struct list_node. This has to be the first field of the structure, or elsedev-memleakcommand will think your structure has leaked.
Protocol Modifications
The source tree contains CSV files extracted from the v1.0 BOLT specifications (wire/extracted_peer_wire_csv and wire/extracted_onion_wire_csv). You can regenerate these by first deleting the local copy(if any) at directory .tmp.bolts, setting BOLTDIR and BOLTVERSION appropriately, and finally running make extract-bolt-csv. By default the bolts will be retrieved from the directory ../bolts and a recent git version.
e.g., make extract-bolt-csv BOLTDIR=../bolts BOLTVERSION=ee76043271f79f45b3392e629fd35e47f1268dc8
Release checklist
Here's a checklist for the release process.
Leading Up To The Release
- Talk to team about whether there are any changes which MUST go in this release which may cause delay.
- Look through outstanding issues, to identify any problems that might be necessary to fixup before the release. Good candidates are reports of the project not building on different architectures or crashes.
- Identify a good lead for each outstanding issue, and ask them about a fix timeline.
- Create a milestone for the next release on Github, and go though open issues and PRs and mark accordingly.
- Ask (via email) the most significant contributor who has not already named a release to name the release (use devtools/credit to find this contributor). CC previous namers and team.
Preparing for -rc1
- Check that
CHANGELOG.mdis well formatted, ordered in areas, covers all significant changes, and sub-ordered approximately by user impact & coolness. - Use
devtools/changelog.pyto collect the changelog entries from pull request commit messages and merge them into the manually maintainedCHANGELOG.md. This does API queries to GitHub, which are severely ratelimited unless you use an API token: set theGH_TOKENenvironment variable to a Personal Access Token from https://github.com/settings/tokens - Create a new CHANGELOG.md heading to
v<VERSION>rc1, and create a link at the bottom. Note that you should exactly copy the date and name format from a previous release, as thebuild-release.shscript relies on this. - Update the contrib/pyln package versions:
make update-pyln-versions NEW_VERSION=<VERSION> - Create a PR with the above.
Releasing -rc1
- Merge the above PR.
- Tag it
git pull && git tag -s v<VERSION>rc1. Note that you should get a prompt to give this tag a 'message'. Make sure you fill this in. - Confirm that the tag will show up for builds with
git describe - Push the tag to remote
git push --tags. - Update the /topic on #c-lightning on Libera.
- Prepare draft release notes (see devtools/credit), and share with team for editing.
- Upgrade your personal nodes to the rc1, to help testing.
- Test
tools/build-release.shto build the non-reproducible images and reproducible zipfile. - Use the zipfile to produce a Reproducible builds.
Releasing -rc2, etc
- Change rc1 to rc2 in CHANGELOG.md.
- Add a PR with the rc2.
- Tag it
git pull && git tag -s v<VERSION>rc2 && git push --tags - Update the /topic on #c-lightning on Libera.
- Upgrade your personal nodes to the rc2.
Tagging the Release
- Update the CHANGELOG.md; remove -rcN in both places, update the date and add title and namer.
- Update the contrib/pyln package versions:
make update-pyln-versions NEW_VERSION=<VERSION> - Add a PR with that release.
- Merge the PR, then:
export VERSION=0.9.3git pullgit tag -a -s v${VERSION} -m v${VERSION}git push --tags
- Run
tools/build-release.shto build the non-reproducible images and reproducible zipfile. - Use the zipfile to produce a reproducible build.
- To create and sign checksums, start by entering the release dir:
cd release - Create the checksums for signing:
sha256sum * > SHA256SUMS - Create the first signature with
gpg -sb --armor SHA256SUMS - The tarballs may be owned by root, so revert ownership if necessary:
sudo chown ${USER}:${USER} *${VERSION}* - Upload the resulting files to github and save as a draft.
(https://github.com/ElementsProject/lightning/releases/) - Ping the rest of the team to check the SHA256SUMS file and have them send their
gpg -sb --armor SHA256SUMS. - Append the signatures into a file called
SHA256SUMS.asc, verify
withgpg --verify SHA256SUMS.ascand include the file in the draft
release. make pyln-releaseto upload pyln modules to pypi.org. This requires keys
for each of pyln-client, pyln-proto, and pyln-testing accessible to poetry.
This can be done by configuring the python keyring library along with a
suitable backend. Alternatively, the key can be set as an environment
variable and each of the pyln releases can be built and published
independently:export POETRY_PYPI_TOKEN_PYPI=<pyln-client token>make pyln-release-client- ... repeat for each pyln package.
Performing the Release
- Edit the GitHub draft and include the
SHA256SUMS.ascfile. - Publish the release as not a draft.
- Update the /topic on #c-lightning on Libera.
- Send a mail to c-lightning and lightning-dev mailing lists, using the same wording as the Release Notes in github.
Post-release
- Look through PRs which were delayed for release and merge them.
- Close out the Milestone for the now-shipped release.
- Update this file with any missing or changed instructions.