Skip to content
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

Duplicated signatures in transactions - Closes #2254 #2275

Merged
merged 94 commits into from
Aug 13, 2018

Conversation

4miners
Copy link
Contributor

@4miners 4miners commented Aug 1, 2018

What was the problem?

Duplicated signatures in transactions (send from multisignature, multisignature registration). More details in #2254 (comment)

How did I fix it?

Refactored processSignature function in multisignatures module, execute all the logic through balanceSequence

How to test it?

Run test suite.

Review checklist

@4miners
Copy link
Contributor Author

4miners commented Aug 1, 2018

@nazarhussain, @SargeKhan, @ManuGowda Please review. I'll write unit tests for new functions after resolving all feedback from the review.

@4miners 4miners changed the base branch from development to 1.2.0 August 1, 2018 16:32
@4miners 4miners requested a review from ManuGowda August 1, 2018 16:44
Copy link
Contributor

@ManuGowda ManuGowda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good, added a few comments.

/**
* Gets transaction from transaction id and add it to sequence and bus.
* Check is provided signature is valid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if the provided signature is valid

// If publicKey is provided we can perform direct verify
if (signature.publicKey) {
// Check if publicKey is present as member of multisignature account in transaction
if (members.indexOf(signature.publicKey) === -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe? members.includes(signature.publicKey)

return setImmediate(cb, 'Transaction not found');
__private.isValidSignature = (signature, members, transaction) => {
let isValid = false;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const { signature, publicKey } = signature;
and reuse the variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot do that because I log the entire signature object later.

* @param {function} cb - Callback function
* @returns {setImmediateCallback} cb, err
*/
__private.processSignatureForMultisignatureCreation = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename function to processSignatureForMultisignatureAccountCreation

return setImmediate(cb, 'Failed to verify signature');
}
// Check if received signature already exists in transaction
if (transaction.signatures.indexOf(signature.signature) !== -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use of includes here as well

minimum: 2,
});

// Create signatures (strings)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object instedof string

@4miners
Copy link
Contributor Author

4miners commented Aug 6, 2018

Unit tests completed, please review @nazarhussain, @SargeKhan, @ManuGowda.

@MaciejBaj MaciejBaj merged commit 85b9a37 into 1.2.0 Aug 13, 2018
@MaciejBaj MaciejBaj deleted the 2254_duplicated-signatures branch August 13, 2018 10:14
MaciejBaj added a commit that referenced this pull request Sep 19, 2018
Duplicated signatures in transactions - Closes #2254
MaciejBaj added a commit that referenced this pull request Sep 19, 2018
Duplicated signatures in transactions - Closes #2254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants