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: added missing parameters to deploy script and reduced runs to 50 for SubgraphService #1062

Open
wants to merge 2 commits into
base: horizon
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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/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 @@ -41,6 +41,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 @@ -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);
}

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

/**
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/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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also set in graphprotocol/contracts/packages/subgraph-service/foundry.toml. Not sure if they are meant to be kept in-sync...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, thank you! I changed it back to 200 to get the gas report and forgot to switch it back

},
},
},
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