diff --git a/packages/horizon/README.md b/packages/horizon/README.md index d3a0d6200..4b0954953 100644 --- a/packages/horizon/README.md +++ b/packages/horizon/README.md @@ -10,7 +10,7 @@ We use Hardhat Ignition to deploy the contracts. To build and deploy the contrac yarn install yarn build npx hardhat ignition deploy ./ignition/modules/horizon.ts \ - --parameters ./ignition/configs/graph.hardhat.json \ + --parameters ./ignition/configs/horizon.hardhat.json \ --network hardhat ``` diff --git a/packages/horizon/ignition/configs/horizon.hardhat.json b/packages/horizon/ignition/configs/horizon.hardhat.json index 894a2ed59..ef16c8136 100644 --- a/packages/horizon/ignition/configs/horizon.hardhat.json +++ b/packages/horizon/ignition/configs/horizon.hardhat.json @@ -41,6 +41,7 @@ }, "TAPCollector": { "eip712Name": "TAPCollector", - "eip712Version": "1" + "eip712Version": "1", + "revokeSignerThawingPeriod": 10000 } } diff --git a/packages/horizon/ignition/modules/core/TAPCollector.ts b/packages/horizon/ignition/modules/core/TAPCollector.ts index 429dc5083..2e8be4bfb 100644 --- a/packages/horizon/ignition/modules/core/TAPCollector.ts +++ b/packages/horizon/ignition/modules/core/TAPCollector.ts @@ -11,8 +11,9 @@ export default buildModule('TAPCollector', (m) => { const name = m.getParameter('eip712Name') const version = m.getParameter('eip712Version') + const revokeSignerThawingPeriod = m.getParameter('revokeSignerThawingPeriod') - const TAPCollector = m.contract('TAPCollector', TAPCollectorArtifact, [name, version, Controller], { after: [PeripheryRegistered, HorizonRegistered] }) + const TAPCollector = m.contract('TAPCollector', TAPCollectorArtifact, [name, version, Controller, revokeSignerThawingPeriod], { after: [PeripheryRegistered, HorizonRegistered] }) return { TAPCollector } }) diff --git a/packages/horizon/scripts/deploy.ts b/packages/horizon/scripts/deploy.ts index a7daff3d4..5a94398d2 100644 --- a/packages/horizon/scripts/deploy.ts +++ b/packages/horizon/scripts/deploy.ts @@ -1,6 +1,6 @@ import { ignition } from 'hardhat' -import Parameters from '../ignition/graph.hardhat.json' +import Parameters from '../ignition/configs/horizon.hardhat.json' import PeripheryModule from '../ignition/modules/periphery' async function main() { diff --git a/packages/subgraph-service/contracts/SubgraphService.sol b/packages/subgraph-service/contracts/SubgraphService.sol index a07463a25..5f45c0f96 100644 --- a/packages/subgraph-service/contracts/SubgraphService.sol +++ b/packages/subgraph-service/contracts/SubgraphService.sol @@ -77,6 +77,7 @@ contract SubgraphService is * on the DisputeManager. We use the {ProvisionManager} overrideable getters to get the ranges. * @param minimumProvisionTokens The minimum amount of provisioned tokens required to create an allocation * @param maximumDelegationRatio The maximum delegation ratio allowed for an allocation + * @param stakeToFeesRatio The ratio of stake to fees to lock when collecting query fees */ function initialize( uint256 minimumProvisionTokens, @@ -497,8 +498,7 @@ contract SubgraphService is * @return max The maximum is unbounded */ function _getThawingPeriodRange() internal view override returns (uint64 min, uint64 max) { - uint64 disputePeriod = _disputeManager().getDisputePeriod(); - return (disputePeriod, DEFAULT_MAX_THAWING_PERIOD); + return (_disputeManager().getDisputePeriod(), DEFAULT_MAX_THAWING_PERIOD); } /** @@ -507,8 +507,7 @@ contract SubgraphService is * @return max The maximum is 100% in PPM */ function _getVerifierCutRange() internal view override returns (uint32 min, uint32 max) { - uint32 verifierCut = _disputeManager().getVerifierCut(); - return (verifierCut, DEFAULT_MAX_VERIFIER_CUT); + return (_disputeManager().getVerifierCut(), DEFAULT_MAX_VERIFIER_CUT); } /** diff --git a/packages/subgraph-service/contracts/utilities/AllocationManager.sol b/packages/subgraph-service/contracts/utilities/AllocationManager.sol index 669cd9bf8..37e57828f 100644 --- a/packages/subgraph-service/contracts/utilities/AllocationManager.sol +++ b/packages/subgraph-service/contracts/utilities/AllocationManager.sol @@ -485,8 +485,7 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca * @param _proof The EIP712 proof, an EIP712 signed message of (indexer,allocationId) */ function _verifyAllocationProof(address _indexer, address _allocationId, bytes memory _proof) private view { - bytes32 digest = _encodeAllocationProof(_indexer, _allocationId); - address signer = ECDSA.recover(digest, _proof); + address signer = ECDSA.recover(_encodeAllocationProof(_indexer, _allocationId), _proof); require(signer == _allocationId, AllocationManagerInvalidAllocationProof(signer, _allocationId)); } } diff --git a/packages/subgraph-service/foundry.toml b/packages/subgraph-service/foundry.toml index 9f5c3a92a..90444cf44 100644 --- a/packages/subgraph-service/foundry.toml +++ b/packages/subgraph-service/foundry.toml @@ -6,4 +6,4 @@ test = 'test' cache_path = 'cache_forge' fs_permissions = [{ access = "read", path = "./"}] optimizer = true -optimizer-runs = 200 +optimizer-runs = 50 diff --git a/packages/subgraph-service/hardhat.config.ts b/packages/subgraph-service/hardhat.config.ts index 1e2dfc9fd..b173873fb 100644 --- a/packages/subgraph-service/hardhat.config.ts +++ b/packages/subgraph-service/hardhat.config.ts @@ -13,7 +13,7 @@ const config: HardhatUserConfig = { settings: { optimizer: { enabled: true, - runs: 200, + runs: 50, }, }, }, diff --git a/packages/subgraph-service/ignition/configs/subgraph-service.hardhat.json b/packages/subgraph-service/ignition/configs/subgraph-service.hardhat.json index 83dfa1899..c1a248448 100644 --- a/packages/subgraph-service/ignition/configs/subgraph-service.hardhat.json +++ b/packages/subgraph-service/ignition/configs/subgraph-service.hardhat.json @@ -8,6 +8,7 @@ }, "SubgraphService": { "minimumProvisionTokens": "100000000000000000000000n", - "maximumDelegationRatio": 16 + "maximumDelegationRatio": 16, + "stakeToFeesRatio": 2 } } diff --git a/packages/subgraph-service/ignition/modules/DisputeManager.ts b/packages/subgraph-service/ignition/modules/DisputeManager.ts index ff3921eca..78692937c 100644 --- a/packages/subgraph-service/ignition/modules/DisputeManager.ts +++ b/packages/subgraph-service/ignition/modules/DisputeManager.ts @@ -20,7 +20,7 @@ export default buildModule('DisputeManager', (m) => { const DisputeManagerImplementation = m.contract('DisputeManager', [controllerAddress]) // Upgrade implementation - const DisputeManagerProxyAdmin = m.contractAt('TransparentUpgradeableProxy', ProxyAdminArtifact, disputeManagerProxyAdminAddress) + const DisputeManagerProxyAdmin = m.contractAt('ProxyAdmin', ProxyAdminArtifact, disputeManagerProxyAdminAddress) const encodedCall = m.encodeFunctionCall(DisputeManagerImplementation, 'initialize', [ arbitrator, disputePeriod, diff --git a/packages/subgraph-service/ignition/modules/SubgraphService.ts b/packages/subgraph-service/ignition/modules/SubgraphService.ts index 783cd7d15..0f17a5906 100644 --- a/packages/subgraph-service/ignition/modules/SubgraphService.ts +++ b/packages/subgraph-service/ignition/modules/SubgraphService.ts @@ -16,15 +16,17 @@ export default buildModule('SubgraphService', (m) => { // Parameters - config file const minimumProvisionTokens = m.getParameter('minimumProvisionTokens') const maximumDelegationRatio = m.getParameter('maximumDelegationRatio') + const stakeToFeesRatio = m.getParameter('stakeToFeesRatio') // Deploy implementation const SubgraphServiceImplementation = m.contract('SubgraphService', [controllerAddress, disputeManagerAddress, tapCollectorAddress, curationAddress]) // Upgrade implementation - const SubgraphServiceProxyAdmin = m.contractAt('TransparentUpgradeableProxy', ProxyAdminArtifact, subgraphServiceProxyAdminAddress) + const SubgraphServiceProxyAdmin = m.contractAt('ProxyAdmin', ProxyAdminArtifact, subgraphServiceProxyAdminAddress) const encodedCall = m.encodeFunctionCall(SubgraphServiceImplementation, 'initialize', [ minimumProvisionTokens, maximumDelegationRatio, + stakeToFeesRatio, ]) m.call(SubgraphServiceProxyAdmin, 'upgradeAndCall', [subgraphServiceProxyAddress, SubgraphServiceImplementation, encodedCall])