aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/signature_validator.ts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-24 15:19:06 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-08-25 04:19:07 +0800
commit0a1ae2c31139e446b2fb3b7f03caf371c6668ae2 (patch)
tree3408f2db59daf3762dcb4244f52e3389c97849df /packages/contracts/test/exchange/signature_validator.ts
parentc5f8b9c2d2b1eed5789b40c4df07e98afe0431ab (diff)
downloaddexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.tar
dexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.tar.gz
dexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.tar.bz2
dexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.tar.lz
dexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.tar.xz
dexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.tar.zst
dexon-sol-tools-0a1ae2c31139e446b2fb3b7f03caf371c6668ae2.zip
Remove pragma experimental v0.5.0 and use staticcall is assembly
Diffstat (limited to 'packages/contracts/test/exchange/signature_validator.ts')
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
index 0e2967bc7..75656d992 100644
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ b/packages/contracts/test/exchange/signature_validator.ts
@@ -352,7 +352,7 @@ describe('MixinSignatureValidator', () => {
expect(isValidSignature).to.be.false();
});
- it('should not allow `isValidSignature` to update state when SignatureType=Wallet', async () => {
+ it('should return false when `isValidSignature` attempts to update state and not allow state to be updated when SignatureType=Wallet', async () => {
// Create EIP712 signature
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
@@ -366,13 +366,12 @@ describe('MixinSignatureValidator', () => {
]);
const signatureHex = ethUtil.bufferToHex(signature);
// Validate signature
- await expectContractCallFailedWithoutReasonAsync(
- signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- maliciousWallet.address,
- signatureHex,
- ),
+ const isValid = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ maliciousWallet.address,
+ signatureHex,
);
+ expect(isValid).to.be.equal(false);
});
it('should return true when SignatureType=Validator, signature is valid and validator is approved', async () => {
@@ -405,15 +404,18 @@ describe('MixinSignatureValidator', () => {
expect(isValidSignature).to.be.false();
});
- it('should not allow `isValidSignature` to update state when SignatureType=Validator', async () => {
+ it('should return false when `isValidSignature` attempts to update state and not allow state to be updated when SignatureType=Validator', async () => {
const validatorAddress = ethUtil.toBuffer(`${maliciousValidator.address}`);
const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
const signature = Buffer.concat([validatorAddress, signatureType]);
const signatureHex = ethUtil.bufferToHex(signature);
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- await expectContractCallFailedWithoutReasonAsync(
- signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex),
+ const isValid = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ maliciousValidator.address,
+ signatureHex,
);
+ expect(isValid).to.be.equal(false);
});
it('should return false when SignatureType=Validator, signature is valid and validator is not approved', async () => {
// Set approval of signature validator to false