Introduce a SignatoryManager service. #509

Merged
crodas merged 23 commits from proto/independent-signatory into main 2025-05-28 15:43:30 +00:00
crodas commented 2024-12-20 00:29:12 +00:00 (Migrated from github.com)

Description

The SignatoryManager manager provides an API to interact with keysets, private keys, and all key-related operations, offering segregation between the mint and the most sensible part of the mind: the private keys.

Although the default signatory runs in memory, it is completely isolated from the rest of the system and can only be communicated through the interface offered by the signatory manager. Only messages can be sent from the mintd to the Signatory trait through the Signatory Manager.

This pull request sets the foundation for eventually being able to run the Signatory and all the key-related operations in a separate service, possibly in a foreign service, to offload risks, as described in #476.

The Signatory manager is concurrent and deferred any mechanism needed to handle concurrency to the Signatory trait.

TODO

  • Add standalone binary to spawn a GRPC server inside cdk-signatory
  • Add GRPC client on cdk
  • Add tests
  • Add cdk-signatory to the pipeline

Notes to the reviewers

Maybe a new terminology, other than Signatory and SignatoryManager can be used, but the idea I believe is solid.


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

### Description The SignatoryManager manager provides an API to interact with keysets, private keys, and all key-related operations, offering segregation between the mint and the most sensible part of the mind: the private keys. Although the default signatory runs in memory, it is completely isolated from the rest of the system and can only be communicated through the interface offered by the signatory manager. Only messages can be sent from the mintd to the Signatory trait through the Signatory Manager. This pull request sets the foundation for eventually being able to run the Signatory and all the key-related operations in a separate service, possibly in a foreign service, to offload risks, as described in #476. The Signatory manager is concurrent and deferred any mechanism needed to handle concurrency to the Signatory trait. TODO ------ - [x] Add standalone binary to spawn a GRPC server inside cdk-signatory - [x] Add GRPC client on cdk - [ ] Add tests - [ ] Add cdk-signatory to the pipeline ----- ### Notes to the reviewers Maybe a new terminology, other than Signatory and SignatoryManager can be used, but the idea I believe is solid. ----- ### Suggested [CHANGELOG](https://github.com/cashubtc/cdk/blob/main/CHANGELOG.md) Updates <!-- Please do not edit the actual changelog but note what you changed here. --> #### CHANGED #### ADDED #### REMOVED #### FIXED ---- ### Checklist * [x] I followed the [code style guidelines](https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md) * [x] I ran `just final-check` before committing
ok300 (Migrated from github.com) reviewed 2024-12-20 00:29:12 +00:00
callebtc (Migrated from github.com) reviewed 2024-12-20 00:29:12 +00:00
callebtc (Migrated from github.com) reviewed 2024-12-23 09:12:43 +00:00
callebtc (Migrated from github.com) commented 2024-12-23 09:11:29 +00:00

Functionality like this should happen in the core mint instead of here. The message should be sent to the blind signer only if all checks are successful, including scripts etc.

Functionality like this should happen in the core mint instead of here. The message should be sent to the blind signer only if all checks are successful, including scripts etc.
callebtc (Migrated from github.com) commented 2024-12-23 09:12:34 +00:00

Possibly out of scope but it would be nice if this parameter would accept a slice of integers (all possible amounts) instead of a single exponent (max order).

Possibly out of scope but it would be nice if this parameter would accept a slice of integers (all possible amounts) instead of a single exponent (max order).
crodas commented 2025-01-21 03:47:59 +00:00 (Migrated from github.com)

@thesimplekid @callebtc Does it look better?

Basically so far I have:

  1. Move the signatory to their own repo. The same code can be embedded or run in a its own binary and connect through an URL
  2. Regardless of embedded or remote, the signatory works in their own tokio thread, and they communicate with the mintd through messages
  3. A lot of code that can be merged before in its own PR, which aims to have fewer dependency and reduce the duplicate code, such as the Database instantiation

If this makes sense, I'll do the preparations (like preparing 3), fix merging issues, and add some comments. 3 was only required if the signatory binary is not in the same crate as mintd, but it makes sense to perhaps remove it for now and revisit it later https://github.com/cashubtc/cdk/pull/550, only rebasing is missing if it makes sense.

@thesimplekid @callebtc Does it look better? Basically so far I have: 1. Move the signatory to their own repo. The same code can be [embedded](https://github.com/cashubtc/cdk/pull/509/files#diff-eaecc2727173ea68b9bea52b1ad3d63089baf5e30c3639584ef454a97f8ee83eR257-R263) or run in a its [own binary](https://github.com/cashubtc/cdk/pull/509/files#diff-9b17db52e80e8ba42a10c7ca4d5525bcf8796d0d21fb2235c9f0a9658bd999abR43-R55) and [connect through an URL](https://github.com/cashubtc/cdk/pull/509/files#diff-eaecc2727173ea68b9bea52b1ad3d63089baf5e30c3639584ef454a97f8ee83eR267-R271) 2. Regardless of embedded or remote, the signatory works in their [own tokio thread](https://github.com/cashubtc/cdk/pull/509/files#diff-e3f658c6499c98f53606c5233e7c1c88c20390e60a53f7307817c3c307115712R43-R65), and they communicate with the mintd [through messages](https://github.com/cashubtc/cdk/pull/509/files#diff-e3f658c6499c98f53606c5233e7c1c88c20390e60a53f7307817c3c307115712R82-R91) 3. A lot of code that can be merged before in its own PR, which aims to have fewer dependency and reduce the duplicate code, such as the [Database instantiation](https://github.com/cashubtc/cdk/pull/509/files#diff-519f7c600830c19baa30bc18e0674e7010b8da18a0f4621c339b0e19e9d97ac6R32-R56) If this makes sense, ~I'll do the preparations (like preparing `3`), fix merging issues, and add some comments. `3` was only required if the signatory binary is not in the same crate as `mintd`, but it makes sense to perhaps remove it for now and revisit it later~ https://github.com/cashubtc/cdk/pull/550, only rebasing is missing if it makes sense.
thesimplekid (Migrated from github.com) reviewed 2025-01-21 10:52:42 +00:00
thesimplekid (Migrated from github.com) left a comment

Move the signatory to their own repo.

You mean crate right?

This is a really good start and a structure that makes sense. I think there are still some open questions around what should be handled by the signatory and what by the mint. For example the proof verification I don't think the checking of p2pk and htlc conditions should be done by the signatory and it should only handle stuff that actually required the mint private keys. However, we do want to provide enough information that the signatory can be more then just a blind signer, doing ie rate limiting and we don't have a strong picture of what that will look like yet.

> Move the signatory to their own repo. You mean crate right? This is a really good start and a structure that makes sense. I think there are still some open questions around what should be handled by the signatory and what by the mint. For example the proof verification I don't think the checking of p2pk and htlc conditions should be done by the signatory and it should only handle stuff that actually required the mint private keys. However, we do want to provide enough information that the signatory can be more then just a blind signer, doing ie rate limiting and we don't have a strong picture of what that will look like yet.
thesimplekid (Migrated from github.com) commented 2025-01-21 10:45:08 +00:00

What is check ln?

What is check ln?
@ -0,0 +1,40 @@
[package]
thesimplekid (Migrated from github.com) commented 2025-01-21 10:43:54 +00:00

These break MSRV, I'll figure that out on the management-rpc branch and report back

These break MSRV, I'll figure that out on the management-rpc [branch](https://github.com/cashubtc/cdk/pull/543) and report back
@ -0,0 +1,21 @@
//! In memory signatory
thesimplekid (Migrated from github.com) commented 2025-01-21 10:42:19 +00:00

I don't think the full verification of the proof should be in the signatory only the verification of the signature.

I don't think the full verification of the proof should be in the signatory only the verification of the signature.
crodas (Migrated from github.com) reviewed 2025-01-21 15:17:50 +00:00
@ -0,0 +1,40 @@
[package]
crodas (Migrated from github.com) commented 2025-01-21 15:17:50 +00:00

I'll fix this, making this optional (only to compile the binary)

I'll fix this, making this optional (only to compile the binary)
crodas (Migrated from github.com) reviewed 2025-01-21 15:18:56 +00:00
crodas (Migrated from github.com) commented 2025-01-21 15:18:55 +00:00

I'll rename it better; it is checked if the configuration has lightning configuration. I don't need that. I think I'll create another function instead of altering that function.

I'll rename it better; it is checked if the configuration has lightning configuration. I don't need that. I think I'll create another function instead of altering that function.
crodas (Migrated from github.com) reviewed 2025-01-21 16:23:47 +00:00
@ -0,0 +1,40 @@
[package]
crodas (Migrated from github.com) commented 2025-01-21 16:23:46 +00:00

I this fixed now @thesimplekid ?

I this fixed now @thesimplekid ?
ok300 (Migrated from github.com) reviewed 2025-02-06 18:34:31 +00:00
@ -0,0 +1,6 @@
fn main() {
println!("cargo:rerun-if-changed=src/proto/signatory.proto");
#[cfg(feature = "grpc")]
ok300 (Migrated from github.com) commented 2025-02-06 18:34:31 +00:00
    println!("cargo:rerun-if-changed=src/proto/signatory.proto");
    
    #[cfg(feature = "grpc")]

This will make sure cargo only recompiles when the proto file changes.

```suggestion println!("cargo:rerun-if-changed=src/proto/signatory.proto"); #[cfg(feature = "grpc")] ``` This will make sure `cargo` only recompiles when the `proto` file changes.
crodas (Migrated from github.com) reviewed 2025-02-06 19:17:59 +00:00
@ -0,0 +1,6 @@
fn main() {
println!("cargo:rerun-if-changed=src/proto/signatory.proto");
#[cfg(feature = "grpc")]
crodas (Migrated from github.com) commented 2025-02-06 19:17:59 +00:00

Thank you! I'll add it shortly, I'm rebasing first.

Thank you! I'll add it shortly, I'm rebasing first.
thesimplekid (Migrated from github.com) reviewed 2025-02-14 15:11:11 +00:00
thesimplekid (Migrated from github.com) reviewed 2025-02-14 19:08:18 +00:00
thesimplekid (Migrated from github.com) commented 2025-02-14 18:03:21 +00:00

can we week serde at 1? I know we changed uuid bc of the wasm build issue

can we week serde at 1? I know we changed uuid bc of the wasm build issue
thesimplekid (Migrated from github.com) commented 2025-02-14 18:05:51 +00:00

these should all be version 0.7.1

these should all be version `0.7.1`
@ -0,0 +1,21 @@
//! In memory signatory
thesimplekid (Migrated from github.com) commented 2025-02-14 18:10:55 +00:00

maybe instead of a verify_proof fn we have a verify signature fn to make it clear we only verify the signature on the proof.

maybe instead of a `verify_proof` fn we have a verify signature fn to make it clear we only verify the signature on the proof.
@ -0,0 +1,222 @@
use std::net::SocketAddr;
thesimplekid (Migrated from github.com) commented 2025-02-14 18:14:35 +00:00

What do you think if implementing start and stop on MwmorySignatory instead of this fn

github.com/cashubtc/cdk@e1458b07a8/crates/cdk-mint-rpc/src/proto/server.rs (L50-L120)

What do you think if implementing start and stop on `MwmorySignatory` instead of this fn https://github.com/cashubtc/cdk/blob/e1458b07a898f19742656d95bc83c5c954d9f855/crates/cdk-mint-rpc/src/proto/server.rs#L50-L120
thesimplekid (Migrated from github.com) commented 2025-02-14 18:16:00 +00:00

We still want to commit to MSRV with grpc enabled. The required dep version on used the cdk-mint-rpc. I think you are using them maybe we just remove the comment.

We still want to commit to MSRV with grpc enabled. The required dep version on used the `cdk-mint-rpc`. I think you are using them maybe we just remove the comment.
thesimplekid (Migrated from github.com) commented 2025-02-14 18:16:34 +00:00

This should be moved up under features?

This should be moved up under features?
@ -71,1 +75,4 @@
/// Set signatory service
pub fn with_signatory(mut self, signatory: Arc<dyn Signatory + Sync + Send + 'static>) -> Self {
self.signatory = Some(signatory);
thesimplekid (Migrated from github.com) commented 2025-02-14 18:19:18 +00:00

Why do we need a with_signatory and with_remote_signatory can't we just use with_signatory and its something that implements the trait and we don't care what?

Why do we need a `with_signatory` and `with_remote_signatory` can't we just use `with_signatory` and its something that implements the trait and we don't care what?
thesimplekid (Migrated from github.com) commented 2025-02-14 18:20:31 +00:00

Do we need a grpc feature? If the signatory is just something that impl the Signatory trait does cdk need to know if its rpc or not?

Do we need a grpc feature? If the signatory is just something that impl the `Signatory` trait does cdk need to know if its rpc or not?
crodas (Migrated from github.com) reviewed 2025-02-14 22:52:43 +00:00
@ -71,1 +75,4 @@
/// Set signatory service
pub fn with_signatory(mut self, signatory: Arc<dyn Signatory + Sync + Send + 'static>) -> Self {
self.signatory = Some(signatory);
crodas (Migrated from github.com) commented 2025-02-14 22:52:43 +00:00

Good point, I'll refactor this.

Good point, I'll refactor this.
crodas (Migrated from github.com) reviewed 2025-02-14 22:53:28 +00:00
crodas (Migrated from github.com) commented 2025-02-14 22:53:27 +00:00

It was all due the MSRV, I'll revisit before having this PR ready for review

It was all due the MSRV, I'll revisit before having this PR ready for review
crodas (Migrated from github.com) reviewed 2025-02-14 22:54:15 +00:00
crodas (Migrated from github.com) commented 2025-02-14 22:54:15 +00:00

After addressing the MSRV, (as you described in https://github.com/cashubtc/cdk/pull/509#discussion_r1956554070) I will drop the GRPC feature

After addressing the MSRV, (as you described in https://github.com/cashubtc/cdk/pull/509#discussion_r1956554070) I will drop the GRPC feature
davidcaseria (Migrated from github.com) reviewed 2025-04-09 17:12:03 +00:00
@ -0,0 +1,21 @@
//! In memory signatory
davidcaseria (Migrated from github.com) commented 2025-04-09 17:12:03 +00:00

Should the functions also take a batch of messages/proofs to limit the amount of network calls?

Should the functions also take a batch of messages/proofs to limit the amount of network calls?
thesimplekid commented 2025-04-23 16:12:04 +00:00 (Migrated from github.com)
possibly closes https://github.com/cashubtc/cdk/issues/614
thesimplekid (Migrated from github.com) requested changes 2025-05-10 13:14:30 +00:00
thesimplekid (Migrated from github.com) left a comment

Really nice work

Really nice work
@ -0,0 +57,4 @@
}
#[tracing::instrument(skip_all)]
async fn runner(
thesimplekid (Migrated from github.com) commented 2025-05-10 12:59:43 +00:00
    [tracing::instrument(skip_all)]
    async fn runner(
```suggestion [tracing::instrument(skip_all)] async fn runner( ```
@ -0,0 +60,4 @@
async fn runner(
mut receiver: mpsc::Receiver<Request>,
handler: Arc<dyn Signatory + Send + Sync>,
) {
thesimplekid (Migrated from github.com) commented 2025-05-10 12:53:46 +00:00

What is the advantage to having this runner and then using the channels to pass the request? Wouldn't another option be to having the signatory on the service?

What is the advantage to having this runner and then using the channels to pass the request? Wouldn't another option be to having the signatory on the service?
@ -0,0 +99,4 @@
}
#[tracing::instrument(skip_all)]
async fn blind_sign(
thesimplekid (Migrated from github.com) commented 2025-05-10 13:00:15 +00:00

Can we add tracing::instrument to these?

Can we add tracing::instrument to these?
@ -0,0 +1,158 @@
use std::path::Path;
thesimplekid (Migrated from github.com) commented 2025-05-10 12:46:21 +00:00
            let server_root_ca_cert = std::fs::read_to_string(tls_dir.join("ca.pem"))?);
```suggestion let server_root_ca_cert = std::fs::read_to_string(tls_dir.join("ca.pem"))?); ```
@ -0,0 +1,222 @@
use std::net::SocketAddr;
thesimplekid (Migrated from github.com) commented 2025-05-10 12:57:39 +00:00
```suggestion ```
@ -0,0 +20,4 @@
T: Signatory + Send + Sync + 'static,
{
#[tracing::instrument(skip_all)]
async fn blind_sign(
thesimplekid (Migrated from github.com) commented 2025-05-10 13:02:36 +00:00

Can we add tracing::instrument to these?

Can we add tracing::instrument to these?
@ -0,0 +1,31 @@
CREATE TABLE proof_new (
y BLOB PRIMARY KEY,
amount INTEGER NOT NULL,
keyset_id TEXT NOT NULL, -- no FK constraint here
thesimplekid (Migrated from github.com) commented 2025-05-10 13:03:19 +00:00

Why can't we use the FK?

Why can't we use the FK?
@ -61,3 +67,4 @@
cdk-signatory = { workspace = true, default-features = false }
getrandom = { version = "0.2", features = ["js"] }
[[example]]
thesimplekid (Migrated from github.com) commented 2025-05-10 13:04:25 +00:00

Should the grpc feature be optional here by adding a feature to cdk?

Should the grpc feature be optional here by adding a feature to cdk?
@ -64,0 +29,4 @@
pub fn auth_keysets(&self) -> KeysetResponse {
KeysetResponse {
keysets: self
.keysets
thesimplekid (Migrated from github.com) commented 2025-05-10 13:08:14 +00:00

Do we know that the signatory will return only active and only one keyset?

Do we know that the signatory will return only active and only one keyset?
@ -48,6 +51,11 @@ pub use verification::Verification;
/// Cashu Mint
#[derive(Clone)]
pub struct Mint {
thesimplekid (Migrated from github.com) commented 2025-05-10 13:09:50 +00:00
    /// It is implemented in the cdk-signatory crate, and it can be embedded in the mint or
```suggestion /// It is implemented in the cdk-signatory crate, and it can be embedded in the mint or ```
@ -396,82 +328,79 @@ impl Mint {
Ok(fee)
}
thesimplekid (Migrated from github.com) commented 2025-05-10 13:12:23 +00:00
    pub async fn verify_proofs(&self, proofs: Proofs) -> Result<(), Error> {

Since we just call to_owned on this later should we just make this a vec?

```suggestion pub async fn verify_proofs(&self, proofs: Proofs) -> Result<(), Error> { ``` Since we just call to_owned on this later should we just make this a vec?
crodas (Migrated from github.com) reviewed 2025-05-10 13:40:12 +00:00
crodas (Migrated from github.com) reviewed 2025-05-10 13:42:50 +00:00
@ -0,0 +60,4 @@
async fn runner(
mut receiver: mpsc::Receiver<Request>,
handler: Arc<dyn Signatory + Send + Sync>,
) {
crodas (Migrated from github.com) commented 2025-05-10 13:42:50 +00:00

This alternative runs the signatory on a separate thread, passing messages. Otherwise, it would be a direct function call. It is a minor improvement that can be dropped.

This alternative runs the signatory on a separate thread, passing messages. Otherwise, it would be a direct function call. It is a minor improvement that can be dropped.
thesimplekid commented 2025-05-10 13:43:34 +00:00 (Migrated from github.com)

Are there any tests you added or think we can added to better cover or do you thing its well covered? Thinking mainly around rotation and generation.

Are there any tests you added or think we can added to better cover or do you thing its well covered? Thinking mainly around rotation and generation.
crodas (Migrated from github.com) reviewed 2025-05-10 13:44:10 +00:00
@ -0,0 +1,31 @@
CREATE TABLE proof_new (
y BLOB PRIMARY KEY,
amount INTEGER NOT NULL,
keyset_id TEXT NOT NULL, -- no FK constraint here
crodas (Migrated from github.com) commented 2025-05-10 13:44:10 +00:00

Because the database no longer runs in the same file. Remember the signatory runs and owns their own file, potentially on another machine. Even in the same machine, it is sub-efficient to use the same SQLite.

Because the database no longer runs in the same file. Remember the signatory runs and owns their own file, potentially on another machine. Even in the same machine, it is sub-efficient to use the same SQLite.
crodas (Migrated from github.com) reviewed 2025-05-10 13:45:09 +00:00
@ -61,3 +67,4 @@
cdk-signatory = { workspace = true, default-features = false }
getrandom = { version = "0.2", features = ["js"] }
[[example]]
crodas (Migrated from github.com) commented 2025-05-10 13:45:09 +00:00

Potentially, but it should be on by default and only disabled whenever it is not possible (wasm). It would enable the gRPC client in the cdk.

Potentially, but it should be on by default and only disabled whenever it is not possible (wasm). It would enable the gRPC client in the cdk.
crodas (Migrated from github.com) reviewed 2025-05-10 13:46:22 +00:00
@ -64,0 +29,4 @@
pub fn auth_keysets(&self) -> KeysetResponse {
KeysetResponse {
keysets: self
.keysets
crodas (Migrated from github.com) commented 2025-05-10 13:46:21 +00:00

No, it will return all keys. That's why the CDK will cache it. I will optimise the CDK usage by keeping the active keys in a separate struct.

Most CDK functions are now synchronous though, since the keys is already part of memory and replaceable as well.

No, it will return all keys. That's why the CDK will cache it. I will optimise the CDK usage by keeping the active keys in a separate struct. Most CDK functions are now synchronous though, since the keys is already part of memory and replaceable as well.
thesimplekid (Migrated from github.com) reviewed 2025-05-10 14:07:35 +00:00
@ -0,0 +60,4 @@
async fn runner(
mut receiver: mpsc::Receiver<Request>,
handler: Arc<dyn Signatory + Send + Sync>,
) {
thesimplekid (Migrated from github.com) commented 2025-05-10 14:07:35 +00:00

Thats fine keep it as it is.

Thats fine keep it as it is.
crodas commented 2025-05-10 14:46:24 +00:00 (Migrated from github.com)

Are there any tests you added or think we can added to better cover or do you thing its well covered? Thinking mainly around rotation and generation.

I think the tests are good enough. The only bit that I removed was knowing the upcoming private key (for instance the test test_mint_keyset_gen), since that is unknown to the CDK.

> Are there any tests you added or think we can added to better cover or do you thing its well covered? Thinking mainly around rotation and generation. I think the tests are good enough. The only bit that I removed was knowing the upcoming private key (for instance the test `test_mint_keyset_gen`), since that is unknown to the CDK.
thesimplekid commented 2025-05-10 15:11:01 +00:00 (Migrated from github.com)

I think the tests are good enough. The only bit that I removed was knowing the upcoming private key (for instance the test test_mint_keyset_gen), since that is unknown to the CDK.

Did you remove it or add it to the signatory?

> I think the tests are good enough. The only bit that I removed was knowing the upcoming private key (for instance the test test_mint_keyset_gen), since that is unknown to the CDK. Did you remove it or add it to the signatory?
davidcaseria (Migrated from github.com) reviewed 2025-05-12 13:22:05 +00:00
@ -0,0 +1,173 @@
syntax = "proto3";
davidcaseria (Migrated from github.com) commented 2025-05-12 13:18:04 +00:00

Should this be changed to match the proposed spec? https://github.com/cashubtc/nuts/pull/250

Should this be changed to match the proposed spec? https://github.com/cashubtc/nuts/pull/250
@ -0,0 +8,4 @@
use crate::signatory::{RotateKeyArguments, Signatory, SignatoryKeySet, SignatoryKeysets};
/// A client for the Signatory service.
pub struct SignatoryRpcClient {
davidcaseria (Migrated from github.com) commented 2025-05-12 13:21:51 +00:00

Should we allow callers to include a gRPC Metadata struct that is included in each request? This can enable a signatory to handle multiple mints.

Should we allow callers to include a gRPC `Metadata` struct that is included in each request? This can enable a signatory to handle multiple mints.
crodas (Migrated from github.com) reviewed 2025-05-19 18:04:28 +00:00
@ -0,0 +1,173 @@
syntax = "proto3";
crodas (Migrated from github.com) commented 2025-05-19 18:04:28 +00:00

It is already up to date

It is already up to date
crodas (Migrated from github.com) reviewed 2025-05-19 23:01:31 +00:00
crodas (Migrated from github.com) commented 2025-05-19 23:01:31 +00:00

Already fixed

Already fixed
crodas (Migrated from github.com) reviewed 2025-05-19 23:02:12 +00:00
crodas (Migrated from github.com) commented 2025-05-19 23:02:12 +00:00

This will be done in #762

This will be done in #762
crodas (Migrated from github.com) reviewed 2025-05-19 23:02:30 +00:00
@ -0,0 +1,21 @@
//! In memory signatory
crodas (Migrated from github.com) commented 2025-05-19 23:02:30 +00:00

Already done

Already done
crodas (Migrated from github.com) reviewed 2025-05-19 23:04:09 +00:00
@ -0,0 +1,21 @@
//! In memory signatory
crodas (Migrated from github.com) commented 2025-05-19 23:04:09 +00:00

I think this conversation should be moved to https://github.com/cashubtc/nuts/pull/250

I think this conversation should be moved to https://github.com/cashubtc/nuts/pull/250
crodas (Migrated from github.com) reviewed 2025-05-20 01:26:39 +00:00
@ -0,0 +99,4 @@
}
#[tracing::instrument(skip_all)]
async fn blind_sign(
crodas (Migrated from github.com) commented 2025-05-20 01:26:39 +00:00

Done in bb6a154d

Done in bb6a154d
thesimplekid (Migrated from github.com) requested changes 2025-05-20 08:33:56 +00:00
thesimplekid (Migrated from github.com) left a comment

Looks good just noted a few things.

Have you tested a mint upgrade. Starting a mint on the last version 0.9.2. We should expect that once upgraded the keysets are not changed and proofs generated on past versions can still be verified?

On that note on an upgrade there isn't anything that an operator needs to do in order to run the db_signatory correct?

Looks good just noted a few things. Have you tested a mint upgrade. Starting a mint on the last version 0.9.2. We should expect that once upgraded the keysets are not changed and proofs generated on past versions can still be verified? On that note on an upgrade there isn't anything that an operator needs to do in order to run the db_signatory correct?
@ -0,0 +1,40 @@
[package]
thesimplekid (Migrated from github.com) commented 2025-05-20 08:25:35 +00:00

Since we import cdk-common we shouldn't need cashu as cdk-common re-exports everything from cashu.

```suggestion ``` Since we import cdk-common we shouldn't need cashu as cdk-common re-exports everything from cashu.
@ -0,0 +34,4 @@
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
getrandom = { version = "0.2", features = ["js"] }
thesimplekid (Migrated from github.com) commented 2025-05-20 08:21:29 +00:00
getrandom = { version = "0.3", features = ["js"] }

newest is 0.3 is there a reason we can update?

```suggestion getrandom = { version = "0.3", features = ["js"] } ``` newest is 0.3 is there a reason we can update?
@ -0,0 +1,15 @@
#[cfg(not(target_arch = "wasm32"))]
thesimplekid (Migrated from github.com) commented 2025-05-20 08:27:04 +00:00

Can we refactor this to not have the cli mod. https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md#sub-modules

Can we refactor this to not have the cli mod. https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md#sub-modules
@ -0,0 +1,345 @@
//! Main Signatory implementation
thesimplekid (Migrated from github.com) commented 2025-05-20 08:28:17 +00:00

Should do this TODO now?

Should do this TODO now?
@ -396,82 +328,79 @@ impl Mint {
Ok(fee)
thesimplekid (Migrated from github.com) commented 2025-05-20 08:31:21 +00:00
    pub async fn verify_proofs(&self, proofs: Proofs) -> Result<(), Error> {

Since we call to_ownded on this later should we just change the fn def

```suggestion pub async fn verify_proofs(&self, proofs: Proofs) -> Result<(), Error> { ``` Since we call `to_ownded` on this later should we just change the fn def
crodas (Migrated from github.com) reviewed 2025-05-20 12:55:12 +00:00
@ -0,0 +1,345 @@
//! Main Signatory implementation
crodas (Migrated from github.com) commented 2025-05-20 12:55:11 +00:00

On it right now

On it right now
crodas (Migrated from github.com) reviewed 2025-05-20 12:55:25 +00:00
@ -396,82 +328,79 @@ impl Mint {
Ok(fee)
crodas (Migrated from github.com) commented 2025-05-20 12:55:25 +00:00

I'll make it happen

I'll make it happen
crodas (Migrated from github.com) reviewed 2025-05-20 16:24:20 +00:00
@ -0,0 +34,4 @@
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
getrandom = { version = "0.2", features = ["js"] }
crodas (Migrated from github.com) commented 2025-05-20 16:24:20 +00:00

I just did it, let's see if the CI likes it

I just did it, let's see if the CI likes it
davidcaseria (Migrated from github.com) reviewed 2025-05-20 20:51:45 +00:00
@ -0,0 +32,4 @@
// Represents a blinded message
message BlindedMessage {
uint64 amount = 1;
string keyset_id = 2;
davidcaseria (Migrated from github.com) commented 2025-05-20 20:51:41 +00:00

Should this be bytes?

Should this be bytes?
crodas (Migrated from github.com) reviewed 2025-05-21 02:00:59 +00:00
@ -0,0 +32,4 @@
// Represents a blinded message
message BlindedMessage {
uint64 amount = 1;
string keyset_id = 2;
crodas (Migrated from github.com) commented 2025-05-21 02:00:58 +00:00

Can we fix in the NUT? Perhaps we can merge this as is, and fix it in the NUT then here in a follow-up PR.

Can we fix in the [NUT](https://github.com/cashubtc/nuts/pull/250/files#diff-b59ecc5713e7d5c9d72582c7f69a8bede40ff8387f1c63779d840ad9840c65d8R35)? Perhaps we can merge this as is, and fix it in the NUT then here in a follow-up PR.
thesimplekid (Migrated from github.com) requested changes 2025-05-22 10:37:59 +00:00
@ -0,0 +34,4 @@
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
getrandom = { version = "0.2", features = ["js"] }
thesimplekid (Migrated from github.com) commented 2025-05-22 10:26:53 +00:00

Did this get reverted in a force push by accident I still see 0.2?

Did this get reverted in a force push by accident I still see 0.2?
@ -44,1 +44,4 @@
# -Z minimal-versions
sync_wrapper = "0.1.2"
bech32 = "0.9.1"
thesimplekid (Migrated from github.com) commented 2025-05-22 10:33:17 +00:00

We can move arc-swap to the normal deps not under z minimal

```suggestion ``` We can move arc-swap to the normal deps not under z minimal
thesimplekid (Migrated from github.com) requested changes 2025-05-27 13:22:19 +00:00
thesimplekid (Migrated from github.com) left a comment

I think this is good to merge if we just add the test. We can resolve the other comments in a follow up.

I think this is good to merge if we just add the test. We can resolve the other comments in a follow up.
@ -854,3 +679,4 @@
assert_eq!(2, keysets.keysets.len());
for keyset in &keysets.keysets {
if keyset.id == first_keyset_id {
assert!(!keyset.active);
thesimplekid (Migrated from github.com) commented 2025-05-27 13:19:58 +00:00

Offline we talked about a test to ensure the signatory generates the same keyset as the current logic. This seems to be the test we want but its removed or is moved? I tested it manually with cdk-mintd and it is correct would be good to lock it in with a test.

Offline we talked about a test to ensure the signatory generates the same keyset as the current logic. This seems to be the test we want but its removed or is moved? I tested it manually with cdk-mintd and it is correct would be good to lock it in with a test.
crodas (Migrated from github.com) reviewed 2025-05-27 13:24:34 +00:00
@ -854,3 +679,4 @@
assert_eq!(2, keysets.keysets.len());
for keyset in &keysets.keysets {
if keyset.id == first_keyset_id {
assert!(!keyset.active);
crodas (Migrated from github.com) commented 2025-05-27 13:24:34 +00:00

I'm going to make sure it is added back.

I'm going to make sure it is added back.
thesimplekid (Migrated from github.com) reviewed 2025-05-27 13:26:56 +00:00
@ -0,0 +34,4 @@
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
getrandom = { version = "0.2", features = ["js"] }
thesimplekid (Migrated from github.com) commented 2025-05-27 13:26:56 +00:00

On main ci seems okay with 0.3 is there something specific to the signatory that there is an error with 0.3?

On main ci seems okay with 0.3 is there something specific to the signatory that there is an error with 0.3?
crodas (Migrated from github.com) reviewed 2025-05-27 13:35:00 +00:00
@ -44,1 +44,4 @@
# -Z minimal-versions
sync_wrapper = "0.1.2"
bech32 = "0.9.1"
crodas (Migrated from github.com) commented 2025-05-27 13:35:00 +00:00

Sure

Sure
crodas (Migrated from github.com) reviewed 2025-05-27 13:35:31 +00:00
@ -0,0 +34,4 @@
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
getrandom = { version = "0.2", features = ["js"] }
crodas (Migrated from github.com) commented 2025-05-27 13:35:31 +00:00

I'll rebase and check

I'll rebase and check
thesimplekid (Migrated from github.com) reviewed 2025-05-27 13:56:32 +00:00
@ -0,0 +32,4 @@
// Represents a blinded message
message BlindedMessage {
uint64 amount = 1;
string keyset_id = 2;
thesimplekid (Migrated from github.com) commented 2025-05-27 13:56:32 +00:00

We can do this in a follow up pr.

We can do this in a follow up pr.
crodas (Migrated from github.com) reviewed 2025-05-27 20:45:44 +00:00
@ -854,3 +679,4 @@
assert_eq!(2, keysets.keysets.len());
for keyset in &keysets.keysets {
if keyset.id == first_keyset_id {
assert!(!keyset.active);
crodas (Migrated from github.com) commented 2025-05-27 20:45:44 +00:00

Fixed in af3f5859 /cc @thesimplekid

Fixed in af3f5859 /cc @thesimplekid
thesimplekid commented 2025-05-28 01:41:27 +00:00 (Migrated from github.com)

ACK LGTM af3f585960f7caa42b78ff0d140db521ade9004a

ACK LGTM af3f585960f7caa42b78ff0d140db521ade9004a
thesimplekid (Migrated from github.com) approved these changes 2025-05-28 15:42:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!509
No description provided.