Commit a7b55a89 authored by clabby's avatar clabby Committed by GitHub

feat(ctb): Remove `deletePendingWithdrawal` (#9498)

* Remove `deletePendingWithdrawals`

* semver
parent 57d43503
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -32,8 +32,8 @@
"sourceCodeHash": "0xdc27421279afb6c3b26fc8c589c5d213695f666c74d2c2c41cb7df719d172f37"
},
"src/L1/OptimismPortal2.sol": {
"initCodeHash": "0xcb81890a6a3caa9f759be0fa97cd7ea7243564c31a3ebafe9528878eb02670bc",
"sourceCodeHash": "0x9a700ba456d9f8cc338fc755ae99c46ef264a95cf63915d185ba6890c81b4b59"
"initCodeHash": "0x718b2bc2925ca1551a98908b26237fc7dd6634f7ca35c766a42b3d7e20eecd5e",
"sourceCodeHash": "0x686871310ca57017c027aa414888b0d576e29d8b08691ae8eeee19ee1655d717"
},
"src/L1/ProtocolVersions.sol": {
"initCodeHash": "0x72cd467e8bcf019c02675d72ab762e088bcc9cc0f1a4e9f587fa4589f7fdd1b8",
......
......@@ -76,19 +76,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_withdrawalHash",
"type": "bytes32"
}
],
"name": "deleteProvenWithdrawal",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
......
......@@ -117,8 +117,8 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
}
/// @notice Semantic version.
/// @custom:semver 3.1.0
string public constant version = "3.1.0";
/// @custom:semver 3.2.0
string public constant version = "3.2.0";
/// @notice Constructs the OptimismPortal contract.
constructor(
......@@ -417,14 +417,6 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
disputeGameBlacklist[_disputeGame] = true;
}
/// @notice Deletes a proven withdrawal from the `provenWithdrawals` mapping in the case that a MPT proof was
/// incorrectly verified by the `MerkleTrie` verifier contract.
/// @param _withdrawalHash Hash of the withdrawal transaction to delete from the `pendingWithdrawals` mapping.
function deleteProvenWithdrawal(bytes32 _withdrawalHash) external {
require(msg.sender == guardian(), "OptimismPortal: only the guardian can delete proven withdrawals");
delete provenWithdrawals[_withdrawalHash];
}
/// @notice Sets the respected game type. Changing this value can alter the security properties of the system,
/// depending on the new game's behavior.
/// @param _gameType The game type to consult for output proposals.
......
......@@ -359,39 +359,7 @@ contract OptimismPortal2_FinalizeWithdrawal_Test is CommonTest {
assertFalse(optimismPortal2.finalizedWithdrawals(Hashing.hashWithdrawal(_defaultTx)));
}
/// @dev Tests that `deleteProvenWithdrawal` reverts when called by a non-guardian.
function testFuzz_deleteProvenWithdrawal_onlyGuardian_reverts(address _act, bytes32 _wdHash) external {
vm.assume(_act != address(optimismPortal2.guardian()));
vm.expectRevert("OptimismPortal: only the guardian can delete proven withdrawals");
optimismPortal2.deleteProvenWithdrawal(_wdHash);
}
/// @dev Tests that the guardian role can delete any proven withdrawal.
function test_deleteProvenWithdrawal_guardian_succeeds() external {
vm.expectEmit(true, true, true, true);
emit WithdrawalProven(_withdrawalHash, alice, bob);
optimismPortal2.proveWithdrawalTransaction({
_tx: _defaultTx,
_disputeGameIndex: _proposedGameIndex,
_outputRootProof: _outputRootProof,
_withdrawalProof: _withdrawalProof
});
// Ensure the withdrawal has been proven.
(, uint64 timestamp) = optimismPortal2.provenWithdrawals(_withdrawalHash);
assertEq(timestamp, block.timestamp);
// Delete the proven withdrawal.
vm.prank(optimismPortal2.guardian());
optimismPortal2.deleteProvenWithdrawal(_withdrawalHash);
// Ensure the withdrawal has been deleted
(, timestamp) = optimismPortal2.provenWithdrawals(_withdrawalHash);
assertEq(timestamp, 0);
}
/// @dev Tests that `deleteProvenWithdrawal` reverts when called by a non-guardian.
/// @dev Tests that `blacklistDisputeGame` reverts when called by a non-guardian.
function testFuzz_blacklist_onlyGuardian_reverts(address _act) external {
vm.assume(_act != address(optimismPortal2.guardian()));
......
......@@ -249,7 +249,6 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("disputeGameBlacklist(address)") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("respectedGameType()") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("blacklistDisputeGame(address)"), _auth: Role.GUARDIAN });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("deleteProvenWithdrawal(bytes32)"), _auth: Role.GUARDIAN });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("setRespectedGameType(uint32)"), _auth: Role.GUARDIAN });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("checkWithdrawal(bytes32)") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("proofMaturityDelaySeconds()") });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment