From 4147dfce350249719f4953688e56cdcca93b8421 Mon Sep 17 00:00:00 2001 From: josojo Date: Mon, 1 Jan 2024 15:32:31 +0100 Subject: [PATCH] remove can fork (#140) --- contracts/ForkingManager.sol | 5 ----- contracts/L1GlobalForkRequester.sol | 2 +- contracts/interfaces/IForkingManager.sol | 2 -- test/ForkingManager.t.sol | 3 --- test/L1GlobalForkRequester.t.sol | 5 ++--- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/contracts/ForkingManager.sol b/contracts/ForkingManager.sol index a0818791..e38dbd5d 100644 --- a/contracts/ForkingManager.sol +++ b/contracts/ForkingManager.sol @@ -78,11 +78,6 @@ contract ForkingManager is IForkingManager, ForkableStructure { return (children[0] != address(0) || children[1] != address(0)); } - // TODO: If there is any other reason a fork can be prevented, eg the contract can be frozen by governance, add it here. - function canFork() external view returns (bool) { - return (executionTimeForProposal == 0); - } - /** * @notice function to initiate and schedule the fork * @param _disputeData the dispute contract and call to identify the dispute diff --git a/contracts/L1GlobalForkRequester.sol b/contracts/L1GlobalForkRequester.sol index dd937c11..9681eec9 100644 --- a/contracts/L1GlobalForkRequester.sol +++ b/contracts/L1GlobalForkRequester.sol @@ -82,7 +82,7 @@ contract L1GlobalForkRequester { if (transferredBalance < forkingManager.arbitrationFee()) { isForkGuaranteedNotToRevert = false; } - if (!forkingManager.canFork()) { + if (forkingManager.isForkingInitiated()) { isForkGuaranteedNotToRevert = false; } diff --git a/contracts/interfaces/IForkingManager.sol b/contracts/interfaces/IForkingManager.sol index 75fc114d..8a9086a5 100644 --- a/contracts/interfaces/IForkingManager.sol +++ b/contracts/interfaces/IForkingManager.sol @@ -43,8 +43,6 @@ interface IForkingManager is IForkableStructure { function isForkingExecuted() external returns (bool); - function canFork() external returns (bool); - // Struct that holds an address pair used to store the new child contracts struct AddressPair { address one; diff --git a/test/ForkingManager.t.sol b/test/ForkingManager.t.sol index c6334004..e2d2cfb2 100644 --- a/test/ForkingManager.t.sol +++ b/test/ForkingManager.t.sol @@ -203,7 +203,6 @@ contract ForkingManagerTest is Test { function testForkingStatusFunctions() public { assertFalse(forkmanager.isForkingInitiated()); assertFalse(forkmanager.isForkingExecuted()); - assertTrue(forkmanager.canFork()); // Mint and approve the arbitration fee for the test contract forkonomicToken.approve(address(forkmanager), arbitrationFee); @@ -227,14 +226,12 @@ contract ForkingManagerTest is Test { assertTrue(forkmanager.isForkingInitiated()); assertFalse(forkmanager.isForkingExecuted()); - assertFalse(forkmanager.canFork()); vm.warp(block.timestamp + forkmanager.forkPreparationTime() + 1); forkmanager.executeFork(); assertTrue(forkmanager.isForkingInitiated()); assertTrue(forkmanager.isForkingExecuted()); - assertFalse(forkmanager.canFork()); } function testInitiateForkChargesFees() public { diff --git a/test/L1GlobalForkRequester.t.sol b/test/L1GlobalForkRequester.t.sol index b5213503..e08869be 100644 --- a/test/L1GlobalForkRequester.t.sol +++ b/test/L1GlobalForkRequester.t.sol @@ -229,7 +229,6 @@ contract L1GlobalForkRequesterTest is Test { address(forkmanager.forkonomicToken()), address(forkonomicToken) ); - assertTrue(forkmanager.canFork()); assertFalse(forkmanager.isForkingInitiated()); assertFalse(forkmanager.isForkingExecuted()); @@ -268,7 +267,7 @@ contract L1GlobalForkRequesterTest is Test { address(forkmanager.forkonomicToken()), address(forkonomicToken) ); - assertTrue(forkmanager.canFork()); + assertFalse(forkmanager.isForkingInitiated()); l1GlobalForkRequester.handlePayment( address(forkonomicToken), @@ -316,7 +315,7 @@ contract L1GlobalForkRequesterTest is Test { address(forkmanager.forkonomicToken()), address(forkonomicToken) ); - assertTrue(forkmanager.canFork()); + assertFalse(forkmanager.isForkingInitiated()); { // Someone else starts and executes a fork before we can handle our payment