Skip to content

Commit 1fcda4c

Browse files
committed
chore: bump package versions
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
1 parent 8e7f89a commit 1fcda4c

File tree

7 files changed

+79
-3
lines changed

7 files changed

+79
-3
lines changed

packages/interfaces/CHANGELOG.md

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

3+
## 0.6.0
4+
5+
### Minor Changes
6+
7+
- Updated indexer struct and function signature
8+
39
## 0.5.2
410

511
### Patch Changes

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.5.2",
3+
"version": "0.6.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/subgraph-service/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @graphprotocol/subgraph-service
22

3+
## 0.5.0
4+
5+
### Minor Changes
6+
7+
- Updated indexer struct and function signature
8+
39
## 0.4.1
410

511
### Patch Changes

packages/subgraph-service/package.json

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

packages/toolshed/CHANGELOG.md

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

3+
## 0.6.12
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @graphprotocol/interfaces@0.6.0
9+
310
## 0.6.11
411

512
### 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.11",
3+
"version": "0.6.12",
44
"publishConfig": {
55
"access": "public"
66
},

packages/toolshed/src/core/attestations.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,60 @@ export async function generateAttestationData(
6464
new Uint8Array([sig.v]),
6565
])
6666
}
67+
68+
/**
69+
* Verifies the signer of an attestation data.
70+
* @param attestationData The attestation data to verify.
71+
* @param expectedSigner The expected signer address.
72+
* @param disputeManagerAddress The address of the dispute manager contract.
73+
* @param chainId The chain ID.
74+
* @returns True if the signer matches the expected signer, false otherwise.
75+
*/
76+
export function verifyAttestationSigner(
77+
attestationData: string,
78+
expectedSigner: string,
79+
disputeManagerAddress: string,
80+
chainId: number,
81+
): boolean {
82+
try {
83+
// Extract components from attestation data
84+
const data = ethers.getBytes(attestationData)
85+
86+
// Each CID and deployment ID is 32 bytes
87+
const requestCID = ethers.hexlify(data.slice(0, 32))
88+
const responseCID = ethers.hexlify(data.slice(32, 64))
89+
const subgraphDeploymentID = ethers.hexlify(data.slice(64, 96))
90+
91+
// Extract signature components
92+
const r = ethers.hexlify(data.slice(96, 128))
93+
const s = ethers.hexlify(data.slice(128, 160))
94+
const v = data[160]
95+
96+
// Create the domain for the EIP712 signature
97+
const domain = {
98+
name: 'Graph Protocol',
99+
version: '0',
100+
chainId: chainId,
101+
verifyingContract: disputeManagerAddress,
102+
salt: EIP712_DISPUTE_MANAGER_DOMAIN_SALT,
103+
}
104+
105+
// Create receipt struct
106+
const receipt = {
107+
requestCID,
108+
responseCID,
109+
subgraphDeploymentID,
110+
}
111+
112+
// Recover the signer address
113+
const signature = ethers.Signature.from({ r, s, v })
114+
const recoveredAddress = ethers.verifyTypedData(domain, EIP712_ATTESTATION_PROOF_TYPES, receipt, signature)
115+
console.log(`recoveredAddress: ${recoveredAddress}`)
116+
117+
// Compare addresses (case-insensitive)
118+
return recoveredAddress.toLowerCase() === expectedSigner.toLowerCase()
119+
} catch (error) {
120+
console.log(error)
121+
return false
122+
}
123+
}

0 commit comments

Comments
 (0)