Skip to content

Commit

Permalink
solving merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo committed Mar 18, 2024
2 parents e6ab5ce + eb00452 commit 18f6589
Show file tree
Hide file tree
Showing 50 changed files with 2,462 additions and 13,335 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
with:
version: nightly

- run: npm install

- name: Run Forge build
run: |
forge --version
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/testhardhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ on:
pull_request:
branches: [main, develop]

# Temporary disabled due to a dependency issue. Locally the tests are running fine.
# jobs:
# lint-and-test:
# runs-on: ubuntu-latest

# strategy:
# matrix:
# node-version: [16.x]
# os: [ubuntu-latest]
jobs:
lint-and-test:
runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# cache: 'npm'
# cache-dependency-path: ./package-lock.json
# - run: npm install
# - run: npx hardhat test
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: ./package-lock.json
- run: npm install
- run: npx hardhat test
9 changes: 0 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/zkevm-contracts"]
path = lib/zkevm-contracts
url = https://github.com/RealityETH/zkevm-contracts
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Tests for the above are in [tests/python/test.py](tests/python/test.py).

install dependencies:
```
yarn
npm install
```

compile contracts:
Expand Down
33 changes: 18 additions & 15 deletions contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ pragma solidity ^0.8.20;
/* solhint-disable quotes */
/* solhint-disable not-rely-on-time */

import {IRealityETH} from "./../lib/reality-eth/interfaces/IRealityETH.sol";
import {IRealityETH} from "@reality.eth/contracts/development/contracts/IRealityETH.sol";
import {IRealityETHHistoryVerification} from "@reality.eth/contracts/development/contracts/IRealityETHHistoryVerification.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {IMinimalAdjudicationFramework} from "./interface/IMinimalAdjudicationFramework.sol";
Expand All @@ -27,6 +28,8 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {
error OnlyAllowlistedActor();
/// @dev Error thrown when multiple modifications are requested at once
error NoMultipleModificationsAtOnce();
/// @dev Invalid history supplied for unfinalized question
error InvalidHistorySupplied();

// Iterable list contains list of allowlisted arbitrators
uint256 public constant ARB_DISPUTE_TIMEOUT = 86400;
Expand Down Expand Up @@ -216,20 +219,24 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {

bytes32 answer;
uint256 bond;
// Normally you call this right after posting your answer so your final answer will be the current answer
// If someone has since submitted a different answer, you need to pass in the history from now until yours
// Normally you call this right after posting your answer so your final answer will be the current best answer
// If someone has since submitted a different answer, you need to pass in the history from now back to yours
if (historyHashes.length == 0) {
answer = realityETH.getBestAnswer(questionId);
bond = realityETH.getBond(questionId);
} else {
(answer, bond) = realityETH
.getEarliestAnswerFromSuppliedHistoryOrRevert(
questionId,
historyHashes,
addrs,
bonds,
answers
);
if (
!IRealityETHHistoryVerification(address(realityETH))
.isHistoryOfUnfinalizedQuestionValid(
questionId,
historyHashes,
addrs,
bonds,
answers
)
) revert InvalidHistorySupplied();
answer = answers[answers.length - 1];
bond = bonds[bonds.length - 1];
}

if (answer != bytes32(uint256(1))) {
Expand Down Expand Up @@ -268,10 +275,6 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {

// Getter functions only below here

function realitio() external view returns (address) {
return address(realityETH);
}

function isArbitrator(address arbitrator) external view returns (bool) {
return _arbitrators.contains(arbitrator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ pragma solidity ^0.8.20;
/* solhint-disable quotes */
/* solhint-disable not-rely-on-time */

import {BalanceHolder} from "./../../lib/reality-eth/BalanceHolder.sol";
import {MinimalAdjudicationFramework} from "../MinimalAdjudicationFramework.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {BalanceHolder} from "@reality.eth/contracts/development/contracts/BalanceHolder.sol";
import {IRealityETH} from "@reality.eth/contracts/development/contracts/IRealityETH.sol";
import {IArbitratorCore} from "@reality.eth/contracts/development/contracts/IArbitratorCore.sol";

/*
This contract sits between a Reality.eth instance and an Arbitrator.
Expand All @@ -20,6 +22,7 @@ To the normal Arbitrator contracts that does its arbitration jobs, it looks like
*/

contract AdjudicationFrameworkRequests is
IArbitratorCore,
MinimalAdjudicationFramework,
BalanceHolder
{
Expand Down Expand Up @@ -55,18 +58,6 @@ contract AdjudicationFrameworkRequests is
/// @dev Error thrown when too soon to cancel
error TooSoonToCancel();

event LogRequestArbitration(
bytes32 indexed questionId,
uint256 feePaid,
address requester,
uint256 remaining
);

event LogNotifyOfArbitrationRequest(
bytes32 indexed questionId,
address indexed user
);

uint256 public dispute_fee;

struct ArbitrationRequest {
Expand All @@ -80,6 +71,10 @@ contract AdjudicationFrameworkRequests is

mapping(bytes32 => ArbitrationRequest) public questionArbitrations;

// Metadata for anything the UI needs to know.
// TODO: Add a "tos" parameter pointing to a document that explains the adjudication principles, see #256
string public metadata = "{}";

/// @param _realityETH The reality.eth instance we adjudicate for
/// @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
Expand Down Expand Up @@ -180,8 +175,6 @@ contract AdjudicationFrameworkRequests is

questionArbitrations[questionId].payer = requester;
questionArbitrations[questionId].arbitrator = msg.sender;

emit LogNotifyOfArbitrationRequest(questionId, requester);
}

/// @notice Clear the arbitrator setting of an arbitrator that has been delisted
Expand Down Expand Up @@ -297,4 +290,8 @@ contract AdjudicationFrameworkRequests is

realityETH.submitAnswerByArbitrator(questionId, answer, answerer);
}

function realitio() external view returns (IRealityETH) {
return realityETH;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ interface IMinimalAdjudicationFramework is IMinimalAdjudicationFrameworkErrors {

// Getter functions only below here

function realitio() external view returns (address);

function isArbitrator(address arbitrator) external view returns (bool);

function isArbitratorPropositionFrozen(
Expand Down
Loading

0 comments on commit 18f6589

Please sign in to comment.