Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GiriGiriBashi #46

Merged
merged 14 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IAdapter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

/**
* @title IAdapter
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IBlockHashAdapter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IAdapter } from "./IAdapter.sol";

Expand Down
34 changes: 32 additions & 2 deletions packages/evm/contracts/interfaces/IGiriGiriBashi.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IAdapter } from "./IAdapter.sol";
import { IHashi } from "./IHashi.sol";
Expand All @@ -23,9 +23,10 @@ interface IGiriGiriBashi is IShuSho {
uint256 timeout; // grace period in which the adapter must report on an in-range id after being challenged.
}

error AdaptersCannotContainChallengedAdapter(IAdapter[] adapters, IAdapter adapter);
error AdapterHasNotYetTimedOut(IAdapter adapter);
error AdapterNotQuarantined(IAdapter adapter);
error AdaptersAgreed(IAdapter adapter1, IAdapter adapter2);
error AdaptersAgreed();
error AlreadyQuarantined(IAdapter adapter);
error CannotProveNoConfidence(uint256 domain, uint256 id, IAdapter[] adapters);
error ChallengeNotFound(bytes32 challengeId, uint256 domain, uint256 id, IAdapter adapter);
Expand Down Expand Up @@ -143,6 +144,13 @@ interface IGiriGiriBashi is IShuSho {
*/
function enableAdapters(uint256 domain, IAdapter[] memory adapters, Settings[] memory settings) external;

/**
* @dev Get the current challenge given a challengeId.
* @param challengeId - The Bytes32 identifier for the challenge.
* @return challenge - Challenge indicating the challenge parameters.
*/
function getChallenge(bytes32 challengeId) external view returns (Challenge memory);

/**
* @dev Gets the challenge ID for a given domain, ID, and adapter.
* @param domain - The Uint256 identifier for the domain.
Expand All @@ -152,6 +160,13 @@ interface IGiriGiriBashi is IShuSho {
*/
function getChallengeId(uint256 domain, uint256 id, IAdapter adapter) external pure returns (bytes32);

/**
* @dev Get how far beyond the current highestId can be challenged.
* @param domain - The Uint256 identifier for the domain.
* @return range - Uint256 indicating the challenge range.
*/
function getChallengeRange(uint256 domain) external view returns (uint256);

/**
* @dev Returns the hash agreed upon by a threshold of the enabled adapters.
* @param domain - Uint256 identifier for the domain to query.
Expand Down Expand Up @@ -187,6 +202,21 @@ interface IGiriGiriBashi is IShuSho {
*/
function getHash(uint256 domain, uint256 id, IAdapter[] memory adapters) external returns (bytes32);

/**
* @dev Returns the highest id reported for a given id
* @param domain - Uint256 identifier for the domain to query.
* @return id - Uint256 indicating the highest id reported.
*/
function getHead(uint256 domain) external view returns (uint256);

/**
* @dev Get the current settings for a given adapter.
* @param domain - Uint256 identifier for the domain to query.
* @param adapter - The adapter.
* @return settings - The Settings for the given adapter.
*/
function getSettings(uint256 domain, IAdapter adapter) external view returns (Settings memory);

/**
* @dev Replaces the quarantined adapters for a given domain with new adapters and settings.
* @param domain - The Uint256 identifier for the domain.
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IHashi.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IAdapter } from "./IAdapter.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IHeaderStorage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

/**
* @title IHeaderStorage
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IJushin.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

/**
* @title IJushin
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IMessage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IReporter } from "./IReporter.sol";
import { IAdapter } from "./IAdapter.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { Message } from "./IMessage.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IMessageIdCalculator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

/**
* @title IMessageIdCalculator
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IReporter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IAdapter } from "./IAdapter.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IShoyuBashi.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IHashi } from "./IHashi.sol";
import { IAdapter } from "./IAdapter.sol";
Expand Down
25 changes: 24 additions & 1 deletion packages/evm/contracts/interfaces/IShuSho.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IHashi } from "./IHashi.sol";
import { IAdapter } from "./IAdapter.sol";
Expand All @@ -20,10 +20,12 @@ interface IShuSho {

error AdapterNotEnabled(IAdapter adapter);
error AdapterAlreadyEnabled(IAdapter adapter);
error CountCannotBeZero();
error DuplicateHashiAddress(IHashi hashi);
error DuplicateOrOutOfOrderAdapters(IAdapter adapterOne, IAdapter adapterTwo);
error DuplicateThreashold(uint256 threshold);
error InvalidAdapter(IAdapter adapter);
error InvalidThreshold(uint256 threshold);
error NoAdaptersEnabled(uint256 domain);
error NoAdaptersGiven();
error ThresholdNotMet();
Expand Down Expand Up @@ -69,13 +71,28 @@ interface IShuSho {
*/
function checkAdapterOrderAndValidity(uint256 domain, IAdapter[] memory _adapters) external view;

/**
* @dev Get the previous and the next adapter given a domain and an adapter.
* @param domain - Uint256 identifier for the domain.
* @param adapter - IAdapter value for the adapter.
* @return link - The Link struct containing the previous and the next adapter.
*/
function getAdapterLink(uint256 domain, IAdapter adapter) external view returns (Link memory);

/**
* @dev Returns an array of enabled adapters for a given domain.
* @param domain - Uint256 identifier for the domain for which to list adapters.
* @return adapters - The adapters for a given domain.
*/
function getAdapters(uint256 domain) external view returns (IAdapter[] memory);

/**
* @dev Get the current configuration for a given domain.
* @param domain - Uint256 identifier for the domain.
* @return domain - The Domain struct containing the current configuration for a given domain.
*/
function getDomain(uint256 domain) external view returns (Domain memory);

/**
* @dev Returns the threshold and count for a given domain.
* @param domain - Uint256 identifier for the domain.
Expand All @@ -84,4 +101,10 @@ interface IShuSho {
* @notice If the threshold for a domain has not been set, or is explicitly set to 0, this function will return a threshold equal to the adapters count for the given domain.
*/
function getThresholdAndCount(uint256 domain) external view returns (uint256, uint256);

/**
* @dev Returns the address of the specified Hashi.
* @return hashi - The Hashi address.
*/
function hashi() external view returns (IHashi);
}
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IYaho.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { IMessageHashCalculator } from "./IMessageHashCalculator.sol";
import { IMessageIdCalculator } from "./IMessageIdCalculator.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/contracts/interfaces/IYaru.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
pragma solidity ^0.8.0;

import { Message } from "./IMessage.sol";
import { IMessageHashCalculator } from "./IMessageHashCalculator.sol";
Expand Down
Loading
Loading