Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename FailedInnerCall → FailedCall
  • Loading branch information
Amxx committed Mar 5, 2024
commit d2fcabf53ec7671a6709eb41d5e3ca80caf0149d
2 changes: 1 addition & 1 deletion contracts/metatx/ERC2771Forwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ contract ERC2771Forwarder is EIP712, Nonces {
}

if (!_execute(request, true)) {
revert Errors.FailedInnerCall();
revert Errors.FailedCall();
}
}

Expand Down
12 changes: 6 additions & 6 deletions contracts/utils/Address.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ library Address {

(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedInnerCall();
revert Errors.FailedCall();
}
}

Expand All @@ -49,7 +49,7 @@ library Address {
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedInnerCall} error.
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
Expand Down Expand Up @@ -100,7 +100,7 @@ library Address {

/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedInnerCall}) in case
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
Expand All @@ -122,7 +122,7 @@ library Address {

/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedInnerCall} error.
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
Expand All @@ -133,7 +133,7 @@ library Address {
}

/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedInnerCall}.
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
Expand All @@ -145,7 +145,7 @@ library Address {
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedInnerCall();
revert Errors.FailedCall();
}
}
}
2 changes: 1 addition & 1 deletion contracts/utils/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library Errors {
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
error FailedCall();

/**
* @dev The deployment failed.
Expand Down
2 changes: 1 addition & 1 deletion test/finance/VestingWallet.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function envSetup(mock, beneficiary, token) {
const beneficiaryMock = await ethers.deployContract('EtherReceiverMock');
await beneficiaryMock.setAcceptEther(false);
await mock.connect(beneficiary).transferOwnership(beneficiaryMock);
return { args: [], error: [mock, 'FailedInnerCall'] };
return { args: [], error: [mock, 'FailedCall'] };
},
releasedEvent: 'EtherReleased',
args: [],
Expand Down
2 changes: 1 addition & 1 deletion test/governance/Governor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ describe('Governor', function () {
await this.helper.waitForSnapshot();
await this.helper.connect(this.voter1).vote({ support: VoteType.For });
await this.helper.waitForDeadline();
await expect(this.helper.execute()).to.be.revertedWithCustomError(this.mock, 'FailedInnerCall');
await expect(this.helper.execute()).to.be.revertedWithCustomError(this.mock, 'FailedCall');
});

it('if receiver revert with reason', async function () {
Expand Down
10 changes: 5 additions & 5 deletions test/governance/TimelockController.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ describe('TimelockController', function () {
operation.predecessor,
operation.salt,
),
).to.be.revertedWithCustomError(this.mock, 'FailedInnerCall');
).to.be.revertedWithCustomError(this.mock, 'FailedCall');
});
});
});
Expand Down Expand Up @@ -1099,7 +1099,7 @@ describe('TimelockController', function () {
this.mock
.connect(this.executor)
.execute(operation.target, operation.value, operation.data, operation.predecessor, operation.salt),
).to.be.revertedWithCustomError(this.mock, 'FailedInnerCall');
).to.be.revertedWithCustomError(this.mock, 'FailedCall');
});

it('call throw', async function () {
Expand Down Expand Up @@ -1146,7 +1146,7 @@ describe('TimelockController', function () {
.execute(operation.target, operation.value, operation.data, operation.predecessor, operation.salt, {
gasLimit: '100000',
}),
).to.be.revertedWithCustomError(this.mock, 'FailedInnerCall');
).to.be.revertedWithCustomError(this.mock, 'FailedCall');
});

it('call payable with eth', async function () {
Expand Down Expand Up @@ -1199,7 +1199,7 @@ describe('TimelockController', function () {
this.mock
.connect(this.executor)
.execute(operation.target, operation.value, operation.data, operation.predecessor, operation.salt),
).to.be.revertedWithCustomError(this.mock, 'FailedInnerCall');
).to.be.revertedWithCustomError(this.mock, 'FailedCall');

expect(await ethers.provider.getBalance(this.mock)).to.equal(0n);
expect(await ethers.provider.getBalance(this.callreceivermock)).to.equal(0n);
Expand Down Expand Up @@ -1227,7 +1227,7 @@ describe('TimelockController', function () {
this.mock
.connect(this.executor)
.execute(operation.target, operation.value, operation.data, operation.predecessor, operation.salt),
).to.be.revertedWithCustomError(this.mock, 'FailedInnerCall');
).to.be.revertedWithCustomError(this.mock, 'FailedCall');

expect(await ethers.provider.getBalance(this.mock)).to.equal(0n);
expect(await ethers.provider.getBalance(this.callreceivermock)).to.equal(0n);
Expand Down
2 changes: 1 addition & 1 deletion test/metatx/ERC2771Forwarder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('ERC2771Forwarder', function () {
data: this.receiver.interface.encodeFunctionData('mockFunctionRevertsNoReason'),
});

await expect(this.forwarder.execute(request)).to.be.revertedWithCustomError(this.forwarder, 'FailedInnerCall');
await expect(this.forwarder.execute(request)).to.be.revertedWithCustomError(this.forwarder, 'FailedCall');
});
});

Expand Down
12 changes: 6 additions & 6 deletions test/utils/Address.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('Address', function () {
await this.targetEther.setAcceptEther(false);
await expect(this.mock.$sendValue(this.targetEther, funds)).to.be.revertedWithCustomError(
this.mock,
'FailedInnerCall',
'FailedCall',
);
});
});
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('Address', function () {

await expect(this.mock.$functionCall(this.target, call)).to.be.revertedWithCustomError(
this.mock,
'FailedInnerCall',
'FailedCall',
);
});

Expand All @@ -118,7 +118,7 @@ describe('Address', function () {

await expect(this.mock.$functionCall(this.target, call, { gasLimit: 120_000n })).to.be.revertedWithCustomError(
this.mock,
'FailedInnerCall',
'FailedCall',
);
});

Expand All @@ -134,7 +134,7 @@ describe('Address', function () {

await expect(this.mock.$functionCall(this.target, call)).to.be.revertedWithCustomError(
this.mock,
'FailedInnerCall',
'FailedCall',
);
});
});
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('Address', function () {

await expect(this.mock.$functionCallWithValue(this.target, call, value)).to.be.revertedWithCustomError(
this.mock,
'FailedInnerCall',
'FailedCall',
);
});
});
Expand All @@ -225,7 +225,7 @@ describe('Address', function () {

await expect(this.mock.$functionStaticCall(this.target, call)).to.be.revertedWithCustomError(
this.mock,
'FailedInnerCall',
'FailedCall',
);
});

Expand Down