-
Notifications
You must be signed in to change notification settings - Fork 144
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
refactor(signing): support non-index zero input signing #4646
Conversation
Related to this issue? #4645 |
ff69170
to
aa34d14
Compare
@kyranjamie I tested your branch. I still get the error and see the wrong address in their app, maybe it is on their end so will comment on the issue. |
b318f68
to
bf9c35f
Compare
bf9c35f
to
fd5be9b
Compare
const signedOnlyIndexZeroPsbt = | ||
'70736274ff01007b02000000020c9199d8079e6fe8a6c78ac9c4e0311c97c9fcdc8b5586c56d191b6d98c0035e0000000000ffffffff087168f5b929b37a27704d338aa9d0d3508a819f879c244ba12128f04a5b37ef0000000000ffffffff01c800000000000000160014a8113965cee4d5ffa2d9996a204866a58200131d000000000001011f6400000000000000160014a8113965cee4d5ffa2d9996a204866a58200131d220203fe21e3444109e30ff7d19da0f530c344cad2e35fbee89afb2413858e4a9d7aa5483045022100ea4c2a68f1032102ad2c73504096f5dbd63d242ccce8000aa9db1a0ce4c4c59402204269fdd3536697329ed9bffcf67e3584d2d3426f84bb004fe467286abe7b02d8010001011f6400000000000000160014a8113965cee4d5ffa2d9996a204866a58200131d0000'; | ||
|
||
test.describe('Sign PSBT', () => { | ||
test.beforeEach(async ({ extensionId, globalPage, onboardingPage, page }) => { | ||
await globalPage.setupAndUseApiCalls(extensionId); | ||
await onboardingPage.signInWithTestAccount(extensionId); | ||
await page.goto('https://leather.io'); | ||
await page.goto('localhost:3000'); |
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 checking this is intentional?
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.
Yep, cc @fbwoolf
We just need a page to trigger the request from, better the local app than leather.io
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 took from other rpc signing tests, so best to change there too?
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.
Code LGTM - didn't fully test the flow
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.
Nice refactor. 👍
6b892d7
to
420fb4f
Compare
@314159265359879 any chance you can QA pre-merge? |
420fb4f
to
18c9dc0
Compare
f0f3636
to
18c9dc0
Compare
Closes #4620
Leather currently operates in a mode where addresses are reused. Users only have a single native segwit/taproot address per account. For a short while we were generating new addresses, per bitcoin privacy best practice, and built the signing logic it in a way to support this in future.
In refactoring the signing to work with Ledger via a unified API, I assumed the zero address index which broke this. This PR aims to fix this problem, by introducing a signing configuration, consisting of a derivation path and an input index. When creating the inscription transfer, we create this accompanying config,
BitcoinSigningConfig[]
. From this, we can then tell the signing function with which address index we need to sign the tx.In order to not have to make changes in parts of the code where we do know transactions only need to be signed with the 0th index, I've written a function to make the config that assumes this.
Open to other ideas how we can do this. It's a shame in a way to have to have this accompanying metadata, but I can't think of any way we could otherwise know how to sign the tx at a later point in the tx signing flow.