From 61add609219f76b575e255f2be33524cadb0d071 Mon Sep 17 00:00:00 2001 From: Michael Benfield Date: Wed, 27 Mar 2024 17:44:17 -0700 Subject: [PATCH] test revert on selfdestruct --- src/mocks/Program.sol | 4 ++++ src/mocks/SelfDestruct.sol | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/mocks/SelfDestruct.sol diff --git a/src/mocks/Program.sol b/src/mocks/Program.sol index 2ff15f43..871847c3 100644 --- a/src/mocks/Program.sol +++ b/src/mocks/Program.sol @@ -9,6 +9,10 @@ import "@openzeppelin/contracts/utils/Strings.sol"; contract ProgramTest { event Hash(bytes32 result); + function callSelfDestruct(address addr) external { + selfdestruct(payable(addr)); + } + function callKeccak(address program, bytes calldata data) external { // in keccak.rs // the input is the # of hashings followed by a preimage diff --git a/src/mocks/SelfDestruct.sol b/src/mocks/SelfDestruct.sol new file mode 100644 index 00000000..ffc9a5dc --- /dev/null +++ b/src/mocks/SelfDestruct.sol @@ -0,0 +1,11 @@ +// Copyright 2022-2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity ^0.8.0; + +contract SelfDestruct { + function callSelfDestruct(address addr) external { + selfdestruct(payable(addr)); + } +}