Skip to content

Commit a1acbe5

Browse files
authored
Merge branch 'horizon' into tmigone/thawing-fixes
2 parents 7ea61e6 + f88f335 commit a1acbe5

File tree

179 files changed

+37980
-879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+37980
-879
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@ cache_forge
5454

5555
tx-builder-*.json
5656
!tx-builder-template.json
57+
58+
# Hardhat Ignition
59+
**/chain-31337/
60+
!**/ignition/**/artifacts/

packages/contracts/contracts/disputes/DisputeManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
579579
* @notice Ignore a dispute with ID `_disputeID`
580580
* @param _disputeID ID of the dispute to be disregarded
581581
*/
582-
function drawDispute(bytes32 _disputeID) public override onlyArbitrator onlyPendingDispute(_disputeID) {
582+
function drawDispute(bytes32 _disputeID) external override onlyArbitrator onlyPendingDispute(_disputeID) {
583583
Dispute storage dispute = disputes[_disputeID];
584584

585585
// Return deposit to the fisherman

packages/contracts/contracts/governance/Controller.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ contract Controller is Governed, Pausable, IController {
8989
/**
9090
* @notice Change the partial paused state of the contract
9191
* Partial pause is intended as a partial pause of the protocol
92-
* @param _toPause True if the contracts should be (partially) paused, false otherwise
92+
* @param _toPartialPause True if the contracts should be (partially) paused, false otherwise
9393
*/
94-
function setPartialPaused(bool _toPause) external override onlyGovernorOrGuardian {
95-
_setPartialPaused(_toPause);
94+
function setPartialPaused(bool _toPartialPause) external override onlyGovernorOrGuardian {
95+
_setPartialPaused(_toPartialPause);
9696
}
9797

9898
/**

packages/contracts/contracts/governance/Pausable.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract contract Pausable {
1414
bool internal _paused;
1515

1616
/// Timestamp for the last time the partial pause was set
17-
uint256 public lastPausePartialTime;
17+
uint256 public lastPartialPauseTime;
1818
/// Timestamp for the last time the full pause was set
1919
uint256 public lastPauseTime;
2020

@@ -31,15 +31,15 @@ abstract contract Pausable {
3131

3232
/**
3333
* @dev Change the partial paused state of the contract
34-
* @param _toPause New value for the partial pause state (true means the contracts will be partially paused)
34+
* @param _toPartialPause New value for the partial pause state (true means the contracts will be partially paused)
3535
*/
36-
function _setPartialPaused(bool _toPause) internal {
37-
if (_toPause == _partialPaused) {
36+
function _setPartialPaused(bool _toPartialPause) internal {
37+
if (_toPartialPause == _partialPaused) {
3838
return;
3939
}
40-
_partialPaused = _toPause;
40+
_partialPaused = _toPartialPause;
4141
if (_partialPaused) {
42-
lastPausePartialTime = block.timestamp;
42+
lastPartialPauseTime = block.timestamp;
4343
}
4444
emit PartialPauseChanged(_partialPaused);
4545
}

packages/contracts/test/unit/disputes/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface Dispute {
1616
export function createQueryDisputeID(
1717
attestation: Attestation,
1818
indexerAddress: string,
19-
submitterAddress: string,
19+
fishermanAddress: string,
2020
): string {
2121
return solidityKeccak256(
2222
['bytes32', 'bytes32', 'bytes32', 'address', 'address'],
@@ -25,7 +25,7 @@ export function createQueryDisputeID(
2525
attestation.responseCID,
2626
attestation.subgraphDeploymentID,
2727
indexerAddress,
28-
submitterAddress,
28+
fishermanAddress,
2929
],
3030
)
3131
}

packages/horizon/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
# Sample Hardhat Project
1+
# 🌅 Graph Horizon 🌅
22

3-
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
3+
Graph Horizon is the next evolution of the Graph Protocol.
44

5-
Try running some of the following tasks:
5+
## Deployment
66

7-
```shell
8-
npx hardhat help
9-
npx hardhat test
10-
REPORT_GAS=true npx hardhat test
11-
npx hardhat node
12-
npx hardhat run scripts/deploy.ts
7+
We use Hardhat Ignition to deploy the contracts. To build and deploy the contracts run the following commands:
8+
9+
```bash
10+
yarn install
11+
yarn build
12+
npx hardhat ignition deploy ./ignition/modules/horizon.ts \
13+
--parameters ./ignition/configs/graph.hardhat.json \
14+
--network hardhat
1315
```
16+
17+
You can use any network defined in `hardhat.config.ts` by replacing `hardhat` with the network name.

packages/horizon/contracts/data-service/extensions/DataServiceFees.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
2222
/**
2323
* @notice See {IDataServiceFees-releaseStake}
2424
*/
25-
function releaseStake(uint256 n) external virtual override {
26-
_releaseStake(msg.sender, n);
25+
function releaseStake(uint256 numClaimsToRelease) external virtual override {
26+
_releaseStake(msg.sender, numClaimsToRelease);
2727
}
2828

2929
/**
@@ -49,7 +49,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
4949
claims[claimId] = StakeClaim({
5050
tokens: _tokens,
5151
createdAt: block.timestamp,
52-
releaseAt: _unlockTimestamp,
52+
releasableAt: _unlockTimestamp,
5353
nextClaim: bytes32(0)
5454
});
5555
if (claimsList.count != 0) claims[claimsList.tail].nextClaim = claimId;
@@ -61,14 +61,14 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
6161
/**
6262
* @notice See {IDataServiceFees-releaseStake}
6363
*/
64-
function _releaseStake(address _serviceProvider, uint256 _n) internal {
64+
function _releaseStake(address _serviceProvider, uint256 _numClaimsToRelease) internal {
6565
LinkedList.List storage claimsList = claimsLists[_serviceProvider];
6666
(uint256 claimsReleased, bytes memory data) = claimsList.traverse(
6767
_getNextStakeClaim,
6868
_processStakeClaim,
6969
_deleteStakeClaim,
7070
abi.encode(0, _serviceProvider),
71-
_n
71+
_numClaimsToRelease
7272
);
7373

7474
emit StakeClaimsReleased(_serviceProvider, claimsReleased, abi.decode(data, (uint256)));
@@ -86,7 +86,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
8686
StakeClaim memory claim = _getStakeClaim(_claimId);
8787

8888
// early exit
89-
if (claim.releaseAt > block.timestamp) {
89+
if (claim.releasableAt > block.timestamp) {
9090
return (true, LinkedList.NULL_BYTES);
9191
}
9292

@@ -95,7 +95,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
9595

9696
// process
9797
feesProvisionTracker.release(serviceProvider, claim.tokens);
98-
emit StakeClaimReleased(serviceProvider, _claimId, claim.tokens, claim.releaseAt);
98+
emit StakeClaimReleased(serviceProvider, _claimId, claim.tokens, claim.releasableAt);
9999

100100
// encode
101101
_acc = abi.encode(tokensClaimed + claim.tokens, serviceProvider);

packages/horizon/contracts/data-service/extensions/DataServiceRescuable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ abstract contract DataServiceRescuable is DataService, IDataServiceRescuable {
7070
if (Denominations.isNativeToken(_token)) Address.sendValue(payable(_to), _tokens);
7171
else SafeERC20.safeTransfer(IERC20(_token), _to, _tokens);
7272

73-
emit TokensRescued(msg.sender, _to, _tokens);
73+
emit TokensRescued(msg.sender, _to, _token, _tokens);
7474
}
7575
}

packages/horizon/contracts/data-service/interfaces/IDataService.sol

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface IDataService {
2525
* @notice Emitted when a service provider accepts a provision in {Graph Horizon staking contract}.
2626
* @param serviceProvider The address of the service provider.
2727
*/
28-
event ProvisionAccepted(address indexed serviceProvider);
28+
event ProvisionPendingParametersAccepted(address indexed serviceProvider);
2929

3030
/**
3131
* @notice Emitted when a service provider starts providing the service.
@@ -60,11 +60,6 @@ interface IDataService {
6060
*/
6161
event ServiceProviderSlashed(address indexed serviceProvider, uint256 tokens);
6262

63-
/**
64-
* @notice Thrown to signal that a feature is not implemented by a data service.
65-
*/
66-
error DataServiceFeatureNotImplemented();
67-
6863
/**
6964
* @notice Registers a service provider with the data service. The service provider can now
7065
* start providing the service.
@@ -84,16 +79,16 @@ interface IDataService {
8479
function register(address serviceProvider, bytes calldata data) external;
8580

8681
/**
87-
* @notice Accepts staged parameters in the provision of a service provider in the {Graph Horizon staking
82+
* @notice Accepts pending parameters in the provision of a service provider in the {Graph Horizon staking
8883
* contract}.
8984
* @dev Provides a way for the data service to validate and accept provision parameter changes. Call {_acceptProvision}.
9085
*
91-
* Emits a {ProvisionAccepted} event.
86+
* Emits a {ProvisionPendingParametersAccepted} event.
9287
*
9388
* @param serviceProvider The address of the service provider.
9489
* @param data Custom data, usage defined by the data service.
9590
*/
96-
function acceptProvision(address serviceProvider, bytes calldata data) external;
91+
function acceptProvisionPendingParameters(address serviceProvider, bytes calldata data) external;
9792

9893
/**
9994
* @notice Service provider starts providing the service.

packages/horizon/contracts/data-service/interfaces/IDataServiceFees.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface IDataServiceFees is IDataService {
3232
// Timestamp when the claim was created
3333
uint256 createdAt;
3434
// Timestamp when the claim will expire and tokens can be released
35-
uint256 releaseAt;
35+
uint256 releasableAt;
3636
// Next claim in the linked list
3737
bytes32 nextClaim;
3838
}
@@ -56,13 +56,13 @@ interface IDataServiceFees is IDataService {
5656
* @param serviceProvider The address of the service provider
5757
* @param claimId The id of the stake claim
5858
* @param tokens The amount of tokens released
59-
* @param releaseAt The timestamp when the tokens were released
59+
* @param releasableAt The timestamp when the tokens were released
6060
*/
6161
event StakeClaimReleased(
6262
address indexed serviceProvider,
6363
bytes32 indexed claimId,
6464
uint256 tokens,
65-
uint256 releaseAt
65+
uint256 releasableAt
6666
);
6767

6868
/**
@@ -89,7 +89,7 @@ interface IDataServiceFees is IDataService {
8989
* stake claims that releasing them all at once would exceed the block gas limit.
9090
* @dev This function can be overriden and/or disabled.
9191
* @dev Emits a {StakeClaimsReleased} event, and a {StakeClaimReleased} event for each claim released.
92-
* @param n Amount of stake claims to process. If 0, all stake claims are processed.
92+
* @param numClaimsToRelease Amount of stake claims to process. If 0, all stake claims are processed.
9393
*/
94-
function releaseStake(uint256 n) external;
94+
function releaseStake(uint256 numClaimsToRelease) external;
9595
}

0 commit comments

Comments
 (0)