Managment rpc #543
No reviewers
Labels
No labels
DB & Storage
Deployment
Error Handling & Logging
Maintenance
Payment Backend
backport
backport v0.13.x
backport v0.14.x
backport v0.15.x
bindings
blocked
bug
cdk-sql
ci
cli
deps
documentation
duplicate
enhancement
good first issue
help wanted
invalid
keep-open
ldk-node-ui
migrations
mint
mutation-testing
needs rebase
needs review
new nut
nut change
question
ready
rust-version
rustfmt
stacked hold
stale
testing
wallet
weekly-report
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cashubtc/cdk!543
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "managment_rpc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
closes #456
Notes to the reviewers
A mint management rpc can be started by enabling it in the mintd config. There is a gprpc client cli that can be run by running
cargo r --bin cdk-mint-clito update the mint settings.If the rpc server is enabled the mint will only read settings from the config file the first time after that the rpc must be used and changes to the mint info in the config file will not be used.
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-checkbefore committingadd
mint_rpc_clilib as well as the bin@ -0,0 +1,41 @@[package]We don't want to enforce such an old version of
tonic,prostandtonic-buildso we should be able to support the range to enable support of msrv and newer rust version.cc @crodas @davidcaseria
@ -358,12 +360,51 @@ async fn main() -> anyhow::Result<()> {}Would it make sense to place it behind a feature flag, like the swagger UI?
@ -358,12 +360,51 @@ async fn main() -> anyhow::Result<()> {}resolved in 4ce1337a9397a6774b39a43fa779ee9d4bd8b3c2
Fixes #542
@ -240,4 +240,16 @@ impl Settings {A more compact way to achieve the same.
@ -399,6 +399,18 @@ impl Settings {Same as in
nut04, a more compact way.@ -0,0 +1,41 @@[package]A
descriptiontag would be useful.All other CDK crates have a "unified", single version. Since there are so many inter-dependencies, maybe it's good to stick with that model and use the CDK version here (0.6.0)?
@ -0,0 +1,196 @@use std::path::PathBuf;unwrap()->?@ -0,0 +92,4 @@tracing::debug!("Using work dir: {}", work_dir.display());let channel = if work_dir.join("tls").is_dir() {// TLS directory exists, configure TLSA log statement would be more helpful IMO.
@ -0,0 +107,4 @@.connect().await?} else {// No TLS directory, skip TLS configuration@ -0,0 +2,4 @@pub mod mint_rpc_cli;pub use proto::*;NIT: alphabetic sorting
@ -0,0 +16,4 @@rpc UpdateNut04(UpdateNut04Request) returns (UpdateResponse) {}rpc UpdateNut05(UpdateNut05Request) returns (UpdateResponse) {}rpc UpdateQuoteTtl(UpdateQuoteTtlRequest) returns (UpdateResponse) {}rpc UpdateNut04Quote(UpdateNut04QuoteRequest) returns (UpdateNut04QuoteRequest) {}Is this for manual updating of quote states? If so, isn't this dangerous to allow (i.e. could interfere with the automatic quote state mgmt)?
@ -0,0 +28,4 @@string info = 2;}message GetInfoResponse {Maybe this should include the current settings, at least for
nut04/05? Alternatively, maybeUpdateNut04/05should return the current settings?There are methods to update them, but there is no way to get them. Since
updatewill merge the settings, it would be useful to have a way to see the current ones.@ -0,0 +1,586 @@use std::net::SocketAddr;IMO
warnis better for the insecure branch.@ -7,4 +7,3 @@homepage = "https://github.com/cashubtc/cdk"repository = "https://github.com/cashubtc/cdk.git"rust-version = "1.63.0" # MSRVdescription = "CDK mint binary"Removed by mistake?
@ -11,1 +10,4 @@[features]default = ["management-rpc"]swagger = ["cdk-axum/swagger", "dep:utoipa", "dep:utoipa-swagger-ui"]Maybe it's better to have this disabled by default?
Keeps the attack surface smaller for the default setup. Mint operators can still enable it if they need it.
@ -358,12 +360,51 @@ async fn main() -> anyhow::Result<()> {}@ -7,4 +7,3 @@homepage = "https://github.com/cashubtc/cdk"repository = "https://github.com/cashubtc/cdk.git"rust-version = "1.63.0" # MSRVdescription = "CDK mint binary"mintd doesn't have an msrv or at least not 1.63 as it pulls in lnd that had a higer msrv and redb
@ -11,1 +10,4 @@[features]default = ["management-rpc"]swagger = ["cdk-axum/swagger", "dep:utoipa", "dep:utoipa-swagger-ui"]I think its better to have in the default binary as I think most operator will want it, though it can be disabled at run time if they do not want to so there there is little more expose there from the excess code. The rpc is not started by default at runtime that does default to not start.
Related if you are worried about a smaller attack surface via excess cdk code mintd should not be used as it brings in both dbs, and all the ln backends and then chooses these at runtime. I don't think this really increase the attack surface as its code that is not run, but does increase the binary.
@ -0,0 +1,5 @@fn main() -> Result<(), Box<dyn std::error::Error>> {println!("cargo:rerun-if-changed=src/proto/cdk-mint-rpc.proto");tonic_build::compile_protos("src/proto/cdk-mint-rpc.proto")?;Helps avoid unnecessary recompilations. With this,
cargowill only recompile if the proto changed.@ -0,0 +1,41 @@[package]@ -0,0 +1,5 @@fn main() -> Result<(), Box<dyn std::error::Error>> {println!("cargo:rerun-if-changed=src/proto/cdk-mint-rpc.proto");tonic_build::compile_protos("src/proto/cdk-mint-rpc.proto")?;Nice thank you
@ -0,0 +28,4 @@string info = 2;}message GetInfoResponse {They are shows by curling the info endpoint. But yes more convenient to have here as well. we can add it.