diff --git a/Cargo.lock b/Cargo.lock index 5e49e08d1..3e4ca1d64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,15 @@ dependencies = [ [[package]] name = "ahash" -version = "0.3.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", + "zerocopy", +] [[package]] name = "aho-corasick" @@ -395,14 +401,16 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitcoin" -version = "0.29.2" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3" +checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462" dependencies = [ "bech32 0.9.1", - "bitcoin_hashes 0.11.0", + "bitcoin-private", + "bitcoin_hashes 0.12.0", "bitcoinconsensus", - "secp256k1 0.24.3", + "hex_lit", + "secp256k1 0.27.0", "serde", ] @@ -449,11 +457,12 @@ checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" [[package]] name = "bitcoin-push-decoder" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d533f86c679e4388a80f0c11524ae690dc1850315007757dced23ecd53526bbe" +checksum = "ee01fc59f06261a3727830dc61fd87f9f9ae503194d7aea0306a2535a9a06a3d" dependencies = [ - "bitcoin 0.29.2", + "bitcoin 0.30.2", + "hex", "log", ] @@ -462,9 +471,6 @@ name = "bitcoin_hashes" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" -dependencies = [ - "serde", -] [[package]] name = "bitcoin_hashes" @@ -473,6 +479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501" dependencies = [ "bitcoin-private", + "serde", ] [[package]] @@ -1545,19 +1552,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.8.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "ahash", - "autocfg", -] +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] [[package]] name = "hashbrown" @@ -2007,27 +2013,25 @@ dependencies = [ [[package]] name = "lightning" -version = "0.0.118" +version = "0.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cec5fa9382154fe9671e8df93095b800c7d77abc66e2a5ef839d672521c5e" +checksum = "5fd92d4aa159374be430c7590e169b4a6c0fb79018f5bc4ea1bffde536384db3" dependencies = [ - "bitcoin 0.29.2", - "hex", + "bitcoin 0.30.2", + "hex-conservative", "regex", ] [[package]] name = "lightning-invoice" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb24878b0f4ef75f020976c886d9ad1503867802329cc963e0ab4623ea3b25c" +checksum = "26d07d01cf197bf2184b929b7dc94aa70d935aac6df896c256a3a9475b7e9d40" dependencies = [ "bech32 0.9.1", - "bitcoin 0.29.2", - "bitcoin_hashes 0.11.0", + "bitcoin 0.30.2", "lightning", - "num-traits", - "secp256k1 0.24.3", + "secp256k1 0.27.0", ] [[package]] @@ -2768,9 +2772,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" +checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" dependencies = [ "proc-macro2", "syn 2.0.96", @@ -3430,23 +3434,23 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.3" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "bitcoin_hashes 0.11.0", - "rand 0.8.5", - "secp256k1-sys 0.6.1", - "serde", + "secp256k1-sys 0.8.1", ] [[package]] name = "secp256k1" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ + "bitcoin_hashes 0.12.0", + "rand 0.8.5", "secp256k1-sys 0.8.1", + "serde", ] [[package]] @@ -3460,15 +3464,6 @@ dependencies = [ "serde", ] -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - [[package]] name = "secp256k1-sys" version = "0.8.1" @@ -3521,11 +3516,11 @@ dependencies = [ [[package]] name = "serde_bolt" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06b8577e0fd88c67c88e08139a7ecb7b6ab9b8800dfe1290d3de66d2a2601f2" +checksum = "bffab210d8357b433ffab5b3fd39d56f7fddb5eb36c84039fa455933ef05209f" dependencies = [ - "bitcoin 0.29.2", + "bitcoin 0.30.2", "bitcoin-consensus-derive", "chunked-buffer", "hex", @@ -4489,11 +4484,11 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "txoo" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9db6dd6fd9fff3c0d875c1d8b891481c368b02c76d81bacd0f52f832a3699ef" +checksum = "5675f1c4ed9845d91baa88cc10aff641867ed17b32440f9e26cd04c086610ba0" dependencies = [ - "bitcoin 0.29.2", + "bitcoin 0.30.2", "log", "serde", "serde_bolt", @@ -4614,20 +4609,30 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vls-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b78705ec28a9904243cc3a7117840a8153166561288076fc5a9aa2ea89811f8" +dependencies = [ + "hex", +] + [[package]] name = "vls-core" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4ffd7d4f73477364006d79e58f7a78e2abf7db1bd715ca285f4dfc897f5a44" +checksum = "be3166ccaea17097c368ab83692116ac136894d2e514876fb31609f63fc2e928" dependencies = [ + "ahash", "anyhow", "backtrace", - "bitcoin 0.29.2", + "bitcoin 0.30.2", "bitcoin-consensus-derive", "bitcoin-push-decoder", "bolt-derive", "env_logger 0.9.3", - "hashbrown 0.8.2", + "hashbrown 0.13.2", "hex", "itertools 0.10.5", "lightning", @@ -4640,13 +4645,15 @@ dependencies = [ "serde_with", "tracing", "txoo", + "vls-common", + "vls-policy-derive", ] [[package]] name = "vls-persist" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1908e667de1b883705b13d6247a1ac276bedf033f08ce0193a1d7313e25b4f" +checksum = "3da49b2af05d819f7f42278b78d4c165ec003474f7a5fd8c1f282183b10d311f" dependencies = [ "hex", "log", @@ -4658,11 +4665,22 @@ dependencies = [ "vls-core", ] +[[package]] +name = "vls-policy-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b17d0402fe542a86bcac5a2b52a78448a38d13bb6a133a67a8143c6eaad608" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "vls-protocol" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a587cd1c110fcb5b3ba1ce043f94040c2fd704a05bd4f6aa5d8b9b9bdaaa8b" +checksum = "8597fe72d5490db26270939d50adeed16baf7be57522e6ebaa8f3a760f28ae7b" dependencies = [ "as-any", "bitcoin-consensus-derive", @@ -4676,9 +4694,9 @@ dependencies = [ [[package]] name = "vls-protocol-signer" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83515109f514a78497cc13fc81ffc7cc3ff6ef46b623e6a710bc56b60a02b8e" +checksum = "00ed706a354b586f1339de6828ef8635c132461ea7dff4da2c8f80bcc00c3a0a" dependencies = [ "bit-vec", "log", @@ -5091,6 +5109,26 @@ dependencies = [ "time", ] +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index b92e6411a..3227652be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,10 +27,10 @@ cln-grpc = "0.4" cln-rpc = "0.4" cln-plugin = "0.4" -vls-core = "^0.12" -vls-persist = "^0.12" -vls-protocol-signer = "^0.12" -vls-protocol = "^0.12" +vls-core = "^0.13" +vls-persist = "^0.13" +vls-protocol-signer = "^0.13" +vls-protocol = "^0.13" # Config for 'cargo dist' diff --git a/Makefile b/Makefile index 69d325898..a5b0e347f 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,8 @@ CLN_VERSIONS = \ v22.11gl1 \ v23.05gl1 \ v23.08gl1 \ - v24.02gl1 + v24.02gl1 \ + v24.11gl1 DOCKER_OPTIONS= \ --rm \ diff --git a/Taskfile.yml b/Taskfile.yml index 18cceba52..e028444af 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -34,7 +34,7 @@ tasks: - task: testing:check - task: clnvm:check - docker-ci-check: + docker-ci-build: cmds: - > docker buildx build \ @@ -47,9 +47,19 @@ tasks: -t gltesting \ -f docker/gl-testing/Dockerfile \ . - - docker run -ti -v $(pwd):/repo gltesting task ci-check + + docker-ci-check: + deps: +# - docker-ci-build + cmds: + - docker run --rm -ti -v $(pwd):/repo gltesting task ci-check ci-build: cmds: - task: signerproxy:build - task: plugin:build + clean: + dir: "." + cmds: + - cargo clean + - rm -rf .venv diff --git a/docker/gl-testing/Dockerfile b/docker/gl-testing/Dockerfile index e62c1c611..0c4ee96cf 100644 --- a/docker/gl-testing/Dockerfile +++ b/docker/gl-testing/Dockerfile @@ -175,10 +175,9 @@ ENV GRPC_ENABLE_FORK_SUPPORT=0 # Install cln-versions ENV CLNVM_CACHE_DIR=/opt/cln -ENV GL_TESTING_IGNORE_HASH=1 # Enumerate all versions that gl-testing should find -ENV CLN_PATH=/opt/cln/v0.10.1/usr/local/bin/:/opt/cln/v0.10.2/usr/local/bin/:/opt/cln/v0.11.0.1/usr/local/bin/:/opt/cln/v0.11.2gl2/usr/local/bin/:/opt/cln/v22.11gl1/usr/local/bin/:/opt/cln/v23.05gl1/usr/local/bin/:/opt/cln/v23.08gl1/usr/local/bin/:/opt/cln/v24.02gl1/usr/local/bin/ +ENV CLN_PATH=/opt/cln/v0.10.1/usr/local/bin/:/opt/cln/v0.10.2/usr/local/bin/:/opt/cln/v0.11.0.1/usr/local/bin/:/opt/cln/v0.11.2gl2/usr/local/bin/:/opt/cln/v22.11gl1/usr/local/bin/:/opt/cln/v23.05gl1/usr/local/bin/:/opt/cln/v23.08gl1/usr/local/bin/:/opt/cln/v24.02gl1/usr/local/bin/:/opt/cln/v24.11gl1/usr/local/bin/ # Create a non-root user. ARG GID=0 diff --git a/libs/gl-client-py/.tasks.yml b/libs/gl-client-py/.tasks.yml index 51fbebf85..85ffb66fb 100644 --- a/libs/gl-client-py/.tasks.yml +++ b/libs/gl-client-py/.tasks.yml @@ -1,9 +1,17 @@ version: '3' tasks: + force-install: + dir: "." + cmds: + # Forces a reinstall of the latest version + - uv run maturin develop + check: env: PYTEST_OPTS: "-vvv" + deps: + - force-install cmds: - uv run pytest tests $PYTEST_OPTS diff --git a/libs/gl-client-py/glclient/__init__.py b/libs/gl-client-py/glclient/__init__.py index 9718c1a44..8cfe16b46 100644 --- a/libs/gl-client-py/glclient/__init__.py +++ b/libs/gl-client-py/glclient/__init__.py @@ -17,7 +17,7 @@ # Keep in sync with the libhsmd version, this is tested in unit tests. -__version__ = "v24.02" +__version__ = "v24.11" E = TypeVar("E", bound=PbMessage) diff --git a/libs/gl-client-py/pyproject.toml b/libs/gl-client-py/pyproject.toml index 121549ae2..a0e1b9703 100644 --- a/libs/gl-client-py/pyproject.toml +++ b/libs/gl-client-py/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gl-client" -version = "0.3.1" +version = "0.3.2rc1" description = "Add your description here" readme = "README.md" requires-python = ">=3.8" @@ -21,6 +21,7 @@ dev = [ "grpcio>=1.67", "maturin>=1", "mypy>=1.14.1", + "patchelf>=0.17.2.2", "protobuf>=4", "pyln-grpc-proto>=0.1.2", "types-protobuf>=5.29.1.20241207", diff --git a/libs/gl-client/src/lnurl/pay/mod.rs b/libs/gl-client/src/lnurl/pay/mod.rs index 8aca8f3ca..43d449c92 100644 --- a/libs/gl-client/src/lnurl/pay/mod.rs +++ b/libs/gl-client/src/lnurl/pay/mod.rs @@ -108,7 +108,7 @@ pub fn validate_invoice_from_callback_response( ); let description_hash: String = match invoice.description() { - Bolt11InvoiceDescription::Direct(d) => sha256::digest(d.clone().into_inner()), + Bolt11InvoiceDescription::Direct(d) => sha256::digest(d.to_string()), Bolt11InvoiceDescription::Hash(h) => h.0.to_string(), }; diff --git a/libs/gl-client/src/persist.rs b/libs/gl-client/src/persist.rs index 9f8d23167..4e4a25691 100644 --- a/libs/gl-client/src/persist.rs +++ b/libs/gl-client/src/persist.rs @@ -512,6 +512,9 @@ impl Persist for MemoryPersister { 0, state_e.velocity_control.into(), state_e.fee_velocity_control.into(), + 0u64, + /* dbid_high_water_mark: prevents reuse of + * channel dbid, 0 disables enforcement. */ ); let entry = lightning_signer::persist::model::NodeEntry { diff --git a/libs/gl-client/src/signer/mod.rs b/libs/gl-client/src/signer/mod.rs index bd4a14a7d..aff8f72db 100644 --- a/libs/gl-client/src/signer/mod.rs +++ b/libs/gl-client/src/signer/mod.rs @@ -47,7 +47,7 @@ pub mod model; mod report; mod resolve; -const VERSION: &str = "v24.02"; +const VERSION: &str = "v24.11"; const GITHASH: &str = env!("GIT_HASH"); const RUNE_VERSION: &str = "gl0"; // This is the same derivation key that is used by core lightning itself. @@ -122,7 +122,8 @@ impl Signer { // The persister takes care of persisting metadata across // restarts let persister = Arc::new(crate::persist::MemoryPersister::new()); - let mut policy = lightning_signer::policy::simple_validator::make_simple_policy(network); + let mut policy = + lightning_signer::policy::simple_validator::make_default_simple_policy(network); policy.filter = PolicyFilter::default(); policy.filter.merge(PolicyFilter { @@ -141,9 +142,9 @@ impl Signer { policy.max_feerate_per_kw = 150_000; policy.filter.merge(PolicyFilter { rules: vec![ - FilterRule::new_warn("policy-commitment-fee-range"), - FilterRule::new_warn("policy-mutual-fee-range"), - ], + FilterRule::new_warn("policy-commitment-fee-range"), + FilterRule::new_warn("policy-mutual-fee-range"), + ], }); } @@ -269,26 +270,8 @@ impl Signer { dev_bip32_seed: None, dev_channel_secrets: None, dev_channel_secrets_shaseed: None, - hsm_wire_min_version: 5, - hsm_wire_max_version: 5, - }) - } - - fn bolt12initreq() -> vls_protocol::msgs::Message { - vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { - info: Octets("bolt12-invoice-base".as_bytes().to_vec()), - }) - } - - fn scbinitreq() -> vls_protocol::msgs::Message { - vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { - info: Octets("scb secret".as_bytes().to_vec()), - }) - } - - fn commandoinitreq() -> vls_protocol::msgs::Message { - vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { - info: Octets("commando".as_bytes().to_vec()), + hsm_wire_min_version: 4, + hsm_wire_max_version: 6, }) } @@ -641,11 +624,24 @@ impl Signer { let requests = vec![ // v22.11 introduced an addiotiona startup message, the // bolt12 key generation - Signer::bolt12initreq(), + vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { + info: Octets("bolt12-invoice-base".as_bytes().to_vec()), + }), // SCB needs a secret derived too - Signer::scbinitreq(), + vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { + info: Octets("scb secret".as_bytes().to_vec()), + }), // Commando needs a secret for its runes - Signer::commandoinitreq(), + vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { + info: Octets("commando".as_bytes().to_vec()), + }), + // The node alias key + vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { + info: Octets("node-alias-base".as_bytes().to_vec()), + }), + vls_protocol::msgs::Message::DeriveSecret(vls_protocol::msgs::DeriveSecret { + info: Octets("offer-blinded-path".as_bytes().to_vec()), + }), ]; let serialized: Vec> = requests.iter().map(|m| m.inner().as_vec()).collect(); diff --git a/libs/gl-client/src/signer/resolve.rs b/libs/gl-client/src/signer/resolve.rs index f02a2e7a9..97f8ca980 100644 --- a/libs/gl-client/src/signer/resolve.rs +++ b/libs/gl-client/src/signer/resolve.rs @@ -77,7 +77,7 @@ impl Resolver { } (Message::NewChannel(m1), Request::FundChannel(m2)) => { // Different node_id? Reject! - m1.node_id.0 == m2.id.as_slice() + m1.peer_id.0 == m2.id.as_slice() // TODO: Add `close_to` to allowlist for the close // later on } diff --git a/libs/gl-plugin/src/tramp.rs b/libs/gl-plugin/src/tramp.rs index c3e28d189..8028acfaf 100644 --- a/libs/gl-plugin/src/tramp.rs +++ b/libs/gl-plugin/src/tramp.rs @@ -6,7 +6,6 @@ use cln_rpc::{ ClnRpc, }; use futures::{future::join_all, FutureExt}; -use gl_client::bitcoin::hashes::hex::ToHex; use log::{debug, warn}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; @@ -64,6 +63,7 @@ pub async fn trampolinepay( rpc_path: impl AsRef, ) -> Result { let node_id = cln_rpc::primitives::PublicKey::from_slice(&req.trampoline_node_id[..])?; + let hex_node_id = hex::encode(node_id.serialize()); let mut rpc = ClnRpc::new(&rpc_path).await?; @@ -133,12 +133,12 @@ pub async fn trampolinepay( .unwrap_or(0); log::debug!( "New trampoline payment via {}: {} ", - node_id.to_hex(), + hex_node_id, req.bolt11.clone() ); // Wait for the peer connection to re-establish. - log::debug!("Await peer connection to {}", node_id.to_hex()); + log::debug!("Await peer connection to {}", hex_node_id); AwaitablePeer::new(node_id, rpc_path.as_ref().to_path_buf()) .wait() .await?; @@ -153,7 +153,7 @@ pub async fn trampolinepay( .await? .peers .first() - .ok_or_else(|| anyhow!("node with id {} is unknown", node_id.to_hex()))? + .ok_or_else(|| anyhow!("node with id {} is unknown", hex_node_id))? .features .as_ref() .map(|feat| hex::decode(feat)) diff --git a/libs/gl-testing/gltesting/grpcweb.py b/libs/gl-testing/gltesting/grpcweb.py index f0ca65d08..a2bb636a3 100644 --- a/libs/gl-testing/gltesting/grpcweb.py +++ b/libs/gl-testing/gltesting/grpcweb.py @@ -154,15 +154,15 @@ def auth(self, request: Request) -> bool: ts = request.headers.get("glts", None) if not pk: - self.logger.warn(f"Missing public key header") + self.logger.warning(f"Missing public key header: headers={request.headers}") return False if not sig: - self.logger.warn(f"Missing signature header") + self.logger.warning(f"Missing signature header: headers={request.headers}") return False if not ts: - self.logger.warn(f"Missing timestamp header") + self.logger.warning(f"Missing timestamp header: headers={request.headers}") return False # TODO Check the signature. @@ -212,12 +212,15 @@ def proxy(self, request: Request): ) try: + self.logger.debug(f"Sending grpc request req={req}, payload={content} to url={url}") res = client.send(req) # Capture the error from header and send it in the body as well - if res.headers.get("grpc-status", "0") != "0": - grpc_status = res.headers.get("grpc-status") + status = res.headers.get("grpc-status", "0") + logging.debug(f"Server returned grpc-status={status}") + if status != "0": error_message = res.headers.get("grpc-message", "None") - self.logger.warning(f"gRPC status code received: {grpc_status}") + self.logger.error(f"Received grpc-status={status}, error={error_message}") + self.logger.warning(f"gRPC status code received: {status}") self.logger.warning(f"gRPC message received: {error_message}") error = error_message.encode("utf-8") error_res = struct.pack("!cI", request.flags, len(error)) + error diff --git a/libs/gl-testing/gltesting/node.py b/libs/gl-testing/gltesting/node.py index 23fcf890a..c4963d9f8 100644 --- a/libs/gl-testing/gltesting/node.py +++ b/libs/gl-testing/gltesting/node.py @@ -95,7 +95,8 @@ def __init__( '--dev-bitcoind-poll=5', '--dev-fast-gossip', '--offline', - '--experimental-anchors', + '--allow-deprecated-apis=true', + #'--experimental-anchors', '--developer', # TODO Make this multi-version capable ] diff --git a/libs/gl-testing/gltesting/scheduler.py b/libs/gl-testing/gltesting/scheduler.py index 1f4645229..97b43c67d 100644 --- a/libs/gl-testing/gltesting/scheduler.py +++ b/libs/gl-testing/gltesting/scheduler.py @@ -136,6 +136,8 @@ def get_node(self, node_id): for n in self.nodes: if n.node_id == node_id: return n + from rich.pretty import pprint + pprint(self.nodes) raise ValueError( f"No node with node_id={node_id} found in gltesting scheduler, do you need to register it first?" ) @@ -264,7 +266,7 @@ async def Recover(self, req): async def Schedule(self, req): n = self.get_node(req.node_id) - + print("XXX", n) # If already running we just return the existing binding if n.process: return schedpb.NodeInfoResponse( @@ -274,7 +276,7 @@ async def Schedule(self, req): node_version = n.signer_version.get_node_version() node_version = self.versions.get(node_version, None) - + print("XXX", node_version) logging.debug( f"Determined that we need to start node_version={node_version} for n.signer_version={n.signer_version}" ) @@ -284,41 +286,48 @@ async def Schedule(self, req): f"No node_version found for n.signer_version={n.signer_version}" ) - # Otherwise we need to start a new process - n.process = NodeProcess( - node_id=req.node_id, - init_msg=n.initmsg, - directory=n.directory, - network=n.network, - identity=n.identity, - version=node_version, - bitcoind=self.bitcoind, - startupmsgs=n.startupmsgs, - ) - n.process.write_node_config(n.network) - n.process.start() - - with n.condition: - n.condition.notify_all() - - # Wait for the grpc port to be accessible - start_time = time.perf_counter() - timeout = 10 - while True: - try: - with socket.create_connection( - ("localhost", n.process.grpc_port), timeout=0.1 - ): - break - except Exception: - time.sleep(0.01) - if time.perf_counter() - start_time >= timeout: - raise TimeoutError( - f"Waited too for port localhost:{n.process.grpc_port} to become reachable" - ) - # TODO Actually wait for the port to be accessible - time.sleep(1) - + print("XXX","Starting") + try: + # Otherwise we need to start a new process + n.process = NodeProcess( + node_id=req.node_id, + init_msg=n.initmsg, + directory=n.directory, + network=n.network, + identity=n.identity, + version=node_version, + bitcoind=self.bitcoind, + startupmsgs=n.startupmsgs, + ) + n.process.write_node_config(n.network) + n.process.start() + + # Wait for the grpc port to be accessible + start_time = time.perf_counter() + timeout = 10 + print("Waiting for node to become reachable") + while True: + try: + print("Pinging") + with socket.create_connection( + ("localhost", n.process.grpc_port), timeout=0.1 + ): + print("Successfully connected to grpc port") + break + except Exception: + print("Failed to contact grpc port, sleeping") + time.sleep(0.1) + if time.perf_counter() - start_time >= timeout: + raise TimeoutError( + f"Waited too for port localhost:{n.process.grpc_port} to become reachable" + ) + # TODO Actually wait for the port to be accessible + time.sleep(1) + with n.condition: + n.condition.notify_all() + except Exception as e: + print(e) + raise e return schedpb.NodeInfoResponse( node_id=n.node_id, grpc_uri=n.process.grpc_uri, diff --git a/libs/gl-testing/gltesting/utils.py b/libs/gl-testing/gltesting/utils.py index fb5cd6ff9..5eb3a28ee 100644 --- a/libs/gl-testing/gltesting/utils.py +++ b/libs/gl-testing/gltesting/utils.py @@ -19,6 +19,7 @@ def is_compat(self, nv: NodeVersion) -> bool: "v23.05": ["v23.05gl1"], "v23.08": ["v23.08gl1"], "v24.02": ["v24.02gl1"], + "v24.11": ["v24.11gl1"], } return self.name in compat[nv.name] @@ -35,6 +36,7 @@ def get_node_version(self): "v23.05": "v23.05gl1", "v23.08": "v23.08gl1", "v24.02": "v24.02gl1", + "v24.11": "v24.11gl1", } return m[self.name] diff --git a/libs/gl-testing/tests/test_grpc_web.py b/libs/gl-testing/tests/test_grpc_web.py index ce9c1e936..9357f54be 100644 --- a/libs/gl-testing/tests/test_grpc_web.py +++ b/libs/gl-testing/tests/test_grpc_web.py @@ -47,7 +47,7 @@ def test_node_grpc_web(scheduler, node_grpc_web_proxy, clients): c = clients.new() c.register(configure=True) n = c.node() - _s = c.signer().run_in_thread() + _s = c.signer().run_in_thread() info = n.get_info() # Now extract the TLS certificates, so we can sign the payload. diff --git a/libs/gl-testing/tests/test_node.py b/libs/gl-testing/tests/test_node.py index 8ed6383ba..d6263cd87 100644 --- a/libs/gl-testing/tests/test_node.py +++ b/libs/gl-testing/tests/test_node.py @@ -455,7 +455,7 @@ def test_vls_crash_repro( ) -> None: """Reproduce an overflow panic in VLS v0.10.0.""" (l1,) = node_factory.line_graph(1, opts={"experimental-anchors": None}) - assert l1.rpc.getinfo()["version"] == "v24.02gl1" + assert l1.rpc.getinfo()["version"] == "v24.11gl1" c = clients.new() c.register(configure=True)