Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion relayer-subgraph-inbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/vea-relayer-subgraph-inbox",
"version": "0.2.3",
"version": "0.2.4",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
Expand Down
8 changes: 4 additions & 4 deletions relayer-subgraph-inbox/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ dataSources:
name: VeaInboxArbToEthTestnet
network: arbitrum-sepolia
source:
address: "0xE12daFE59Bc3A996362d54b37DFd2BA9279cAd06"
address: "0xAA4F00c86bf956C0Fae603D030CBc2dA7f8B7C5B"
abi: VeaInboxArbToEthTestnet
startBlock: 77452741
startBlock: 139057282
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand Down Expand Up @@ -88,9 +88,9 @@ dataSources:
name: VeaInboxArbToGnosisTestnet
network: arbitrum-sepolia
source:
address: "0x62403e9Fbac618301175C89fb21920e4FF235A6a"
address: "0xa0d410b202D69C36871d5135ce42fC7D379BBB1c"
abi: VeaInboxArbToGnosisTestnet
startBlock: 129094170
startBlock: 139057386
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand Down
2 changes: 1 addition & 1 deletion veascan-subgraph-inbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/veascan-subgraph-inbox",
"version": "0.2.1",
"version": "0.2.3",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion veascan-subgraph-inbox/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Snapshot @entity {
stateRootString: String
messages: [Message!]! @derivedFrom(field: "snapshot")
numberMessages: BigInt!
taken: Boolean!
saved: Boolean!
resolving: Boolean!
fallback: [Fallback!]! @derivedFrom(field: "snapshot")
}
Expand Down
12 changes: 6 additions & 6 deletions veascan-subgraph-inbox/src/VeaInbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function getCurrentSnapshot(inboxAddress: Address): Snapshot {
const snapshot = new Snapshot(snapshotId);
snapshot.inbox = inboxAddress;
snapshot.numberMessages = BigInt.fromI32(0);
snapshot.taken = false;
snapshot.saved = false;
snapshot.resolving = false;
snapshot.epoch = BigInt.fromI32(0);
snapshot.epochString = "0";
Expand All @@ -84,7 +84,7 @@ function getCurrentSnapshot(inboxAddress: Address): Snapshot {
);
snapshot.inbox = inboxAddress;
snapshot.numberMessages = BigInt.fromI32(0);
snapshot.taken = false;
snapshot.saved = false;
snapshot.resolving = false;
snapshot.epoch = BigInt.fromI32(0);
snapshot.epochString = "0";
Expand Down Expand Up @@ -127,7 +127,7 @@ export function handleSnapshotSaved(event: SnapshotSaved): void {
const epoch = event.block.timestamp.div(epochPeriod);
const stateRoot = contract.snapshots(epoch);
const currentSnapshot = getCurrentSnapshot(event.address);
currentSnapshot.taken = true;
currentSnapshot.saved = true;
currentSnapshot.caller = event.transaction.from;
currentSnapshot.stateRoot = stateRoot;
currentSnapshot.stateRootString = stateRoot.toHexString();
Expand All @@ -147,7 +147,7 @@ export function handleSnapshotSaved(event: SnapshotSaved): void {
const newSnapshot = new Snapshot(snapshotId);
newSnapshot.inbox = event.address;
newSnapshot.numberMessages = BigInt.fromI32(0);
newSnapshot.taken = false;
newSnapshot.saved = false;
newSnapshot.resolving = false;
newSnapshot.save();

Expand Down Expand Up @@ -204,7 +204,7 @@ export function handleSnapshotSent(event: SnapshotSent): void {
const inbox = VeaInboxArbToEthDevnet.bind(event.address);

let currentSnapshot = getCurrentSnapshot(event.address);
currentSnapshot.taken = false;
currentSnapshot.saved = false;
currentSnapshot.resolving = true;
currentSnapshot.timestamp = epochSent.times(inbox.epochPeriod());
currentSnapshot.stateRoot = Bytes.fromHexString(
Expand All @@ -225,7 +225,7 @@ export function handleSnapshotSent(event: SnapshotSent): void {
const newSnapshot = new Snapshot(newSnapshotId);
newSnapshot.inbox = event.address;
newSnapshot.numberMessages = BigInt.fromI32(0);
newSnapshot.taken = false;
newSnapshot.saved = false;
newSnapshot.resolving = false;
// Initialize new snapshot fields with defaults.
newSnapshot.epoch = BigInt.fromI32(0);
Expand Down
4 changes: 2 additions & 2 deletions veascan-subgraph-inbox/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ dataSources:
name: VeaInboxArbToEthTestnet
network: arbitrum-sepolia
source:
address: "0xE12daFE59Bc3A996362d54b37DFd2BA9279cAd06"
address: "0xAA4F00c86bf956C0Fae603D030CBc2dA7f8B7C5B"
abi: VeaInboxArbToEthTestnet
startBlock: 77452741
startBlock: 139057282
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand Down
2 changes: 1 addition & 1 deletion veascan-subgraph-outbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/veascan-subgraph-outbox",
"version": "0.2.3",
"version": "0.2.4",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
Expand Down
9 changes: 6 additions & 3 deletions veascan-subgraph-outbox/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ type Challenge @entity {
type Verification @entity {
id: ID!
claim: Claim!
timestamp: BigInt!
caller: Bytes! # address
txHash: Bytes!
startTimestamp: BigInt
startCaller: Bytes # address
startTxHash: Bytes
verifiedTimestamp: BigInt
verifiedCaller: Bytes # address
verifiedTxHash: Bytes
}

type Message @entity {
Expand Down
35 changes: 30 additions & 5 deletions veascan-subgraph-outbox/src/VeaOutbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Claimed,
MessageRelayed,
Verified,
VerificationStarted,
} from "../generated/VeaOutboxArbToEthDevnet/VeaOutboxArbToEthDevnet";
import {
Challenge,
Expand Down Expand Up @@ -68,6 +69,27 @@ export function handleChallenged(event: Challenged): void {
}
}

export function handleVerificationStarted(event: VerificationStarted): void {
const ref = getRef(event.address);
for (
let i = ref.totalClaims.minus(BigInt.fromI32(1));
i.ge(BigInt.fromI32(0));
i = i.minus(BigInt.fromI32(1))
) {
const claimId = event.address.toHexString() + "-" + i.toString();
const claim = Claim.load(claimId);
if (claim && claim.epoch.equals(event.params._epoch)) {
const verification = new Verification(claim.id);
verification.claim = claim.id;
verification.startTimestamp = event.block.timestamp;
verification.startCaller = event.transaction.from;
verification.startTxHash = event.transaction.hash;
verification.save();
break;
}
}
}

export function handleVerified(event: Verified): void {
const ref = getRef(event.address);
for (
Expand All @@ -81,11 +103,14 @@ export function handleVerified(event: Verified): void {
claim.verified = true;
claim.save();

const verification = new Verification(claim.id);
verification.claim = claim.id;
verification.timestamp = event.block.timestamp;
verification.caller = event.transaction.from;
verification.txHash = event.transaction.hash;
let verification = Verification.load(claim.id);
if (!verification) {
verification = new Verification(claim.id);
verification.claim = claim.id;
}
verification.verifiedTimestamp = event.block.timestamp;
verification.verifiedCaller = event.transaction.from;
verification.verifiedTxHash = event.transaction.hash;
verification.save();
break;
}
Expand Down
10 changes: 8 additions & 2 deletions veascan-subgraph-outbox/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dataSources:
name: VeaOutboxArbToEthTestnet
network: sepolia
source:
address: "0x209BFdC6B7c66b63A8382196Ba3d06619d0F12c9"
address: "0xC0574e973059e727E5E4bEB2e04F1D69F627faab"
abi: VeaOutboxArbToEthTestnet
startBlock: 6636625
startBlock: 8047848
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -18,6 +18,7 @@ dataSources:
- Claimed
- MessageRelayed
- Verified
- VerificationStarted
abis:
- name: VeaOutboxArbToEthTestnet
file: ../contracts/deployments/sepolia/VeaOutboxArbToEthTestnet.json
Expand All @@ -30,6 +31,8 @@ dataSources:
handler: handleMessageRelayed
- event: Verified(uint256)
handler: handleVerified
- event: VerificationStarted(indexed uint256)
handler: handleVerificationStarted
file: ./src/VeaOutbox.ts
- kind: ethereum
name: VeaOutboxArbToEthDevnet
Expand All @@ -47,6 +50,7 @@ dataSources:
- Claimed
- MessageRelayed
- Verified
- VerificationStarted
abis:
- name: VeaOutboxArbToEthDevnet
file: ../contracts/deployments/sepolia/VeaOutboxArbToEthDevnet.json
Expand All @@ -59,4 +63,6 @@ dataSources:
handler: handleMessageRelayed
- event: Verified(uint256)
handler: handleVerified
- event: VerificationStarted(indexed uint256)
handler: handleVerificationStarted
file: ./src/VeaOutbox.ts
Loading