P2pk receive wallet #1466
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!1466
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "lescuer97/p2pk_receive_wallet"
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
Add public key generation with counter for wallet.
Notes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-checkbefore committingThis replaces this right? https://github.com/cashubtc/cdk/pull/1053
I think we need to have a discussion and have some guidelines on when we should add new fns to the db traits and when we should take advantage of the KVStore. I think there is a balance between over using the store and making our db traits too complicated.
yes
could you explain the difference between KVStore and the traits? what do you think it should be the parameters on choosing one or the other?
The kvstore is general so we can just store arbitrary data in it without having to add fns on the trait. With the drawback of a different migration pattern and less structured data. So I'm not necessarily saying we should do it here but there is a discussion worth having about when to use the Kv and when to add new fns and db tables.
yeah, I understand. I would use the KVstore when you have data that is clearly independent. EX: Information about a specific npub that you sent money to comes up in my mind
@thesimplekid @crodas I think this is know in a decent state. I know I'm lacking tests. I want to get your opinion on the implementation before I do that.
We shouldn't need this should be able to get what we need from cdk
@ -0,0 +1,70 @@use std::str::FromStr;Lets remove the emojis
This should need doc comments not sure why clippy hasn't caught it
Out of date
out of date
Outdated
Think we should rename this get private key?
These fns should also have doc comments
I wonder if we should have a fn to get the most recent pubkey especially with p2bk the user might want to just reuse the pubkey.
this does not give a private key, so no
I don't think it's a bad idea.
I made a function for getting the latest public key
I don't expose right now a way to get the secret key. this is a private method.
I'll take suggestions on naming
get_public_key i meant
We need to set the time here. we can use
unix_time()We don't error if we do not have the required keys to sign. If we cannot get enough sigs for a proof we should not send it to the mint.
changed the named functions plus added missing ones to ffi
I added an
enough_signaturesfunction to the Proof struct that will check. Needed to add a new error to the Nut 10 file.I'm getting a typo error from a
meeting agenda. I assume this is a mistakeRebase will solve this
Thanks just a few comments.
We already have a
verify_p2pk()fn that we use for the mint. I think we can just reuse that and remove this fn?@ -0,0 +1,70 @@use std::str::FromStr;There is a
get_latest_pubkefn on the MultiMintWallet we should use that if the latest arg is passed.We don't need the
Okimport here.@ -0,0 +62,4 @@println!("\npublic not found!\n");}println!("\npublic keys found:\n");for public_key in list_public_keys {We should check if the list is empty here and print no keys found if so.
This is missing the created time.
We should add some db tests for the new functions that would have caught this.
We should have a purpose identifier. We could reuse the cashu purpose of 129372' and then use 1 for the next where on secrets we use 0.
Why is this only here on the multi-mint wallet. Shouldn't it be on the
Walletand then the Multi-mint wallet can call that. Generally this is how we use the multi-mint wallet where it is just a dumb wrapper around the Wallet.These fns should be on the
Walletas well. The `Wallet~ needs to be able to usable without the multi mint wallet.I thought about this a bit more and we should not reuse the cashu purpose. We should only use that where its spec'd in the nuts which this is not.
yeah, I had a default param in the migration, that is why I had not caught it. I will add some tests
I used the new 1 as we said with the cashu purpose.
I think was a bad idea from me. What if something else gets added to the spec using that purpose, we would then conflict.
I might have a miss understanding on how this works. I didn't want to put the functions inside the Wallet mostly because it would mean that the keys are dependent of each mint.
Should I just allow for both?
The keys won't really rely on the wallet since there is nothing in the derivation path linking them to a mint. But yeah we need the fns on the
Walletso can just make this on both theWalletandMultimintWallet. The logic can be in a shared helper fn.@thesimplekid rebased
ACK 4093b6c014de5612b2d2497d909d74ef47c3b8bc
@ -0,0 +33,4 @@ChildNumber::from_hardened_idx(0)?,ChildNumber::from_hardened_idx(0)?,ChildNumber::from_normal_idx(last_derivation_index)?,]);Shouldn't we still have a purpose here even though we said we shouldnt reuse the cashu one?
@ -0,0 +33,4 @@ChildNumber::from_hardened_idx(0)?,ChildNumber::from_hardened_idx(0)?,ChildNumber::from_normal_idx(last_derivation_index)?,]);yeah we probably should
@ -0,0 +33,4 @@ChildNumber::from_hardened_idx(0)?,ChildNumber::from_hardened_idx(0)?,ChildNumber::from_normal_idx(last_derivation_index)?,]);Added a purpose and solved conflicts
this commit: https://github.com/cashubtc/cdk/pull/1466/commits/57a072b4d6b3bc468cc7c8f9078929ebadce3359 changes the derivation to in accordance to https://github.com/cashubtc/nuts/pull/331.
plus adds tests
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.