lsps: remove unmaintained crate `paste`
What changed, and why it matters
This commit removes an unmaintained Rust helper crate called `paste` from the LSPS plugin and replaces its macro-generated function names with manually written ones. There is no functional change to the program's behavior, no bug fix, and no security patch. It is a routine dependency cleanup.
No security action needed. Treat as normal maintenance; verify CI still passes after the dependency removal.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The paste crate was used in a declarative macro (rpc_error_methods!) to concatenate identifiers and generate *_with_data helper functions. Because paste is unmaintained, the commit changes the macro to require callers to pass both the base name and the *_with_data name explicitly, then generates both functions without paste. The resulting public API and behavior are identical; only the build dependency list and macro internals changed.
Changed components
plugins/lsps-plugin/Cargo.tomlplugins/lsps-plugin/src/proto/jsonrpc.rsplugins/lsps-plugin/src/proto/lsps0.rsplugins/lsps-plugin/src/proto/lsps2.rsCargo.lockInspect captured patch +25 / −34
diff --git a/Cargo.lock b/Cargo.lock
index 8aab3f58..8b5e1e96 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -508,7 +508,6 @@ dependencies = [
"cln-rpc",
"hex",
"log",
- "paste",
"rand 0.10.1",
"serde",
"serde_json",
@@ -1849,12 +1848,6 @@ dependencies = [
"windows-link",
]
-[[package]]
-name = "paste"
-version = "1.0.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
-
[[package]]
name = "pem"
version = "3.0.6"
diff --git a/plugins/lsps-plugin/Cargo.toml b/plugins/lsps-plugin/Cargo.toml
index edeb82ee..51610e80 100644
--- a/plugins/lsps-plugin/Cargo.toml
+++ b/plugins/lsps-plugin/Cargo.toml
@@ -21,7 +21,6 @@ cln-plugin = { workspace = true }
cln-rpc = { workspace = true }
hex = "0.4"
log = "0.4"
-paste = "1.0.15"
rand = "0.10"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value"] }
diff --git a/plugins/lsps-plugin/src/proto/jsonrpc.rs b/plugins/lsps-plugin/src/proto/jsonrpc.rs
index 90be2921..d44701c2 100644
--- a/plugins/lsps-plugin/src/proto/jsonrpc.rs
+++ b/plugins/lsps-plugin/src/proto/jsonrpc.rs
@@ -314,28 +314,27 @@ impl<R> JsonRpcResponseBody<R> {
/// - `method_name(message)` - Creates error without data
/// - `method_name_with_data(message, data)` - Creates error with data
macro_rules! rpc_error_methods {
- ($($method:ident => $code:expr),* $(,)?) => {
+ ($($method:ident, $method_with_data:ident => $code:expr),* $(,)?) => {
$(
- paste::paste! {
- fn $method<T: std::fmt::Display>(message: T) -> $crate::proto::jsonrpc::RpcError {
- $crate::proto::jsonrpc::RpcError {
- code: $code,
- message: message.to_string(),
- data: None,
- }
+ fn $method<T: std::fmt::Display>(message: T) -> $crate::proto::jsonrpc::RpcError {
+ $crate::proto::jsonrpc::RpcError {
+ code: $code,
+ message: message.to_string(),
+ data: None,
}
+ }
- fn [<$method _with_data>]<T: std::fmt::Display>(
- message: T,
- data: serde_json::Value,
- ) -> $crate::proto::jsonrpc::RpcError {
- $crate::proto::jsonrpc::RpcError {
- code: $code,
- message: message.to_string(),
- data: Some(data),
- }
+ fn $method_with_data<T: std::fmt::Display>(
+ message: T,
+ data: serde_json::Value,
+ ) -> $crate::proto::jsonrpc::RpcError {
+ $crate::proto::jsonrpc::RpcError {
+ code: $code,
+ message: message.to_string(),
+ data: Some(data),
}
}
+
)*
};
}
@@ -383,11 +382,11 @@ impl RpcError {
pub trait RpcErrorExt {
rpc_error_methods! {
- parse_error => PARSE_ERROR,
- internal_error => INTERNAL_ERROR,
- invalid_params => INVALID_PARAMS,
- method_not_found => METHOD_NOT_FOUND,
- invalid_request => INVALID_REQUEST,
+ parse_error, parse_error_with_data => PARSE_ERROR,
+ internal_error, internal_error_with_data => INTERNAL_ERROR,
+ invalid_params, invalid_params_with_data => INVALID_PARAMS,
+ method_not_found, method_not_found_with_data => METHOD_NOT_FOUND,
+ invalid_request, invalid_request_with_data => INVALID_REQUEST,
}
}
diff --git a/plugins/lsps-plugin/src/proto/lsps0.rs b/plugins/lsps-plugin/src/proto/lsps0.rs
index 433d1063..0eb01a96 100644
--- a/plugins/lsps-plugin/src/proto/lsps0.rs
+++ b/plugins/lsps-plugin/src/proto/lsps0.rs
@@ -19,7 +19,7 @@ pub mod error_codes {
pub trait LSPS0RpcErrorExt {
rpc_error_methods! {
- client_rejected => error_codes::CLIENT_REJECTED,
+ client_rejected, client_rejected_with_data => error_codes::CLIENT_REJECTED,
}
}
diff --git a/plugins/lsps-plugin/src/proto/lsps2.rs b/plugins/lsps-plugin/src/proto/lsps2.rs
index 9663cc03..a9907afa 100644
--- a/plugins/lsps-plugin/src/proto/lsps2.rs
+++ b/plugins/lsps-plugin/src/proto/lsps2.rs
@@ -52,9 +52,9 @@ impl core::error::Error for Error {}
pub trait LSPS2RpcErrorExt {
rpc_error_methods! {
- invalid_opening_fee_params => error_codes::INVALID_OPENING_FEE_PARAMS,
- payment_size_too_small => error_codes::PAYMENT_SIZE_TOO_SMALL,
- payment_size_too_large => error_codes::PAYMENT_SIZE_TOO_LARGE
+ invalid_opening_fee_params, invalid_opening_fee_params_with_data => error_codes::INVALID_OPENING_FEE_PARAMS,
+ payment_size_too_small, payment_size_too_small_with_data => error_codes::PAYMENT_SIZE_TOO_SMALL,
+ payment_size_too_large, payment_size_too_large_with_data => error_codes::PAYMENT_SIZE_TOO_LARGE
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.