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
7 changes: 5 additions & 2 deletions .github/workflows/openai-serve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ on:
branches:
- main
paths:
- flake.nix
- flake.lock
- apps/openai-serve/**
- go-lcpd/proto/**
- proto/**
- proto-go/**
- .github/workflows/openai-serve.yml
pull_request:
paths:
- flake.nix
- flake.lock
- apps/openai-serve/**
- go-lcpd/proto/**
- proto/**
Expand All @@ -38,5 +42,4 @@ jobs:
use-flakehub: false

- name: Lint and test
run: nix develop ./go-lcpd -c make -C apps/openai-serve lint test

run: nix develop . -c make -C apps/openai-serve lint test
9 changes: 6 additions & 3 deletions .github/workflows/proto-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ on:
branches:
- main
paths:
- flake.nix
- flake.lock
- go-lcpd/proto/**
- proto/**
- proto-go/**
- .github/workflows/proto-go.yml
pull_request:
paths:
- flake.nix
- flake.lock
- go-lcpd/proto/**
- proto/**
- proto-go/**
Expand All @@ -36,10 +40,9 @@ jobs:
use-flakehub: false

- name: Lint protos
run: nix develop ./go-lcpd -c sh -lc 'cd go-lcpd && buf lint'
run: nix develop . -c sh -lc 'cd go-lcpd && buf lint'

- name: Verify proto-go generated code is up to date
run: |
nix develop ./go-lcpd -c sh -lc 'cd go-lcpd && buf generate --template ../proto-go/buf.gen.yaml'
nix develop . -c sh -lc 'cd go-lcpd && buf generate --template ../proto-go/buf.gen.yaml'
git diff --exit-code -- proto-go

6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ on:
branches:
- main
paths:
- flake.nix
- flake.lock
- go-lcpd/**
- proto/**
- proto-go/**
- .github/workflows/test.yml
pull_request:
paths:
- flake.nix
- flake.lock
- go-lcpd/**
- proto/**
- proto-go/**
Expand Down Expand Up @@ -39,4 +43,4 @@ jobs:
use-flakehub: false

- name: Lint and test
run: nix develop ./go-lcpd -c make -C go-lcpd lint test
run: nix develop . -c make -C go-lcpd lint test
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ If you're unsure what to pick up, open an issue with what you want to do and we'

## Development setup

This repo uses Nix flakes to keep the dev environment consistent.
This repo uses Nix flakes to keep the dev environment consistent (see repo root `flake.nix`).

Typical workflow:

```sh
cd go-lcpd
nix develop
cd go-lcpd
make test
```

Expand Down
1 change: 1 addition & 0 deletions go-lcpd/flake.lock → flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions go-lcpd/flake.nix → flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
description = "go-lcpd dev environment (pinned toolchain + regtest devnet)";
description = "lightning-compute-protocol dev environment (pinned toolchain + regtest devnet)";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
Expand Down Expand Up @@ -57,11 +57,12 @@
export GOFLAGS="-buildvcs=false"

echo "devshell ready"
echo " test: make test"
echo " regtest: make test-regtest"
echo " devnet: ./scripts/devnet up"
echo " test: make -C go-lcpd test"
echo " regtest: make -C go-lcpd test-regtest"
echo " devnet: go-lcpd/scripts/devnet up"
'';
};
}
);
}

4 changes: 2 additions & 2 deletions go-lcpd/.envrc.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# direnv config for go-lcpd.
#
# - use the go-lcpd flake via `nix develop`
# - use the repo root flake via `nix develop`
# - run `direnv allow` once to enable auto-loading

use flake .
use flake ..

# Optional: enable regtest integration tests (heavy).
# export LCP_ITEST_REGTEST=1
Expand Down
6 changes: 3 additions & 3 deletions go-lcpd/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.PHONY: test test-regtest test-regtest-custommsg test-regtest-grpc test-regtest-openai-serve lint tools gen fmt proto-deps devnet-up devnet-down devnet-status devnet-info

# Nix-first workflow:
# - All targets are meant to run inside the go-lcpd devShell (`nix develop`).
# - All targets are meant to run inside the repo devShell (`nix develop` at repo root).
# - If you invoke `make` outside the devShell, this Makefile re-execs itself via
# `nix develop -c make ...` so that tool versions are pinned by flake.lock.
# `nix develop .. -c make ...` so that tool versions are pinned by flake.lock.
.DEFAULT_GOAL := test

NIX_DEVELOP ?= nix develop
NIX_DEVELOP ?= nix develop ..
GOALS := $(if $(MAKECMDGOALS),$(MAKECMDGOALS),$(.DEFAULT_GOAL))

ifeq ($(strip $(IN_NIX_SHELL)),)
Expand Down
4 changes: 2 additions & 2 deletions go-lcpd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For the LCP wire protocol spec, see `../docs/protocol/` (e.g., `../docs/protocol

Prerequisites:
- Go 1.24.4+ (or a Go toolchain that supports module toolchain auto-download)
- Optional: Nix (flakes enabled) + direnv for a pinned toolchain (`flake.nix`)
- Optional: Nix (flakes enabled) + direnv for a pinned toolchain (repo root `../flake.nix`)

If you use the optional Nix devShell, it includes Go / buf / golangci-lint v2 / and (when needed) bitcoind / lnd / jq.

Expand All @@ -34,7 +34,7 @@ Notes:

```sh
cd go-lcpd
nix develop
nix develop ..

make gen
make test
Expand Down
17 changes: 17 additions & 0 deletions go-lcpd/provider.devnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
enabled: true
quote_ttl_seconds: 300

llm:
models:
gpt-5.2:
price:
input_msat_per_mtok: 1750000
cached_input_msat_per_mtok: 175000
output_msat_per_mtok: 14000000

# Optional: load-based surge pricing at quote-time.
pricing:
in_flight_surge:
threshold: 2
per_job_bps: 500 # +5% per job above threshold
max_multiplier_bps: 30000 # 3.0x cap
2 changes: 1 addition & 1 deletion go-lcpd/scripts/devnet
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Environment variables (optional):

Notes:
- Requires `bitcoind`, `bitcoin-cli`, `lnd`, and `lncli` on PATH.
- If you use the optional Nix devShell, you can run: `nix develop -c ./scripts/devnet up`
- If you use the optional Nix devShell, you can run: `nix develop .. -c ./scripts/devnet up`
- All state is stored under ./.data/devnet/ (gitignored).
EOF
}
Expand Down
Loading