Merge pull request #2278 from 0xProject/fix/3.0/removeProtocolFeeZeroAssertion

Remove assertion that protocol fee != zero
This commit is contained in:
Greg Hysz
2019-10-22 13:24:59 -07:00
committed by GitHub
6 changed files with 18 additions and 45 deletions

View File

@@ -161,19 +161,11 @@ contract MixinExchangeFees is
private
view
{
if (protocolFeePaid == 0) {
LibRichErrors.rrevert(
LibStakingRichErrors.InvalidProtocolFeePaymentError(
LibStakingRichErrors.ProtocolFeePaymentErrorCodes.ZeroProtocolFeePaid,
protocolFeePaid,
msg.value
)
);
}
// The protocol fee must equal the value passed to the contract; unless
// the value is zero, in which case the fee is taken in WETH.
if (msg.value != protocolFeePaid && msg.value != 0) {
LibRichErrors.rrevert(
LibStakingRichErrors.InvalidProtocolFeePaymentError(
LibStakingRichErrors.ProtocolFeePaymentErrorCodes.MismatchedFeeAndPayment,
protocolFeePaid,
msg.value
)

View File

@@ -29,11 +29,6 @@ library LibStakingRichErrors {
CanOnlyDecreaseOperatorShare
}
enum ProtocolFeePaymentErrorCodes {
ZeroProtocolFeePaid,
MismatchedFeeAndPayment
}
enum InitializationErrorCodes {
MixinSchedulerAlreadyInitialized,
MixinParamsAlreadyInitialized
@@ -104,9 +99,9 @@ library LibStakingRichErrors {
bytes4 internal constant INVALID_PARAM_VALUE_ERROR_SELECTOR =
0xfc45bd11;
// bytes4(keccak256("InvalidProtocolFeePaymentError(uint8,uint256,uint256)"))
// bytes4(keccak256("InvalidProtocolFeePaymentError(uint256,uint256)"))
bytes4 internal constant INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR =
0xefd6cb33;
0x31d7a505;
// bytes4(keccak256("PreviousEpochNotFinalizedError(uint256,uint256)"))
bytes4 internal constant PREVIOUS_EPOCH_NOT_FINALIZED_ERROR_SELECTOR =
@@ -252,7 +247,6 @@ library LibStakingRichErrors {
}
function InvalidProtocolFeePaymentError(
ProtocolFeePaymentErrorCodes errorCodes,
uint256 expectedProtocolFeePaid,
uint256 actualProtocolFeePaid
)
@@ -262,7 +256,6 @@ library LibStakingRichErrors {
{
return abi.encodeWithSelector(
INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR,
errorCodes,
expectedProtocolFeePaid,
actualProtocolFeePaid
);