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. if iszero(didSucceed) { // Call reverted.
// Get the revert data.
let revertDataSize := returndatasize() 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 // We need to move the free memory pointer because we
// still have solidity logic that executes after this assembly. // still have solidity logic that executes after this assembly.
mstore(64, add(cdStart, revertDataSize)) mstore(64, add(cdStart, add(revertDataSize, 32)))
// Copy the revert data.
returndatacopy(cdStart, 0, revertDataSize)
revertData := cdStart revertData := cdStart
} }
} }

View File

@@ -21,9 +21,10 @@ pragma solidity ^0.5.5;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol"; import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
// solhint-disable no-unused-vars
contract TestRevertReceiver { 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. /// @dev Reverts with `REVERT_REASON`. Intended to be used with `Validator` signature type.
/// @param hash Message hash that is signed. /// @param hash Message hash that is signed.

View File

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