diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-05-22 06:59:58 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-05-31 08:11:30 +0800 |
commit | 822e319efea9c862702ddf589eb2344ff02e5bc5 (patch) | |
tree | ae5421da5b6ac84c318ed1aa66445222be45a579 /packages/contracts/test/exchange/signature_validator.ts | |
parent | 6d462fc961da2ba4d5502ad6b71654c1715550d9 (diff) | |
download | dexon-0x-contracts-822e319efea9c862702ddf589eb2344ff02e5bc5.tar.gz dexon-0x-contracts-822e319efea9c862702ddf589eb2344ff02e5bc5.tar.zst dexon-0x-contracts-822e319efea9c862702ddf589eb2344ff02e5bc5.zip |
Use last byte of signature as signature type
Diffstat (limited to 'packages/contracts/test/exchange/signature_validator.ts')
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index 376fff438..ca679e344 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -75,13 +75,11 @@ describe('MixinSignatureValidator', () => { }); it('should return false with an invalid signature', async () => { + const v = ethUtil.toBuffer(signedOrder.signature.slice(0, 4)); const invalidR = ethUtil.sha3('invalidR'); const invalidS = ethUtil.sha3('invalidS'); - const invalidSigBuff = Buffer.concat([ - ethUtil.toBuffer(signedOrder.signature.slice(0, 6)), - invalidR, - invalidS, - ]); + const signatureType = ethUtil.toBuffer(`0x${signedOrder.signature.slice(-2)}`); + const invalidSigBuff = Buffer.concat([v, invalidR, invalidS, signatureType]); const invalidSigHex = `0x${invalidSigBuff.toString('hex')}`; signedOrder.signature = invalidSigHex; const orderHashHex = orderUtils.getOrderHashHex(signedOrder); |