Ran prettier/linter

This commit is contained in:
Lawrence Forman 2019-04-12 17:09:09 -04:00 committed by Amir Bandeali
parent a7fe47f295
commit eb00ff05a8
3 changed files with 18 additions and 24 deletions

View File

@ -179,13 +179,16 @@ contract MixinAssetProxyDispatcher is
)
if iszero(didSucceed) { // Call reverted.
// Get the revert data.
let revertDataSize := returndatasize()
// Construct a `bytes memory` type to hold the revert data
// at `cdStart`.
// The first 32 bytes are the length of the data.
mstore(cdStart, revertDataSize)
// Copy the revert data immediately after the length.
returndatacopy(add(cdStart, 32), 0, revertDataSize)
// We need to move the free memory pointer because we
// still have solidity logic that executes after this assembly.
mstore(64, add(cdStart, revertDataSize))
// Copy the revert data.
returndatacopy(cdStart, 0, revertDataSize)
mstore(64, add(cdStart, add(revertDataSize, 32)))
revertData := cdStart
}
}

View File

@ -21,9 +21,10 @@ pragma solidity ^0.5.5;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
// solhint-disable no-unused-vars
contract TestRevertReceiver {
string constant REVERT_REASON = "you shall not pass";
string constant public REVERT_REASON = "you shall not pass";
/// @dev Reverts with `REVERT_REASON`. Intended to be used with `Validator` signature type.
/// @param hash Message hash that is signed.

View File

@ -90,13 +90,9 @@ describe('MixinSignatureValidator', () => {
);
signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, artifacts);
await web3Wrapper.awaitTransactionSuccessAsync(
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
testValidator.address,
true,
{
from: signerAddress,
},
),
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
from: signerAddress,
}),
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
@ -144,6 +140,8 @@ describe('MixinSignatureValidator', () => {
});
describe('isValidSignature', () => {
const REVERT_REASON = 'you shall not pass';
beforeEach(async () => {
signedOrder = await orderFactory.newSignedOrderAsync();
});
@ -412,7 +410,7 @@ describe('MixinSignatureValidator', () => {
orderHashHex,
revertingWallet.address,
signatureHex,
new StringRevertError('you shall not pass').encode(),
new StringRevertError(REVERT_REASON).encode(),
);
const tx = signatureValidator.publicIsValidSignature.callAsync(
orderHashHex,
@ -464,11 +462,7 @@ describe('MixinSignatureValidator', () => {
signatureHex,
constants.NULL_BYTES,
);
const tx = signatureValidator.publicIsValidSignature.callAsync(
orderHashHex,
signerAddress,
signatureHex,
);
const tx = signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex);
return expect(tx).to.revertWith(expectedError);
});
@ -482,13 +476,9 @@ describe('MixinSignatureValidator', () => {
orderHashHex,
signedOrder.makerAddress,
signatureHex,
new StringRevertError('you shall not pass').encode(),
);
const tx = signatureValidator.publicIsValidSignature.callAsync(
orderHashHex,
signerAddress,
signatureHex,
new StringRevertError(REVERT_REASON).encode(),
);
const tx = signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex);
return expect(tx).to.revertWith(expectedError);
});