-
Notifications
You must be signed in to change notification settings - Fork 118
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
Implementation of construction/payloads and construction/combine endpoints #275
Implementation of construction/payloads and construction/combine endpoints #275
Conversation
Codecov Report
@@ Coverage Diff @@
## master #275 +/- ##
==========================================
+ Coverage 65.16% 65.52% +0.35%
==========================================
Files 53 53
Lines 3801 3910 +109
Branches 649 672 +23
==========================================
+ Hits 2477 2562 +85
- Misses 1321 1345 +24
Partials 3 3
Continue to review full report at Codecov.
|
@zone117x Fixed all the issues and updated PR. |
amount: new BN(amount), | ||
fee: new BN(fees), | ||
publicKeys: publicKeysStrings, | ||
numSignatures: 2, |
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 appears to only allow for 2-of-2 multisig transactions, it should support N-of-M
e40b9a5
to
7a00e7a
Compare
amount: new BN(amount), | ||
fee: new BN(fees), | ||
publicKeys: publicKeysStrings, | ||
numSignatures: publicKeys.length, |
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.
did you intend for publicKeys.length
to be the value here? This will mean that all of the keys associated with publicKeys
will have to eventually sign this tx...
typically the creator of a multi-sig transaction is able to specify what this value should be.
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'm assuming the caller is only specifying keys whose signatures are required. It means the caller is the creator of mulit-sig/single-sig transaction here. I can not find any other param in rosetta which will indicate signatures and public keys can be different.
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.
@asimm241 can you verify that other Rosetta implementations do not support m-of-n multisig transactions?
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.
@zone117x I haven't found any implementation to support multi-sig for rosetta in other blockchains. I have found this question https://community.rosetta-api.org/t/construction-api-and-multi-sig-accounts/208. This states that they are targeting m-of-n multi-sig for rosetta v1.5.0
Keeping this in view should we postpone the support of multi-sig.
Moreover, BTW rosetta docs do not require public keys in payloads request but makeUnsignedTokenTransferTransaction
requires a public key(s), is there any other way to create a transaction without specifying the public key(s)?
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 states that they are targeting m-of-n multi-sig for rosetta v1.5.0. Keeping this in view should we postpone the support of multi-sig.
We can postpone m-of-n until then 👍
rosetta docs do not require public keys in payloads request but makeUnsignedTokenTransferTransaction requires a public key(s)
It appears to be not-required to allow support for blockchains that do not need public keys. Is there anywhere that states the endpoint must work when public keys are not provided?
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, I haven't encountered anything like that so far, I'm searching for it though, I'm also thinking of asking a question on their community forum. Let's see.
|
||
if (publicKeys.length !== 1) { | ||
//TODO support multi-sig in the future. | ||
res.status(400).json(RosettaErrors.needOnePublicKey); |
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.
Do other rosetta implementations do the same thing when there are more than 1 public keys?
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.
Other implementations that I have looked at don't require a public key to build an unsigned transaction.
Is there a way we can create a transaction without specifying the public key?
if No, then we need to update metadata and preprocess API to incorporate the public key.
as per these coinbase/mesh-specifications#46, coinbase/mesh-specifications#45
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.
Here is the PR containing those changes. #288
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.
PR #288 merged. This PR needs a rebase to fix the conflicting file and then looks good to merge 👍
return; | ||
} | ||
|
||
if (signatures.length !== 1) res.status(400).json(RosettaErrors.needOnlyOneSignature); |
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.
Same question here -- is this what other Rosetta implementations do?
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.
Alright, we should create a github issue for tracking multi-sig support once the Rosetta spec adds it
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.
Created issue #289
…a path to constants
add test cases for multisignature for combine and payloads endpoint
b3b477e
to
66648c5
Compare
🎉 This PR is included in version 0.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
construction/payloads
-implment construction/payloads endpoint
-unit test coveratge
construction/combine
-implment construction/combine endpoint
-unit test coveratge