From 3d3bf87b343c5bca63fa05197b83685754255345 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 21 Sep 2023 16:24:00 +0930 Subject: [PATCH] build: remove all trace of DEVELOPER. If you previously configured with `--enable-developer` we turn that into `--enable-debugbuild`. Signed-off-by: Rusty Russell Changelog-Removed: build: `--enable-developer` arg to configure (and DEVELOPER variables): use `./configure --enable-debugbuild` and `developer` setting at runtime. --- .github/workflows/bsd.yml | 2 +- .github/workflows/ci.yaml | 58 +++++++------------ .github/workflows/macos.yaml | 2 +- .github/workflows/prototest.yaml | 1 - Dockerfile | 3 +- Makefile | 14 +---- README.md | 8 --- common/utils.h | 11 ---- configure | 8 --- contrib/docker/scripts/build.sh | 1 - doc/beginners-guide/beginners-guide.md | 6 -- .../contributor-workflow.md | 6 +- doc/contribute-to-core-lightning/testing.md | 7 +-- .../getting-started/installation.md | 4 +- doc/node-operators-guide/faq.md | 6 +- lightningd/lightningd.c | 2 +- 16 files changed, 37 insertions(+), 102 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index e2db5b4df..f73348a7f 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -68,7 +68,7 @@ jobs: git config --global --add safe.directory `pwd` git submodule update --init --recursive - ./configure CC="$CC" --enable-developer --disable-valgrind + ./configure CC="$CC" --disable-valgrind cat config.vars diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 334cf7823..c9b431656 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,22 +77,18 @@ jobs: fail-fast: true matrix: include: - - CFG: gcc-dev1 - DEVELOPER: 1 + - CFG: compile-gcc VALGRIND: 1 COMPILER: gcc - - CFG: gcc-dev0 - DEVELOPER: 0 + - CFG: compile-gcc-O3 VALGRIND: 1 COMPILER: gcc COPTFLAGS_VAR: COPTFLAGS="-O3 -Werror" # While we're at it let's try to compile with clang - - CFG: clang-dev1 - DEVELOPER: 1 + - CFG: compile-clang VALGRIND: 1 COMPILER: clang - - CFG: clang-sanitizers - DEVELOPER: 1 + - CFG: compile-clang-sanitizers COMPILER: clang ASAN: 1 UBSAN: 1 @@ -112,7 +108,6 @@ jobs: - name: Build env: - DEVELOPER: ${{ matrix.DEVELOPER }} COMPILER: ${{ matrix.COMPILER }} ASAN: ${{ matrix.ASAN }} UBSAN: ${{ matrix.UBSAN }} @@ -151,9 +146,9 @@ jobs: fail-fast: true matrix: include: - - CFG: gcc-dev1 + - CFG: compile-gcc VALGRIND: 1 - - CFG: clang-sanitizers + - CFG: compile-clang-sanitizers VALGRIND: 0 steps: - name: Checkout @@ -209,7 +204,7 @@ jobs: - name: Build run: | - ./configure --enable-debugbuild --enable-fuzzing --enable-developer --disable-valgrind CC=clang + ./configure --enable-debugbuild --enable-fuzzing --disable-valgrind CC=clang make -j $(nproc) check-fuzz integration: @@ -227,55 +222,43 @@ jobs: fail-fast: true matrix: include: - - NAME: gcc-dev1 - CFG: gcc-dev1 - DEVELOPER: 1 - TEST_DB_PROVIDER: sqlite3 - COMPILER: gcc - TEST_NETWORK: regtest - - NAME: gcc-dev0 - CFG: gcc-dev0 - DEVELOPER: 0 + - NAME: gcc + CFG: compile-gcc TEST_DB_PROVIDER: sqlite3 COMPILER: gcc TEST_NETWORK: regtest # While we're at it let's try to compile with clang - - NAME: clang-dev1 - CFG: clang-dev1 - DEVELOPER: 1 + - NAME: clang + CFG: compile-clang TEST_DB_PROVIDER: sqlite3 COMPILER: clang TEST_NETWORK: regtest # And of course we want to test postgres too - NAME: postgres - CFG: gcc-dev1 - DEVELOPER: 1 + CFG: compile-gcc COMPILER: gcc TEST_DB_PROVIDER: postgres TEST_NETWORK: regtest # And don't forget about elements (like cdecker did when # reworking the CI...) - NAME: liquid - CFG: gcc-dev1 - DEVELOPER: 1 + CFG: compile-gcc COMPILER: gcc TEST_NETWORK: liquid-regtest TEST_DB_PROVIDER: sqlite3 # And dual funding! - NAME: dual-fund - CFG: gcc-dev1 + CFG: compile-gcc TEST_DB_PROVIDER: sqlite3 COMPILER: gcc TEST_NETWORK: regtest - DEVELOPER: 1 EXPERIMENTAL_DUAL_FUND: 1 # And splicing! - NAME: splicing - CFG: gcc-dev1 + CFG: compile-gcc TEST_DB_PROVIDER: sqlite3 COMPILER: gcc TEST_NETWORK: regtest - DEVELOPER: 1 EXPERIMENTAL_SPLICING: 1 steps: - name: Checkout @@ -301,7 +284,6 @@ jobs: - name: Test env: - DEVELOPER: ${{ matrix.DEVELOPER }} COMPILER: ${{ matrix.COMPILER }} EXPERIMENTAL_DUAL_FUND: ${{ matrix.EXPERIMENTAL_DUAL_FUND }} EXPERIMENTAL_SPLICING: ${{ matrix.EXPERIMENTAL_SPLICING }} @@ -325,7 +307,7 @@ jobs: BITCOIN_VERSION: "25.0" ELEMENTS_VERSION: 22.0.2 RUST_PROFILE: release # Has to match the one in the compile step - CFG: gcc-dev1 + CFG: compile-gcc PYTEST_OPTS: --test-group-random-seed=42 --timeout=1800 needs: - compile @@ -375,10 +357,10 @@ jobs: - name: Download build uses: actions/download-artifact@v3 with: - name: cln-gcc-dev1.tar.bz2 + name: cln-compile-gcc.tar.bz2 - name: Unpack build - run: tar -xvjf cln-gcc-dev1.tar.bz2 + run: tar -xvjf cln-compile-gcc.tar.bz2 - name: Test env: @@ -448,10 +430,10 @@ jobs: - name: Download build uses: actions/download-artifact@v3 with: - name: cln-clang-sanitizers.tar.bz2 + name: cln-compile-clang-sanitizers.tar.bz2 - name: Unpack build - run: tar -xvjf cln-clang-sanitizers.tar.bz2 + run: tar -xvjf cln-compile-clang-sanitizers.tar.bz2 - name: Test run: | diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 280052d32..dcc30836f 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -55,5 +55,5 @@ jobs: slow_test: marks tests as slow (deselect with '-m "not slow_test"') EOF - python3.10 -m poetry run ./configure --enable-developer --disable-valgrind --disable-compat + python3.10 -m poetry run ./configure --disable-valgrind --disable-compat python3.10 -m poetry run make diff --git a/.github/workflows/prototest.yaml b/.github/workflows/prototest.yaml index c9940f66f..fa768fdf8 100644 --- a/.github/workflows/prototest.yaml +++ b/.github/workflows/prototest.yaml @@ -28,7 +28,6 @@ jobs: -e NETWORK=${{ matrix.network }} \ -e TARGET_HOST=${{ matrix.TARGET_HOST }} \ -e VALGRIND=${{ matrix.valgrind }} \ - -e DEVELOPER=1 \ -e PYTEST_PAR=2 \ -e PYTEST_OPTS="--timeout=300" \ -e TEST_CMD="make check-protos" \ diff --git a/Dockerfile b/Dockerfile index 312d30cc5..a5ef573f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -99,7 +99,6 @@ COPY . /tmp/lightning RUN git clone --recursive /tmp/lightning . && \ git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD) -ARG DEVELOPER=1 ENV PYTHON_VERSION=3 RUN curl -sSL https://install.python-poetry.org | python3 - @@ -113,7 +112,7 @@ RUN /root/.local/bin/poetry export -o requirements.txt --without-hashes --with d RUN pip3 install -r requirements.txt RUN ./configure --prefix=/tmp/lightning_install --enable-static && \ - make DEVELOPER=${DEVELOPER} && \ + make && \ /root/.local/bin/poetry run make install FROM debian:bullseye-slim as final diff --git a/Makefile b/Makefile index 8a2a5a882..c0627911f 100644 --- a/Makefile +++ b/Makefile @@ -456,11 +456,7 @@ check-protos: $(ALL_PROGRAMS) ifeq ($(PYTEST),) @echo "py.test is required to run the protocol tests, please install using 'pip3 install -r requirements.txt', and rerun 'configure'."; false else -ifeq ($(DEVELOPER),1) @(cd external/lnprototest && PYTHONPATH=$(MY_CHECK_PYTHONPATH) LIGHTNING_SRC=../.. $(PYTEST) --runner lnprototest.clightning.Runner $(PYTEST_OPTS)) -else - @echo "lnprototest target requires DEVELOPER=1, skipping" -endif endif pytest: $(ALL_PROGRAMS) $(DEFAULT_TARGETS) $(ALL_TEST_PROGRAMS) $(ALL_TEST_GEN) @@ -468,8 +464,8 @@ ifeq ($(PYTEST),) @echo "py.test is required to run the integration tests, please install using 'pip3 install -r requirements.txt', and rerun 'configure'." exit 1 else -# Explicitly hand DEVELOPER and VALGRIND so you can override on make cmd line. - PYTHONPATH=$(MY_CHECK_PYTHONPATH) TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS) +# Explicitly hand VALGRIND so you can override on make cmd line. + PYTHONPATH=$(MY_CHECK_PYTHONPATH) TEST_DEBUG=1 VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS) endif check-fuzz: $(ALL_FUZZ_TARGETS) @@ -734,13 +730,7 @@ pyln-release: $(PYLNS:%=pyln-release-%) pyln-release-%: cd contrib/pyln-$* && $(MAKE) prod-release -# These must both be enabled for update-mocks -ifeq ($(DEVELOPER),1) update-mocks: $(ALL_TEST_PROGRAMS:%=update-mocks/%.c) -else -update-mocks: - @echo Need DEVELOPER=1 to regenerate mocks >&2; exit 1 -endif $(ALL_TEST_PROGRAMS:%=update-mocks/%.c): $(ALL_GEN_HEADERS) $(EXTERNAL_LIBS) libccan.a ccan/ccan/cdump/tools/cdump-enumstr config.vars diff --git a/README.md b/README.md index a41ce1212..b8648d733 100644 --- a/README.md +++ b/README.md @@ -55,13 +55,6 @@ of the `startup_regtest.sh` file for details on how to use it. . contrib/startup_regtest.sh ``` -Note that your local nodeset will be much faster/more responsive if -you've configured your node to expose the developer options, e.g. - -```bash -./configure --enable-developer -``` - #### Mainnet Option To test with real bitcoin, you will need to have a local `bitcoind` node running: @@ -211,7 +204,6 @@ If you encrypt your `hsm_secret`, you will have to pass the `--encrypted-hsm` st ### Developers Developers wishing to contribute should start with the developer guide [here](doc/contribute-to-core-lightning/coding-style-guidelines.md). -You should also configure with `--enable-developer` to get additional checks and options. [blockstream-store-blog]: https://blockstream.com/2018/01/16/en-lightning-charge/ [std]: https://github.com/lightning/bolts diff --git a/common/utils.h b/common/utils.h index cc49aa3b5..982492245 100644 --- a/common/utils.h +++ b/common/utils.h @@ -131,17 +131,6 @@ STRUCTEQ_DEF(ripemd160, 0, u); * complained on, so we can re-test as gcc evolves. */ #define COMPILER_WANTS_INIT(compiler_versions) = 0 -/* For case where we want one thing if DEVELOPER, another if not, particularly - * for function parameters. - * - * Usefully, you can refer to DEVELOPER-only fields here. */ -#if DEVELOPER -/* Make sure that nondev is evaluated, and valid */ -#define IFDEV(dev, nondev) ((void)(nondev), (dev)) -#else -#define IFDEV(dev, nondev) (nondev) -#endif - /* Context which all wally allocations use (see common/setup.c) */ extern const tal_t *wally_tal_ctx; diff --git a/configure b/configure index 433451d65..39227e05c 100755 --- a/configure +++ b/configure @@ -149,10 +149,7 @@ set_defaults() PREFIX=${PREFIX:-/usr/local} CC=${CC:-cc} CDEBUGFLAGS=${CDEBUGFLAGS--std=gnu11 -g -fstack-protector-strong} - DEVELOPER=${DEVELOPER:-0} DEBUGBUILD=${DEBUGBUILD:-0} - # --enable-developer forces debug build - [ "$DEVELOPER" = 0 ] || DEBUGBUILD=1 COMPAT=${COMPAT:-1} STATIC=${STATIC:-0} CLANG_COVERAGE=${CLANG_COVERAGE:-0} @@ -208,8 +205,6 @@ usage() echo "Options include:" usage_with_default "--prefix=" "$PREFIX" echo " Prefix for make install" - usage_with_default "--enable/disable-developer" "$DEVELOPER" "enable" "disable" - echo " Developer mode, good for testing" usage_with_default "--enable/disable-debugbuild" "$DEBUGBUILD" "enable" "disable" echo " Extra debug checks in the build, good for testing" usage_with_default "--enable/disable-compat" "$COMPAT" "enable" "disable" @@ -273,8 +268,6 @@ for opt in "$@"; do COPTFLAGS=*) COPTFLAGS="${opt#COPTFLAGS=}";; PYTEST=*) PYTEST="${opt#PYTEST=}";; --prefix=*) PREFIX="${opt#--prefix=}";; - --enable-developer) DEVELOPER=1;; - --disable-developer) DEVELOPER=0;; --enable-debugbuild) DEBUGBUILD=1;; --disable-debugbuild) DEBUGBUILD=0;; --enable-compat) COMPAT=1;; @@ -521,7 +514,6 @@ add_var SQLITE3_LDLIBS "$SQLITE3_LDLIBS" add_var POSTGRES_INCLUDE "$POSTGRES_INCLUDE" add_var POSTGRES_LDLIBS "$POSTGRES_LDLIBS" add_var VALGRIND "$VALGRIND" -add_var DEVELOPER "$DEVELOPER" $CONFIG_HEADER.$$ add_var DEBUGBUILD "$DEBUGBUILD" add_var COMPAT "$COMPAT" $CONFIG_HEADER.$$ add_var PYTEST "$PYTEST" diff --git a/contrib/docker/scripts/build.sh b/contrib/docker/scripts/build.sh index c9cb48228..952224916 100755 --- a/contrib/docker/scripts/build.sh +++ b/contrib/docker/scripts/build.sh @@ -6,7 +6,6 @@ export BOLTDIR=bolts export CC=${COMPILER:-gcc} export COMPAT=${COMPAT:-1} export TEST_CHECK_DBSTMTS=${TEST_CHECK_DBSTMTS:-0} -export DEVELOPER=${DEVELOPER:-1} export PATH=$CWD/dependencies/bin:"$HOME"/.local/bin:"$PATH" export PYTEST_OPTS="--maxfail=5 --suppress-no-test-exit-code ${PYTEST_OPTS}" export PYTEST_PAR=${PYTEST_PAR:-10} diff --git a/doc/beginners-guide/beginners-guide.md b/doc/beginners-guide/beginners-guide.md index c0866bdbb..0341ef4a4 100644 --- a/doc/beginners-guide/beginners-guide.md +++ b/doc/beginners-guide/beginners-guide.md @@ -16,12 +16,6 @@ If you want to experiment with `lightningd`, there's a script to set up a `bitco . contrib/startup_regtest.sh ``` -Note that your local nodeset will be much faster/more responsive if you've configured your node to expose the developer options, e.g. - -```bash -./configure --enable-developer -``` - #### Mainnet Option To test with real bitcoin, you will need to have a local `bitcoind` node running: diff --git a/doc/contribute-to-core-lightning/contributor-workflow.md b/doc/contribute-to-core-lightning/contributor-workflow.md index 889e9597a..90ab20c4a 100644 --- a/doc/contribute-to-core-lightning/contributor-workflow.md +++ b/doc/contribute-to-core-lightning/contributor-workflow.md @@ -18,20 +18,20 @@ sudo apt install valgrind cppcheck shellcheck libsecp256k1-dev libpq-dev Re-run `configure` and build using `make`: ```shell -./configure --enable-developer +./configure 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. +There are various development options enabled by running with `--developer`. 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. ```shell -./configure --enable-developer +./configure make -j$(nproc) ``` diff --git a/doc/contribute-to-core-lightning/testing.md b/doc/contribute-to-core-lightning/testing.md index cadec0235..272e66a86 100644 --- a/doc/contribute-to-core-lightning/testing.md +++ b/doc/contribute-to-core-lightning/testing.md @@ -11,7 +11,6 @@ updatedAt: "2023-07-13T05:21:39.220Z" Tests are run with: `make check [flags]` where the pertinent flags are: ```shell -DEVELOPER=[0|1] - developer mode increases test coverage VALGRIND=[0|1] - detects memory leaks during test execution but adds a significant delay PYTEST_PAR=n - runs pytests in parallel ``` @@ -19,7 +18,7 @@ PYTEST_PAR=n - runs pytests in parallel A modern desktop can build and run through all the tests in a couple of minutes with: ```shell Shell -make -j12 full-check PYTEST_PAR=24 DEVELOPER=1 VALGRIND=0 +make -j12 full-check PYTEST_PAR=24 VALGRIND=0 ``` Adjust `-j` and `PYTEST_PAR` accordingly for your hardware. @@ -92,7 +91,7 @@ In order to build the Core Lightning binaries with code coverage you will need a Then you'll need to enable support at configuration time. You likely want to enable a few sanitizers for bug detections as well as experimental features for an extended coverage (not required though). ```shell -./configure --enable-developer --enable-address-sanitizer --enable-ub-sanitizer --enable-fuzzing --disable-valgrind CC=clang && make +./configure --enable-address-sanitizer --enable-ub-sanitizer --enable-fuzzing --disable-valgrind CC=clang && make ``` The targets will be built in `tests/fuzz/` as `fuzz-` binaries, with their best known seed corpora stored in `tests/fuzz/corpora/`. @@ -169,4 +168,4 @@ In order to write a new target: - fill two functions: `init()` for static stuff and `run()` which will be called repeatedly with mutated data. - read about [what makes a good fuzz target](https://github.com/google/fuzzing/blob/master/docs/good-fuzz-target.md). -A simple example is [`fuzz-addr`](https://github.com/ElementsProject/lightning/blob/master/tests/fuzz/fuzz-addr.c). It setups the chainparams and context (wally, tmpctx, ..) in `init()` then bruteforces the bech32 encoder in `run()`. \ No newline at end of file +A simple example is [`fuzz-addr`](https://github.com/ElementsProject/lightning/blob/master/tests/fuzz/fuzz-addr.c). It setups the chainparams and context (wally, tmpctx, ..) in `init()` then bruteforces the bech32 encoder in `run()`. diff --git a/doc/getting-started/getting-started/installation.md b/doc/getting-started/getting-started/installation.md index bc085c380..305a033d4 100644 --- a/doc/getting-started/getting-started/installation.md +++ b/doc/getting-started/getting-started/installation.md @@ -153,7 +153,7 @@ This will put you in a new shell to enter the following commands: ```shell poetry install -./configure --enable-developer +./configure make make check VALGRIND=0 ``` @@ -480,7 +480,7 @@ Build with: ```shell BUILD=x86_64 MAKE_HOST=arm-linux-androideabi \ - make PIE=1 DEVELOPER=0 \ + make PIE=1 \ CONFIGURATOR_CC="arm-linux-androideabi-clang -static" ``` diff --git a/doc/node-operators-guide/faq.md b/doc/node-operators-guide/faq.md index 92ec70180..7a903166a 100644 --- a/doc/node-operators-guide/faq.md +++ b/doc/node-operators-guide/faq.md @@ -128,7 +128,7 @@ lightning-cli dev-forget-channel $NODEID -This will perform additional checks on whether it is safe to forget the channel, and only then removes the channel from the DB. Notice that this command is only available if CLN was compiled with `DEVELOPER=1`. +This will perform additional checks on whether it is safe to forget the channel, and only then removes the channel from the DB. Notice that this command is only available if CLN was started with `--developer`. ### My channel is stuck in state `CHANNELD_AWAITING_LOCKIN` @@ -177,7 +177,7 @@ There are 3 types of 'rescans' you can make: - `rescanblockchain`: A `bitcoind` RPC call which rescans the blockchain starting at the given height. This does not have an effect on Core Lightning as `lightningd` tracks all block and wallet data independently. - `--rescan=depth`: A `lightningd` configuration flag. This flag is read at node startup and tells lightningd at what depth from current blockheight to rebuild its internal state. (You can specify an exact block to start scanning from, instead of depth from current height, by using a negative number) -- `dev-rescan-outputs`: A `lightningd` RPC call. Only available if your node has been configured and built in DEVELOPER mode (i.e. `./configure --enable-developer`) This will sync the state for known UTXOs in the `lightningd` wallet with `bitcoind`. As it only operates on outputs already seen on chain by the `lightningd` internal wallet, this will not find missing wallet funds. +- `dev-rescan-outputs`: A `lightningd` RPC call. Only available if your node has been started in developer mode (i.e. `--developer`). This will sync the state for known UTXOs in the `lightningd` wallet with `bitcoind`. As it only operates on outputs already seen on chain by the `lightningd` internal wallet, this will not find missing wallet funds. ### Database corruption / channel state lost @@ -201,4 +201,4 @@ If `option_static_remotekey` is enabled you can attempt to recover the funds in ### How do I get the `psbt` for RPC calls that need it? -A `psbt` is created and returned by a call to [`utxopsbt` with `reservedok=true`](ref:lightning-utxopsbt). \ No newline at end of file +A `psbt` is created and returned by a call to [`utxopsbt` with `reservedok=true`](ref:lightning-utxopsbt). diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 885f514bc..64a132566 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -115,7 +115,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx) * should use 'const' on pointers if you can. */ /* They can turn this on with --developer */ - ld->developer = IFDEV(true, false); + ld->developer = false; /*~ We used to EXPLICITLY #if-wrap DEVELOPER code, but as our test * matrix grew, we turned them into a --developer runtime option.