Skip to content

Commit

Permalink
Merge pull request #1062 from graphprotocol/mde/horizon-and-subgrah-s…
Browse files Browse the repository at this point in the history
…ervice-deploy-fix
  • Loading branch information
tmigone authored Dec 17, 2024
2 parents a228e0e + 2b03618 commit 0f2100d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/horizon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
3 changes: 2 additions & 1 deletion packages/horizon/ignition/configs/horizon.hardhat.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
"TAPCollector": {
"eip712Name": "TAPCollector",
"eip712Version": "1"
"eip712Version": "1",
"revokeSignerThawingPeriod": 10000
}
}
3 changes: 2 additions & 1 deletion packages/horizon/ignition/modules/core/TAPCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
})
2 changes: 1 addition & 1 deletion packages/horizon/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
7 changes: 3 additions & 4 deletions packages/subgraph-service/contracts/SubgraphService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -496,8 +497,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);
}

/**
Expand All @@ -506,8 +506,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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion packages/subgraph-service/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ test = 'test'
cache_path = 'cache_forge'
fs_permissions = [{ access = "read", path = "./"}]
optimizer = true
optimizer-runs = 200
optimizer-runs = 50
2 changes: 1 addition & 1 deletion packages/subgraph-service/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config: HardhatUserConfig = {
settings: {
optimizer: {
enabled: true,
runs: 200,
runs: 50,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"SubgraphService": {
"minimumProvisionTokens": "100000000000000000000000n",
"maximumDelegationRatio": 16
"maximumDelegationRatio": 16,
"stakeToFeesRatio": 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down

0 comments on commit 0f2100d

Please sign in to comment.