Skip to content

Commit c71f461

Browse files
authored
Merge pull request #1224 from graphprotocol/tmigone/phase3-fixes
2 parents b11ff3a + 74c0807 commit c71f461

File tree

8 files changed

+46
-28
lines changed

8 files changed

+46
-28
lines changed

packages/interfaces/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @graphprotocol/interfaces
22

3+
## 0.6.2
4+
5+
### Patch Changes
6+
7+
- Ensure ServiceRegistry loads the correct interface
8+
9+
## 0.6.1
10+
11+
### Patch Changes
12+
13+
- Add ServiceRegistered to LegacyServiceRegistry interface
14+
315
## 0.6.0
416

517
### Minor Changes

packages/interfaces/contracts/toolshed/IServiceRegistryToolshed.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ pragma solidity ^0.7.6 || 0.8.27;
44
import { IServiceRegistry } from "../contracts/discovery/IServiceRegistry.sol";
55

66
interface IServiceRegistryToolshed is IServiceRegistry {
7+
event ServiceRegistered(address indexed indexer, string url, string geohash);
8+
79
/**
810
* @notice Gets the indexer registrationdetails
911
* @dev Note that this storage getter actually returns a ISubgraphService.IndexerService struct, but ethers v6 is not

packages/interfaces/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/interfaces",
3-
"version": "0.6.0",
3+
"version": "0.6.2",
44
"publishConfig": {
55
"access": "public"
66
},

packages/interfaces/src/index.ts

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,11 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
7979
const factoriesMap: Record<string, ContractFactoryStatic> = {}
8080

8181
// For factory name 'x', use contract name 'y'
82+
// This is necessary because DisputeManager name collision, its the name of the contract in both the contracts and subgraph-service packages
8283
const factoryNameOverrides: Record<string, string> = {
8384
'contracts.contracts.disputes.IDisputeManager__factory': 'ILegacyDisputeManager',
8485
}
8586

86-
// For contract name 'x', also create an entry for alias 'y' in the factory map
87-
const factoryNameAliases: Record<string, string> = {
88-
IServiceRegistry: 'ILegacyServiceRegistry',
89-
}
90-
9187
function recurse(value: unknown, path: string[] = []) {
9288
if (typeof value !== 'object' || value === null) {
9389
return
@@ -116,19 +112,6 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
116112

117113
// Add main entry
118114
factoriesMap[contractName] = factory as ContractFactoryStatic
119-
120-
// If alias exists, add alias entry too
121-
if (factoryNameAliases[contractName]) {
122-
const aliasName = factoryNameAliases[contractName]
123-
124-
if (factoriesMap[aliasName]) {
125-
console.log(
126-
`⚠️ Duplicate factory for alias "${aliasName}" derived from "${contractName}". Keeping the first occurrence.`,
127-
)
128-
} else {
129-
factoriesMap[aliasName] = factory as ContractFactoryStatic
130-
}
131-
}
132115
} else if (typeof val === 'object' && val !== null) {
133116
recurse(val, currentPath)
134117
}
@@ -143,7 +126,7 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
143126
/**
144127
* Gets alternative names for a contract to handle interface naming conventions
145128
* For any given value passed to it, returns `ContractName` and `IContractName`
146-
* Note that this function will apply toolshed overrides, this returns a more complete interface
129+
* Note that this function will apply toolshed overrides if available as they are more complete interfaces
147130
* @param {string} contractName - The original contract name
148131
* @returns {string[]} Array of possible contract names including interface variants
149132
* @private
@@ -160,21 +143,18 @@ function getContractNameAlternatives(contractName: string): string[] {
160143
L2Curation: 'L2CurationToolshed',
161144
PaymentsEscrow: 'PaymentsEscrowToolshed',
162145
RewardsManager: 'RewardsManagerToolshed',
163-
ServiceRegistry: 'ServiceRegistryToolshed',
164146
SubgraphService: 'SubgraphServiceToolshed',
147+
ServiceRegistry: 'ServiceRegistryToolshed',
148+
LegacyServiceRegistry: 'ServiceRegistryToolshed',
165149
}
166150

151+
// override with toolshed alternative if available
167152
if (nameOverrides[contractName]) {
168153
contractName = nameOverrides[contractName]
169154
}
170155

171156
const alternatives: string[] = [contractName]
172-
173-
if (contractName.startsWith('I')) {
174-
alternatives.push(contractName.replace('I', ''))
175-
} else {
176-
alternatives.push(`I${contractName}`)
177-
}
157+
alternatives.push(contractName.startsWith('I') ? contractName.replace('I', '') : `I${contractName}`)
178158

179159
return alternatives
180160
}

packages/subgraph-service/ignition/configs/protocol.default.json5

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
"gnsImplementationAddress": "",
1414
"subgraphNFTAddress": "",
1515

16+
// These do not exist in the protocol deployment, but are needed by ignition modules
17+
// so we set them to 0x00...00
18+
"legacyDisputeManagerAddress": "0x0000000000000000000000000000000000000000",
19+
"legacyServiceRegistryAddress": "0x0000000000000000000000000000000000000000",
20+
1621
// Must be set for step 2 of the deployment
1722
"disputeManagerProxyAddress": "",
1823
"disputeManagerProxyAdminAddress": "",

packages/subgraph-service/ignition/configs/protocol.localNetwork.json5

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
"gnsImplementationAddress": "",
1414
"subgraphNFTAddress": "",
1515

16+
// These do not exist in the protocol deployment, but are needed by ignition modules
17+
// so we set them to 0x00...00
18+
"legacyDisputeManagerAddress": "0x0000000000000000000000000000000000000000",
19+
"legacyServiceRegistryAddress": "0x0000000000000000000000000000000000000000",
20+
1621
// Must be set for step 2 of the deployment
1722
"disputeManagerProxyAddress": "",
1823
"disputeManagerProxyAdminAddress": "",

packages/toolshed/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# @graphprotocol/toolshed
22

3+
## 0.6.15
4+
5+
### Patch Changes
6+
7+
- Ensure ServiceRegistry loads the correct interface
8+
- Updated dependencies
9+
- @graphprotocol/interfaces@0.6.2
10+
11+
## 0.6.14
12+
13+
### Patch Changes
14+
15+
- Update to latest interfaces package
16+
317
## 0.6.13
418

519
### Patch Changes

packages/toolshed/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/toolshed",
3-
"version": "0.6.13",
3+
"version": "0.6.15",
44
"publishConfig": {
55
"access": "public"
66
},

0 commit comments

Comments
 (0)