LiskArchive / lisk-elements

⚙️ Library for sending Lisk transactions from the client or server
https://lisk.io/
GNU General Public License v3.0
250 stars 64 forks source link

Adding signatures for a multisignature registration transaction from a second passphrase enabled account fails #1163

Closed SargeKhan closed 5 years ago

SargeKhan commented 5 years ago

Expected behavior

VerifyMultisignature function for a multisignature transaction from second passphrase enable account should correctly verify signatures.

Actual behavior

There are two bugs in the verifySignature function. The first bug is that the error message returned is incorrect. For example, for a transaction:

{
    _multisignatureStatus: 3,
    amount: BigNumber { s: 1, e: 0, c: [Array] },
    fee: BigNumber { s: 1, e: 9, c: [Array] },
    _id: '5636978847875081649',
    recipientId: '',
    recipientPublicKey: '',
    senderId: '10077141864362276523L',
    senderPublicKey:
     '3b33573c5fa0333001adf8bc6c1e6c84150eb5c0da308c4b562de7fd2318178c',
    _signature:
     '68cd108e3c13e40239e8fad447e9a8e2d8e462c84721c17ed4c0f912c73557fa65decff8fbd26ec49e00acc3e03395b7f5025e6467f46af3a4a946dc7628ac07',
    signatures:
     [ 'e29ba09effa6c1b43e09e163a1f748fac7937f1b48d2262cea6d9c2b93b356eb46e7f1799dcac5a86f30ad1bc9dc9e0c923c92557602a2c50a82c2e43680e007',
       'd54809c907a23e78fcdc5682049a2775b3cd9556f77c55489dc75611aa7c021b39fad87e980be19e70bc4bc70acc0e9e455a65e4391d040032c40eb579a69b0e' ],
    _signSignature:
     'b18499973df280822743c1a7448715f9dd53b79bf55596896d4eb51710aaf68aac7fa4db68bc78a032e02dbdafa5daa49afbc77c30a7cae2e29fa53314a2150c',
    timestamp: 87671302,
    type: 4,
    receivedAt: 2019-03-05T10:08:32.113Z,
    asset: { multisignature: [Object] },
    ready: true 
}

It returns the error:

{ TransactionError: Failed to validate signature e29ba09effa6c1b43e09e163a1f748fac7937f1b48d2262cea6d9c2b93b356eb46e7f1799dcac5a86f30ad1bc9dc9e0c923c92557602a2c50a82c2e43680e007
      at errors.invalidTransactionSignatures.length.invalidTransactionSignatures.map.signature 
    ....
    jse_shortmsg:
     'Failed to validate signature e29ba09effa6c1b43e09e163a1f748fac7937f1b48d2262cea6d9c2b93b356eb46e7f1799dcac5a86f30ad1bc9dc9e0c923c92557602a2c50a82c2e43680e007',
    jse_info: {},
    message:
     'Failed to validate signature e29ba09effa6c1b43e09e163a1f748fac7937f1b48d2262cea6d9c2b93b356eb46e7f1799dcac5a86f30ad1bc9dc9e0c923c92557602a2c50a82c2e43680e007',
    name: 'TransactionError',
    id: '5636978847875081649',
    dataPath: '.signature',
    actual: undefined,
    expected: undefined }

This error message is incorrect because the failed signature is a multisignature which should have the datapath: signatures. Secondly, this signature is a valid signature which is accepted by the Lisk-core implementation. Therefore, there must be a bug in how the signature is calculated in lisk-elements.

Which version(s) does this affect? (Environment, OS, etc...)

2.1.0