From f65d166214ab101859f508e0ac5808394e2f866e Mon Sep 17 00:00:00 2001 From: Edmund Edgar Date: Tue, 28 Nov 2023 03:36:10 +0000 Subject: [PATCH] standardize on eg l2CamelCase not l2camelCase --- contracts/L2ChainInfo.sol | 14 +-- contracts/L2ForkArbitrator.sol | 22 ++-- test/AdjudicationIntegration.t.sol | 138 +++++++++++++------------- test/L1GlobalChainInfoPublisher.t.sol | 20 ++-- test/L1GlobalForkRequester.t.sol | 36 +++---- 5 files changed, 115 insertions(+), 115 deletions(-) diff --git a/contracts/L2ChainInfo.sol b/contracts/L2ChainInfo.sol index 67fafe2c..b14cde48 100644 --- a/contracts/L2ChainInfo.sol +++ b/contracts/L2ChainInfo.sol @@ -16,8 +16,8 @@ import {IBridgeMessageReceiver} from "@RealityETH/zkevm-contracts/contracts/inte contract L2ChainInfo is IBridgeMessageReceiver{ // These are the same for all forks - address public l2bridge; - address public l1globalChainInfoPublisher; + address public l2Bridge; + address public l1GlobalChainInfoPublisher; uint32 public constant L1_NETWORK_ID = 0; struct ChainInfo{ @@ -31,9 +31,9 @@ contract L2ChainInfo is IBridgeMessageReceiver{ mapping(bool=>mapping(address=>mapping(bytes32=>bytes32))) public forkQuestionResults; mapping(bool=>mapping(address=>mapping(bytes32=>uint64))) public questionToChainID; - constructor(address _l2bridge, address _l1globalChainInfoPublisher) { - l2bridge = _l2bridge; - l1globalChainInfoPublisher = _l1globalChainInfoPublisher; + constructor(address _l2Bridge, address _l1GlobalChainInfoPublisher) { + l2Bridge = _l2Bridge; + l1GlobalChainInfoPublisher = _l1GlobalChainInfoPublisher; } modifier isUpToDate { @@ -58,8 +58,8 @@ contract L2ChainInfo is IBridgeMessageReceiver{ // It could also send us information about a previous chain that's a parent of ours if we forked again before getting it for some reason. function onMessageReceived(address _originAddress, uint32 _originNetwork, bytes memory _data) external payable { - require(msg.sender == l2bridge, "not the expected bridge"); - require(_originAddress == l1globalChainInfoPublisher, "only publisher can call us"); + require(msg.sender == l2Bridge, "not the expected bridge"); + require(_originAddress == l1GlobalChainInfoPublisher, "only publisher can call us"); require(_originNetwork == L1_NETWORK_ID, "Bad origin network"); (uint64 chainId, address forkonomicToken, uint256 forkFee, bool isL1, address forker, bytes32 questionId, bytes32 result) = abi.decode(_data, (uint64, address, uint256, bool, address, bytes32, bytes32)); diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index cbb14096..69430e9d 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -52,14 +52,14 @@ contract L2ForkArbitrator is MoneyBoxUser, IBridgeMessageReceiver { mapping(address => uint256) public refundsDue; L2ChainInfo public chainInfo; - L1GlobalForkRequester public l1globalForkRequester; + L1GlobalForkRequester public l1GlobalForkRequester; uint256 public disputeFee; // Normally dispute fee should generally only go down in a fork - constructor(IRealityETH _realitio, L2ChainInfo _chainInfo, L1GlobalForkRequester _l1globalForkRequester, uint256 _initialDisputeFee) { + constructor(IRealityETH _realitio, L2ChainInfo _chainInfo, L1GlobalForkRequester _l1GlobalForkRequester, uint256 _initialDisputeFee) { realitio = _realitio; chainInfo = _chainInfo; - l1globalForkRequester = _l1globalForkRequester; + l1GlobalForkRequester = _l1GlobalForkRequester; disputeFee = _initialDisputeFee; } @@ -119,19 +119,19 @@ contract L2ForkArbitrator is MoneyBoxUser, IBridgeMessageReceiver { uint256 paid = arbitrationRequests[question_id].paid; require(paid >= forkFee, "fee paid too low"); - address l2bridge = chainInfo.l2bridge(); - require(l2bridge != address(0), "l2bridge not set"); + address l2Bridge = chainInfo.l2Bridge(); + require(l2Bridge != address(0), "l2Bridge not set"); - IPolygonZkEVMBridge bridge = IPolygonZkEVMBridge(l2bridge); + IPolygonZkEVMBridge bridge = IPolygonZkEVMBridge(l2Bridge); address forkonomicToken = chainInfo.getForkonomicToken(); // The receiving contract may get different payments from different requests - // To differentiate our payment, we will use a dedicated MoneyBox contract controlled by l1globalForkRequester + // To differentiate our payment, we will use a dedicated MoneyBox contract controlled by l1GlobalForkRequester // The L1GlobalForkRequester will deploy this as and when it's needed. // TODO: For now we assume only 1 request is in-flight at a time. If there might be more, differentiate them in the salt. bytes32 salt = keccak256(abi.encodePacked(address(this), question_id)); - address moneyBox = _calculateMoneyBoxAddress(address(l1globalForkRequester), salt, address(forkonomicToken)); + address moneyBox = _calculateMoneyBoxAddress(address(l1GlobalForkRequester), salt, address(forkonomicToken)); bytes memory permitData; bridge.bridgeAsset{value: forkFee}( @@ -150,10 +150,10 @@ contract L2ForkArbitrator is MoneyBoxUser, IBridgeMessageReceiver { // We will set FORK_REQUEST_FAILED which will allow anyone to request cancellation function onMessageReceived(address _originAddress, uint32 _originNetwork, bytes memory _data) external payable { - address l2bridge = chainInfo.l2bridge(); - require(msg.sender == l2bridge, "Not our bridge"); + address l2Bridge = chainInfo.l2Bridge(); + require(msg.sender == l2Bridge, "Not our bridge"); require(_originNetwork == uint32(0), "Wrong network, WTF"); - require(_originAddress == address(l1globalForkRequester), "Unexpected sender"); + require(_originAddress == address(l1GlobalForkRequester), "Unexpected sender"); bytes32 question_id = bytes32(_data); RequestStatus status = arbitrationRequests[question_id].status; diff --git a/test/AdjudicationIntegration.t.sol b/test/AdjudicationIntegration.t.sol index d7c5eceb..4401c652 100644 --- a/test/AdjudicationIntegration.t.sol +++ b/test/AdjudicationIntegration.t.sol @@ -31,8 +31,8 @@ contract AdjudicationIntegrationTest is Test { IERC20 internal tokenMock = IERC20(0x1234567890123456789012345678901234567890); - ForkableRealityETH_ERC20 internal l1realityEth; - RealityETH_v3_0 internal l2realityEth; + ForkableRealityETH_ERC20 internal l1RealityEth; + RealityETH_v3_0 internal l2RealityEth; bytes32 internal addArbitratorQID1; bytes32 internal addArbitratorQID2; @@ -44,7 +44,7 @@ contract AdjudicationIntegrationTest is Test { AdjudicationFramework internal adjudicationFramework1; AdjudicationFramework internal adjudicationFramework2; - L2ForkArbitrator internal l2forkArbitrator; + L2ForkArbitrator internal l2ForkArbitrator; L2ChainInfo internal l2ChainInfo; Arbitrator internal l2Arbitrator1; @@ -93,7 +93,7 @@ contract AdjudicationIntegrationTest is Test { address internal l1ForkingManagerF2 = address(0x2abe13); address internal l1TokenF2 = address(0x2abe14); - uint64 internal l2chainIdInit = 1; + uint64 internal l2ChainIdInit = 1; uint256 internal forkingFee = 5000; // Should ultimately come from l1 forkingmanager @@ -107,14 +107,14 @@ contract AdjudicationIntegrationTest is Test { // Pretend to send the initial setup to the l2 directory via the bridge // Triggers: - // l2ChainInfo.onMessageReceived(l1GlobalChainInfoPublisher, l1chainId, fakeMessageData); + // l2ChainInfo.onMessageReceived(l1GlobalChainInfoPublisher, l1ChainId, fakeMessageData); // In reality this would originate on L1. - vm.chainId(l2chainIdInit); - bytes memory fakeMessageData = abi.encode(l2chainIdInit, address(l1ForkingManager), uint256(forkingFee), false, address(l2forkArbitrator), bytes32(0x0), bytes32(0x0)); + vm.chainId(l2ChainIdInit); + bytes memory fakeMessageData = abi.encode(l2ChainIdInit, address(l1ForkingManager), uint256(forkingFee), false, address(l2ForkArbitrator), bytes32(0x0), bytes32(0x0)); l2Bridge.fakeClaimMessage(address(l1GlobalChainInfoPublisher), uint32(0), address(l2ChainInfo), fakeMessageData, uint256(0)); - l1realityEth = new ForkableRealityETH_ERC20(); - l1realityEth.init(tokenMock, address(0), bytes32(0)); + l1RealityEth = new ForkableRealityETH_ERC20(); + l1RealityEth.init(tokenMock, address(0), bytes32(0)); /* Creates templates 1, 2, 3 as @@ -126,16 +126,16 @@ contract AdjudicationIntegrationTest is Test { // Should be a governance arbitrator for adjudicating upgrades govArb = new Arbitrator(); - govArb.setRealitio(address(l1realityEth)); + govArb.setRealitio(address(l1RealityEth)); govArb.setDisputeFee(50); user1.transfer(1000000); user2.transfer(1000000); // NB we're modelling this on the same chain but it should really be the l2 - l2realityEth = new RealityETH_v3_0(); + l2RealityEth = new RealityETH_v3_0(); - l2forkArbitrator = new L2ForkArbitrator(IRealityETH(l2realityEth), L2ChainInfo(l2ChainInfo), L1GlobalForkRequester(l1GlobalForkRequester), forkingFee); + l2ForkArbitrator = new L2ForkArbitrator(IRealityETH(l2RealityEth), L2ChainInfo(l2ChainInfo), L1GlobalForkRequester(l1GlobalForkRequester), forkingFee); // The adjudication framework can act like a regular reality.eth arbitrator. // It will also use reality.eth to arbitrate its own governance, using the L2ForkArbitrator which makes L1 fork requests. @@ -143,7 +143,7 @@ contract AdjudicationIntegrationTest is Test { initialArbitrators[0] = initialArbitrator1; initialArbitrators[1] = initialArbitrator2; vm.prank(adjudictionDeployer); - adjudicationFramework1 = new AdjudicationFramework(address(l2realityEth), 123, address(l2forkArbitrator), initialArbitrators); + adjudicationFramework1 = new AdjudicationFramework(address(l2RealityEth), 123, address(l2ForkArbitrator), initialArbitrators); l2Arbitrator1 = new Arbitrator(); // NB The adjudication framework looks to individual arbitrators like a reality.eth question, so they can use it without being changed. @@ -160,16 +160,16 @@ contract AdjudicationIntegrationTest is Test { // Contested cases should also be tested. addArbitratorQID1 = adjudicationFramework1.beginAddArbitratorToAllowList(address(l2Arbitrator1)); - l2realityEth.submitAnswer{value: 10000}(addArbitratorQID1, bytes32(uint256(1)), 0); + l2RealityEth.submitAnswer{value: 10000}(addArbitratorQID1, bytes32(uint256(1)), 0); - uint32 to = l2realityEth.getTimeout(addArbitratorQID1); + uint32 to = l2RealityEth.getTimeout(addArbitratorQID1); assertEq(to, REALITY_ETH_TIMEOUT); - uint32 finalizeTs = l2realityEth.getFinalizeTS(addArbitratorQID1); + uint32 finalizeTs = l2RealityEth.getFinalizeTS(addArbitratorQID1); assertTrue(finalizeTs > block.timestamp, "finalization ts should be passed block ts"); vm.expectRevert("question must be finalized"); - l2realityEth.resultFor(addArbitratorQID1); + l2RealityEth.resultFor(addArbitratorQID1); assertTrue(finalizeTs > block.timestamp, "finalization ts should be passed block ts"); vm.expectRevert("question must be finalized"); @@ -193,10 +193,10 @@ contract AdjudicationIntegrationTest is Test { function testContestedAddArbitrator() public { addArbitratorQID2 = adjudicationFramework1.beginAddArbitratorToAllowList(address(l2Arbitrator2)); - l2realityEth.submitAnswer{value: 10000}(addArbitratorQID2, bytes32(uint256(1)), 0); - l2realityEth.submitAnswer{value: 20000}(addArbitratorQID2, bytes32(uint256(0)), 0); + l2RealityEth.submitAnswer{value: 10000}(addArbitratorQID2, bytes32(uint256(1)), 0); + l2RealityEth.submitAnswer{value: 20000}(addArbitratorQID2, bytes32(uint256(0)), 0); - l2forkArbitrator.requestArbitration{value: 500000}(addArbitratorQID2, 0); + l2ForkArbitrator.requestArbitration{value: 500000}(addArbitratorQID2, 0); // This talks to the bridge, we fake what happens next. // TODO: Hook this up to the real bridge so we can test it properly. @@ -207,13 +207,13 @@ contract AdjudicationIntegrationTest is Test { internal returns (bytes32) { // ask a question - bytes32 qid = l2realityEth.askQuestion(0, "Question 1", address(adjudicationFramework1), 123, uint32(block.timestamp), 0); + bytes32 qid = l2RealityEth.askQuestion(0, "Question 1", address(adjudicationFramework1), 123, uint32(block.timestamp), 0); // do some bond escalation vm.prank(user1); - l2realityEth.submitAnswer{value: 10}(qid, bytes32(uint256(1)), 0); + l2RealityEth.submitAnswer{value: 10}(qid, bytes32(uint256(1)), 0); vm.prank(user2); - l2realityEth.submitAnswer{value: 20}(qid, bytes32(0), 0); + l2RealityEth.submitAnswer{value: 20}(qid, bytes32(0), 0); return qid; @@ -246,7 +246,7 @@ contract AdjudicationIntegrationTest is Test { skip(86401); adjudicationFramework1.completeArbitration(qid, bytes32(uint256(1)), user1); - assertEq(l2realityEth.resultFor(qid), bytes32(uint256(1)), "reality.eth question should be settled"); + assertEq(l2RealityEth.resultFor(qid), bytes32(uint256(1)), "reality.eth question should be settled"); } @@ -265,7 +265,7 @@ contract AdjudicationIntegrationTest is Test { // now before we can complete this somebody challenges it removalQuestionId = adjudicationFramework1.beginRemoveArbitratorFromAllowList(address(l2Arbitrator1)); - l2realityEth.submitAnswer{value: 10000}(removalQuestionId, bytes32(uint256(1)), 0); + l2RealityEth.submitAnswer{value: 10000}(removalQuestionId, bytes32(uint256(1)), 0); bytes32[] memory hashes; address[] memory users; @@ -275,9 +275,9 @@ contract AdjudicationIntegrationTest is Test { vm.expectRevert("Bond too low to freeze"); adjudicationFramework1.freezeArbitrator(removalQuestionId, hashes, users, bonds, answers); - lastHistoryHash = l2realityEth.getHistoryHash(removalQuestionId); + lastHistoryHash = l2RealityEth.getHistoryHash(removalQuestionId); vm.prank(user2); - l2realityEth.submitAnswer{value: 20000}(removalQuestionId, bytes32(uint256(1)), 0); + l2RealityEth.submitAnswer{value: 20000}(removalQuestionId, bytes32(uint256(1)), 0); adjudicationFramework1.freezeArbitrator(removalQuestionId, hashes, users, bonds, answers); assertEq(adjudicationFramework1.countArbitratorFreezePropositions(address(l2Arbitrator1)), uint256(1)); @@ -304,7 +304,7 @@ contract AdjudicationIntegrationTest is Test { // Now wait for the timeout and settle the proposition vm.expectRevert("question must be finalized"); - l2realityEth.resultFor(removalQuestionId); + l2RealityEth.resultFor(removalQuestionId); vm.expectRevert("question must be finalized"); adjudicationFramework1.executeRemoveArbitratorFromAllowList(removalQuestionId); @@ -321,12 +321,12 @@ contract AdjudicationIntegrationTest is Test { (, bytes32 removalQuestionId, , , ) = _setupContestedArbitration(); // Put the proposition to remove the arbitrator into the "no" state - l2realityEth.submitAnswer{value: 40000}(removalQuestionId, bytes32(uint256(0)), 0); + l2RealityEth.submitAnswer{value: 40000}(removalQuestionId, bytes32(uint256(0)), 0); // Now wait for the timeout and settle the proposition vm.expectRevert("question must be finalized"); - l2realityEth.resultFor(removalQuestionId); + l2RealityEth.resultFor(removalQuestionId); vm.expectRevert("question must be finalized"); adjudicationFramework1.executeRemoveArbitratorFromAllowList(removalQuestionId); @@ -351,14 +351,14 @@ contract AdjudicationIntegrationTest is Test { // Now wait for the timeout and settle the proposition vm.expectRevert("question must be finalized"); - l2realityEth.resultFor(removalQuestionId); + l2RealityEth.resultFor(removalQuestionId); - assertEq(address(l2forkArbitrator.realitio()), address(l2realityEth), "l2forkArbitrator expects to arbitrate our l2realityEth"); - assertEq(address(adjudicationFramework1.realityETH()), address(l2realityEth), "adjudicationFramework1 expects to use our l2realityEth"); - assertEq(address(l2forkArbitrator), l2realityEth.getArbitrator(removalQuestionId), "Arbitrator of the removalQuestionId is l2forkArbitrator"); + assertEq(address(l2ForkArbitrator.realitio()), address(l2RealityEth), "l2ForkArbitrator expects to arbitrate our l2RealityEth"); + assertEq(address(adjudicationFramework1.realityETH()), address(l2RealityEth), "adjudicationFramework1 expects to use our l2RealityEth"); + assertEq(address(l2ForkArbitrator), l2RealityEth.getArbitrator(removalQuestionId), "Arbitrator of the removalQuestionId is l2ForkArbitrator"); - uint256 forkFee = l2forkArbitrator.getDisputeFee(removalQuestionId); - l2forkArbitrator.requestArbitration{value: forkFee}(removalQuestionId, 0); + uint256 forkFee = l2ForkArbitrator.getDisputeFee(removalQuestionId); + l2ForkArbitrator.requestArbitration{value: forkFee}(removalQuestionId, 0); // IMAGINE THE FORK HAPPENED HERE // There are now two L2s, each with a different chain ID @@ -366,13 +366,13 @@ contract AdjudicationIntegrationTest is Test { vm.chainId(newChainId1); // TODO: Adjust the forkingFee as the total supply has changed a bit - bytes memory fakeMessageData = abi.encode(uint64(newChainId1), address(l1ForkingManagerF1), uint256(forkingFee), false, address(l2forkArbitrator), removalQuestionId, bytes32(uint256(1))); + bytes memory fakeMessageData = abi.encode(uint64(newChainId1), address(l1ForkingManagerF1), uint256(forkingFee), false, address(l2ForkArbitrator), removalQuestionId, bytes32(uint256(1))); l2Bridge.fakeClaimMessage(address(l1GlobalChainInfoPublisher), uint32(0), address(l2ChainInfo), fakeMessageData, uint256(0)); - assertTrue(l2realityEth.isPendingArbitration(removalQuestionId)); - l2forkArbitrator.handleCompletedFork(removalQuestionId, lastHistoryHash, lastAnswer, lastAnswerer); + assertTrue(l2RealityEth.isPendingArbitration(removalQuestionId)); + l2ForkArbitrator.handleCompletedFork(removalQuestionId, lastHistoryHash, lastAnswer, lastAnswerer); - assertFalse(l2realityEth.isPendingArbitration(removalQuestionId)); + assertFalse(l2RealityEth.isPendingArbitration(removalQuestionId)); assertEq(adjudicationFramework1.countArbitratorFreezePropositions(address(l2Arbitrator1)), 1); assertTrue(adjudicationFramework1.arbitrators(address(l2Arbitrator1))); @@ -393,15 +393,15 @@ contract AdjudicationIntegrationTest is Test { // Now wait for the timeout and settle the proposition vm.expectRevert("question must be finalized"); - bytes32 result = l2realityEth.resultFor(removalQuestionId); + bytes32 result = l2RealityEth.resultFor(removalQuestionId); assertEq(result, bytes32(uint256(0))); - assertEq(address(l2forkArbitrator.realitio()), address(l2realityEth), "l2forkArbitrator expects to arbitrate our l2realityEth"); - assertEq(address(adjudicationFramework1.realityETH()), address(l2realityEth), "adjudicationFramework1 expects to use our l2realityEth"); - assertEq(address(l2forkArbitrator), l2realityEth.getArbitrator(removalQuestionId), "Arbitrator of the removalQuestionId is l2forkArbitrator"); + assertEq(address(l2ForkArbitrator.realitio()), address(l2RealityEth), "l2ForkArbitrator expects to arbitrate our l2RealityEth"); + assertEq(address(adjudicationFramework1.realityETH()), address(l2RealityEth), "adjudicationFramework1 expects to use our l2RealityEth"); + assertEq(address(l2ForkArbitrator), l2RealityEth.getArbitrator(removalQuestionId), "Arbitrator of the removalQuestionId is l2ForkArbitrator"); - uint256 forkFee = l2forkArbitrator.getDisputeFee(removalQuestionId); - l2forkArbitrator.requestArbitration{value: forkFee}(removalQuestionId, 0); + uint256 forkFee = l2ForkArbitrator.getDisputeFee(removalQuestionId); + l2ForkArbitrator.requestArbitration{value: forkFee}(removalQuestionId, 0); // IMAGINE THE FORK HAPPENED HERE // There are now two L2s, each with a different chain ID @@ -409,13 +409,13 @@ contract AdjudicationIntegrationTest is Test { vm.chainId(newChainId1); // TODO: Adjust the forkingFee as the total supply has changed a bit - bytes memory fakeMessageData = abi.encode(uint64(newChainId1), address(l1ForkingManagerF1), uint256(forkingFee), false, address(l2forkArbitrator), removalQuestionId, bytes32(uint256(0))); + bytes memory fakeMessageData = abi.encode(uint64(newChainId1), address(l1ForkingManagerF1), uint256(forkingFee), false, address(l2ForkArbitrator), removalQuestionId, bytes32(uint256(0))); l2Bridge.fakeClaimMessage(address(l1GlobalChainInfoPublisher), uint32(0), address(l2ChainInfo), fakeMessageData, uint256(0)); - assertTrue(l2realityEth.isPendingArbitration(removalQuestionId)); - l2forkArbitrator.handleCompletedFork(removalQuestionId, lastHistoryHash, lastAnswer, lastAnswerer); + assertTrue(l2RealityEth.isPendingArbitration(removalQuestionId)); + l2ForkArbitrator.handleCompletedFork(removalQuestionId, lastHistoryHash, lastAnswer, lastAnswerer); - assertFalse(l2realityEth.isPendingArbitration(removalQuestionId)); + assertFalse(l2RealityEth.isPendingArbitration(removalQuestionId)); assertEq(adjudicationFramework1.countArbitratorFreezePropositions(address(l2Arbitrator1)), 1); assertTrue(adjudicationFramework1.arbitrators(address(l2Arbitrator1))); @@ -438,18 +438,18 @@ contract AdjudicationIntegrationTest is Test { // Now wait for the timeout and settle the proposition vm.expectRevert("question must be finalized"); - bytes32 result = l2realityEth.resultFor(removalQuestionId); + bytes32 result = l2RealityEth.resultFor(removalQuestionId); assertEq(result, bytes32(uint256(0))); - assertEq(address(l2forkArbitrator.realitio()), address(l2realityEth), "l2forkArbitrator expects to arbitrate our l2realityEth"); - assertEq(address(adjudicationFramework1.realityETH()), address(l2realityEth), "adjudicationFramework1 expects to use our l2realityEth"); - assertEq(address(l2forkArbitrator), l2realityEth.getArbitrator(removalQuestionId), "Arbitrator of the removalQuestionId is l2forkArbitrator"); + assertEq(address(l2ForkArbitrator.realitio()), address(l2RealityEth), "l2ForkArbitrator expects to arbitrate our l2RealityEth"); + assertEq(address(adjudicationFramework1.realityETH()), address(l2RealityEth), "adjudicationFramework1 expects to use our l2RealityEth"); + assertEq(address(l2ForkArbitrator), l2RealityEth.getArbitrator(removalQuestionId), "Arbitrator of the removalQuestionId is l2ForkArbitrator"); - uint256 forkFee = l2forkArbitrator.getDisputeFee(removalQuestionId); + uint256 forkFee = l2ForkArbitrator.getDisputeFee(removalQuestionId); vm.prank(user2); - l2forkArbitrator.requestArbitration{value: forkFee}(removalQuestionId, 0); + l2ForkArbitrator.requestArbitration{value: forkFee}(removalQuestionId, 0); - 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. @@ -457,22 +457,22 @@ 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); + 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); + l2Bridge.fakeClaimMessage(address(l1GlobalForkRequester), uint32(0), address(l2ForkArbitrator), fakeMessageData, forkFee); + assertEq(address(l2ForkArbitrator).balance, forkFee); - assertFalse(l2forkArbitrator.isForkInProgress(), "Not in forking state"); + assertFalse(l2ForkArbitrator.isForkInProgress(), "Not in forking state"); - l2forkArbitrator.cancelArbitration(removalQuestionId); - assertEq(forkFee, l2forkArbitrator.refundsDue(user2)); + l2ForkArbitrator.cancelArbitration(removalQuestionId); + assertEq(forkFee, l2ForkArbitrator.refundsDue(user2)); - uint256 user2bal = user2.balance; + uint256 user2Bal = user2.balance; vm.prank(user2); - l2forkArbitrator.claimRefund(); - assertEq(address(l2forkArbitrator).balance, 0); - assertEq(user2.balance, user2bal + forkFee); + l2ForkArbitrator.claimRefund(); + assertEq(address(l2ForkArbitrator).balance, 0); + assertEq(user2.balance, user2Bal + forkFee); } @@ -482,7 +482,7 @@ contract AdjudicationIntegrationTest is Test { // Creates 2 templates, each with a log entry from reality.eth vm.prank(adjudictionDeployer); - new AdjudicationFramework(address(l2realityEth), 123, address(l2forkArbitrator), initialArbs); + new AdjudicationFramework(address(l2RealityEth), 123, address(l2ForkArbitrator), initialArbs); // NB The length and indexes of this may change if we add unrelated log entries to the AdjudicationFramework constructor Vm.Log[] memory entries = vm.getRecordedLogs(); @@ -503,7 +503,7 @@ contract AdjudicationIntegrationTest is Test { bytes32 questionId = keccak256(abi.encodePacked("Question 1")); // TODO: This should be in some wrapper contract govArb.setDisputeFee(50); vm.mockCall( - address(l1realityEth), + address(l1RealityEth), abi.encodeWithSelector(IRealityETH.isFinalized.selector), abi.encode(true) ); diff --git a/test/L1GlobalChainInfoPublisher.t.sol b/test/L1GlobalChainInfoPublisher.t.sol index 2ff76612..6d7496b6 100644 --- a/test/L1GlobalChainInfoPublisher.t.sol +++ b/test/L1GlobalChainInfoPublisher.t.sol @@ -54,7 +54,7 @@ contract L1GlobalChainInfoPublisherTest is Test { ForkableZkEVM public zkevm; ForkableGlobalExitRoot public globalExitRoot; - ForkableBridge public l2bridge; + ForkableBridge public l2Bridge; address public bridgeImplementation; address public forkmanagerImplementation; @@ -105,7 +105,7 @@ contract L1GlobalChainInfoPublisherTest is Test { bool public isL1 = true; L1GlobalChainInfoPublisher public l1GlobalChainInfoPublisher = new L1GlobalChainInfoPublisher(); - L2ChainInfo public l2ChainInfo = new L2ChainInfo(address(l2bridge), address(l1GlobalChainInfoPublisher)); + L2ChainInfo public l2ChainInfo = new L2ChainInfo(address(l2Bridge), address(l1GlobalChainInfoPublisher)); ForkingManager.DisputeData public disputeData = IForkingManager.DisputeData({ @@ -130,7 +130,7 @@ contract L1GlobalChainInfoPublisherTest is Test { ); // Bridge on l2, should have different chain ID etc - l2bridge = ForkableBridge( + l2Bridge = ForkableBridge( address( new TransparentUpgradeableProxy(bridgeImplementation, admin, "") ) @@ -283,9 +283,9 @@ contract L1GlobalChainInfoPublisherTest is Test { vm.expectRevert("No changes after forking"); l1GlobalChainInfoPublisher.updateL2ChainInfo(address(bridge), address(l2ChainInfo), address(0), uint256(10)); - (address forkmanager1addr, address forkmanager2addr) = forkmanager.getChildren(); - address bridge1 = IForkingManager(forkmanager1addr).bridge(); - address bridge2 = IForkingManager(forkmanager2addr).bridge(); + (address forkmanager1Addrg, address forkmanager2Addr) = forkmanager.getChildren(); + address bridge1 = IForkingManager(forkmanager1Addrg).bridge(); + address bridge2 = IForkingManager(forkmanager2Addr).bridge(); // The new bridges should work though l1GlobalChainInfoPublisher.updateL2ChainInfo(bridge1, address(l2ChainInfo), address(0), uint256(10)); @@ -294,7 +294,7 @@ contract L1GlobalChainInfoPublisherTest is Test { l1GlobalChainInfoPublisher.updateL2ChainInfo(bridge1, address(l2ChainInfo), address(forkmanager), uint256(10)); l1GlobalChainInfoPublisher.updateL2ChainInfo(bridge2, address(l2ChainInfo), address(forkmanager), uint256(10)); - ForkingManager forkmanager2 = ForkingManager(forkmanager2addr); + ForkingManager forkmanager2 = ForkingManager(forkmanager2Addr); ForkonomicToken forkonomicToken2 = ForkonomicToken(forkmanager2.forkonomicToken()); // Next we'll fork with a dispute @@ -321,9 +321,9 @@ contract L1GlobalChainInfoPublisherTest is Test { vm.expectRevert("No changes after forking"); l1GlobalChainInfoPublisher.updateL2ChainInfo(bridge2, address(l2ChainInfo), address(forkmanager), uint256(10)); - (, address forkmanager22addr) = forkmanager2.getChildren(); - // address bridge21 = IForkingManager(forkmanager21addr).bridge(); - address bridge22 = IForkingManager(forkmanager22addr).bridge(); + (, address forkmanager22Addr) = forkmanager2.getChildren(); + // address bridge21 = IForkingManager(forkmanager21Addrg).bridge(); + address bridge22 = IForkingManager(forkmanager22Addr).bridge(); l1GlobalChainInfoPublisher.updateL2ChainInfo(bridge22, address(l2ChainInfo), address(forkmanager), uint256(10)); diff --git a/test/L1GlobalForkRequester.t.sol b/test/L1GlobalForkRequester.t.sol index e99bc08f..ddee52c5 100644 --- a/test/L1GlobalForkRequester.t.sol +++ b/test/L1GlobalForkRequester.t.sol @@ -207,9 +207,9 @@ contract L1GlobalForkRequesterTest is Test { ExampleMoneyBoxUser exampleMoneyBoxUser = new ExampleMoneyBoxUser(); // Receive a payment from a MoneyBox - address l2requester = address(0xbabe01); + address l2Requester = address(0xbabe01); bytes32 requestId = bytes32("0xc0ffee01"); - bytes32 salt = keccak256(abi.encodePacked(l2requester, requestId)); + bytes32 salt = keccak256(abi.encodePacked(l2Requester, requestId)); address moneyBoxAddress = exampleMoneyBoxUser.calculateMoneyBoxAddress(address(l1GlobalForkRequester), salt, address(forkonomicToken)); vm.prank(address(this)); @@ -223,7 +223,7 @@ contract L1GlobalForkRequesterTest is Test { assertFalse(forkmanager.isForkingInitiated()); assertFalse(forkmanager.isForkingExecuted()); - l1GlobalForkRequester.handlePayment(address(forkonomicToken), l2requester, requestId); + l1GlobalForkRequester.handlePayment(address(forkonomicToken), l2Requester, requestId); assertTrue(forkmanager.isForkingInitiated()); assertFalse(forkmanager.isForkingExecuted()); @@ -237,9 +237,9 @@ contract L1GlobalForkRequesterTest is Test { ExampleMoneyBoxUser exampleMoneyBoxUser = new ExampleMoneyBoxUser(); // Receive a payment from a MoneyBox - address l2requester = address(0xbabe01); + address l2Requester = address(0xbabe01); bytes32 requestId = bytes32("0xc0ffee01"); - bytes32 salt = keccak256(abi.encodePacked(l2requester, requestId)); + bytes32 salt = keccak256(abi.encodePacked(l2Requester, requestId)); address moneyBoxAddress = exampleMoneyBoxUser.calculateMoneyBoxAddress(address(l1GlobalForkRequester), salt, address(forkonomicToken)); vm.prank(address(this)); @@ -251,10 +251,10 @@ contract L1GlobalForkRequesterTest is Test { assertEq(address(forkmanager.forkonomicToken()), address(forkonomicToken)); assertTrue(forkmanager.canFork()); - l1GlobalForkRequester.handlePayment(address(forkonomicToken), l2requester, requestId); + l1GlobalForkRequester.handlePayment(address(forkonomicToken), l2Requester, requestId); assertFalse(forkmanager.isForkingInitiated()); - (uint256 amount, uint256 amountRemainingY, uint256 amountRemainingN) = l1GlobalForkRequester.failedRequests(address(forkonomicToken), l2requester, requestId); + (uint256 amount, uint256 amountRemainingY, uint256 amountRemainingN) = l1GlobalForkRequester.failedRequests(address(forkonomicToken), l2Requester, requestId); assertEq(amount, fee); assertEq(amountRemainingY, 0); assertEq(amountRemainingN, 0); @@ -268,9 +268,9 @@ contract L1GlobalForkRequesterTest is Test { ExampleMoneyBoxUser exampleMoneyBoxUser = new ExampleMoneyBoxUser(); // Receive a payment from a MoneyBox - address l2requester = address(0xbabe01); + address l2Requester = address(0xbabe01); bytes32 requestId = bytes32("0xc0ffee01"); - bytes32 salt = keccak256(abi.encodePacked(l2requester, requestId)); + bytes32 salt = keccak256(abi.encodePacked(l2Requester, requestId)); address moneyBoxAddress = exampleMoneyBoxUser.calculateMoneyBoxAddress(address(l1GlobalForkRequester), salt, address(forkonomicToken)); vm.prank(address(this)); @@ -297,8 +297,8 @@ contract L1GlobalForkRequesterTest is Test { // Our handlePayment will fail and leave our money sitting in failedRequests uint256 balBeforeHandle = forkonomicToken.balanceOf(address(l1GlobalForkRequester)); - l1GlobalForkRequester.handlePayment(address(forkonomicToken), l2requester, requestId); - (uint256 amount, uint256 amountRemainingY, uint256 amountRemainingN) = l1GlobalForkRequester.failedRequests(address(forkonomicToken), l2requester, requestId); + l1GlobalForkRequester.handlePayment(address(forkonomicToken), l2Requester, requestId); + (uint256 amount, uint256 amountRemainingY, uint256 amountRemainingN) = l1GlobalForkRequester.failedRequests(address(forkonomicToken), l2Requester, requestId); assertEq(amount, fee); assertEq(amountRemainingY, 0); assertEq(amountRemainingN, 0); @@ -307,7 +307,7 @@ contract L1GlobalForkRequesterTest is Test { assertEq(balBeforeHandle + amount, balAfterHandle); vm.expectRevert("Token not forked"); - l1GlobalForkRequester.splitTokensIntoChildTokens(address(forkonomicToken), l2requester, requestId); + l1GlobalForkRequester.splitTokensIntoChildTokens(address(forkonomicToken), l2Requester, requestId); // Execute the other guy's fork skip(forkmanager.forkPreparationTime() + 1); @@ -315,7 +315,7 @@ contract L1GlobalForkRequesterTest is Test { { uint256 balBeforeSplit = forkonomicToken.balanceOf(address(l1GlobalForkRequester)); - l1GlobalForkRequester.splitTokensIntoChildTokens(address(forkonomicToken), l2requester, requestId); + l1GlobalForkRequester.splitTokensIntoChildTokens(address(forkonomicToken), l2Requester, requestId); uint256 balAfterSplit = forkonomicToken.balanceOf(address(l1GlobalForkRequester)); assertEq(balAfterSplit + amount, balBeforeSplit); } @@ -326,9 +326,9 @@ contract L1GlobalForkRequesterTest is Test { assertEq(ForkonomicToken(childToken2).balanceOf(address(l1GlobalForkRequester)), amount); // Now we should be able to return the tokens on the child chain - l1GlobalForkRequester.returnTokens(address(childToken1), l2requester, requestId); - (uint256 amountChild1, , ) = l1GlobalForkRequester.failedRequests(childToken1, l2requester, requestId); - (uint256 amountChild2, , ) = l1GlobalForkRequester.failedRequests(childToken2, l2requester, requestId); + l1GlobalForkRequester.returnTokens(address(childToken1), l2Requester, requestId); + (uint256 amountChild1, , ) = l1GlobalForkRequester.failedRequests(childToken1, l2Requester, requestId); + (uint256 amountChild2, , ) = l1GlobalForkRequester.failedRequests(childToken2, l2Requester, requestId); assertEq(ForkonomicToken(childToken2).balanceOf(address(l1GlobalForkRequester)), amount); @@ -338,8 +338,8 @@ contract L1GlobalForkRequesterTest is Test { // TODO: This breaks due to _CURRENT_SUPPORTED_NETWORKS which is capped at 2 // Raise this if we need it, alternatively maybe it's unrelated to Chain ID and it doesn't need to change when the fork does. - // l1GlobalForkRequester.returnTokens(address(childToken2), l2requester, requestId); - // (amountChild2, , ) = l1GlobalForkRequester.failedRequests(childToken2, l2requester, requestId); + // l1GlobalForkRequester.returnTokens(address(childToken2), l2Requester, requestId); + // (amountChild2, , ) = l1GlobalForkRequester.failedRequests(childToken2, l2Requester, requestId); // assertEq(amountChild2, 0); }