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

Update subgraphs for m2 contract changes #192

Merged
Show file tree
Hide file tree
Changes from all commits
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
10,460 changes: 10,460 additions & 0 deletions subgraphs/eigenda-operator-state/abis/BLSApkRegistry.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

66 changes: 25 additions & 41 deletions subgraphs/eigenda-operator-state/networks.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,88 @@
{
"devnet": {
"BLSRegistryCoordinatorWithIndices": {
"RegistryCoordinator": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyRegistry": {
"BLSApkRegistry": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyCompendium": {
"BLSApkRegistry_Operator": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyCompendium_Operator": {
"RegistryCoordinator_Operator": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSRegistryCoordinatorWithIndices_Operator": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyRegistry_QuorumApkUpdates": {
"BLSApkRegistry_QuorumApkUpdates": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
}
},
"anvil": {
"BLSRegistryCoordinatorWithIndices": {
"address": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"startBlock": 0
},
"BLSPubkeyRegistry": {
"address": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"RegistryCoordinator": {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the addresses of these new contracts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are dummy addresses that get replaced by the deployer. Making that explicit by zeroing them out.

It looks like the preprod-goerli and goerli ones may correspond to actual contracts on goerli, but we can't update those until the new deployment.

"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyCompendium": {
"address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"BLSApkRegistry": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyCompendium_Operator": {
"address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"BLSApkRegistry_Operator": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSRegistryCoordinatorWithIndices_Operator": {
"address": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"RegistryCoordinator_Operator": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
},
"BLSPubkeyRegistry_QuorumApkUpdates": {
"address": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"BLSApkRegistry_QuorumApkUpdates": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": 0
}
},
"preprod-goerli": {
"BLSRegistryCoordinatorWithIndices": {
"RegistryCoordinator": {
"address": "0x376B46C69bf1eD9e6EF32115c644650517F1265B",
"startBlock": 10015410
},
"BLSPubkeyRegistry": {
"BLSApkRegistry": {
"address": "0xB64F362EA5216c17cffE5964710c7C9E824af8aD",
"startBlock": 10015410
},
"BLSPubkeyCompendium": {
"address": "0xE0de168E81C8f31A3b91cDC1C8eE033f6f1cC012",
"startBlock": 10015410
},
"BLSPubkeyCompendium_Operator": {
"BLSApkRegistry_Operator": {
"address": "0xE0de168E81C8f31A3b91cDC1C8eE033f6f1cC012",
"startBlock": 10015410
},
"BLSRegistryCoordinatorWithIndices_Operator": {
"RegistryCoordinator_Operator": {
"address": "0x376B46C69bf1eD9e6EF32115c644650517F1265B",
"startBlock": 10015410
},
"BLSPubkeyRegistry_QuorumApkUpdates": {
"BLSApkRegistry_QuorumApkUpdates": {
"address": "0xB64F362EA5216c17cffE5964710c7C9E824af8aD",
"startBlock": 10015410
}
},
"goerli": {
"BLSRegistryCoordinatorWithIndices": {
"RegistryCoordinator": {
"address": "0x0b30a3427765f136754368a4500bAca8d2a54C0B",
"startBlock": 10043972
},
"BLSPubkeyRegistry": {
"BLSApkRegistry": {
"address": "0xD8fCD5c9103962DE37E375EF9dB62cCf39D5BEcA",
"startBlock": 10043972
},
"BLSPubkeyCompendium": {
"address": "0xc81d3963087Fe09316cd1E032457989C7aC91b19",
"startBlock": 10043972
},
"BLSPubkeyCompendium_Operator": {
"BLSApkRegistry_Operator": {
"address": "0xc81d3963087Fe09316cd1E032457989C7aC91b19",
"startBlock": 10043972
},
"BLSRegistryCoordinatorWithIndices_Operator": {
"RegistryCoordinator_Operator": {
"address": "0x0b30a3427765f136754368a4500bAca8d2a54C0B",
"startBlock": 10043972
},
"BLSPubkeyRegistry_QuorumApkUpdates": {
"BLSApkRegistry_QuorumApkUpdates": {
"address": "0xD8fCD5c9103962DE37E375EF9dB62cCf39D5BEcA",
"startBlock": 10043972
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import {
OperatorAddedToQuorums as OperatorAddedToQuorumsEvent,
OperatorRemovedFromQuorums as OperatorRemovedFromQuorumsEvent
} from "../generated/BLSPubkeyRegistry/BLSPubkeyRegistry"
} from "../generated/BLSApkRegistry/BLSApkRegistry"
import {
OperatorAddedToQuorum,
OperatorRemovedFromQuorum
} from "../generated/schema"

import { NewPubkeyRegistration as NewPubkeyRegistrationEvent } from "../generated/BLSApkRegistry/BLSApkRegistry"
import { NewPubkeyRegistration } from "../generated/schema"




export function handleOperatorAddedToQuorums(
event: OperatorAddedToQuorumsEvent
): void {
Expand Down Expand Up @@ -38,3 +44,22 @@ export function handleOperatorRemovedFromQuorums(

entity.save()
}

export function handleNewPubkeyRegistration(
event: NewPubkeyRegistrationEvent
): void {
let entity = new NewPubkeyRegistration(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.operator = event.params.operator
entity.pubkeyG1_X = event.params.pubkeyG1.X
entity.pubkeyG1_Y = event.params.pubkeyG1.Y
entity.pubkeyG2_X = event.params.pubkeyG2.X
entity.pubkeyG2_Y = event.params.pubkeyG2.Y

entity.blockNumber = event.block.number
entity.blockTimestamp = event.block.timestamp
entity.transactionHash = event.transaction.hash

entity.save()
}
21 changes: 0 additions & 21 deletions subgraphs/eigenda-operator-state/src/bls-pubkey-compendium.ts

This file was deleted.

8 changes: 4 additions & 4 deletions subgraphs/eigenda-operator-state/src/operator-creation.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { BigInt, Bytes, log } from "@graphprotocol/graph-ts"
import { NewPubkeyRegistration as NewPubkeyRegistrationEvent } from "../generated/BLSPubkeyCompendium_Operator/BLSPubkeyCompendium"
import { NewPubkeyRegistration as NewPubkeyRegistrationEvent } from "../generated/BLSApkRegistry_Operator/BLSApkRegistry"
import { Operator } from "../generated/schema"
import { BLSPubkeyCompendium } from "../generated/BLSPubkeyCompendium/BLSPubkeyCompendium"
import { BLSApkRegistry } from "../generated/BLSApkRegistry/BLSApkRegistry"

export function handleNewPubkeyRegistration(
event: NewPubkeyRegistrationEvent
): void {
let pubkeyCompendium = BLSPubkeyCompendium.bind(event.address)
let apkRegistry = BLSApkRegistry.bind(event.address)

let entity = new Operator(
pubkeyCompendium.operatorToPubkeyHash(event.params.operator) // this is the operator id
apkRegistry.operatorToPubkeyHash(event.params.operator) // this is the operator id
)

entity.operator = event.params.operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { BigInt, Bytes, log } from "@graphprotocol/graph-ts"
import {
OperatorRegistered as OperatorRegisteredEvent,
OperatorDeregistered as OperatorDeregisteredEvent
} from "../generated/BLSRegistryCoordinatorWithIndices_Operator/BLSRegistryCoordinatorWithIndices"
import { NewPubkeyRegistration as NewPubkeyRegistrationEvent } from "../generated/BLSPubkeyCompendium/BLSPubkeyCompendium"
} from "../generated/RegistryCoordinator_Operator/RegistryCoordinator"
import { NewPubkeyRegistration as NewPubkeyRegistrationEvent } from "../generated/BLSApkRegistry/BLSApkRegistry"
import { Operator } from "../generated/schema"
import { BLSPubkeyCompendium } from "../generated/BLSPubkeyCompendium/BLSPubkeyCompendium"
import { BLSApkRegistry } from "../generated/BLSApkRegistry/BLSApkRegistry"

export function handleOperatorDeregistered(event: OperatorDeregisteredEvent) : void {
let entity = Operator.load(event.params.operatorId)
Expand Down
10 changes: 5 additions & 5 deletions subgraphs/eigenda-operator-state/src/quorum-apk-updates.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts"
import {
BLSPubkeyRegistry,
BLSApkRegistry,
OperatorAddedToQuorums as OperatorAddedToQuorumsEvent,
OperatorRemovedFromQuorums as OperatorRemovedFromQuorumsEvent
} from "../generated/BLSPubkeyRegistry_QuorumApkUpdates/BLSPubkeyRegistry"
} from "../generated/BLSApkRegistry_QuorumApkUpdates/BLSApkRegistry"
import {
QuorumApk
} from "../generated/schema"
Expand All @@ -20,9 +20,9 @@ export function handleOperatorRemovedFromQuorums(
updateApks(event.address, event.transaction.hash.concatI32(event.logIndex.toI32()), event.params.quorumNumbers, event.block.number, event.block.timestamp);
}

function updateApks(blsPubkeyRegistryAddress: Address, quorumApkIdPrefix: Bytes, quorumNumbers: Bytes, blockNumber: BigInt, blockTimestamp: BigInt): void {
function updateApks(blsApkRegistryAddress: Address, quorumApkIdPrefix: Bytes, quorumNumbers: Bytes, blockNumber: BigInt, blockTimestamp: BigInt): void {
// create a binding for blspubkeyregistry
let blsPubkeyRegistry = BLSPubkeyRegistry.bind(blsPubkeyRegistryAddress)
let blsApkRegistry = BLSApkRegistry.bind(blsApkRegistryAddress)
// for each quorum, get the apk from the contract and store it as an entity
for (let i = 0; i < quorumNumbers.length; i++) {
let quorumNumber = quorumNumbers[i]
Expand All @@ -31,7 +31,7 @@ function updateApks(blsPubkeyRegistryAddress: Address, quorumApkIdPrefix: Bytes,
)
quorumApk.quorumNumber = quorumNumber
// get the apk from the contract
let apk = blsPubkeyRegistry.getApkForQuorum(quorumNumber)
let apk = blsApkRegistry.getApk(quorumNumber)
quorumApk.apk_X = apk.X
quorumApk.apk_Y = apk.Y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
OperatorRegistered as OperatorRegisteredEvent,
OperatorSetParamsUpdated as OperatorSetParamsUpdatedEvent,
OperatorSocketUpdate as OperatorSocketUpdateEvent
} from "../generated/BLSRegistryCoordinatorWithIndices/BLSRegistryCoordinatorWithIndices"
} from "../generated/RegistryCoordinator/RegistryCoordinator"
import {
ChurnApproverUpdated,
OperatorDeregistered,
Expand Down
Loading