Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
a6281b2
caddy: --install-namespace if not exists
willcl-ark Oct 12, 2024
38adc3e
speedy startup
willcl-ark Oct 11, 2024
32cdfd3
speedy startup tanks
willcl-ark Oct 12, 2024
2e237bc
speedy startup namespaces
willcl-ark Oct 12, 2024
2526957
fix ingress deployment
willcl-ark Oct 16, 2024
5c18af9
stop scenarios in parallel
willcl-ark Dec 5, 2024
09b7230
deploy logging CRDs first
willcl-ark Dec 5, 2024
241f580
log correct number of outbound connections
cndolo Dec 6, 2024
0287fdf
Merge pull request #671 from cndolo/fix/logging-docs
pinheadmz Dec 6, 2024
82306a8
Merge pull request #649 from willcl-ark/speedy-startup
pinheadmz Dec 6, 2024
5112e03
BREAKING REFACTOR: move some values to global, add lnd as subchart
pinheadmz Aug 23, 2024
89009bf
store channel data from network.yaml in configmaps to open channels
pinheadmz Nov 8, 2024
df70c2a
import LN json
pinheadmz Nov 8, 2024
c38d7dc
ln: same macaroon and cert for all nodes
pinheadmz Nov 12, 2024
0843703
ln: open rest api and ensure scenarios can open channels
pinheadmz Nov 14, 2024
bdf6fdb
use k8s client in commander to get pods instead of warnet.json
pinheadmz Nov 15, 2024
10f6ae2
namespaces: give wargames accounts auth to create commander roles
pinheadmz Nov 15, 2024
c3530f9
add ln nodes and channels along with tanks to commander
pinheadmz Nov 15, 2024
731c53d
minor: lint and remove duplicate config maps
pinheadmz Nov 18, 2024
6dc4024
update namespace permissions
mplsgrant Nov 20, 2024
fe1c2ee
lnd: slow down startup probe to create wallet
pinheadmz Nov 27, 2024
5e69110
Move LND out of commander and refactor ln_init for new architecture
pinheadmz Dec 2, 2024
9209a5e
test LN
pinheadmz Dec 2, 2024
acac14b
make ln_init part of deploy() if ln channels are defined
pinheadmz Dec 5, 2024
e7c1628
allow undefined channel policy
pinheadmz Dec 22, 2024
c18298d
lint
pinheadmz Dec 22, 2024
85ed1d6
Merge pull request #664 from pinheadmz/ln-helm
pinheadmz Dec 23, 2024
5039591
Update apidocs on
pinheadmz Dec 23, 2024
7b43e43
Add the plugin api
mplsgrant Nov 11, 2024
c155135
enable logs and status for plugins
mplsgrant Nov 27, 2024
927cc82
improve docs
mplsgrant Nov 27, 2024
1fad8db
project: suggest setting an env var
mplsgrant Nov 27, 2024
1d9fb95
add --user-dir option for plugins
mplsgrant Nov 30, 2024
08ad2bd
clean up tags and names
mplsgrant Nov 30, 2024
42a4118
simln.py: use user_dir; tweak print statemnet
mplsgrant Dec 4, 2024
7bc7ab6
incorporate suggestions
mplsgrant Dec 4, 2024
5ba06aa
launch activity in one line
mplsgrant Dec 5, 2024
9071720
remove "warnet consumes plugin"
mplsgrant Dec 5, 2024
3f125d6
clear out constants cruft
mplsgrant Dec 5, 2024
b904879
allow simln to declare its constants
mplsgrant Dec 5, 2024
1789a53
de-dupe deploy code
mplsgrant Dec 6, 2024
77ac67c
deploy plugins from network.yaml
mplsgrant Dec 6, 2024
fcd871d
remove contract reporting
mplsgrant Dec 6, 2024
7a4ff3c
add/modify documentation; bump SimLN version
mplsgrant Dec 9, 2024
f042913
fixups
mplsgrant Dec 9, 2024
e23a728
add pre/post deploy options
mplsgrant Dec 10, 2024
0196643
fix: move run_plugins command
mplsgrant Dec 10, 2024
2bb6bbc
update relative path in plugin doc
mplsgrant Dec 11, 2024
89f4d19
add preNode/postNode; add exec/waitFor
mplsgrant Dec 12, 2024
98c002d
use entrypoint for plugins
mplsgrant Dec 13, 2024
7817cc7
parallelize run_plugins; add pre/post network
mplsgrant Dec 13, 2024
dc05443
allow plugins to take namespace and nargs
mplsgrant Dec 13, 2024
08b8c32
preNode -> postNode
mplsgrant Dec 13, 2024
0e33b48
fixup docs a little; expand test a little
mplsgrant Dec 13, 2024
ec17d24
address Max's feedback
mplsgrant Dec 13, 2024
fd80b3b
update documentation and examples
mplsgrant Dec 13, 2024
3b575d6
update documentation/examples; use PluginContent
mplsgrant Dec 13, 2024
33a9330
deploy: if no plugins, don't print
mplsgrant Dec 18, 2024
27ac1f3
deploy: simplify process checking
mplsgrant Dec 18, 2024
39da86d
incorporate many of zip's suggestions
mplsgrant Jan 3, 2025
925f17a
allow random activity by omitting activity
mplsgrant Jan 3, 2025
e351787
correct spelling in simln readme file
mplsgrant Jan 3, 2025
7311bc2
set debug = False
mplsgrant Jan 6, 2025
80dade1
Merge pull request #670 from mplsgrant/2024-11-plugins
pinheadmz Jan 7, 2025
6059e8b
move tanks_connected to commander
mplsgrant Jan 14, 2025
15cab4a
Merge pull request #676 from mplsgrant/2025-01-move-tanks-connected
mplsgrant Jan 14, 2025
e158f3f
v1.1.10
pinheadmz Jan 27, 2025
7fe53ea
scenarios: add --admin flag to run command for ClusterRole access
pinheadmz Feb 12, 2025
030eb8a
test: cover scenarios run --admin
pinheadmz Feb 13, 2025
7f648db
Merge pull request #682 from bitcoin-dev-project/admin-scenarios
pinheadmz Feb 13, 2025
c18f01e
Update apidocs on
pinheadmz Feb 13, 2025
296e0ba
v1.1.11
pinheadmz Feb 13, 2025
2f365ee
Add version command
deadmanoz Feb 18, 2025
0ff4d73
Fix "stop all" bug. Multiprocessing doesn't like local functions
deadmanoz Feb 18, 2025
fa576ce
Fix incorrect GitHub URL
deadmanoz Feb 18, 2025
3982251
Extra output when user selects "n" for custom network on init/new
deadmanoz Feb 18, 2025
f9c6f34
Review feedback: linting and remove manual version documentation
deadmanoz Feb 18, 2025
2aab33c
Ruff format
deadmanoz Feb 19, 2025
ccd9d98
Use setuptools_scm & tags for versioning
deadmanoz Feb 26, 2025
e24df9e
Remove _version.py
deadmanoz Feb 26, 2025
8915a8e
post-release is deprecated
deadmanoz Feb 26, 2025
49fec67
Ruff check & format
deadmanoz Feb 26, 2025
217ac00
Local and distribution versioning
deadmanoz Feb 27, 2025
92dec09
Merge branch 'testing-version' into add-version-fix-stop-all-bug
deadmanoz Feb 28, 2025
a55ed48
Remove .DS_Store from .gitignore (move to user global .gitignore)
deadmanoz Mar 6, 2025
d799f83
Simplify versioning - don't append dirty, try get _version file first
deadmanoz Mar 6, 2025
a51e047
Ruff format
deadmanoz Mar 6, 2025
54a1114
base_version giving unwanted output, just use tag
deadmanoz Mar 6, 2025
27af3a7
Remove setup.py, use setuptools_scm config
deadmanoz Mar 6, 2025
0193078
Don't use subprocess, just use version detected on install
deadmanoz Mar 9, 2025
240dc21
Merge pull request #683 from deadmanoz/add-version-fix-stop-all-bug
pinheadmz Mar 10, 2025
24b4969
Update apidocs on
pinheadmz Mar 10, 2025
cb6de6a
Use docker buildx bake to build images
willcl-ark Nov 19, 2024
0942822
patch to enable aarch64
willcl-ark Nov 21, 2024
79da159
add miniupnp-dev to v0.20.0
willcl-ark Nov 21, 2024
fadf038
image build: use cmake with docker buildx bake
danvergara Mar 6, 2025
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
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ jobs:
- dag_connection_test.py
- graph_test.py
- logging_test.py
- ln_basic_test.py
- ln_test.py
- rpc_test.py
- services_test.py
- signet_test.py
- simln_test.py
- scenarios_test.py
- namespace_admin_test.py
- wargames_test.py
steps:
- uses: actions/checkout@v4
- uses: azure/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ warnet.egg-info
dist/
build/
**/kubeconfigs/
src/warnet/_version.py
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Monitor and analyze the emergent behaviors of Bitcoin networks.
- [Installation](/docs/install.md)
- [CLI Commands](/docs/warnet.md)
- [Network configuration with yaml files](/docs/config.md)
- [Plugins](/docs/plugins.md)
- [Scenarios](/docs/scenarios.md)
- [Monitoring](/docs/logging_monitoring.md)
- [Snapshots](/docs/snapshots.md)
Expand Down
238 changes: 238 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
group "all" {
targets = [
"bitcoin-28",
"bitcoin-27",
"bitcoin-26",
"v0-21-1",
"v0-20-0",
"v0-19-2",
"v0-17-0",
"v0-16-1",
"bitcoin-unknown-message",
"bitcoin-invalid-blocks",
"bitcoin-50-orphans",
"bitcoin-no-mp-trim",
"bitcoin-disabled-opcodes",
"bitcoin-5k-inv"
]
}

group "maintained" {
targets = [
"bitcoin-28",
"bitcoin-27",
"bitcoin-26"
]
}

group "practice" {
targets = [
"bitcoin-unknown-message",
"bitcoin-invalid-blocks",
"bitcoin-50-orphans",
"bitcoin-no-mp-trim",
"bitcoin-disabled-opcodes",
"bitcoin-5k-inv"
]
}

group "vulnerable" {
targets = [
"v0-21-1",
"v0-20-0",
"v0-19-2",
"v0-17-0",
"v0-16-1",
]
}

target "maintained-base" {
context = "./resources/images/bitcoin"
args = {
REPO = "bitcoin/bitcoin"
BUILD_ARGS = "--disable-tests --without-gui --disable-bench --disable-fuzz-binary --enable-suppress-external-warnings"
}
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"]
}

target "cmake-base" {
inherits = ["maintained-base"]
dockerfile = "./Dockerfile.dev"
args = {
BUILD_ARGS = "-DBUILD_TESTS=OFF -DBUILD_GUI=OFF -DBUILD_BENCH=OFF -DBUILD_FUZZ_BINARY=OFF -DWITH_ZMQ=ON"
}
}

target "autogen-base" {
inherits = ["maintained-base"]
dockerfile = "./Dockerfile"
}

target "bitcoin-master" {
inherits = ["cmake-base"]
tags = ["bitcoindevproject/bitcoin:28.1"]
args = {
COMMIT_SHA = "bd0ee07310c3dcdd08633c69eac330e2e567b235"
}
}

target "bitcoin-28" {
inherits = ["autogen-base"]
tags = ["bitcoindevproject/bitcoin:28.0"]
args = {
COMMIT_SHA = "110183746150428e6385880c79f8c5733b1361ba"
}
}

target "bitcoin-27" {
inherits = ["autogen-base"]
tags = ["bitcoindevproject/bitcoin:27.2"]
args = {
COMMIT_SHA = "bf03c458e994abab9be85486ed8a6d8813313579"
}
}

target "bitcoin-26" {
inherits = ["autogen-base"]
tags = ["bitcoindevproject/bitcoin:26.2"]
args = {
COMMIT_SHA = "7b7041019ba5e7df7bde1416aa6916414a04f3db"
}
}

target "practice-base" {
dockerfile = "./Dockerfile"
context = "./resources/images/bitcoin/insecure"
contexts = {
bitcoin-src = "."
}
args = {
ALPINE_VERSION = "3.20"
BITCOIN_VERSION = "28.1.1"
EXTRA_PACKAGES = "sqlite-dev"
EXTRA_RUNTIME_PACKAGES = ""
REPO = "willcl-ark/bitcoin"
}
platforms = ["linux/amd64", "linux/armhf"]
}

target "bitcoin-unknown-message" {
inherits = ["practice-base"]
tags = ["bitcoindevproject/bitcoin:99.0.0-unknown-message"]
args = {
COMMIT_SHA = "ae999611026e941eca5c0b61f22012c3b3f3d8dc"
}
}

target "bitcoin-invalid-blocks" {
inherits = ["practice-base"]
tags = ["bitcoindevproject/bitcoin:98.0.0-invalid-blocks"]
args = {
COMMIT_SHA = "9713324368e5a966ec330389a533ae8ad7a0ea8f"
}
}

target "bitcoin-50-orphans" {
inherits = ["practice-base"]
tags = ["bitcoindevproject/bitcoin:97.0.0-50-orphans"]
args = {
COMMIT_SHA = "cbcb308eb29621c0db3a105e1a1c1788fb0dab6b"
}
}

target "bitcoin-no-mp-trim" {
inherits = ["practice-base"]
tags = ["bitcoindevproject/bitcoin:96.0.0-no-mp-trim"]
args = {
COMMIT_SHA = "a3a15a9a06dd541d1dafba068c00eedf07e1d5f8"
}
}

target "bitcoin-disabled-opcodes" {
inherits = ["practice-base"]
tags = ["bitcoindevproject/bitcoin:95.0.0-disabled-opcodes"]
args = {
COMMIT_SHA = "5bdb8c52a8612cac9aa928c84a499dd701542b2a"
}
}

target "bitcoin-5k-inv" {
inherits = ["practice-base"]
tags = ["bitcoindevproject/bitcoin:94.0.0-5k-inv"]
args = {
COMMIT_SHA = "e70e610e07eea3aeb0c49ae0bd9f4049ffc1b88c"
}
}

target "CVE-base" {
dockerfile = "./Dockerfile"
context = "./resources/images/bitcoin/insecure"
contexts = {
bitcoin-src = "."
}
platforms = ["linux/amd64", "linux/armhf"]
args = {
REPO = "josibake/bitcoin"
}
}

target "v0-16-1" {
inherits = ["CVE-base"]
tags = ["bitcoindevproject/bitcoin:0.16.1"]
args = {
ALPINE_VERSION = "3.7"
BITCOIN_VERSION = "0.16.1"
COMMIT_SHA = "dc94c00e58c60412a4e1a540abdf0b56093179e8"
EXTRA_PACKAGES = "protobuf-dev libressl-dev"
EXTRA_RUNTIME_PACKAGES = "boost boost-program_options libressl"
PRE_CONFIGURE_COMMANDS = "sed -i '/AC_PREREQ/a\\AR_FLAGS=cr' src/univalue/configure.ac && sed -i '/AX_PROG_CC_FOR_BUILD/a\\AR_FLAGS=cr' src/secp256k1/configure.ac && sed -i 's:sys/fcntl.h:fcntl.h:' src/compat.h"
}
}

target "v0-17-0" {
inherits = ["CVE-base"]
tags = ["bitcoindevproject/bitcoin:0.17.0"]
args = {
ALPINE_VERSION = "3.9"
BITCOIN_VERSION = "0.17.0"
COMMIT_SHA = "f6b2db49a707e7ad433d958aee25ce561c66521a"
EXTRA_PACKAGES = "protobuf-dev libressl-dev"
EXTRA_RUNTIME_PACKAGES = "boost boost-program_options libressl sqlite-dev"
}
}

target "v0-19-2" {
inherits = ["CVE-base"]
tags = ["bitcoindevproject/bitcoin:0.19.2"]
args = {
ALPINE_VERSION = "3.12.12"
BITCOIN_VERSION = "0.19.2"
COMMIT_SHA = "e20f83eb5466a7d68227af14a9d0cf66fb520ffc"
EXTRA_PACKAGES = "sqlite-dev libressl-dev"
EXTRA_RUNTIME_PACKAGES = "boost boost-program_options libressl sqlite-dev"
}
}

target "v0-20-0" {
inherits = ["CVE-base"]
tags = ["bitcoindevproject/bitcoin:0.20.0"]
args = {
ALPINE_VERSION = "3.12.12"
BITCOIN_VERSION = "0.20.0"
COMMIT_SHA = "0bbff8feff0acf1693dfe41184d9a4fd52001d3f"
EXTRA_PACKAGES = "sqlite-dev miniupnpc-dev"
EXTRA_RUNTIME_PACKAGES = "boost-filesystem miniupnpc-dev sqlite-dev"
}
}

target "v0-21-1" {
inherits = ["CVE-base"]
tags = ["bitcoindevproject/bitcoin:0.21.1"]
args = {
ALPINE_VERSION = "3.17"
BITCOIN_VERSION = "0.21.1"
COMMIT_SHA = "e0a22f14c15b4877ef6221f9ee2dfe510092d734"
EXTRA_PACKAGES = "sqlite-dev"
EXTRA_RUNTIME_PACKAGES = "boost-filesystem sqlite-dev"
}
}
17 changes: 17 additions & 0 deletions docs/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,20 @@ python3 -m build
# Upload to Pypi
python3 -m twine upload dist/*
```

## Building docker images

The Bitcoin Core docker images used by warnet are specified in the *docker-bake.hcl* file.
This uses the (experimental) `bake` build functionality of docker buildx.
We use [HCL language](https://github.com/hashicorp/hcl) in the declaration file itself.
See the `bake` [documentation](https://docs.docker.com/build/bake/) for more information on specifications, and how to e.g. override arguments.

In order to build (or "bake") a certain image, find the image's target (name) in the *docker-bake.hcl* file, and then run `docker buildx bake <target>`.

```bash
# build the dummy image that will crash on 5k invs
docker buildx bake bitcoin-5k-inv

# build the same image, but set platform to only linux/amd64
docker buildx bake bitcoin-5k-inv --set bitcoin-5k-inv.platform=linux/amd64
```
4 changes: 2 additions & 2 deletions docs/logging_monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ For example, the default metrics listed above would be explicitly configured as
nodes:
- name: tank-0000
metricsExport: true
metrics: blocks=getblockcount() inbounds=getnetworkinfo()["connections_in"] outbounds=getnetworkinfo()["connections_in"] mempool_size=getmempoolinfo()["size"]
metrics: blocks=getblockcount() inbounds=getnetworkinfo()["connections_in"] outbounds=getnetworkinfo()["connections_out"] mempool_size=getmempoolinfo()["size"]
```

The data can be retrieved directly from the Prometheus exporter container in the tank pod via port `9332`, example:
Expand All @@ -108,7 +108,7 @@ blocks 704.0
# HELP inbounds getnetworkinfo()["connections_in"]
# TYPE inbounds gauge
inbounds 0.0
# HELP outbounds getnetworkinfo()["connections_in"]
# HELP outbounds getnetworkinfo()["connections_out"]
# TYPE outbounds gauge
outbounds 0.0
# HELP mempool_size getmempoolinfo()["size"]
Expand Down
72 changes: 72 additions & 0 deletions docs/plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Plugins

Plugins extend Warnet. Plugin authors can import commands from Warnet and interact with the kubernetes cluster, and plugin users can run plugins from the command line or from the `network.yaml` file.

## Activating plugins from `network.yaml`

You can activate a plugin command by placing it in the `plugins` section at the bottom of each `network.yaml` file like so:

````yaml
nodes:
<<snip>>

plugins: # This marks the beginning of the plugin section
preDeploy: # This is a hook. This particular hook will call plugins before deploying anything else.
hello: # This is the name of the plugin.
entrypoint: "../plugins/hello" # Every plugin must specify a path to its entrypoint.
podName: "hello-pre-deploy" # Plugins can have their own particular configurations, such as how to name a pod.
helloTo: "preDeploy!" # This configuration tells the hello plugin who to say "hello" to.
````

## Many kinds of hooks
There are many hooks to the Warnet `deploy` command. The example below specifies them:

````yaml
nodes:
<<snip>>

plugins:
preDeploy: # Plugins will run before any other `deploy` code.
hello:
entrypoint: "../plugins/hello"
podName: "hello-pre-deploy"
helloTo: "preDeploy!"
postDeploy: # Plugins will run after all the `deploy` code has run.
simln:
entrypoint: "../plugins/simln"
activity: '[{"source": "tank-0003-ln", "destination": "tank-0005-ln", "interval_secs": 1, "amount_msat": 2000}]'
hello:
entrypoint: "../plugins/hello"
podName: "hello-post-deploy"
helloTo: "postDeploy!"
preNode: # Plugins will run before `deploy` launches a node (once per node).
hello:
entrypoint: "../plugins/hello"
helloTo: "preNode!"
postNode: # Plugins will run after `deploy` launches a node (once per node).
hello:
entrypoint: "../plugins/hello"
helloTo: "postNode!"
preNetwork: # Plugins will run before `deploy` launches the network (essentially between logging and when nodes are deployed)
hello:
entrypoint: "../plugins/hello"
helloTo: "preNetwork!"
podName: "hello-pre-network"
postNetwork: # Plugins will run after the network deploy threads have been joined.
hello:
entrypoint: "../plugins/hello"
helloTo: "postNetwork!"
podName: "hello-post-network"
````

Warnet will execute these plugin commands during each invocation of `warnet deploy`.



## A "hello" example

To get started with an example plugin, review the `README` of the `hello` plugin found in any initialized Warnet directory:

1. `warnet init`
2. `cd plugins/hello/`

Loading