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
17 changes: 15 additions & 2 deletions libs/gl-client-py/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ PYVERSION=$(shell cd libs && cargo metadata --format-version 1 | jq -r '.package
PYDIR=${REPO}/libs/gl-client-py
PROTODIR=${REPO}/libs/proto

# The protobuf gencode embeds a hard assertion that the runtime is at
# least as new as the protoc that produced it, so regenerating with a
# newer toolchain than the deployed runtime breaks every consumer at
# import time. Pin the generator and run it isolated from the ambient
# venv, so the checked-in stubs do not depend on who regenerated them.
# Bump deliberately, together with the `protobuf` runtime bound in
# pyproject.toml.
PROTOC_TOOLCHAIN = \
uv run --no-project \
--with grpcio-tools==1.78.0 \
--with mypy-protobuf==5.0.0 \
python -m grpc_tools.protoc

PYPROTOC_OPTS = \
-I ${PROTODIR} \
--python_out=${PYDIR} \
Expand All @@ -35,8 +48,8 @@ ${PYPROTOS}: pygrpc
pygrpc: ${PROTOSRC}
cp ${PYDIR}/../proto/glclient/scheduler.proto ${PYDIR}/glclient/
cp ${PYDIR}/../proto/glclient/greenlight.proto ${PYDIR}/glclient/
cd ${PYDIR}; uv run python -m grpc_tools.protoc ${PYPROTOC_OPTS} glclient/scheduler.proto
cd ${PYDIR}; uv run python -m grpc_tools.protoc ${PYPROTOC_OPTS} glclient/greenlight.proto
cd ${PYDIR}; ${PROTOC_TOOLCHAIN} ${PYPROTOC_OPTS} glclient/scheduler.proto
cd ${PYDIR}; ${PROTOC_TOOLCHAIN} ${PYPROTOC_OPTS} glclient/greenlight.proto

check-py:
#uv run --reinstall-package='gl-sdk' --all-packages mypy ${PYDIR}/glclient
Expand Down
37 changes: 35 additions & 2 deletions libs/gl-client-py/glclient/scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import "glclient/greenlight.proto";
// Users are authenticated using mTLS authentication. Applications are
// provisioned with an anonymous keypair that is not bound to a node,
// allowing access only to the unauthenticated endpoints
// `Scheduler.GetChallenge`, `Scheduler.Register` and
// `Scheduler.Recover`. This allows them to register or recover a
// `Scheduler.GetChallenge`, `Scheduler.Register`,
// `Scheduler.Recover` and
// `Scheduler.CheckLightningAvailability`. This allows them to
// register or recover a
// node, but doesn't give access to the node itself. Upon registering
// or recovering an account the user receives a keypair that is bound
// to the specific node. Once the user receives their personal mTLS
Expand Down Expand Up @@ -82,6 +84,25 @@ service Scheduler {
// error being returned.
rpc GetChallenge(ChallengeRequest) returns (ChallengeResponse) {}

// Reports whether the Lightning account backed by `node_id` may
// be surfaced to the user. This is a feature gate for downstream
// applications: greenlight relays the question to its Lightning
// Service Provider, which answers based on whether it has
// previously granted this node a slot (grants are sticky) or has
// the capacity to grant one now.
//
// Unlike the other node-scoped calls this one is deliberately
// available *before* registration, since an application has to
// decide whether to offer Lightning at all before it creates a
// node. There is therefore no mTLS identity to derive the node
// from, and the caller names the `node_id` it is asking about.
//
// The answer is advisory and may change: a node that is not
// available today may become available once the LSP has capacity
// again. Applications should treat an error as "unknown" rather
// than as a negative answer.
rpc CheckLightningAvailability(CheckLightningAvailabilityRequest) returns (CheckLightningAvailabilityResponse) {}

// Scheduling takes a previously registered node, locates a
// free slot in greenlight's infrastructure and allocates it
// to run the node. The node then goes through the startup
Expand Down Expand Up @@ -248,6 +269,18 @@ enum ChallengeScope {
RECOVER = 1;
}

message CheckLightningAvailabilityRequest {
// 33 bytes node public key. The node need not be registered
// with greenlight yet.
bytes node_id = 1;
};

message CheckLightningAvailabilityResponse {
// Whether the Lightning account backed by this node may be
// surfaced to the user.
bool available = 1;
};

message RegistrationRequest {
// 33 bytes node public key.
bytes node_id = 1;
Expand Down
118 changes: 61 additions & 57 deletions libs/gl-client-py/glclient/scheduler_pb2.py

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions libs/gl-client-py/glclient/scheduler_pb2.pyi

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

78 changes: 72 additions & 6 deletions libs/gl-client-py/glclient/scheduler_pb2_grpc.py

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

81 changes: 75 additions & 6 deletions libs/gl-client-py/glclient/scheduler_pb2_grpc.pyi

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

Loading
Loading