-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Signer interface for Taro virtual transactions #116
Conversation
I don't think they actually need to, given the unit tests can just use a canned private key signer (or maybe that's what you mean?). Similar to this: https://github.com/lightninglabs/taro/blob/main/asset/asset.go#L330-L334
Which check?
I think we'd keep this one to make a mock signer that just uses the raw private key for unit tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a rebase!
Interface and mock look good, though I think some things can be simplified a bit.
0ca257d
to
3670cc8
Compare
Rebased, updated to address all feedback, also added more plumbing for merge / multi-input transfers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🥟
// descriptor and TX. | ||
|
||
// NOTE: We currently assume the signature requested is for the | ||
// BIP 86 spending type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine for the scope of our current milestone, but isn't this mainly dependent on the SIgnMethod
in the sign desc?
So then it's up to the caller to also provide the witness script (for the leaf being revealed/spent).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the interface itself doesn't prevent non-BIP86 use. This assumption is really enforced earlier on in SignTaprootKeySpend
, there isn't currently a way to provide a witness script at all.
return nil, err | ||
} | ||
|
||
validatedAsset.PrevWitnesses[idx].TxWitness = *newWitness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Saw a few nits but am going to address those in my proof append PR where I can use some of the stuff declared in this PR.
Spun off from send state machine, builds on #115, only last commit is new.
In this PR, we introduce a
Signer
interface responsible for signing over Taro virtual TXs. This is needed to connect the sending state machine to a backing lnd client, and not require direct access to private keys.I've added an equality check between the mock Signer and the old 'direct' signing method, and the existing unit tests pass, so AFAICT this interface + mock logic works. Requesting feedback to make sure that isn't a fluke + general improvements.
Outstanding tasks before pulling out of draft: