Rename _rrevert to rrevert

This commit is contained in:
Amir Bandeali 2019-08-11 15:22:19 -07:00
parent ccce7e001e
commit 0e2616f16b
16 changed files with 72 additions and 72 deletions

View File

@ -47,7 +47,7 @@ library LibMath {
denominator, denominator,
target target
)) { )) {
LibRichErrors._rrevert(LibMathRichErrors.RoundingError( LibRichErrors.rrevert(LibMathRichErrors.RoundingError(
numerator, numerator,
denominator, denominator,
target target
@ -78,7 +78,7 @@ library LibMath {
denominator, denominator,
target target
)) { )) {
LibRichErrors._rrevert(LibMathRichErrors.RoundingError( LibRichErrors.rrevert(LibMathRichErrors.RoundingError(
numerator, numerator,
denominator, denominator,
target target
@ -152,7 +152,7 @@ library LibMath {
returns (bool isError) returns (bool isError)
{ {
if (denominator == 0) { if (denominator == 0) {
LibRichErrors._rrevert(LibMathRichErrors.DivisionByZeroError()); LibRichErrors.rrevert(LibMathRichErrors.DivisionByZeroError());
} }
// The absolute rounding error is the difference between the rounded // The absolute rounding error is the difference between the rounded
@ -205,7 +205,7 @@ library LibMath {
returns (bool isError) returns (bool isError)
{ {
if (denominator == 0) { if (denominator == 0) {
LibRichErrors._rrevert(LibMathRichErrors.DivisionByZeroError()); LibRichErrors.rrevert(LibMathRichErrors.DivisionByZeroError());
} }
// See the comments in `isRoundingError`. // See the comments in `isRoundingError`.

View File

@ -47,7 +47,7 @@ contract MixinAssetProxyDispatcher is
bytes4 assetProxyId = IAssetProxy(assetProxy).getProxyId(); bytes4 assetProxyId = IAssetProxy(assetProxy).getProxyId();
address currentAssetProxy = assetProxies[assetProxyId]; address currentAssetProxy = assetProxies[assetProxyId];
if (currentAssetProxy != address(0)) { if (currentAssetProxy != address(0)) {
LibRichErrors._rrevert(LibExchangeRichErrors.AssetProxyExistsError(currentAssetProxy)); LibRichErrors.rrevert(LibExchangeRichErrors.AssetProxyExistsError(currentAssetProxy));
} }
// Add asset proxy and log registration. // Add asset proxy and log registration.
@ -88,7 +88,7 @@ contract MixinAssetProxyDispatcher is
if (amount > 0 && from != to) { if (amount > 0 && from != to) {
// Ensure assetData length is valid // Ensure assetData length is valid
if (assetData.length <= 3) { if (assetData.length <= 3) {
LibRichErrors._rrevert(LibExchangeRichErrors.AssetProxyDispatchError( LibRichErrors.rrevert(LibExchangeRichErrors.AssetProxyDispatchError(
IExchangeRichErrors.AssetProxyDispatchErrorCodes.INVALID_ASSET_DATA_LENGTH, IExchangeRichErrors.AssetProxyDispatchErrorCodes.INVALID_ASSET_DATA_LENGTH,
orderHash, orderHash,
assetData assetData
@ -101,7 +101,7 @@ contract MixinAssetProxyDispatcher is
// Ensure that assetProxy exists // Ensure that assetProxy exists
if (assetProxy == address(0)) { if (assetProxy == address(0)) {
LibRichErrors._rrevert(LibExchangeRichErrors.AssetProxyDispatchError( LibRichErrors.rrevert(LibExchangeRichErrors.AssetProxyDispatchError(
IExchangeRichErrors.AssetProxyDispatchErrorCodes.UNKNOWN_ASSET_PROXY, IExchangeRichErrors.AssetProxyDispatchErrorCodes.UNKNOWN_ASSET_PROXY,
orderHash, orderHash,
assetData assetData
@ -122,7 +122,7 @@ contract MixinAssetProxyDispatcher is
// If the transaction did not succeed, revert with the returned data. // If the transaction did not succeed, revert with the returned data.
if (!didSucceed) { if (!didSucceed) {
LibRichErrors._rrevert(LibExchangeRichErrors.AssetProxyTransferError( LibRichErrors.rrevert(LibExchangeRichErrors.AssetProxyTransferError(
orderHash, orderHash,
assetData, assetData,
revertData revertData

View File

@ -68,7 +68,7 @@ contract MixinExchangeCore is
// Ensure orderEpoch is monotonically increasing // Ensure orderEpoch is monotonically increasing
if (newOrderEpoch <= oldOrderEpoch) { if (newOrderEpoch <= oldOrderEpoch) {
LibRichErrors._rrevert(LibExchangeRichErrors.OrderEpochError( LibRichErrors.rrevert(LibExchangeRichErrors.OrderEpochError(
makerAddress, makerAddress,
orderSenderAddress, orderSenderAddress,
oldOrderEpoch oldOrderEpoch
@ -330,7 +330,7 @@ contract MixinExchangeCore is
{ {
// An order can only be filled if its status is FILLABLE. // An order can only be filled if its status is FILLABLE.
if (orderInfo.orderStatus != uint8(LibOrder.OrderStatus.FILLABLE)) { if (orderInfo.orderStatus != uint8(LibOrder.OrderStatus.FILLABLE)) {
LibRichErrors._rrevert(LibExchangeRichErrors.OrderStatusError( LibRichErrors.rrevert(LibExchangeRichErrors.OrderStatusError(
orderInfo.orderHash, orderInfo.orderHash,
LibOrder.OrderStatus(orderInfo.orderStatus) LibOrder.OrderStatus(orderInfo.orderStatus)
)); ));
@ -339,7 +339,7 @@ contract MixinExchangeCore is
// Validate sender is allowed to fill this order // Validate sender is allowed to fill this order
if (order.senderAddress != address(0)) { if (order.senderAddress != address(0)) {
if (order.senderAddress != msg.sender) { if (order.senderAddress != msg.sender) {
LibRichErrors._rrevert(LibExchangeRichErrors.InvalidSenderError( LibRichErrors.rrevert(LibExchangeRichErrors.InvalidSenderError(
orderInfo.orderHash, msg.sender orderInfo.orderHash, msg.sender
)); ));
} }
@ -348,7 +348,7 @@ contract MixinExchangeCore is
// Validate taker is allowed to fill this order // Validate taker is allowed to fill this order
if (order.takerAddress != address(0)) { if (order.takerAddress != address(0)) {
if (order.takerAddress != takerAddress) { if (order.takerAddress != takerAddress) {
LibRichErrors._rrevert(LibExchangeRichErrors.InvalidTakerError( LibRichErrors.rrevert(LibExchangeRichErrors.InvalidTakerError(
orderInfo.orderHash, takerAddress orderInfo.orderHash, takerAddress
)); ));
} }
@ -367,7 +367,7 @@ contract MixinExchangeCore is
order, order,
orderInfo.orderHash, orderInfo.orderHash,
signature)) { signature)) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.BAD_SIGNATURE, IExchangeRichErrors.SignatureErrorCodes.BAD_SIGNATURE,
orderInfo.orderHash, orderInfo.orderHash,
makerAddress, makerAddress,
@ -390,14 +390,14 @@ contract MixinExchangeCore is
// Validate sender is allowed to cancel this order // Validate sender is allowed to cancel this order
if (order.senderAddress != address(0)) { if (order.senderAddress != address(0)) {
if (order.senderAddress != msg.sender) { if (order.senderAddress != msg.sender) {
LibRichErrors._rrevert(LibExchangeRichErrors.InvalidSenderError(orderInfo.orderHash, msg.sender)); LibRichErrors.rrevert(LibExchangeRichErrors.InvalidSenderError(orderInfo.orderHash, msg.sender));
} }
} }
// Validate transaction signed by maker // Validate transaction signed by maker
address makerAddress = _getCurrentContextAddress(); address makerAddress = _getCurrentContextAddress();
if (order.makerAddress != makerAddress) { if (order.makerAddress != makerAddress) {
LibRichErrors._rrevert(LibExchangeRichErrors.InvalidMakerError(orderInfo.orderHash, makerAddress)); LibRichErrors.rrevert(LibExchangeRichErrors.InvalidMakerError(orderInfo.orderHash, makerAddress));
} }
} }

View File

@ -166,7 +166,7 @@ contract MixinMatchOrders is
// These equations can be combined to get the following: // These equations can be combined to get the following:
if (leftOrder.makerAssetAmount.safeMul(rightOrder.makerAssetAmount) < if (leftOrder.makerAssetAmount.safeMul(rightOrder.makerAssetAmount) <
leftOrder.takerAssetAmount.safeMul(rightOrder.takerAssetAmount)) { leftOrder.takerAssetAmount.safeMul(rightOrder.takerAssetAmount)) {
LibRichErrors._rrevert(LibExchangeRichErrors.NegativeSpreadError( LibRichErrors.rrevert(LibExchangeRichErrors.NegativeSpreadError(
leftOrderInfo.orderHash, leftOrderInfo.orderHash,
rightOrderInfo.orderHash rightOrderInfo.orderHash
)); ));
@ -196,24 +196,24 @@ contract MixinMatchOrders is
{ {
// Ensure that the left and right orders have nonzero lengths. // Ensure that the left and right orders have nonzero lengths.
if (leftOrders.length == 0) { if (leftOrders.length == 0) {
LibRichErrors._rrevert(LibExchangeRichErrors.BatchMatchOrdersError( LibRichErrors.rrevert(LibExchangeRichErrors.BatchMatchOrdersError(
IExchangeRichErrors.BatchMatchOrdersErrorCodes.ZERO_LEFT_ORDERS IExchangeRichErrors.BatchMatchOrdersErrorCodes.ZERO_LEFT_ORDERS
)); ));
} }
if (rightOrders.length == 0) { if (rightOrders.length == 0) {
LibRichErrors._rrevert(LibExchangeRichErrors.BatchMatchOrdersError( LibRichErrors.rrevert(LibExchangeRichErrors.BatchMatchOrdersError(
IExchangeRichErrors.BatchMatchOrdersErrorCodes.ZERO_RIGHT_ORDERS IExchangeRichErrors.BatchMatchOrdersErrorCodes.ZERO_RIGHT_ORDERS
)); ));
} }
// Ensure that the left and right arrays are compatible. // Ensure that the left and right arrays are compatible.
if (leftOrders.length != leftSignatures.length) { if (leftOrders.length != leftSignatures.length) {
LibRichErrors._rrevert(LibExchangeRichErrors.BatchMatchOrdersError( LibRichErrors.rrevert(LibExchangeRichErrors.BatchMatchOrdersError(
IExchangeRichErrors.BatchMatchOrdersErrorCodes.INVALID_LENGTH_LEFT_SIGNATURES IExchangeRichErrors.BatchMatchOrdersErrorCodes.INVALID_LENGTH_LEFT_SIGNATURES
)); ));
} }
if (rightOrders.length != rightSignatures.length) { if (rightOrders.length != rightSignatures.length) {
LibRichErrors._rrevert(LibExchangeRichErrors.BatchMatchOrdersError( LibRichErrors.rrevert(LibExchangeRichErrors.BatchMatchOrdersError(
IExchangeRichErrors.BatchMatchOrdersErrorCodes.INVALID_LENGTH_RIGHT_SIGNATURES IExchangeRichErrors.BatchMatchOrdersErrorCodes.INVALID_LENGTH_RIGHT_SIGNATURES
)); ));
} }

View File

@ -111,7 +111,7 @@ contract MixinSignatureValidator is
signatureType == SignatureType.Validator || signatureType == SignatureType.Validator ||
signatureType == SignatureType.EIP1271Wallet signatureType == SignatureType.EIP1271Wallet
) { ) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.INAPPROPRIATE_SIGNATURE_TYPE, IExchangeRichErrors.SignatureErrorCodes.INAPPROPRIATE_SIGNATURE_TYPE,
hash, hash,
signerAddress, signerAddress,
@ -307,7 +307,7 @@ contract MixinSignatureValidator is
// a correctly formatted but incorrect signature. // a correctly formatted but incorrect signature.
if (signatureType == SignatureType.Invalid) { if (signatureType == SignatureType.Invalid) {
if (signature.length != 1) { if (signature.length != 1) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH, IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH,
hash, hash,
signerAddress, signerAddress,
@ -319,7 +319,7 @@ contract MixinSignatureValidator is
// Signature using EIP712 // Signature using EIP712
} else if (signatureType == SignatureType.EIP712) { } else if (signatureType == SignatureType.EIP712) {
if (signature.length != 66) { if (signature.length != 66) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH, IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH,
hash, hash,
signerAddress, signerAddress,
@ -340,7 +340,7 @@ contract MixinSignatureValidator is
// Signed using web3.eth_sign // Signed using web3.eth_sign
} else if (signatureType == SignatureType.EthSign) { } else if (signatureType == SignatureType.EthSign) {
if (signature.length != 66) { if (signature.length != 66) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH, IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH,
hash, hash,
signerAddress, signerAddress,
@ -399,7 +399,7 @@ contract MixinSignatureValidator is
} }
if (signature.length == 0) { if (signature.length == 0) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH, IExchangeRichErrors.SignatureErrorCodes.INVALID_LENGTH,
hash, hash,
signerAddress, signerAddress,
@ -412,7 +412,7 @@ contract MixinSignatureValidator is
// Ensure signature is supported // Ensure signature is supported
if (signatureTypeRaw >= uint8(SignatureType.NSignatureTypes)) { if (signatureTypeRaw >= uint8(SignatureType.NSignatureTypes)) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.UNSUPPORTED, IExchangeRichErrors.SignatureErrorCodes.UNSUPPORTED,
hash, hash,
signerAddress, signerAddress,
@ -426,7 +426,7 @@ contract MixinSignatureValidator is
// it an explicit option. This aids testing and analysis. It is // it an explicit option. This aids testing and analysis. It is
// also the initialization value for the enum type. // also the initialization value for the enum type.
if (SignatureType(signatureTypeRaw) == SignatureType.Illegal) { if (SignatureType(signatureTypeRaw) == SignatureType.Illegal) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.ILLEGAL, IExchangeRichErrors.SignatureErrorCodes.ILLEGAL,
hash, hash,
signerAddress, signerAddress,
@ -481,7 +481,7 @@ contract MixinSignatureValidator is
return returnData.readBytes4(0) == LEGACY_WALLET_MAGIC_VALUE; return returnData.readBytes4(0) == LEGACY_WALLET_MAGIC_VALUE;
} }
// Static call to verifier failed. // Static call to verifier failed.
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureWalletError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureWalletError(
hash, hash,
walletAddress, walletAddress,
signature, signature,
@ -535,7 +535,7 @@ contract MixinSignatureValidator is
return returnData.readBytes4(0) == EIP1271_MAGIC_VALUE; return returnData.readBytes4(0) == EIP1271_MAGIC_VALUE;
} }
// Static call to verifier failed. // Static call to verifier failed.
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureWalletError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureWalletError(
hash, hash,
walletAddress, walletAddress,
signature, signature,
@ -571,7 +571,7 @@ contract MixinSignatureValidator is
address validatorAddress = signature.readAddress(signatureLength - 21); address validatorAddress = signature.readAddress(signatureLength - 21);
// Ensure signer has approved validator. // Ensure signer has approved validator.
if (!allowedValidators[signerAddress][validatorAddress]) { if (!allowedValidators[signerAddress][validatorAddress]) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureValidatorNotApprovedError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureValidatorNotApprovedError(
signerAddress, signerAddress,
validatorAddress validatorAddress
)); ));
@ -599,7 +599,7 @@ contract MixinSignatureValidator is
return returnData.readBytes4(0) == EIP1271_MAGIC_VALUE; return returnData.readBytes4(0) == EIP1271_MAGIC_VALUE;
} }
// Static call to verifier failed. // Static call to verifier failed.
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureValidatorError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureValidatorError(
hash, hash,
signerAddress, signerAddress,
validatorAddress, validatorAddress,

View File

@ -91,7 +91,7 @@ contract MixinTransactions is
// Check transaction is not expired // Check transaction is not expired
// solhint-disable-next-line not-rely-on-time // solhint-disable-next-line not-rely-on-time
if (block.timestamp >= transaction.expirationTimeSeconds) { if (block.timestamp >= transaction.expirationTimeSeconds) {
LibRichErrors._rrevert(LibExchangeRichErrors.TransactionError( LibRichErrors.rrevert(LibExchangeRichErrors.TransactionError(
IExchangeRichErrors.TransactionErrorCodes.EXPIRED, IExchangeRichErrors.TransactionErrorCodes.EXPIRED,
transactionHash transactionHash
)); ));
@ -99,7 +99,7 @@ contract MixinTransactions is
// Prevent reentrancy // Prevent reentrancy
if (currentContextAddress != address(0)) { if (currentContextAddress != address(0)) {
LibRichErrors._rrevert(LibExchangeRichErrors.TransactionError( LibRichErrors.rrevert(LibExchangeRichErrors.TransactionError(
IExchangeRichErrors.TransactionErrorCodes.NO_REENTRANCY, IExchangeRichErrors.TransactionErrorCodes.NO_REENTRANCY,
transactionHash transactionHash
)); ));
@ -107,7 +107,7 @@ contract MixinTransactions is
// Validate transaction has not been executed // Validate transaction has not been executed
if (transactionsExecuted[transactionHash]) { if (transactionsExecuted[transactionHash]) {
LibRichErrors._rrevert(LibExchangeRichErrors.TransactionError( LibRichErrors.rrevert(LibExchangeRichErrors.TransactionError(
IExchangeRichErrors.TransactionErrorCodes.ALREADY_EXECUTED, IExchangeRichErrors.TransactionErrorCodes.ALREADY_EXECUTED,
transactionHash transactionHash
)); ));
@ -121,7 +121,7 @@ contract MixinTransactions is
transaction, transaction,
transactionHash, transactionHash,
signature)) { signature)) {
LibRichErrors._rrevert(LibExchangeRichErrors.TransactionSignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.TransactionSignatureError(
transactionHash, transactionHash,
signerAddress, signerAddress,
signature signature
@ -136,7 +136,7 @@ contract MixinTransactions is
transactionsExecuted[transactionHash] = true; transactionsExecuted[transactionHash] = true;
(bool didSucceed, bytes memory returnData) = address(this).delegatecall(transaction.data); (bool didSucceed, bytes memory returnData) = address(this).delegatecall(transaction.data);
if (!didSucceed) { if (!didSucceed) {
LibRichErrors._rrevert(LibExchangeRichErrors.TransactionExecutionError( LibRichErrors.rrevert(LibExchangeRichErrors.TransactionExecutionError(
transactionHash, transactionHash,
returnData returnData
)); ));

View File

@ -308,7 +308,7 @@ contract MixinWrapperFunctions is
signature signature
); );
if (fillResults.takerAssetFilledAmount != takerAssetFillAmount) { if (fillResults.takerAssetFilledAmount != takerAssetFillAmount) {
LibRichErrors._rrevert(LibExchangeRichErrors.IncompleteFillError( LibRichErrors.rrevert(LibExchangeRichErrors.IncompleteFillError(
getOrderInfo(order).orderHash getOrderInfo(order).orderHash
)); ));
} }

View File

@ -31,7 +31,7 @@ contract Authorizable is
/// @dev Only authorized addresses can invoke functions with this modifier. /// @dev Only authorized addresses can invoke functions with this modifier.
modifier onlyAuthorized { modifier onlyAuthorized {
if (!authorized[msg.sender]) { if (!authorized[msg.sender]) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.SenderNotAuthorizedError(msg.sender)); LibRichErrors.rrevert(LibAuthorizableRichErrors.SenderNotAuthorizedError(msg.sender));
} }
_; _;
} }
@ -47,12 +47,12 @@ contract Authorizable is
{ {
// Ensure that the target is not the zero address. // Ensure that the target is not the zero address.
if (target == address(0)) { if (target == address(0)) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.ZeroCantBeAuthorizedError()); LibRichErrors.rrevert(LibAuthorizableRichErrors.ZeroCantBeAuthorizedError());
} }
// Ensure that the target is not already authorized. // Ensure that the target is not already authorized.
if (authorized[target]) { if (authorized[target]) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.TargetAlreadyAuthorizedError(target)); LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetAlreadyAuthorizedError(target));
} }
authorized[target] = true; authorized[target] = true;
@ -67,7 +67,7 @@ contract Authorizable is
onlyOwner onlyOwner
{ {
if (!authorized[target]) { if (!authorized[target]) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.TargetNotAuthorizedError(target)); LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetNotAuthorizedError(target));
} }
delete authorized[target]; delete authorized[target];
@ -92,16 +92,16 @@ contract Authorizable is
onlyOwner onlyOwner
{ {
if (!authorized[target]) { if (!authorized[target]) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.TargetNotAuthorizedError(target)); LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetNotAuthorizedError(target));
} }
if (index >= authorities.length) { if (index >= authorities.length) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.IndexOutOfBoundsError( LibRichErrors.rrevert(LibAuthorizableRichErrors.IndexOutOfBoundsError(
index, index,
authorities.length authorities.length
)); ));
} }
if (authorities[index] != target) { if (authorities[index] != target) {
LibRichErrors._rrevert(LibAuthorizableRichErrors.AuthorizedAddressMismatchError( LibRichErrors.rrevert(LibAuthorizableRichErrors.AuthorizedAddressMismatchError(
authorities[index], authorities[index],
target target
)); ));

View File

@ -54,7 +54,7 @@ library LibAddressArray {
// `freeMemPtr` > `addressArrayEndPtr`: Some value occupies memory after `addressArray` // `freeMemPtr` > `addressArrayEndPtr`: Some value occupies memory after `addressArray`
// `freeMemPtr` < `addressArrayEndPtr`: Memory has not been managed properly. // `freeMemPtr` < `addressArrayEndPtr`: Memory has not been managed properly.
if (freeMemPtr < addressArrayEndPtr) { if (freeMemPtr < addressArrayEndPtr) {
LibRichErrors._rrevert(LibAddressArrayRichErrors.MismanagedMemoryError( LibRichErrors.rrevert(LibAddressArrayRichErrors.MismanagedMemoryError(
freeMemPtr, freeMemPtr,
addressArrayEndPtr addressArrayEndPtr
)); ));

View File

@ -180,14 +180,14 @@ library LibBytes {
// Ensure that the from and to positions are valid positions for a slice within // Ensure that the from and to positions are valid positions for a slice within
// the byte array that is being used. // the byte array that is being used.
if (from > to) { if (from > to) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
from, from,
to to
)); ));
} }
if (to > b.length) { if (to > b.length) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,
to, to,
b.length b.length
@ -222,14 +222,14 @@ library LibBytes {
// Ensure that the from and to positions are valid positions for a slice within // Ensure that the from and to positions are valid positions for a slice within
// the byte array that is being used. // the byte array that is being used.
if (from > to) { if (from > to) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
from, from,
to to
)); ));
} }
if (to > b.length) { if (to > b.length) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,
to, to,
b.length b.length
@ -253,7 +253,7 @@ library LibBytes {
returns (bytes1 result) returns (bytes1 result)
{ {
if (b.length == 0) { if (b.length == 0) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanZeroRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanZeroRequired,
b.length, b.length,
0 0
@ -280,7 +280,7 @@ library LibBytes {
returns (address result) returns (address result)
{ {
if (b.length < 20) { if (b.length < 20) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
b.length, b.length,
20 // 20 is length of address 20 // 20 is length of address
@ -329,7 +329,7 @@ library LibBytes {
returns (address result) returns (address result)
{ {
if (b.length < index + 20) { if (b.length < index + 20) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
b.length, b.length,
index + 20 // 20 is length of address index + 20 // 20 is length of address
@ -364,7 +364,7 @@ library LibBytes {
pure pure
{ {
if (b.length < index + 20) { if (b.length < index + 20) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
b.length, b.length,
index + 20 // 20 is length of address index + 20 // 20 is length of address
@ -413,7 +413,7 @@ library LibBytes {
returns (bytes32 result) returns (bytes32 result)
{ {
if (b.length < index + 32) { if (b.length < index + 32) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,
b.length, b.length,
index + 32 index + 32
@ -443,7 +443,7 @@ library LibBytes {
pure pure
{ {
if (b.length < index + 32) { if (b.length < index + 32) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,
b.length, b.length,
index + 32 index + 32
@ -503,7 +503,7 @@ library LibBytes {
returns (bytes4 result) returns (bytes4 result)
{ {
if (b.length < index + 4) { if (b.length < index + 4) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsFourRequired, LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsFourRequired,
b.length, b.length,
index + 4 index + 4
@ -544,7 +544,7 @@ library LibBytes {
// Assert length of <b> is valid, given // Assert length of <b> is valid, given
// length of nested bytes // length of nested bytes
if (b.length < index + nestedBytesLength) { if (b.length < index + nestedBytesLength) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors LibBytesRichErrors
.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsNestedBytesLengthRequired, .InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsNestedBytesLengthRequired,
b.length, b.length,
@ -574,7 +574,7 @@ library LibBytes {
// Assert length of <b> is valid, given // Assert length of <b> is valid, given
// length of input // length of input
if (b.length < index + 32 + input.length) { if (b.length < index + 32 + input.length) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors LibBytesRichErrors
.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsNestedBytesLengthRequired, .InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsNestedBytesLengthRequired,
b.length, b.length,
@ -603,7 +603,7 @@ library LibBytes {
uint256 sourceLen = source.length; uint256 sourceLen = source.length;
// Dest length must be >= source length, or some bytes would not be copied. // Dest length must be >= source length, or some bytes would not be copied.
if (dest.length < sourceLen) { if (dest.length < sourceLen) {
LibRichErrors._rrevert(LibBytesRichErrors.InvalidByteOperationError( LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors LibBytesRichErrors
.InvalidByteOperationErrorCodes.DestinationLengthGreaterThanOrEqualSourceLengthRequired, .InvalidByteOperationErrorCodes.DestinationLengthGreaterThanOrEqualSourceLengthRequired,
dest.length, dest.length,

View File

@ -47,7 +47,7 @@ library LibRichErrors {
/// @dev Reverts an encoded rich revert reason `errorData`. /// @dev Reverts an encoded rich revert reason `errorData`.
/// @param errorData ABI encoded error data. /// @param errorData ABI encoded error data.
function _rrevert(bytes memory errorData) function rrevert(bytes memory errorData)
internal internal
pure pure
{ {

View File

@ -16,7 +16,7 @@ library LibSafeMath {
} }
uint256 c = a * b; uint256 c = a * b;
if (c / a != b) { if (c / a != b) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_MULTIPLICATION_OVERFLOW, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_MULTIPLICATION_OVERFLOW,
a, a,
b b
@ -31,7 +31,7 @@ library LibSafeMath {
returns (uint256) returns (uint256)
{ {
if (b == 0) { if (b == 0) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_DIVISION_BY_ZERO, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_DIVISION_BY_ZERO,
a, a,
b b
@ -47,7 +47,7 @@ library LibSafeMath {
returns (uint256) returns (uint256)
{ {
if (b > a) { if (b > a) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_SUBTRACTION_UNDERFLOW, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_SUBTRACTION_UNDERFLOW,
a, a,
b b
@ -63,7 +63,7 @@ library LibSafeMath {
{ {
uint256 c = a + b; uint256 c = a + b;
if (c < a) { if (c < a) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_ADDITION_OVERFLOW, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_ADDITION_OVERFLOW,
a, a,
b b

View File

@ -18,7 +18,7 @@ contract Ownable is
modifier onlyOwner() { modifier onlyOwner() {
if (msg.sender != owner) { if (msg.sender != owner) {
LibRichErrors._rrevert(LibOwnableRichErrors.OnlyOwnerError( LibRichErrors.rrevert(LibOwnableRichErrors.OnlyOwnerError(
msg.sender, msg.sender,
owner owner
)); ));
@ -31,7 +31,7 @@ contract Ownable is
onlyOwner onlyOwner
{ {
if (newOwner == address(0)) { if (newOwner == address(0)) {
LibRichErrors._rrevert(LibOwnableRichErrors.TransferOwnerToZeroError()); LibRichErrors.rrevert(LibOwnableRichErrors.TransferOwnerToZeroError());
} else { } else {
owner = newOwner; owner = newOwner;
} }

View File

@ -37,7 +37,7 @@ contract ReentrancyGuard {
// If the counter value is different from what we remember, the function // If the counter value is different from what we remember, the function
// was called more than once and an illegal reentrancy occured. // was called more than once and an illegal reentrancy occured.
if (localCounter != reentrancyGuardCounter) { if (localCounter != reentrancyGuardCounter) {
LibRichErrors._rrevert( LibRichErrors.rrevert(
LibReentrancyGuardRichErrors.IllegalReentrancyError() LibReentrancyGuardRichErrors.IllegalReentrancyError()
); );
} }

View File

@ -16,7 +16,7 @@ contract SafeMath {
} }
uint256 c = a * b; uint256 c = a * b;
if (c / a != b) { if (c / a != b) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_MULTIPLICATION_OVERFLOW, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_MULTIPLICATION_OVERFLOW,
a, a,
b b
@ -31,7 +31,7 @@ contract SafeMath {
returns (uint256) returns (uint256)
{ {
if (b == 0) { if (b == 0) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_DIVISION_BY_ZERO, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_DIVISION_BY_ZERO,
a, a,
b b
@ -47,7 +47,7 @@ contract SafeMath {
returns (uint256) returns (uint256)
{ {
if (b > a) { if (b > a) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_SUBTRACTION_UNDERFLOW, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_SUBTRACTION_UNDERFLOW,
a, a,
b b
@ -63,7 +63,7 @@ contract SafeMath {
{ {
uint256 c = a + b; uint256 c = a + b;
if (c < a) { if (c < a) {
LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( LibRichErrors.rrevert(LibSafeMathRichErrors.SafeMathError(
LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_ADDITION_OVERFLOW, LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_ADDITION_OVERFLOW,
a, a,
b b

View File

@ -27,6 +27,6 @@ contract TestLibRichErrors {
external external
pure pure
{ {
LibRichErrors._rrevert(errorData); LibRichErrors.rrevert(errorData);
} }
} }