Commit Graph

460 Commits

Author SHA1 Message Date
Jon Griffiths 8b4136bad5 build: remove gmp
Core and secp have not used gmp for a very long time now (core disabled
it in 2015).

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
2023-05-24 18:21:43 +09:30
Rusty Russell e7d4c3175a build: remove --enable-experimental-features / EXPERIMENTAL_FEATURES
Changelog-EXPERIMENTAL: Build: all experimental features are now runtime-enabled; no more ./configure --enable-experimental-features
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell 4deb552fe9 build: don't generate experimental variants of wire files.
We no longer have any experimental-only wire definitions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell 244217f921 tools/generate-wire.py: intuit tlvs field if a tlv type is mentioned.
The modern style is to assert that all messages have tlvs, but many
are currently empty.  In particular,
c4c5a8e5fb30b1b99fa5bb0aba7d0b6b4c831ee5 added "update_add_htlc_tlvs"
without adding an explicit field of that type to "update_add_htlc".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell 53566c47bd tools: remove optional csv field handling.
There are no feature-dependent fields left in the spec.  (I've also
made a PR for the spec to remove the tooling for it there).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Alex Myers 8163bfc7bd reckless: simplify installer registration
Fixes a bug in installer registration where executable is evaluated
before entrypoints and other details are added.

***RECKLESS STDERR***
Traceback (most recent call last):
  File lightning/tools/reckless, line 382, in <module>
    INSTALLERS['nodejs'].add_entrypoint('{name}')
KeyError: 'nodejs'

Reported by @ksedgwic

Changelog-None
2023-04-24 13:08:15 -07:00
Alex Myers f731695430 reckless: provide response when failing to add source 2023-04-15 10:33:07 -07:00
Alex Myers 233f05e0e2 reckless: enable case-insensitive searching
Adds a test to validate case matching.
2023-04-15 10:33:07 -07:00
Alex Myers d279da551b reckless: add missing type hints 2023-04-15 10:33:07 -07:00
Alex Myers 347e7237f8 reckless: match name using installer entry formats
When enabling or disabling a plugin, the entrypoint is inferred
from the user provided name. A canonical name should be used, which
the installer entrypoint formats help to determine (this generally strips
the file extension if one is provided.)
2023-04-15 10:33:07 -07:00
Alex Myers 2577096e71 reckless: install command now uses `Installer` class methods
Also adds a timeout when testing a plugin.  Previously the behavior
of pyln-client was relied upon to exit if not communicating with
lightningd, however, this behavior is not universal.

Changlelog-Changed: reckless now installs node.js plugins
2023-04-15 10:33:07 -07:00
Alex Myers 32dd8258d4 reckless: add installer methods
Also removes support for pip editable install using pyproject.toml
`pip install -e .` This was a fallback method when a requirements
file was not present, but was hacky and often failed anyway.

reckless: remove installation via pyproject.toml

This method relied on pip install in editable mode (hacky) and often
failed to complete anyhow.  We should instead encourage a requirements
file to be created/used for user installation.
2023-04-15 10:33:07 -07:00
Alex Myers d5df26f613 reckless: add Installer class to support additional languages
This abstracts the installation procedure to allow generic operations
such as dependency installation to be performed for languages.
2023-04-15 10:33:07 -07:00
Alex Myers 6ac0842aa1 reckless: fix crash on non-verbose output
Also cleans up verbose logic
2023-04-15 10:33:07 -07:00
Alex Myers f5a132314a reckless: remove extraneous web request 2023-04-15 10:33:07 -07:00
Alex Myers 6163138420 reckless: avoid superfluous config rewrites 2023-04-15 10:33:07 -07:00
Alex Myers b59b6b9cec reckless: fix CLI redirect, minor cleanup 2023-04-15 10:33:07 -07:00
Rusty Russell 62d9ecb6d3 hsmtool: makerune command.
You still need to actually make a rune when lightningd starts, as
commando (for safety) won't work unless you actually generate a rune
(that it knows of!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: hsmtool: `makerune` command to make a master rune for a node.
2023-04-11 11:19:13 -07:00
Rusty Russell 441b38c9ea hsmtool: move sodium_init() to top level.
This way we always call it (we weren't for some paths!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-11 11:19:13 -07:00
Rusty Russell e5c76f829e hsmtool: rework common hsm_secret fetch/decode.
1. Rename get_hsm_secret to get_unencrypted_hsm_secret.
2. Create a common helper for fetching full file contents.
3. Create new routine to decrypt if necessary: get_hsm_secret().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-11 11:19:13 -07:00
Alex Myers cf203369bc reckless: use environment variable redirects
This will be used during CI testing in the following commit.
2023-04-09 12:41:11 +09:30
Alex Myers 55cddcd350 reckless: add support for additional networks
This should have been added earlier as @cdecker suggested, but is needed
to enable CI testing.

Changelog-Changed: Reckless - added support for networks beyond bitocoin and regtest
2023-04-09 12:41:11 +09:30
Alex Myers e61401aab9 reckless: don't crash on subprocess calls
They prefer Paths to be explicitly cast as strings
2023-04-09 12:41:11 +09:30
Rusty Russell aa1a0e31fd Docker: run directory for post-start if present.
Also, fix the case where we didn't use --network with EXPOSE_TCP,
as reported by @theborakompanioni:

```
I get Wrong network! Our Bitcoin backend is running on 'regtest', but we expect 'main'. with LIGHTNINGD_NETWORK := regtest when param --network is not provided.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-03-23 16:43:07 +10:30
Rusty Russell eb6b8551d4 tools/fromschema.py: don't try to handle more complex cases.
We only handle top-level objects with an array of objects:
make sure it is one before we call the routines.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-01-30 15:15:41 -06:00
Rusty Russell 885506765e tools/check-bolt.c: don't leak open directory.
Thanks valgrind!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-01-30 13:24:29 +10:30
Rusty Russell b2148d0eab docs: handle "added": "version" and "deprecated": "version" from schemas.
This means we will document deprecations and additions, rather than just
pretending they've always been that way!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-01-11 12:51:18 +10:30
Matt Whitlock 31732f7825 fromschema.py: escape underscores in descriptions 2022-12-12 15:34:00 +10:30
Alex Myers 70fc702ee4 reckless: further verbosity/squelch of pip output 2022-12-06 10:42:29 +01:00
Alex Myers 8653d1200f reckless: avoid redundant include statement in config 2022-12-06 10:42:29 +01:00
Alex Myers 3f2e923e81 reckless: fix verbose option
The switch to logging enabled verbose output regardless of the option
flag. Here the functionality is restored.

Changelog-Fixed: reckless verbosity properly applied.
2022-12-06 10:42:29 +01:00
Rusty Russell 5e76c74622 tools/generate_wire.py: don't declare unused for variable.
Ubuntu clang 15.0.2-1 complains:

```
wire/peer_exp_wiregen.c:257:14: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
        for (size_t i = 0; *plen != 0; i++) {
                    ^
wire/peer_exp_wiregen.c:1373:14: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
        for (size_t i = 0; *plen != 0; i++) {
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-11-18 12:26:59 +01:00
Christian Decker 7b12d3eb60 reckless: Replace custom logging with the logging crate 2022-11-10 16:29:56 +01:00
Christian Decker 77b7a74cd6 reckless: Replace urllib3 with urllib
`urllib3` does not ship as built-in with any of the recent python
releases, whereas `urllib` does, and for the uses we have, they are
pretty much identical.
2022-11-10 16:29:56 +01:00
Alex Myers fd52e260f0 reckless: neaten path conversions
Changelog-None
2022-11-10 16:29:56 +01:00
Alex Myers f1c2f811b7 reckless: avoid changing directory during install 2022-11-10 16:29:56 +01:00
Alex Myers 36b4457c04 reckless: Use urllib3 instead of requests
The requests package is preferred, but until installation of python user
dependencies is implemented, sticking with standard modules allows a
frictionless experience.
2022-11-10 16:29:56 +01:00
Rusty Russell 2e4a58efac check: fix warnings from shellcheck 0.8.0
And make errors gcc-style, so emacs can jump through the automatically.

```
In devtools/reduce-includes.sh line 21:
	    echo -n "-$LINE"
                 ^-- SC3037 (warning): In POSIX sh, echo flags are undefined.


In devtools/reduce-includes.sh line 25:
	    echo -n "."
                 ^-- SC3037 (warning): In POSIX sh, echo flags are undefined.


In tools/rel.sh line 6:
prefix=$(printf '%s\n' "${from#$common}" | sed 's@[^/][^/]*@..@g')
                               ^-----^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.

Did you mean: 
prefix=$(printf '%s\n' "${from#"$common"}" | sed 's@[^/][^/]*@..@g')


In tools/rel.sh line 7:
printf '%s\n' "$prefix/${to#$common}"
                            ^-----^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.

Did you mean: 
printf '%s\n' "$prefix/${to#"$common"}"

For more information:
  https://www.shellcheck.net/wiki/SC3037 -- In POSIX sh, echo flags are undef...
  https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b...
make: *** [Makefile:553: check-shellcheck] Error 123
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-11-09 15:08:03 +01:00
Alex Myers 341d73fdc2 reckless: fix git clone issue with removed dir
Reckless was failing to install multiple plugins due to git not
appreciating the cwd being a now removed dir after the first plugin
tmp files were cleaned up.
2022-11-08 13:19:36 +01:00
Alex Myers e48fda1ba0 reckless: analyze repositories with urlparse 2022-11-08 13:19:36 +01:00
Alex Myers 2f4e862863 reckless: improve config file handling
While loading the appropriate lightningconfig file, it is now checked
against the active config file in lightningd. Because a deviation from the
default file structure would not be possible, a -conf option is also added
to explicitly pass the lightningd config file into reckless.
2022-11-08 13:19:36 +01:00
Alex Myers 53ad1ee576 reckless: add function for lightning-cli calls
This also simplifies dynamic enable/disable by catching the exception
raised when the cli is unable to connect to RPC (lightningd offline or
misconfigured relative to reckless).
2022-11-08 13:19:36 +01:00
Alex Myers 4a95a4c7da reckless: multiline string style cleanup 2022-11-08 13:19:36 +01:00
Alex Myers 71351ceacf reckless: replace os.path with pathlib operations
This change makes it easier to follow retrieval of parent directories.
Additional os.path operations replaced with their pathlib.Path equivalents
to keep module usage consistent.
2022-11-08 13:19:36 +01:00
Alex Myers df98c8b927 reckless: refactor argument list handling.
The goal was to support passing a list to install, enable, etc. in order
to improve performance. Passing lists to most of the functions was less
practical than iterating through the items from the top level.
2022-11-08 13:19:36 +01:00
Alex Myers 24422e9f7c reckless: add type hints 2022-11-08 13:19:36 +01:00
Alex Myers 5d23c7ab0b reckless: raise exception or early termination instead of returning None
More pythonic than returning mixed types.
2022-11-08 13:19:36 +01:00
Alex Myers 791e521179 reckless: update help alias
`reckless help <cmd>` previously called the function docstring. This could
be updated to use the subparser help, but would require a strict naming
convention or a dictionary. Providing a hint to use the built-in
contextual help via the option flag is hopefully sufficient.
2022-11-08 13:19:36 +01:00
Alex Myers f3934cda50 reckless: use argparse subparsers
A more pythonic approach which should also enable additional help context
for subcommands.
2022-11-08 13:19:36 +01:00
Alex Myers 651c5b6de0 reckless: use config that was explicitly passed to lightningd
Regtest environments commonly use explicit definition of the config
file for lightningd.  This can be queried and utilized by default,
saving redundant definitions between lightning and reckless.
2022-11-08 13:19:36 +01:00