-
Notifications
You must be signed in to change notification settings - Fork 38
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
Create ContractSignerProvider #188
Conversation
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.
Just had a quick look but the overall direction matches with what I had in mind. I feel it might be better to keep the signers in memory though (and maybe have the lazily created) rather than re-deriving them every time they are needed.
a7f891e
to
9da1619
Compare
Added a cache and reworked some the APIs to be cleaner, think tests should be passing now too. |
f822a61
to
f0f7e74
Compare
451b25e
to
8c08202
Compare
Got pretty much everything passing and in a clean state. Only test failing is |
Have you tried using the one within |
Does not work either, I imagine all of those tests are broken too :/ |
Ah these ones can be generated with this script: 'scripts/generate_serialized_contract_files.sh'. |
Regenerated test vectors and everything seems to pass now :) |
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.
Overall looks nice, but still some details to be resolved.
type Signer = SimpleSigner; | ||
|
||
fn derive_signer_key_id(&self, _is_offer_party: bool, temp_id: [u8; 32]) -> [u8; 32] { | ||
temp_id // fixme not safe |
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.
I feel like this method should take more parameters, like maybe the collateral values, the event id, or whatever could be use to generate a likely unique key id. Then IIUC this should be called only once, so if using the method I mention below, you could check that the label does not exist (and maybe panic if it does?)
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.
A lot of the parameters aren't really always available. The main problems comes from renew_offer where you have to do it from only a single party's params
/// Get the secret key associated with the provided public key. | ||
/// | ||
/// Only used for Channels. |
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.
This will probably need to be split in the future, but fine if you don't do it now.
Think I responded to all comments |
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.
Thanks, just a couple of things need fixing.
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.
Thanks!
Closes #185
Still some cleanup to do but curious on direction here. Tried to mimic LDK's trait as best I could.
Instead of creating a
create_adoptor_signature
function I went with justget_secret_key
as this would be really invasive and require refactor things in other crates that weren't justdlc_manager
. Also kept the old functions around for the channel handling, a lot of that I don't fully know what is going on and this felt simpler for now.