Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions contrib/pyln-spec/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/make

SPECDIR := ../../../lightning-rfc
SPECDIR := ../../../bolts
# This gives us something like 'v1.0-137-gae2d248b7ad8b0965f224c303019ba04c661008f'
GITDESCRIBE := $(shell git -C $(SPECDIR) describe --abbrev=40)
# -> 1.0
Expand Down Expand Up @@ -31,12 +31,14 @@ check-source-mypy-%:
cd $* && mypy --ignore-missing-imports `find * -name '*.py'`

# Given a bolt number and a variable, get the value from inside the package.
extract = $(shell python3 -c 'from pyln.spec import bolt$1 as bolt;print(bolt.$2)')
# Get the version for this bolt
version = $(call extract,$1,__version__)
extract = $(shell cat bolt$1/pyln/spec/bolt$1/gen_*version.py | sed -n 's/^$2 = \"\(.*\)\"/\1/p')

# Given a direc the csv version for this bolt.
# Get the version for this bolt
base_version = $(call extract,$1,__base_version__)
csv_version = $(call extract,$1,__csv_version__)
post_version = $(call extract,$1,__post_version__)

version = $(call base_version,$1).$(call csv_version,$1).$(call post_version,$1)

# Given a bolt number, get the current version.
sdistfiles = $(foreach b,$(BOLTS),bolt$b/dist/pyln-bolt$b-$(call version,$b).tar.gz)
Expand All @@ -50,26 +52,27 @@ bdistfiles = $(foreach b,$(BOLTS),bolt$b/dist/pyln_bolt$b-$(call version,$b)-py3

ARTEFACTS := $(foreach b,$(BOLTS),$(call bdistfiles,$b) $(call sdistfiles,$b))

test-release-bolt%: $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(call bdistfiles,$*) $(call sdistfiles,$*)
test-release-%:
cd bolt$b && poetry publish --repository testpypi

test-release: $(BOLTS:%=prod-release-%)

# Create a test virtualenv, install from the testpypi and run the
# tests against it (make sure not to use any virtualenv that may have
# pyln-proto already installed).
virtualenv testpypi-$* --python=/usr/bin/python3 --download --always-copy --clear
# Install the requirements from the prod repo, they are not being kept up to date on the test repo
testpypi-$*/bin/python3 -m pip install -r requirements.txt pytest pytest-timeout
testpypi-$*/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-bolt$*
testpypi-$*/bin/python3 -c "from pyln.spec import bolt$* as bolt;assert(bolt.__version__ == '$(call version,$*)')"
testpypi-$*/bin/pytest bolt$*/tests
rm -rf testpypi-$*
prod-release-%:
cd bolt$b && poetry publish

test-release: check $(foreach b,$(BOLTS),test-release-bolt$b)
prod-release: $(BOLTS:%=prod-release-%)

prod-release: test-release $(ARTEFACTS)
python3 -m twine upload $(ARTEFACTS)
# Pattern rules don't work reliably with multiple % in prereqs!
refresh-1: bolt1/pyln/spec/bolt1/gen_csv_version.py bolt1/pyln/spec/bolt1/gen_version.py
cd bolt1 && poetry version $(call version,1)
refresh-2: bolt2/pyln/spec/bolt2/gen_csv_version.py bolt2/pyln/spec/bolt2/gen_version.py
cd bolt2 && poetry version $(call version,2)
refresh-4: bolt4/pyln/spec/bolt4/gen_csv_version.py bolt4/pyln/spec/bolt4/gen_version.py
cd bolt4 && poetry version $(call version,4)
refresh-7: bolt7/pyln/spec/bolt7/gen_csv_version.py bolt7/pyln/spec/bolt7/gen_version.py
cd bolt7 && poetry version $(call version,7)

refresh: $(CODE_DIRS:%=%/gen_csv_version.py) $(CODE_DIRS:%=%/gen_version.py)
refresh: $(BOLTS:%=refresh-%)

bolt1/pyln/spec/bolt1/csv.py bolt1/pyln/spec/bolt1/text.py: $(SPECDIR)/01-messaging.md Makefile
bolt2/pyln/spec/bolt2/csv.py bolt2/pyln/spec/bolt2/text.py: $(SPECDIR)/02-peer-protocol.md Makefile
Expand Down
4 changes: 2 additions & 2 deletions contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__base_version__ = "1.0"
__post_version__ = "222"
__gitversion__ = "f1c797df2966237244527c1c6343dbe9bc765342"
__post_version__ = "246"
__gitversion__ = "f32c6ddb5f11b431c9bb4f501cdec604172a90de"
8 changes: 7 additions & 1 deletion contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
This protocol assumes an underlying authenticated and ordered transport mechanism that takes care of framing individual messages.
[BOLT #8](08-transport.md) specifies the canonical transport layer used in Lightning, though it can be replaced by any transport that fulfills the above guarantees.

The default TCP port is 9735. This corresponds to hexadecimal `0x2607`: the Unicode code point for LIGHTNING.<sup>[1](#reference-1)</sup>
The default TCP port depends on the network used. The most common networks are:

- Bitcoin mainet with port number 9735 or the corresponding hexadecimal `0x2607`;
- Bitcoin testnet with port number 19735 (`0x4D17`);
- Bitcoin signet with port number 39735 (`0xF87`).

The Unicode code point for LIGHTNING <sup>[1](#reference-1)</sup>, and the port convention try to follow the Bitcoin Core convention.

All data fields are unsigned big-endian unless otherwise specified.

Expand Down
2 changes: 1 addition & 1 deletion contrib/pyln-spec/bolt1/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyln-bolt1"
version = "1.0.1.187.post0"
version = "1.0.2.246"
description = ""
authors = ["Rusty Russell <rusty@blockstream.com>"]
license = "MIT"
Expand Down
9 changes: 6 additions & 3 deletions contrib/pyln-spec/bolt2/pyln/spec/bolt2/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@
"msgtype,funding_signed,35",
"msgdata,funding_signed,channel_id,channel_id,",
"msgdata,funding_signed,signature,signature,",
"msgtype,funding_locked,36",
"msgdata,funding_locked,channel_id,channel_id,",
"msgdata,funding_locked,next_per_commitment_point,point,",
"msgtype,channel_ready,36",
"msgdata,channel_ready,channel_id,channel_id,",
"msgdata,channel_ready,second_per_commitment_point,point,",
"msgdata,channel_ready,tlvs,channel_ready_tlvs,",
"tlvtype,channel_ready_tlvs,short_channel_id,1",
"tlvdata,channel_ready_tlvs,short_channel_id,alias,short_channel_id,",
"msgtype,shutdown,38",
"msgdata,shutdown,channel_id,channel_id,",
"msgdata,shutdown,len,u16,",
Expand Down
2 changes: 1 addition & 1 deletion contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen_csv_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__csv_version__ = "2"
__csv_version__ = "3"
4 changes: 2 additions & 2 deletions contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__base_version__ = "1.0"
__post_version__ = "222"
__gitversion__ = "f1c797df2966237244527c1c6343dbe9bc765342"
__post_version__ = "246"
__gitversion__ = "f32c6ddb5f11b431c9bb4f501cdec604172a90de"
Loading