-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: convert to or modify multisig account added #307
Conversation
2972581
to
009d108
Compare
src/service/AnnounceService.ts
Outdated
ready, | ||
nodeAccount.name, | ||
); | ||
if (transactions[0] instanceof MultisigAccountModificationTransaction) { |
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.
would it be better to use the transactionType instead?
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.
why do you think so?
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 mean you can use instanceof, but the SDK has already got a transactionType enum. could that be neat using the type?
ready, | ||
nodeAccount.name, | ||
); | ||
} | ||
} else { | ||
await this.announceAggregateComplete( |
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.
does the modifyMultisig tx needs to be announced as a bonded transaction? Using transactions.length might not always be safe. What if modifyMultisig is part of the transactions array? what about using array.filter?
target: BootstrapUtils.defaultTargetFolder, | ||
useKnownRestGateways: false, | ||
ready: false, | ||
url: 'http://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.
default to hardcoded http?
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 and default to localhost :)
Copied from: https://github.com/symbol/symbol-bootstrap/blob/56239efa3100116ea294c570ddab317160e0e00b/src/service/LinkService.ts#L77
I think it's fine for this PR, the node list loading logic will be changed after @fboucquez 's (soon to be raised) PR.
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, it's fine, default url is when you are running the link/modify command on the same box that you have launched the node. Most people would either provide an --url
or use --useKnownRestGateways
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.
Please also run npm run style:fix
to update the index.ts and docs
I have done the following testing:
Multisig M, cosigners A,B,C , ServiceOperatorAccount S. It looks really nice:
- Convert to multisig M using M private key. It creates a bonded where All A,B,C need to cosign.
- Modify mutlisg M using A cosigner private key. It creates a bonded where some of B,C to cosign
- Convert to multisig M using S private key. It creates a bonded where all M, A, B, C need to cosign (wallet warning shown as expected)
- Modify multisig M using S private key. It creates a bonded where some A, B, C need to cosign (wallet warning shown as expected)
Could the command ask (optionally) for cosigners private keys. Use case, I'm a regular user that wants to convert my main account to multisig for security reasons. I could provide my cosigners private keys on the spot without bonded, using full aggregate complete. This could be an improvement though, the service providers should never know any cosigner private key.
char: 'a', | ||
}), | ||
addressAdditions: flags.string({ | ||
description: 'Cosignatory accounts addresses to be added (separated by a comma).', |
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.
have you tried multiple: true
, cli handles lists of strings. Does it work nicely?
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, tried multiple addresses separated by comma, works fine 👍
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 mean, oclif multiple: true
field in the flags.string. It uses cli style multiple values
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.
ignore, --addressAdditions A,B,C is easier than --addressAdditions A --addressAdditions B --addressAdditions C
does --addressAdditions
(empty) work? empty list no prompt.
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 think so
ignore, --addressAdditions A,B,C is easier than --addressAdditions A --addressAdditions B --addressAdditions C
No it doesn't, it gives => No Error: Flag --addressAdditions expects a value
does --addressAdditions (empty) work? empty list no prompt.
If we need to support no-prompt command as well, I think we have 2 options here:
- Remove all the prompts, use only the flag values
- Add the following flags --no-addressAdditions, --no-addressDeletions
and the command will look like
symbol-bootstrap modifyMultisig --no-addressAdditions --no-addressDeletions --minApprovalDelta=1 --minRemovalDelta=0
I'd probably vote for 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.
Updated the code as it will not prompt for the following.
--addressAdditions='' --addressDeletions=''
target: BootstrapUtils.defaultTargetFolder, | ||
useKnownRestGateways: false, | ||
ready: false, | ||
url: 'http://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.
Yes, it's fine, default url is when you are running the link/modify command on the same box that you have launched the node. Most people would either provide an --url
or use --useKnownRestGateways
Great! Will run the |
Kudos, SonarCloud Quality Gate passed!
|
symbol-bootstrap modifyMultisig
command is added. It's useful to convert main account into a multisig account or to modify the multisig account structure. Takes the following parameters, the user will be prompted for the unset parameters.