From b27f34e0ffc31a2e02a322cf498e07556f5988ae Mon Sep 17 00:00:00 2001 From: josojo Date: Fri, 19 Jan 2024 23:30:26 +0100 Subject: [PATCH 1/7] first try --- .../MinimalAdjudicationFramework.sol | 19 +++- .../Pull/AdjudicationFrameworkRequests.sol | 8 +- .../Push/AdjudicationFrameworkFeeds.sol | 7 +- contracts/L2ForkArbitrator.sol | 86 ++++++++++++------- .../AdjudicationFrameworkFeeds.t.sol | 3 +- .../AdjudicationFrameworkMinimal.t.sol | 6 +- .../AdjudicationFrameworkRequests.t.sol | 81 +++++++++-------- 7 files changed, 134 insertions(+), 76 deletions(-) diff --git a/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol b/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol index 82fe06d5..24b2a778 100644 --- a/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol +++ b/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol @@ -8,7 +8,7 @@ pragma solidity ^0.8.20; import {IRealityETH} from "./../lib/reality-eth/interfaces/IRealityETH.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; - +import {IL2ForkArbitrator} from "../interfaces/IL2ForkArbitrator.sol"; /* Minimal Adjudication framework every framework should implement. Contains an enumerableSet of Arbitrators. @@ -76,6 +76,7 @@ contract MinimalAdjudicationFramework { // When they're all cleared they can be unfrozen. mapping(address => uint256) public countArbitratorFreezePropositions; + uint256 public arbitrationDelayForCollectingEvidence; IRealityETH public realityETH; modifier onlyArbitrator() { @@ -89,15 +90,18 @@ contract MinimalAdjudicationFramework { /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support /// @param _allowReplacementModification Whether to allow multiple modifications at once + /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested constructor( address _realityETH, address _forkArbitrator, address[] memory _initialArbitrators, - bool _allowReplacementModification + bool _allowReplacementModification, + uint256 _arbitrationDelayForCollectingEvidence ) { allowReplacementModification = _allowReplacementModification; realityETH = IRealityETH(_realityETH); forkArbitrator = _forkArbitrator; + arbitrationDelayForCollectingEvidence = _arbitrationDelayForCollectingEvidence; // Create reality.eth templates for our add questions // We'll identify ourselves in the template so we only need a single parameter for questions, the arbitrator in question. // TODO: We may want to specify a document with the terms that guide this decision here, rather than just leaving it implicit. @@ -163,7 +167,7 @@ contract MinimalAdjudicationFramework { templateId = templateIdReplaceArbitrator; } bytes32 questionId = realityETH.askQuestionWithMinBond( - templateIdRemoveArbitrator, + templateId, question, forkArbitrator, REALITY_ETH_TIMEOUT, @@ -171,6 +175,15 @@ contract MinimalAdjudicationFramework { 0, REALITY_ETH_BOND_ARBITRATOR_REMOVE ); + IL2ForkArbitrator(forkArbitrator).storeInformation( + templateId, + uint32(block.timestamp), + question, + REALITY_ETH_TIMEOUT, + REALITY_ETH_BOND_ARBITRATOR_REMOVE, + 0, + arbitrationDelayForCollectingEvidence + ); if ( propositions[questionId].arbitratorToAdd != address(0) || propositions[questionId].arbitratorToRemove != address(0) diff --git a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol index 87886485..9e2bea72 100644 --- a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol +++ b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol @@ -84,18 +84,22 @@ contract AdjudicationFrameworkRequests is /// @param _disputeFee The dispute fee we charge reality.eth users /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support + /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested + constructor( address _realityETH, uint256 _disputeFee, address _forkArbitrator, address[] memory _initialArbitrators, - bool _allowReplacementModification + bool _allowReplacementModification, + uint256 _arbitrationDelayForCollectingEvidence ) MinimalAdjudicationFramework( _realityETH, _forkArbitrator, _initialArbitrators, - _allowReplacementModification + _allowReplacementModification, + _arbitrationDelayForCollectingEvidence ) { dispute_fee = _disputeFee; diff --git a/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol b/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol index c7787f34..6835f91f 100644 --- a/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol +++ b/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol @@ -31,16 +31,19 @@ contract AdjudicationFrameworkFeeds is MinimalAdjudicationFramework { /// @param _realityETH The reality.eth instance we adjudicate for /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support + /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested constructor( address _realityETH, address _forkArbitrator, - address[] memory _initialArbitrators + address[] memory _initialArbitrators, + uint256 _arbitrationDelayForCollectingEvidence ) MinimalAdjudicationFramework( _realityETH, _forkArbitrator, _initialArbitrators, - true // replace method can be used to switch out arbitrators + true, // replace method can be used to switch out arbitrators + _arbitrationDelayForCollectingEvidence ) {} diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index edc6f7a4..4074368b 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -11,8 +11,7 @@ import {IRealityETH} from "./lib/reality-eth/interfaces/IRealityETH.sol"; import {CalculateMoneyBoxAddress} from "./lib/CalculateMoneyBoxAddress.sol"; import {IPolygonZkEVMBridge} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVMBridge.sol"; -import {IBridgeMessageReceiver} from "@RealityETH/zkevm-contracts/contracts/interfaces/IBridgeMessageReceiver.sol"; - +import {IL2ForkArbitrator} from "./interfaces/IL2ForkArbitrator.sol"; /* This contract is the arbitrator used by governance propositions for AdjudicationFramework contracts. It charges a dispute fee of 5% of total supply [TODO], which it forwards to L1 when requesting a fork. @@ -22,33 +21,7 @@ we are in the 1 week period before a fork) the new one will be queued. // NB This doesn't implement IArbitrator because that requires slightly more functions than we need // TODO: Would be good to make a stripped-down IArbitrator that only has the essential functions -contract L2ForkArbitrator is IBridgeMessageReceiver { - // @dev Error thrown when the arbitration fee is 0 - error ArbitrationFeeMustBePositive(); - // @dev Error thrown when the arbitration request has already been made - error ArbitrationAlreadyRequested(); - // @dev Error thrown when the fork is already in progress over something else - error ForkInProgress(); - // @dev Error thrown when the L2 bridge is not set - error L2BridgeNotSet(); - // @dev Error thrown when the fork is not in progress - error QuestionNotForked(); - // @dev Error thrown when status is not FORK_REQUESTED - error StatusNotForkRequested(); - // @dev Error thrown when status is not FORK_REQUEST_FAILED - error StatusNotForkRequestFailed(); - // @dev Error thrown when the fork is not in progress - error WrongStatus(); - // @dev Error thrown when called with wrong network - error WrongNetwork(); - // @dev Error thrown when called with wrong sender - error WrongSender(); - // @dev Error thrown when called from the wrong bridge - error WrongBridge(); - // @dev Error thrown when the fork is not in progress - error ForkNotInProgress(); - // @dev Error thrown when contract is not awaiting activation - error NotAwaitingActivation(); +contract L2ForkArbitrator is IL2ForkArbitrator { bool public isForkInProgress; IRealityETH public realitio; @@ -65,6 +38,16 @@ contract L2ForkArbitrator is IBridgeMessageReceiver { address payable payer; uint256 paid; bytes32 result; + uint256 timeOfRequest; + } + + enum ArbitrationStatus { + NONE, + SOME + } + struct ArbitrationData { + ArbitrationStatus status; + uint256 delay; // Delay in seconds before the fork is activated } event LogRequestArbitration( @@ -75,6 +58,8 @@ contract L2ForkArbitrator is IBridgeMessageReceiver { ); mapping(bytes32 => ArbitrationRequest) public arbitrationRequests; + mapping(bytes32 => ArbitrationData) public arbitrationData; + mapping(address => uint256) public refundsDue; L2ChainInfo public chainInfo; @@ -121,7 +106,8 @@ contract L2ForkArbitrator is IBridgeMessageReceiver { RequestStatus.QUEUED, payable(msg.sender), msg.value, - bytes32(0) + bytes32(0), + block.timestamp ); realitio.notifyOfArbitrationRequest( @@ -131,21 +117,57 @@ contract L2ForkArbitrator is IBridgeMessageReceiver { ); emit LogRequestArbitration(questionId, msg.value, msg.sender, 0); - if (!isForkInProgress) { + if (!isForkInProgress && arbitrationData[questionId].delay == 0) { requestActivateFork(questionId); } return true; } + function storeInformation( + uint256 templateId, + uint32 openingTs, + string calldata question, + uint32 timeout, + uint32 minBond, + uint256 nonce, + uint256 delay + ) public { + bytes32 contentHash = keccak256( + abi.encodePacked(templateId, openingTs, question) + ); + bytes32 question_id = keccak256( + abi.encodePacked( + contentHash, + address(this), + timeout, + minBond, + address(realitio), + msg.sender, + nonce + ) + ); + arbitrationData[question_id] = ArbitrationData(ArbitrationStatus.SOME, delay); + } + /// @notice Request a fork via the bridge /// @dev Talks to the L1 ForkingManager asynchronously, and may fail. /// @param question_id The question in question function requestActivateFork(bytes32 question_id) public { + if (arbitrationData[question_id].status == ArbitrationStatus.NONE) + revert ArbitrationDataNotSet(); + if (arbitrationRequests[question_id].timeOfRequest + arbitrationData[question_id].delay > block.timestamp) + revert RequestStillInWaitingPeriod(); if (isForkInProgress) { revert ForkInProgress(); // Forking over something else } - if (msg.sender != arbitrationRequests[question_id].payer) { + if ( + arbitrationRequests[question_id].status == + RequestStatus.FORK_REQUEST_FAILED && + msg.sender != arbitrationRequests[question_id].payer + ) { + // If the fork request is done for the first time, anyone can call it. This ensures that a request will be processed even if the original payer is not available. + // Though, if the fork request failed, only the original payer can reinitiate it. revert WrongSender(); } diff --git a/test/AdjudicationFramework/AdjudicationFrameworkFeeds.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkFeeds.t.sol index 45384d38..6de703d9 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkFeeds.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkFeeds.t.sol @@ -24,7 +24,8 @@ contract FeedsTest is Test { feeds = new AdjudicationFrameworkFeeds( address(l2RealityEth), l2Arbitrator, - initialArbitrators + initialArbitrators, + 0 ); } diff --git a/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol index 7f957f03..b095bc78 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol @@ -166,7 +166,8 @@ contract AdjudicationIntegrationTest is Test { 123, address(l2ForkArbitrator), initialArbitrators, - true + true, + 0 ); l2Arbitrator1 = new Arbitrator(); @@ -256,7 +257,8 @@ contract AdjudicationIntegrationTest is Test { 123, address(l2ForkArbitrator), initialArbs, - true + true, + 0 ); // NB The length and indexes of this may change if we add unrelated log entries to the AdjudicationFramework constructor diff --git a/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol index 39a20a63..4265d871 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol @@ -17,6 +17,7 @@ import {L2ChainInfo} from "../../contracts/L2ChainInfo.sol"; import {MockPolygonZkEVMBridge} from "../testcontract/MockPolygonZkEVMBridge.sol"; import {MinimalAdjudicationFramework} from "../../contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol"; import {AdjudicationFrameworkRequests} from "../../contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol"; +import {IL2ForkArbitrator} from "../../contracts/interfaces/IL2ForkArbitrator.sol"; contract AdjudicationIntegrationTest is Test { Arbitrator public govArb; @@ -90,6 +91,7 @@ contract AdjudicationIntegrationTest is Test { uint64 internal l2ChainIdInit = 1; uint256 internal forkingFee = 5000; // Should ultimately come from l1 forkingmanager + uint256 internal additionalDelayToEvaluateTheArbitration = 0; function setUp() public { l2Bridge = new MockPolygonZkEVMBridge(); @@ -163,7 +165,8 @@ contract AdjudicationIntegrationTest is Test { 123, address(l2ForkArbitrator), initialArbitrators, - true + true, + 0 ); l2Arbitrator1 = new Arbitrator(); @@ -642,6 +645,7 @@ contract AdjudicationIntegrationTest is Test { } function testArbitrationContestForkFailed() public { + uint256 additionalDelayForRequest = 100000; (, bytes32 removalQuestionId, , , ) = _setupContestedArbitration(); // Currently in the "yes" state, so once it times out we can complete the removal @@ -673,8 +677,17 @@ contract AdjudicationIntegrationTest is Test { removalQuestionId, 0 ); + // vm.expectRevert(IL2ForkArbitrator.RequestStillInWaitingPeriod.selector); + // l2ForkArbitrator.requestActivateFork(removalQuestionId); + + // skip(additionalDelayForRequest); + // vm.expectRevert(IL2ForkArbitrator.ArbitrationDataNotSet.selector); + // l2ForkArbitrator.requestActivateFork(removalQuestionId); + + // l2ForkArbitrator.requestActivateFork(removalQuestionId); - assertTrue(l2ForkArbitrator.isForkInProgress(), "In forking state"); + + // assertTrue(l2ForkArbitrator.isForkInProgress(), "In forking state"); // L1 STUFF HAPPENS HERE // Assume somebody else called fork or the fee changed or something. @@ -682,38 +695,38 @@ contract AdjudicationIntegrationTest is Test { // NB Here we're sending the payment directly // In fact it seems like it would have to be claimed separately - assertEq(address(l2ForkArbitrator).balance, 0); - payable(address(l2Bridge)).transfer(1000000); // Fund it so it can fund the L2ForkArbitrator - bytes memory fakeMessageData = abi.encode(removalQuestionId); - l2Bridge.fakeClaimMessage( - address(l1GlobalForkRequester), - uint32(0), - address(l2ForkArbitrator), - fakeMessageData, - forkFee - ); - assertEq(address(l2ForkArbitrator).balance, forkFee); - - assertFalse( - l2ForkArbitrator.isForkInProgress(), - "Not in forking state" - ); - - vm.expectRevert(L2ForkArbitrator.WrongSender.selector); - l2ForkArbitrator.requestActivateFork(removalQuestionId); - - vm.expectRevert(L2ForkArbitrator.WrongSender.selector); - l2ForkArbitrator.cancelArbitration(removalQuestionId); - - vm.prank(user2); - l2ForkArbitrator.cancelArbitration(removalQuestionId); - assertEq(forkFee, l2ForkArbitrator.refundsDue(user2)); - - uint256 user2Bal = user2.balance; - vm.prank(user2); - l2ForkArbitrator.claimRefund(); - assertEq(address(l2ForkArbitrator).balance, 0); - assertEq(user2.balance, user2Bal + forkFee); + // assertEq(address(l2ForkArbitrator).balance, 0); + // payable(address(l2Bridge)).transfer(1000000); // Fund it so it can fund the L2ForkArbitrator + // bytes memory fakeMessageData = abi.encode(removalQuestionId); + // l2Bridge.fakeClaimMessage( + // address(l1GlobalForkRequester), + // uint32(0), + // address(l2ForkArbitrator), + // fakeMessageData, + // forkFee + // ); + // assertEq(address(l2ForkArbitrator).balance, forkFee); + + // assertFalse( + // l2ForkArbitrator.isForkInProgress(), + // "Not in forking state" + // ); + + // vm.expectRevert(IL2ForkArbitrator.WrongSender.selector); + // l2ForkArbitrator.requestActivateFork(removalQuestionId); + + // vm.expectRevert(IL2ForkArbitrator.WrongSender.selector); + // l2ForkArbitrator.cancelArbitration(removalQuestionId); + + // vm.prank(user2); + // l2ForkArbitrator.cancelArbitration(removalQuestionId); + // assertEq(forkFee, l2ForkArbitrator.refundsDue(user2)); + + // uint256 user2Bal = user2.balance; + // vm.prank(user2); + // l2ForkArbitrator.claimRefund(); + // assertEq(address(l2ForkArbitrator).balance, 0); + // assertEq(user2.balance, user2Bal + forkFee); } /* From dbc78ea0426ea44607c6287653f0f3a42e0ae9a2 Mon Sep 17 00:00:00 2001 From: josojo Date: Fri, 19 Jan 2024 23:30:37 +0100 Subject: [PATCH 2/7] first try --- contracts/interfaces/IL2ForkArbitrator.sol | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 contracts/interfaces/IL2ForkArbitrator.sol diff --git a/contracts/interfaces/IL2ForkArbitrator.sol b/contracts/interfaces/IL2ForkArbitrator.sol new file mode 100644 index 00000000..52a39e50 --- /dev/null +++ b/contracts/interfaces/IL2ForkArbitrator.sol @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-3.0-only + +pragma solidity ^0.8.20; + +// Allow mixed-case variables for compatibility with reality.eth, eg it uses question_id not questionId +/* solhint-disable var-name-mixedcase */ + + + +import {IBridgeMessageReceiver} from "@RealityETH/zkevm-contracts/contracts/interfaces/IBridgeMessageReceiver.sol"; + +/* +This contract is the arbitrator used by governance propositions for AdjudicationFramework contracts. +It charges a dispute fee of 5% of total supply [TODO], which it forwards to L1 when requesting a fork. +If there is already a dispute in progress (ie another fork has been requested but not yet triggered or +we are in the 1 week period before a fork) the new one will be queued. +*/ + +// NB This doesn't implement IArbitrator because that requires slightly more functions than we need +// TODO: Would be good to make a stripped-down IArbitrator that only has the essential functions +interface IL2ForkArbitrator is IBridgeMessageReceiver { + // @dev Error thrown when the arbitration data is not set + error ArbitrationDataNotSet(); + // @dev Error thrown when the arbitration fee is 0 + error ArbitrationFeeMustBePositive(); + // @dev Error thrown when the arbitration request has already been made + error ArbitrationAlreadyRequested(); + // @dev Error thrown when the fork is already in progress over something else + error ForkInProgress(); + // @dev Error thrown when the L2 bridge is not set + error L2BridgeNotSet(); + // @dev Error thrown when the fork is not in progress + error QuestionNotForked(); + // @dev Error thrown when status is not FORK_REQUESTED + error StatusNotForkRequested(); + // @dev Error thrown when status is not FORK_REQUEST_FAILED + error StatusNotForkRequestFailed(); + // @dev Error thrown when the fork is not in progress + error WrongStatus(); + // @dev Error thrown when called with wrong network + error WrongNetwork(); + // @dev Error thrown when called with wrong sender + error WrongSender(); + // @dev Error thrown when called from the wrong bridge + error WrongBridge(); + // @dev Error thrown when the fork is not in progress + error ForkNotInProgress(); + // @dev Error thrown when contract is not awaiting activation + error NotAwaitingActivation(); + // @dev Error thrown when the request is still in the waiting period + error RequestStillInWaitingPeriod(); + + /// @notice Return the dispute fee for the specified question. 0 indicates that we won't arbitrate it. + /// @dev Uses a general default, takes a question id param for other contracts that may want to set it per-question. + function getDisputeFee(bytes32) external view returns (uint256); + + /// @notice Request arbitration, freezing the question until we send submitAnswerByArbitrator + /// @dev The bounty can be paid only in part, in which case the last person to pay will be considered the payer + /// Will trigger an error if the notification fails, eg because the question has already been finalized + /// @param questionId The question in question + /// @param maxPrevious If specified, reverts if a bond higher than this was submitted after you sent your transaction. + function requestArbitration( + bytes32 questionId, + uint256 maxPrevious + ) external payable returns (bool); + + function storeInformation( + uint256 templateId, + uint32 openingTs, + string calldata question, + uint32 timeout, + uint32 minBond, + uint256 nonce, + uint256 delay + ) external; + + /// @notice Request a fork via the bridge + /// @dev Talks to the L1 ForkingManager asynchronously, and may fail. + /// @param questionId The questionId in the question + function requestActivateFork(bytes32 questionId) external; + + // If the fork request fails, we will get a message back through the bridge telling us about it + // We will set FORK_REQUEST_FAILED which will allow anyone to request cancellation + function onMessageReceived( + address _originAddress, + uint32 _originNetwork, + bytes memory _data + ) external payable; + + /// @notice Submit the arbitrator's answer to a question, assigning the winner automatically. + /// @param question_id The question in question + /// @param last_history_hash The history hash before the final one + /// @param last_answer_or_commitment_id The last answer given, or the commitment ID if it was a commitment. + /// @param last_answerer The address that supplied the last answer + function handleCompletedFork( + bytes32 question_id, + bytes32 last_history_hash, + bytes32 last_answer_or_commitment_id, + address last_answerer + ) external; + + /// @notice Cancel a previous arbitration request + /// @dev This is intended for situations where the stuff is happening non-atomically and the fee changes or someone else forks before us + /// @dev Another way to handle this might be to go back into QUEUED state and let people keep retrying + /// @dev NB This may revert if the contract has returned funds in the bridge but claimAsset hasn't been called yet + /// @param question_id The question in question + function cancelArbitration(bytes32 question_id) external; + function claimRefund() external; +} From 4852c72502233e4b4135af76af1d8a5720584f01 Mon Sep 17 00:00:00 2001 From: josojo Date: Sat, 20 Jan 2024 13:10:53 +0100 Subject: [PATCH 3/7] on my way to improve it --- .../Pull/AdjudicationFrameworkRequests.sol | 2 +- contracts/L2ForkArbitrator.sol | 16 +++-- contracts/interfaces/IL2ForkArbitrator.sol | 8 +-- contracts/lib/reality-eth/RealityETH-3.0.sol | 1 - .../AdjudicationFrameworkRequests.t.sol | 62 +++++++++---------- 5 files changed, 44 insertions(+), 45 deletions(-) diff --git a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol index 9e2bea72..420f5141 100644 --- a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol +++ b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol @@ -84,7 +84,7 @@ contract AdjudicationFrameworkRequests is /// @param _disputeFee The dispute fee we charge reality.eth users /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support - /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested + /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested constructor( address _realityETH, diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index 4074368b..29c7db18 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.20; // Allow mixed-case variables for compatibility with reality.eth, eg it uses question_id not questionId /* solhint-disable var-name-mixedcase */ - import {L2ChainInfo} from "./L2ChainInfo.sol"; import {L1GlobalForkRequester} from "./L1GlobalForkRequester.sol"; import {IRealityETH} from "./lib/reality-eth/interfaces/IRealityETH.sol"; @@ -22,7 +21,6 @@ we are in the 1 week period before a fork) the new one will be queued. // NB This doesn't implement IArbitrator because that requires slightly more functions than we need // TODO: Would be good to make a stripped-down IArbitrator that only has the essential functions contract L2ForkArbitrator is IL2ForkArbitrator { - bool public isForkInProgress; IRealityETH public realitio; @@ -128,7 +126,7 @@ contract L2ForkArbitrator is IL2ForkArbitrator { uint32 openingTs, string calldata question, uint32 timeout, - uint32 minBond, + uint256 minBond, uint256 nonce, uint256 delay ) public { @@ -146,7 +144,10 @@ contract L2ForkArbitrator is IL2ForkArbitrator { nonce ) ); - arbitrationData[question_id] = ArbitrationData(ArbitrationStatus.SOME, delay); + arbitrationData[question_id] = ArbitrationData( + ArbitrationStatus.SOME, + delay + ); } /// @notice Request a fork via the bridge @@ -155,8 +156,11 @@ contract L2ForkArbitrator is IL2ForkArbitrator { function requestActivateFork(bytes32 question_id) public { if (arbitrationData[question_id].status == ArbitrationStatus.NONE) revert ArbitrationDataNotSet(); - if (arbitrationRequests[question_id].timeOfRequest + arbitrationData[question_id].delay > block.timestamp) - revert RequestStillInWaitingPeriod(); + if ( + arbitrationRequests[question_id].timeOfRequest + + arbitrationData[question_id].delay > + block.timestamp + ) revert RequestStillInWaitingPeriod(); if (isForkInProgress) { revert ForkInProgress(); // Forking over something else } diff --git a/contracts/interfaces/IL2ForkArbitrator.sol b/contracts/interfaces/IL2ForkArbitrator.sol index 52a39e50..022439c5 100644 --- a/contracts/interfaces/IL2ForkArbitrator.sol +++ b/contracts/interfaces/IL2ForkArbitrator.sol @@ -5,8 +5,6 @@ pragma solidity ^0.8.20; // Allow mixed-case variables for compatibility with reality.eth, eg it uses question_id not questionId /* solhint-disable var-name-mixedcase */ - - import {IBridgeMessageReceiver} from "@RealityETH/zkevm-contracts/contracts/interfaces/IBridgeMessageReceiver.sol"; /* @@ -64,16 +62,16 @@ interface IL2ForkArbitrator is IBridgeMessageReceiver { uint256 maxPrevious ) external payable returns (bool); - function storeInformation( + function storeInformation( uint256 templateId, uint32 openingTs, string calldata question, uint32 timeout, - uint32 minBond, + uint256 minBond, uint256 nonce, uint256 delay ) external; - + /// @notice Request a fork via the bridge /// @dev Talks to the L1 ForkingManager asynchronously, and may fail. /// @param questionId The questionId in the question diff --git a/contracts/lib/reality-eth/RealityETH-3.0.sol b/contracts/lib/reality-eth/RealityETH-3.0.sol index 693a8f02..be65af97 100644 --- a/contracts/lib/reality-eth/RealityETH-3.0.sol +++ b/contracts/lib/reality-eth/RealityETH-3.0.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.20; import "./interfaces/IRealityETH.sol"; - import "./BalanceHolder.sol"; contract RealityETH_v3_0 is BalanceHolder, IRealityETH { diff --git a/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol index 4265d871..c1a042ed 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol @@ -645,7 +645,6 @@ contract AdjudicationIntegrationTest is Test { } function testArbitrationContestForkFailed() public { - uint256 additionalDelayForRequest = 100000; (, bytes32 removalQuestionId, , , ) = _setupContestedArbitration(); // Currently in the "yes" state, so once it times out we can complete the removal @@ -686,8 +685,7 @@ contract AdjudicationIntegrationTest is Test { // l2ForkArbitrator.requestActivateFork(removalQuestionId); - - // assertTrue(l2ForkArbitrator.isForkInProgress(), "In forking state"); + assertTrue(l2ForkArbitrator.isForkInProgress(), "In forking state"); // L1 STUFF HAPPENS HERE // Assume somebody else called fork or the fee changed or something. @@ -695,38 +693,38 @@ contract AdjudicationIntegrationTest is Test { // NB Here we're sending the payment directly // In fact it seems like it would have to be claimed separately - // assertEq(address(l2ForkArbitrator).balance, 0); - // payable(address(l2Bridge)).transfer(1000000); // Fund it so it can fund the L2ForkArbitrator - // bytes memory fakeMessageData = abi.encode(removalQuestionId); - // l2Bridge.fakeClaimMessage( - // address(l1GlobalForkRequester), - // uint32(0), - // address(l2ForkArbitrator), - // fakeMessageData, - // forkFee - // ); - // assertEq(address(l2ForkArbitrator).balance, forkFee); - - // assertFalse( - // l2ForkArbitrator.isForkInProgress(), - // "Not in forking state" - // ); - - // vm.expectRevert(IL2ForkArbitrator.WrongSender.selector); - // l2ForkArbitrator.requestActivateFork(removalQuestionId); + assertEq(address(l2ForkArbitrator).balance, 0); + payable(address(l2Bridge)).transfer(1000000); // Fund it so it can fund the L2ForkArbitrator + bytes memory fakeMessageData = abi.encode(removalQuestionId); + l2Bridge.fakeClaimMessage( + address(l1GlobalForkRequester), + uint32(0), + address(l2ForkArbitrator), + fakeMessageData, + forkFee + ); + assertEq(address(l2ForkArbitrator).balance, forkFee); - // vm.expectRevert(IL2ForkArbitrator.WrongSender.selector); - // l2ForkArbitrator.cancelArbitration(removalQuestionId); + assertFalse( + l2ForkArbitrator.isForkInProgress(), + "Not in forking state" + ); + + vm.expectRevert(IL2ForkArbitrator.WrongSender.selector); + l2ForkArbitrator.requestActivateFork(removalQuestionId); - // vm.prank(user2); - // l2ForkArbitrator.cancelArbitration(removalQuestionId); - // assertEq(forkFee, l2ForkArbitrator.refundsDue(user2)); + vm.expectRevert(IL2ForkArbitrator.WrongSender.selector); + l2ForkArbitrator.cancelArbitration(removalQuestionId); - // uint256 user2Bal = user2.balance; - // vm.prank(user2); - // l2ForkArbitrator.claimRefund(); - // assertEq(address(l2ForkArbitrator).balance, 0); - // assertEq(user2.balance, user2Bal + forkFee); + vm.prank(user2); + l2ForkArbitrator.cancelArbitration(removalQuestionId); + assertEq(forkFee, l2ForkArbitrator.refundsDue(user2)); + + uint256 user2Bal = user2.balance; + vm.prank(user2); + l2ForkArbitrator.claimRefund(); + assertEq(address(l2ForkArbitrator).balance, 0); + assertEq(user2.balance, user2Bal + forkFee); } /* From 01dba63f6a3429e3a5def16c60daf6495c221eb9 Mon Sep 17 00:00:00 2001 From: josojo Date: Fri, 26 Jan 2024 11:16:26 +0100 Subject: [PATCH 4/7] clean up function parameter documentaiton --- contracts/L2ForkArbitrator.sol | 29 ++++++---------------- contracts/interfaces/IL2ForkArbitrator.sol | 12 +++++++++ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index 29c7db18..d48ecad6 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -77,17 +77,12 @@ contract L2ForkArbitrator is IL2ForkArbitrator { disputeFee = _initialDisputeFee; } - /// @notice Return the dispute fee for the specified question. 0 indicates that we won't arbitrate it. - /// @dev Uses a general default, takes a question id param for other contracts that may want to set it per-question. + /// @inheritdoc IL2ForkArbitrator function getDisputeFee(bytes32) public view returns (uint256) { return disputeFee; } - /// @notice Request arbitration, freezing the question until we send submitAnswerByArbitrator - /// @dev The bounty can be paid only in part, in which case the last person to pay will be considered the payer - /// Will trigger an error if the notification fails, eg because the question has already been finalized - /// @param questionId The question in question - /// @param maxPrevious If specified, reverts if a bond higher than this was submitted after you sent your transaction. + /// @inheritdoc IL2ForkArbitrator function requestArbitration( bytes32 questionId, uint256 maxPrevious @@ -121,6 +116,7 @@ contract L2ForkArbitrator is IL2ForkArbitrator { return true; } + /// @inheritdoc IL2ForkArbitrator function storeInformation( uint256 templateId, uint32 openingTs, @@ -150,9 +146,7 @@ contract L2ForkArbitrator is IL2ForkArbitrator { ); } - /// @notice Request a fork via the bridge - /// @dev Talks to the L1 ForkingManager asynchronously, and may fail. - /// @param question_id The question in question + /// @inheritdoc IL2ForkArbitrator function requestActivateFork(bytes32 question_id) public { if (arbitrationData[question_id].status == ArbitrationStatus.NONE) revert ArbitrationDataNotSet(); @@ -223,8 +217,7 @@ contract L2ForkArbitrator is IL2ForkArbitrator { isForkInProgress = true; } - // If the fork request fails, we will get a message back through the bridge telling us about it - // We will set FORK_REQUEST_FAILED which will allow anyone to request cancellation + /// @inheritdoc IL2ForkArbitrator function onMessageReceived( address _originAddress, uint32 _originNetwork, @@ -257,11 +250,7 @@ contract L2ForkArbitrator is IL2ForkArbitrator { // We don't check the funds are back here, just assume L1GlobalForkRequester send them and they can be recovered. } - /// @notice Submit the arbitrator's answer to a question, assigning the winner automatically. - /// @param question_id The question in question - /// @param last_history_hash The history hash before the final one - /// @param last_answer_or_commitment_id The last answer given, or the commitment ID if it was a commitment. - /// @param last_answerer The address that supplied the last answer + /// @inheritdoc IL2ForkArbitrator function handleCompletedFork( bytes32 question_id, bytes32 last_history_hash, @@ -299,11 +288,7 @@ contract L2ForkArbitrator is IL2ForkArbitrator { delete (arbitrationRequests[question_id]); } - /// @notice Cancel a previous arbitration request - /// @dev This is intended for situations where the stuff is happening non-atomically and the fee changes or someone else forks before us - /// @dev Another way to handle this might be to go back into QUEUED state and let people keep retrying - /// @dev NB This may revert if the contract has returned funds in the bridge but claimAsset hasn't been called yet - /// @param question_id The question in question + /// @inheritdoc IL2ForkArbitrator function cancelArbitration(bytes32 question_id) external { // For simplicity we won't let you cancel until forking is sorted, as you might retry and keep failing for the same reason if (isForkInProgress) { diff --git a/contracts/interfaces/IL2ForkArbitrator.sol b/contracts/interfaces/IL2ForkArbitrator.sol index 022439c5..ecaf5a8f 100644 --- a/contracts/interfaces/IL2ForkArbitrator.sol +++ b/contracts/interfaces/IL2ForkArbitrator.sol @@ -62,6 +62,16 @@ interface IL2ForkArbitrator is IBridgeMessageReceiver { uint256 maxPrevious ) external payable returns (bool); + + /// @notice If the fork request fails, we will get a message back through the bridge telling us about it + /// We will set FORK_REQUEST_FAILED which will allow anyone to request cancellation + /// @param templateId The templateId of the question + /// @param openingTs The opening timestamp of the question + /// @param question The question + /// @param timeout The timeout of the question + /// @param minBond The minimum bond of the question + /// @param nonce The nonce of the question + /// @param delay The delay for the L2 ForkArbitrator function storeInformation( uint256 templateId, uint32 openingTs, @@ -103,5 +113,7 @@ interface IL2ForkArbitrator is IBridgeMessageReceiver { /// @dev NB This may revert if the contract has returned funds in the bridge but claimAsset hasn't been called yet /// @param question_id The question in question function cancelArbitration(bytes32 question_id) external; + + /// @notice Claim the refund for a question that was forked function claimRefund() external; } From 227ea57f50b7a631f8b2829283c40ce876834eda Mon Sep 17 00:00:00 2001 From: josojo Date: Fri, 26 Jan 2024 13:01:06 +0100 Subject: [PATCH 5/7] adding test that shows that storing the delay works --- .../MinimalAdjudicationFramework.sol | 11 +++++----- .../Pull/AdjudicationFrameworkRequests.sol | 6 +++--- .../Push/AdjudicationFrameworkFeeds.sol | 6 +++--- contracts/L2ForkArbitrator.sol | 4 ++++ contracts/interfaces/IL2ForkArbitrator.sol | 1 - .../AdjudicationFrameworkMinimal.t.sol | 21 +++++++++++++++++++ 6 files changed, 37 insertions(+), 12 deletions(-) diff --git a/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol b/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol index 24b2a778..cbfb4d73 100644 --- a/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol +++ b/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol @@ -76,7 +76,8 @@ contract MinimalAdjudicationFramework { // When they're all cleared they can be unfrozen. mapping(address => uint256) public countArbitratorFreezePropositions; - uint256 public arbitrationDelayForCollectingEvidence; + // extra time period given to the ecosystem before a fork is activated + uint256 public forkActivationDeplay; IRealityETH public realityETH; modifier onlyArbitrator() { @@ -90,18 +91,18 @@ contract MinimalAdjudicationFramework { /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support /// @param _allowReplacementModification Whether to allow multiple modifications at once - /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested + /// @param _forkActivationDeplay The delay before arbitration can be requested constructor( address _realityETH, address _forkArbitrator, address[] memory _initialArbitrators, bool _allowReplacementModification, - uint256 _arbitrationDelayForCollectingEvidence + uint256 _forkActivationDeplay ) { allowReplacementModification = _allowReplacementModification; realityETH = IRealityETH(_realityETH); forkArbitrator = _forkArbitrator; - arbitrationDelayForCollectingEvidence = _arbitrationDelayForCollectingEvidence; + forkActivationDeplay = _forkActivationDeplay; // Create reality.eth templates for our add questions // We'll identify ourselves in the template so we only need a single parameter for questions, the arbitrator in question. // TODO: We may want to specify a document with the terms that guide this decision here, rather than just leaving it implicit. @@ -182,7 +183,7 @@ contract MinimalAdjudicationFramework { REALITY_ETH_TIMEOUT, REALITY_ETH_BOND_ARBITRATOR_REMOVE, 0, - arbitrationDelayForCollectingEvidence + forkActivationDeplay ); if ( propositions[questionId].arbitratorToAdd != address(0) || diff --git a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol index 420f5141..e176e76a 100644 --- a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol +++ b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol @@ -84,7 +84,7 @@ contract AdjudicationFrameworkRequests is /// @param _disputeFee The dispute fee we charge reality.eth users /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support - /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested + /// @param _forkActivationDeplay The delay before arbitration can be requested constructor( address _realityETH, @@ -92,14 +92,14 @@ contract AdjudicationFrameworkRequests is address _forkArbitrator, address[] memory _initialArbitrators, bool _allowReplacementModification, - uint256 _arbitrationDelayForCollectingEvidence + uint256 _forkActivationDeplay ) MinimalAdjudicationFramework( _realityETH, _forkArbitrator, _initialArbitrators, _allowReplacementModification, - _arbitrationDelayForCollectingEvidence + _forkActivationDeplay ) { dispute_fee = _disputeFee; diff --git a/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol b/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol index 6835f91f..10a36417 100644 --- a/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol +++ b/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol @@ -31,19 +31,19 @@ contract AdjudicationFrameworkFeeds is MinimalAdjudicationFramework { /// @param _realityETH The reality.eth instance we adjudicate for /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support - /// @param _arbitrationDelayForCollectingEvidence The delay before arbitration can be requested + /// @param _forkActivationDeplay The delay before arbitration can be requested constructor( address _realityETH, address _forkArbitrator, address[] memory _initialArbitrators, - uint256 _arbitrationDelayForCollectingEvidence + uint256 _forkActivationDeplay ) MinimalAdjudicationFramework( _realityETH, _forkArbitrator, _initialArbitrators, true, // replace method can be used to switch out arbitrators - _arbitrationDelayForCollectingEvidence + _forkActivationDeplay ) {} diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index d48ecad6..ed75af2b 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -55,7 +55,11 @@ contract L2ForkArbitrator is IL2ForkArbitrator { uint256 remaining ); + // stores data on the arbitration process + // questionId => ArbitrationRequest mapping(bytes32 => ArbitrationRequest) public arbitrationRequests; + // stores data on the arbitration itself + // questionId => ArbitrationData mapping(bytes32 => ArbitrationData) public arbitrationData; mapping(address => uint256) public refundsDue; diff --git a/contracts/interfaces/IL2ForkArbitrator.sol b/contracts/interfaces/IL2ForkArbitrator.sol index ecaf5a8f..f80a22dc 100644 --- a/contracts/interfaces/IL2ForkArbitrator.sol +++ b/contracts/interfaces/IL2ForkArbitrator.sol @@ -62,7 +62,6 @@ interface IL2ForkArbitrator is IBridgeMessageReceiver { uint256 maxPrevious ) external payable returns (bool); - /// @notice If the fork request fails, we will get a message back through the bridge telling us about it /// We will set FORK_REQUEST_FAILED which will allow anyone to request cancellation /// @param templateId The templateId of the question diff --git a/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol index b095bc78..33760926 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol @@ -290,6 +290,27 @@ contract AdjudicationIntegrationTest is Test { ); } + function testStoresTheForkDelayCorrectly() public { + uint256 delay = 123; + address[] memory initialArbs= new address[](2); + MinimalAdjudicationFramework adjudicationFrameworkWithDelay = new AdjudicationFrameworkRequests( + address(l2RealityEth), + 123, + address(l2ForkArbitrator), + initialArbs, + true, + delay + ); + bytes32 questionIdAddMultiple = adjudicationFrameworkWithDelay + .requestModificationOfArbitrators(address(0), address(0x1000)); + (,uint256 storedDelay) = l2ForkArbitrator.arbitrationData(questionIdAddMultiple); + assertEq( + delay, + storedDelay, + "delay not stored correctly" + ); + } + function testrequestModificationOfArbitrators() public { // Scenario 1: Add 1 arbitrator From f52e1faa3ebd85aae75f250dd6f044d605ff484a Mon Sep 17 00:00:00 2001 From: josojo Date: Fri, 26 Jan 2024 13:14:01 +0100 Subject: [PATCH 6/7] smaller fixes --- contracts/L2ForkArbitrator.sol | 6 ++++- .../AdjudicationFrameworkMinimal.t.sol | 24 +++++++++---------- .../AdjudicationFrameworkRequests.t.sol | 8 ------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index ed75af2b..0b4bc5da 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -114,7 +114,11 @@ contract L2ForkArbitrator is IL2ForkArbitrator { ); emit LogRequestArbitration(questionId, msg.value, msg.sender, 0); - if (!isForkInProgress && arbitrationData[questionId].delay == 0) { + if ( + !isForkInProgress && + arbitrationData[questionId].delay == 0 && + arbitrationData[questionId].status == ArbitrationStatus.SOME + ) { requestActivateFork(questionId); } return true; diff --git a/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol index 33760926..9b6836e4 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkMinimal.t.sol @@ -292,23 +292,21 @@ contract AdjudicationIntegrationTest is Test { function testStoresTheForkDelayCorrectly() public { uint256 delay = 123; - address[] memory initialArbs= new address[](2); + address[] memory initialArbs = new address[](2); MinimalAdjudicationFramework adjudicationFrameworkWithDelay = new AdjudicationFrameworkRequests( - address(l2RealityEth), - 123, - address(l2ForkArbitrator), - initialArbs, - true, - delay - ); + address(l2RealityEth), + 123, + address(l2ForkArbitrator), + initialArbs, + true, + delay + ); bytes32 questionIdAddMultiple = adjudicationFrameworkWithDelay .requestModificationOfArbitrators(address(0), address(0x1000)); - (,uint256 storedDelay) = l2ForkArbitrator.arbitrationData(questionIdAddMultiple); - assertEq( - delay, - storedDelay, - "delay not stored correctly" + (, uint256 storedDelay) = l2ForkArbitrator.arbitrationData( + questionIdAddMultiple ); + assertEq(delay, storedDelay, "delay not stored correctly"); } function testrequestModificationOfArbitrators() public { diff --git a/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol b/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol index c1a042ed..13bdf453 100644 --- a/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol +++ b/test/AdjudicationFramework/AdjudicationFrameworkRequests.t.sol @@ -676,14 +676,6 @@ contract AdjudicationIntegrationTest is Test { removalQuestionId, 0 ); - // vm.expectRevert(IL2ForkArbitrator.RequestStillInWaitingPeriod.selector); - // l2ForkArbitrator.requestActivateFork(removalQuestionId); - - // skip(additionalDelayForRequest); - // vm.expectRevert(IL2ForkArbitrator.ArbitrationDataNotSet.selector); - // l2ForkArbitrator.requestActivateFork(removalQuestionId); - - // l2ForkArbitrator.requestActivateFork(removalQuestionId); assertTrue(l2ForkArbitrator.isForkInProgress(), "In forking state"); From 58109bd9b473a2945e05332d49a270ef103175ae Mon Sep 17 00:00:00 2001 From: josojo Date: Tue, 30 Jan 2024 17:48:47 +0100 Subject: [PATCH 7/7] spelling error --- .../MinimalAdjudicationFramework.sol | 10 +++++----- .../Pull/AdjudicationFrameworkRequests.sol | 6 +++--- .../Push/AdjudicationFrameworkFeeds.sol | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol b/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol index cbfb4d73..49098896 100644 --- a/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol +++ b/contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol @@ -77,7 +77,7 @@ contract MinimalAdjudicationFramework { mapping(address => uint256) public countArbitratorFreezePropositions; // extra time period given to the ecosystem before a fork is activated - uint256 public forkActivationDeplay; + uint256 public forkActivationDelay; IRealityETH public realityETH; modifier onlyArbitrator() { @@ -91,18 +91,18 @@ contract MinimalAdjudicationFramework { /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support /// @param _allowReplacementModification Whether to allow multiple modifications at once - /// @param _forkActivationDeplay The delay before arbitration can be requested + /// @param _forkActivationDelay The delay before arbitration can be requested constructor( address _realityETH, address _forkArbitrator, address[] memory _initialArbitrators, bool _allowReplacementModification, - uint256 _forkActivationDeplay + uint256 _forkActivationDelay ) { allowReplacementModification = _allowReplacementModification; realityETH = IRealityETH(_realityETH); forkArbitrator = _forkArbitrator; - forkActivationDeplay = _forkActivationDeplay; + forkActivationDelay = _forkActivationDelay; // Create reality.eth templates for our add questions // We'll identify ourselves in the template so we only need a single parameter for questions, the arbitrator in question. // TODO: We may want to specify a document with the terms that guide this decision here, rather than just leaving it implicit. @@ -183,7 +183,7 @@ contract MinimalAdjudicationFramework { REALITY_ETH_TIMEOUT, REALITY_ETH_BOND_ARBITRATOR_REMOVE, 0, - forkActivationDeplay + forkActivationDelay ); if ( propositions[questionId].arbitratorToAdd != address(0) || diff --git a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol index e176e76a..11db8732 100644 --- a/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol +++ b/contracts/AdjudicationFramework/Pull/AdjudicationFrameworkRequests.sol @@ -84,7 +84,7 @@ contract AdjudicationFrameworkRequests is /// @param _disputeFee The dispute fee we charge reality.eth users /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support - /// @param _forkActivationDeplay The delay before arbitration can be requested + /// @param _forkActivationDelay The delay before arbitration can be requested constructor( address _realityETH, @@ -92,14 +92,14 @@ contract AdjudicationFrameworkRequests is address _forkArbitrator, address[] memory _initialArbitrators, bool _allowReplacementModification, - uint256 _forkActivationDeplay + uint256 _forkActivationDelay ) MinimalAdjudicationFramework( _realityETH, _forkArbitrator, _initialArbitrators, _allowReplacementModification, - _forkActivationDeplay + _forkActivationDelay ) { dispute_fee = _disputeFee; diff --git a/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol b/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol index 10a36417..cc59e9fa 100644 --- a/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol +++ b/contracts/AdjudicationFramework/Push/AdjudicationFrameworkFeeds.sol @@ -31,19 +31,19 @@ contract AdjudicationFrameworkFeeds is MinimalAdjudicationFramework { /// @param _realityETH The reality.eth instance we adjudicate for /// @param _forkArbitrator The arbitrator contract that escalates to an L1 fork, used for our governance /// @param _initialArbitrators Arbitrator contracts we initially support - /// @param _forkActivationDeplay The delay before arbitration can be requested + /// @param _forkActivationDelay The delay before arbitration can be requested constructor( address _realityETH, address _forkArbitrator, address[] memory _initialArbitrators, - uint256 _forkActivationDeplay + uint256 _forkActivationDelay ) MinimalAdjudicationFramework( _realityETH, _forkArbitrator, _initialArbitrators, true, // replace method can be used to switch out arbitrators - _forkActivationDeplay + _forkActivationDelay ) {}