nutshell icon indicating copy to clipboard operation
nutshell copied to clipboard

Mint Management gRPC Server

Open cloudsupper opened this issue 10 months ago • 6 comments

Mint management gRPC server. Simple gRPC server and CLI to issue commands to the Mint while it's running. Uses mutual TLS to authenticate server and client.

Supported commands:

  • [x] mint-cli get-info (returns mint info)
  • [x] mint-cli get/update mint-quote {quote-id}
  • [x] mint-cli get/update melt-quote {quote-id}
  • [x] mint-cli update add/remove {mint info field}
  • [x] mint-cli rotate to next keyset (NEW PR: #734)

Generating certificates:

Quickly generate CA/server/client certificates with the provided script:

./cashu/mint/management_rpc/generate_certificates.sh

Screencast from 2025-03-12 18-06-09.webm

Screencast from 2025-03-12 18-08-01.webm

Screencast from 2025-03-12 18-08-32.webm

cloudsupper avatar Mar 10 '25 17:03 cloudsupper

Codecov Report

Attention: Patch coverage is 45.54896% with 367 lines in your changes missing coverage. Please review.

Project coverage is 68.25%. Comparing base (3ab1e1d) to head (a96000b). Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
cashu/mint/management_rpc/management_rpc.py 0.00% 154 Missing :warning:
.../mint/management_rpc/protos/management_pb2_grpc.py 51.93% 87 Missing :warning:
cashu/mint/management_rpc/protos/management_pb2.py 17.39% 57 Missing :warning:
cashu/mint/management_rpc/cli/cli.py 77.92% 51 Missing :warning:
cashu/mint/startup.py 0.00% 8 Missing :warning:
cashu/mint/app.py 0.00% 5 Missing :warning:
cashu/mint/db/write.py 85.71% 2 Missing :warning:
cashu/wallet/cli/cli.py 0.00% 2 Missing :warning:
cashu/mint/cache.py 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #723      +/-   ##
==========================================
- Coverage   68.69%   68.25%   -0.45%     
==========================================
  Files          88       93       +5     
  Lines        9554    10483     +929     
==========================================
+ Hits         6563     7155     +592     
- Misses       2991     3328     +337     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 13 '25 10:03 codecov[bot]

This is a comprehensive set of management features. The included methods for unimplemented features are a welcome addition here as well. They will be an aid for applications supporting different release versions and mint implementations.

Some mint configurations found at the .env level are not included here. In the broader list that includes things like rate limits, and reserve fees I noted the following as possible candidates:

  • MINT_MAX_BALANCE
  • MINT_PEG_OUT_ONLY

Noted in discussions were the update_melt_quote and update_mint_quote methods and their implications on new use cases, security, and manipulation. These methods merit further discussion.

orangeshyguy21 avatar Mar 16 '25 18:03 orangeshyguy21

This is a comprehensive set of management features. The included methods for unimplemented features are a welcome addition here as well. They will be an aid for applications supporting different release versions and mint implementations.

Some mint configurations found at the .env level are not included here. In the broader list that includes things like rate limits, and reserve fees I noted the following as possible candidates:

* MINT_MAX_BALANCE

* MINT_PEG_OUT_ONLY

Noted in discussions were the update_melt_quote and update_mint_quote methods and their implications on new use cases, security, and manipulation. These methods merit further discussion.

Mint limits are broken because they were created prior to the per-keyset database views, so they need to be fixed in a separate PR before being added in. I can add in the peg-out only option.

I'll implement the rest of the settings where it makes sense, including auth.

cloudsupper avatar Mar 17 '25 09:03 cloudsupper

@callebtc do we want to merge it? When we need more commands we can add them later.

cloudsupper avatar Apr 03 '25 21:04 cloudsupper

@callebtc do we want to merge it? When we need more commands we can add them later.

I would like to merge it to main after the next minor release.

callebtc avatar Apr 20 '25 09:04 callebtc

Now supports keyset rotation.

cloudsupper avatar Apr 25 '25 17:04 cloudsupper