Conversation
…tion from class to interface
f70c44f
to
3ebe083
Compare
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
+ Coverage 82.76% 83.91% +1.15%
==========================================
Files 28 27 -1
Lines 2031 2052 +21
Branches 438 416 -22
==========================================
+ Hits 1681 1722 +41
+ Misses 346 326 -20
Partials 4 4
Continue to review full report at Codecov.
|
|
||
// Internally, the Stacks blockchain encodes address the same as Bitcoin | ||
// multi-sig address (p2sh) | ||
export const hashP2SH = (numSigs: number, pubKeys: Buffer[]): string => { |
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.
No bitcoinjs-lib dependency? 💯
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.
Great work getting this to work without bitcoinjs-lib 👍
test('Single sig wpkh spending condition compressed', () => { | ||
const addressHashMode = AddressHashMode.SerializeP2WPKH; | ||
const nonce = new BigNum(345); | ||
test('Multi sig spending condition uncompressed', () => { |
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.
Was the original test Single sig wpkh spending condition compressed
intentionally removed?
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.
It was. It turns out that WPKH wasn't implemented yet. I'm not actually sure why that test was passing originally, but after my refactor it began to fail (with the expected Unimplemented Error
) so I removed it
]; | ||
|
||
const spendingConditionBytes = Buffer.from(spendingConditionBytesHex); |
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.
Are there any test vectors copied from the rust codebase to ensure consistency?
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.
The multi-sig test in transaction-tests.js
is mostly copied from the rust codebase, but I'm planning on adding some more test vectors. Will try and add some to this PR tomorrow
Love how clean this PR is. Code looks good. Before I approve I'd like to use this functionality in something (probably with a sidecar tx debug endpoint) for a good end-to-end test. |
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 looks good! Would love to see a builder function or a series of functions that help make the signing process easier.
1fe713e
to
3ee4ed2
Compare
b22f3ea
to
694b2dc
Compare
@@ -1,3 +1,5 @@ | |||
import * as _ from 'lodash'; |
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.
Are you sure this doesn't include the entire lodash bundle?
src/builders.ts
Outdated
let spendingCondition = null; | ||
|
||
if ('publicKey' in options) { | ||
// multi-sig |
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 would not be multi-sig case, right?
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.
yup, this is a typo!
This looks good to merge 👍 |
There's a regression with sponsored transaction signing/serialization. Here's some data I collected to help debug. A contract-call transaction's serialized payload:
Also, here's the error returned by the core-node when submitting the invalid transaction:
{
"error": "transaction rejected",
"reason": "SignatureValidation",
"reason_data": {
"message": "Signer hash does not equal hash of public key(s): 9773d279b98a0e1388875729207fe7602cda7af5 != 31ef5ee9a226a792b93f2bfbfbc54f523eba7818"
},
"txid": "4a407703abe75fb5d1ad489875296d9eff52ad64bbf780b44d08d412ccb5faf9"
}
|
Draft PR in sidecar for supporting multisig transactions, currently helpful as an integration test with core-node hirosystems/stacks-blockchain-api#193 Core-node is rejecting multisig transactions with same error as the sponsored txs: {
"error": "transaction rejected",
"reason": "SignatureValidation",
"reason_data": {
"message": "Signer hash does not equal hash of public key(s): fbcc4c8a97d1fe9d96cdf06c98ce05eccbc9ff35 != 55c50b056f6f2c500b4432b9e89828b3c8d607cf"
},
"txid": "54878b0cd7511af52d0ea901aa21c1f9f87c3ef254cb08bea8a82d1bb5aa4904"
} |
Update: the latest commit fixes multisig transactions -- they are processed by the core-node as expected. However, the sponsored transaction regression still exists. |
I'm able to generate and submit a sponsored transaction with out any issues (on my local mocknet). @zone117x Can you sure some more detail about the transaction that isn't working for you? |
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.
The sponsored tx regression has been fixed.
Additionally, sponsored + multisig transactions also work 👍
SHIP IT
Description
This PR adds support for building Multi-Sig transactions.
Issue: #8
TODO
Type of Change
Does this introduce a breaking change?
List the APIs or describe the functionality that this PR breaks.
Workarounds for or expected timeline for deprecation
Are documentation updates required?
Testing information
Provide context on how tests should be performed.
Checklist
npm run test
passes