Skip to content

Commit 8ac426b

Browse files
authored
Merge branch 'dev' into feat/logtail-pino
2 parents 68d799d + 0bc873c commit 8ac426b

File tree

10 files changed

+200
-74
lines changed

10 files changed

+200
-74
lines changed

.github/workflows/scorecards.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ jobs:
3232

3333
steps:
3434
- name: Harden Runner
35-
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
35+
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
3636
with:
3737
egress-policy: audit
3838

3939
- name: "Checkout code"
40-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4141
with:
4242
persist-credentials: false
4343

4444
- name: "Run analysis"
45-
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
45+
uses: ossf/scorecard-action@f2ea147fec3c2f0d459703eba7405b5e9bcd8c8f # v2.4.2
4646
with:
4747
results_file: results.sarif
4848
results_format: sarif
@@ -64,7 +64,7 @@ jobs:
6464
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6565
# format to the repository Actions tab.
6666
- name: "Upload artifact"
67-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
67+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6868
with:
6969
name: SARIF file
7070
path: results.sarif

veascan-subgraph-inbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kleros/veascan-subgraph-inbox",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"license": "MIT",
55
"engines": {
66
"node": ">=18.0.0"

veascan-subgraph-inbox/src/VeaInbox.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
BigInt,
44
ByteArray,
55
Bytes,
6-
log,
6+
dataSource,
77
} from "@graphprotocol/graph-ts";
88
import { Snapshot, Message, Ref, Fallback, Inbox } from "../generated/schema";
99
import {
@@ -122,10 +122,10 @@ export function handleSnapshotSaved(event: SnapshotSaved): void {
122122
inbox = new Inbox(event.address);
123123
inbox.save();
124124
}
125-
const contract = VeaInboxArbToEthDevnet.bind(event.address);
126-
const epochPeriod = contract.epochPeriod();
125+
const veaInbox = VeaInboxArbToEthDevnet.bind(event.address);
126+
const epochPeriod = veaInbox.epochPeriod();
127127
const epoch = event.block.timestamp.div(epochPeriod);
128-
const stateRoot = contract.snapshots(epoch);
128+
const stateRoot = veaInbox.snapshots(epoch);
129129
const currentSnapshot = getCurrentSnapshot(event.address);
130130
currentSnapshot.saved = true;
131131
currentSnapshot.caller = event.transaction.from;

veascan-subgraph-inbox/subgraph.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,59 @@ dataSources:
5858
- event: SnapshotSent(indexed uint256,bytes32)
5959
handler: handleSnapshotSent
6060
file: ./src/VeaInbox.ts
61+
- kind: ethereum
62+
name: VeaInboxArbToGnosisDevnet
63+
network: arbitrum-sepolia
64+
source:
65+
address: "0xF6286b9C6c7F1B33Ea976FA43434027c7b8421A7"
66+
abi: VeaInboxArbToGnosisDevnet
67+
startBlock: 129093812
68+
mapping:
69+
kind: ethereum/events
70+
apiVersion: 0.0.7
71+
language: wasm/assemblyscript
72+
entities:
73+
- Snapshot
74+
- Message
75+
- Refs
76+
abis:
77+
- name: VeaInboxArbToGnosisDevnet
78+
file: ../contracts/deployments/arbitrumSepolia/VeaInboxArbToGnosisDevnet.json
79+
- name: VeaInboxArbToEthDevnet
80+
file: ../contracts/deployments/arbitrumSepolia/VeaInboxArbToEthDevnet.json
81+
eventHandlers:
82+
- event: MessageSent(bytes)
83+
handler: handleMessageSent
84+
- event: SnapshotSaved(bytes32,uint256,uint64)
85+
handler: handleSnapshotSaved
86+
- event: SnapshotSent(indexed uint256,bytes32)
87+
handler: handleSnapshotSent
88+
file: ./src/VeaInbox.ts
89+
- kind: ethereum
90+
name: VeaInboxArbToGnosisTestnet
91+
network: arbitrum-sepolia
92+
source:
93+
address: "0xa0d410b202D69C36871d5135ce42fC7D379BBB1c"
94+
abi: VeaInboxArbToGnosisTestnet
95+
startBlock: 139057386
96+
mapping:
97+
kind: ethereum/events
98+
apiVersion: 0.0.7
99+
language: wasm/assemblyscript
100+
entities:
101+
- Snapshot
102+
- Message
103+
- Refs
104+
abis:
105+
- name: VeaInboxArbToGnosisTestnet
106+
file: ../contracts/deployments/arbitrumSepolia/VeaInboxArbToGnosisTestnet.json
107+
- name: VeaInboxArbToEthDevnet
108+
file: ../contracts/deployments/arbitrumSepolia/VeaInboxArbToEthDevnet.json
109+
eventHandlers:
110+
- event: MessageSent(bytes)
111+
handler: handleMessageSent
112+
- event: SnapshotSaved(bytes32,uint256,uint64)
113+
handler: handleSnapshotSaved
114+
- event: SnapshotSent(indexed uint256,bytes32)
115+
handler: handleSnapshotSent
116+
file: ./src/VeaInbox.ts
Lines changed: 86 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,91 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
#
5+
# scripts/update.sh
6+
#
7+
# Usage:
8+
# ./scripts/update.sh <hardhatNetwork> <graphNetwork> [contractFileSuffix]
9+
#
10+
# hardhatNetwork: either "sepolia" or "chiado"
11+
# graphNetwork: the same string to write into subgraph.yaml → .network (e.g. "sepolia" or "chiado")
12+
#
213

314
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
15+
SUBGRAPH_YAML="$SCRIPT_DIR/../subgraph.yaml"
16+
VEAOUTBOX_TS="$SCRIPT_DIR/../src/VeaOutbox.ts"
17+
18+
hardhatNetwork="${1:?"Usage: $0 <hardhatNetwork> <graphNetwork> [contractFileSuffix]"}"
19+
graphNetwork="${2:?"Usage: $0 <hardhatNetwork> <graphNetwork> [contractFileSuffix]"}"
20+
contractFileSuffix="${3:-}"
21+
22+
# Back up the original subgraph.yaml
23+
cp "$SUBGRAPH_YAML" "$SUBGRAPH_YAML".bak."$(date +%s)"
24+
25+
count=$(yq '.dataSources | length' "$SUBGRAPH_YAML")
26+
27+
for i in $(seq 0 $((count - 1))); do
28+
origName="$(yq -r ".dataSources[$i].name" "$SUBGRAPH_YAML")"
29+
newName="$origName"
30+
31+
if [[ "$hardhatNetwork" == "sepolia" ]]; then
32+
if [[ "$origName" == *"ArbToGnosisDevnet"* ]]; then
33+
newName="${origName/ArbToGnosisDevnet/ArbToEthDevnet}"
34+
elif [[ "$origName" == *"ArbToGnosisTestnet"* ]]; then
35+
newName="${origName/ArbToGnosisTestnet/ArbToEthTestnet}"
36+
fi
37+
38+
# Patch VeaOutbox.ts: swap Gnosis imports to Eth imports when targeting sepolia
39+
sed -i.bak \
40+
-e 's|from "../generated/VeaOutboxArbToGnosisDevnet/VeaOutboxArbToGnosisDevnet";|from "../generated/VeaOutboxArbToEthDevnet/VeaOutboxArbToEthDevnet";|' \
41+
-e 's|from "../generated/VeaOutboxArbToGnosisTestnet/VeaOutboxArbToGnosisTestnet";|from "../generated/VeaOutboxArbToEthTestnet/VeaOutboxArbToEthTestnet";|' \
42+
"$VEAOUTBOX_TS"
43+
rm -f "$VEAOUTBOX_TS.bak"
44+
45+
elif [[ "$hardhatNetwork" == "chiado" ]]; then
46+
if [[ "$origName" == *"ArbToEthDevnet"* ]]; then
47+
newName="${origName/ArbToEthDevnet/ArbToGnosisDevnet}"
48+
elif [[ "$origName" == *"ArbToEthTestnet"* ]]; then
49+
newName="${origName/ArbToEthTestnet/ArbToGnosisTestnet}"
50+
fi
51+
52+
53+
# Patch VeaOutbox.ts: swap Eth imports to Gnosis imports when targeting chiado
54+
sed -i.bak \
55+
-e 's|from "../generated/VeaOutboxArbToEthDevnet/VeaOutboxArbToEthDevnet";|from "../generated/VeaOutboxArbToGnosisDevnet/VeaOutboxArbToGnosisDevnet";|' \
56+
-e 's|from "../generated/VeaOutboxArbToEthTestnet/VeaOutboxArbToEthTestnet";|from "../generated/VeaOutboxArbToGnosisTestnet/VeaOutboxArbToGnosisTestnet";|' \
57+
"$VEAOUTBOX_TS"
58+
rm -f "$VEAOUTBOX_TS.bak"
59+
fi
60+
artifact="$SCRIPT_DIR/../../contracts/deployments/$hardhatNetwork/${newName}${contractFileSuffix}.json"
61+
62+
if [[ ! -f "$artifact" ]]; then
63+
echo "Artifact not found for dataSource[$i]:"
64+
exit 1
65+
fi
66+
67+
yq -i ".dataSources[$i].name = \"$newName\"" "$SUBGRAPH_YAML"
68+
69+
yq -i ".dataSources[$i].mapping.abis[0].name = \"$newName\"" "$SUBGRAPH_YAML"
70+
71+
relative_abi_file="../contracts/deployments/$hardhatNetwork/${newName}${contractFileSuffix}.json"
72+
yq -i ".dataSources[$i].mapping.abis[0].file = \"$relative_abi_file\"" "$SUBGRAPH_YAML"
73+
74+
yq -i ".dataSources[$i].source.abi = \"$newName\"" "$SUBGRAPH_YAML"
75+
76+
if [[ "$graphNetwork" == "chiado" ]]; then
77+
yq -i ".dataSources[$i].network = \"gnosis-chiado\"" "$SUBGRAPH_YAML"
78+
else
79+
yq -i ".dataSources[$i].network = \"$graphNetwork\"" "$SUBGRAPH_YAML"
80+
fi
81+
82+
address="$(jq -r '.address' "$artifact")"
83+
yq -i ".dataSources[$i].source.address = \"$address\"" "$SUBGRAPH_YAML"
84+
85+
86+
blockNumber="$(jq '.receipt.blockNumber' "$artifact")"
87+
yq -i ".dataSources[$i].source.startBlock = $blockNumber" "$SUBGRAPH_YAML"
488

5-
function update() { # Parameters: file, dataSourceIndex, graphNetwork
6-
local f="$1"
7-
local dataSourceIndex="$2"
8-
local graphNetwork="$3"
9-
10-
# Compute the contract file path relative to the subgraph.yaml file.
11-
local contractFile="${f#$SCRIPT_DIR/../}"
12-
13-
# Update the ABI file path in subgraph.yaml using an inline environment variable.
14-
contractFile="$contractFile" yq -i ".dataSources[$dataSourceIndex].mapping.abis[0].file = env(contractFile)" "$SCRIPT_DIR/../subgraph.yaml"
15-
16-
# Update the network field using the provided graphNetwork value.
17-
graphNetwork="$graphNetwork" yq -i ".dataSources[$dataSourceIndex].network = env(graphNetwork)" "$SCRIPT_DIR/../subgraph.yaml"
18-
19-
# Extract the address and start block from the artifact using jq.
20-
local address
21-
address=$(jq '.address' "$f")
22-
yq -i ".dataSources[$dataSourceIndex].source.address = $address" "$SCRIPT_DIR/../subgraph.yaml"
23-
24-
local blockNumber
25-
blockNumber=$(jq '.receipt.blockNumber' "$f")
26-
yq -i ".dataSources[$dataSourceIndex].source.startBlock = $blockNumber" "$SCRIPT_DIR/../subgraph.yaml"
27-
}
28-
29-
# Parameters:
30-
# $1: hardhatNetwork (default: sepolia)
31-
# $2: graphNetwork (default: sepolia)
32-
# $3: contractFileSuffix (optional; default: empty string)
33-
hardhatNetwork="${1:-sepolia}"
34-
graphNetwork="${2:-sepolia}"
35-
contractFileSuffix="${3:-}" # default is now an empty string
36-
i=0
37-
38-
# Backup the current subgraph.yaml file.
39-
cp "$SCRIPT_DIR/../subgraph.yaml" "$SCRIPT_DIR/../subgraph.yaml.bak.$(date +%s)"
40-
41-
# Iterate over each data source defined in subgraph.yaml.
42-
for contract in $(yq .dataSources[].name "$SCRIPT_DIR/../subgraph.yaml"); do
43-
update "$SCRIPT_DIR/../../contracts/deployments/$hardhatNetwork/${contract}${contractFileSuffix}.json" "$i" "$graphNetwork"
44-
(( i++ ))
4589
done
90+
91+
echo "Done! subgraph.yaml is now pointing at $hardhatNetwork artifacts. Backup saved as subgraph.yaml.bak.<timestamp>."

veascan-subgraph-outbox/src/VeaOutbox.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
MessageRelayed,
66
Verified,
77
VerificationStarted,
8-
} from "../generated/VeaOutboxArbToEthDevnet/VeaOutboxArbToEthDevnet";
8+
} from "../generated/VeaOutboxArbToGnosisDevnet/VeaOutboxArbToGnosisDevnet";
99
import {
1010
Challenge,
1111
Claim,
@@ -78,7 +78,7 @@ export function handleVerificationStarted(event: VerificationStarted): void {
7878
) {
7979
const claimId = event.address.toHexString() + "-" + i.toString();
8080
const claim = Claim.load(claimId);
81-
if (claim?.epoch.equals(event.params._epoch)) {
81+
if (claim && claim.epoch.equals(event.params._epoch)) {
8282
const verification = new Verification(claim.id);
8383
verification.claim = claim.id;
8484
verification.startTimestamp = event.block.timestamp;
@@ -99,7 +99,7 @@ export function handleVerified(event: Verified): void {
9999
) {
100100
const claimId = event.address.toHexString() + "-" + i.toString();
101101
const claim = Claim.load(claimId);
102-
if (claim?.epoch.equals(event.params._epoch)) {
102+
if (claim && claim.epoch.equals(event.params._epoch)) {
103103
claim.verified = true;
104104
claim.save();
105105

veascan-subgraph-outbox/subgraph.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ schema:
33
file: ./schema.graphql
44
dataSources:
55
- kind: ethereum
6-
name: VeaOutboxArbToEthTestnet
7-
network: sepolia
6+
name: VeaOutboxArbToGnosisDevnet
7+
network: gnosis-chiado
88
source:
9-
address: "0xC0574e973059e727E5E4bEB2e04F1D69F627faab"
10-
abi: VeaOutboxArbToEthTestnet
11-
startBlock: 8047848
9+
address: "0xE24B2838962207F585F4fa5C5bE3e1AcA43a1a1B"
10+
abi: VeaOutboxArbToGnosisDevnet
11+
startBlock: 14598540
1212
mapping:
1313
kind: ethereum/events
1414
apiVersion: 0.0.7
@@ -18,10 +18,9 @@ dataSources:
1818
- Claimed
1919
- MessageRelayed
2020
- Verified
21-
- VerificationStarted
2221
abis:
23-
- name: VeaOutboxArbToEthTestnet
24-
file: ../contracts/deployments/sepolia/VeaOutboxArbToEthTestnet.json
22+
- name: VeaOutboxArbToGnosisDevnet
23+
file: ../contracts/deployments/chiado/VeaOutboxArbToGnosisDevnet.json
2524
eventHandlers:
2625
- event: Challenged(indexed uint256,indexed address)
2726
handler: handleChallenged
@@ -35,12 +34,12 @@ dataSources:
3534
handler: handleVerificationStarted
3635
file: ./src/VeaOutbox.ts
3736
- kind: ethereum
38-
name: VeaOutboxArbToEthDevnet
39-
network: sepolia
37+
name: VeaOutboxArbToGnosisTestnet
38+
network: gnosis-chiado
4039
source:
41-
address: "0xb1f5125b52CE23D3763AC1C9ACEf0668825A66c0"
42-
abi: VeaOutboxArbToEthDevnet
43-
startBlock: 7825233
40+
address: "0x1c35dF16AAde8Fcf1D56Bca00B3c8Ef451113DfC"
41+
abi: VeaOutboxArbToGnosisTestnet
42+
startBlock: 15109734
4443
mapping:
4544
kind: ethereum/events
4645
apiVersion: 0.0.7
@@ -50,10 +49,9 @@ dataSources:
5049
- Claimed
5150
- MessageRelayed
5251
- Verified
53-
- VerificationStarted
5452
abis:
55-
- name: VeaOutboxArbToEthDevnet
56-
file: ../contracts/deployments/sepolia/VeaOutboxArbToEthDevnet.json
53+
- name: VeaOutboxArbToGnosisTestnet
54+
file: ../contracts/deployments/chiado/VeaOutboxArbToGnosisTestnet.json
5755
eventHandlers:
5856
- event: Challenged(indexed uint256,indexed address)
5957
handler: handleChallenged

veascan-web/.env.public

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Subgraph endpoints for veascan, Example: "85918/vea-inbox-arb-sepolia-devnet/version/latest"
2-
export VEASCAN_INBOX_SUBGRAPH=61738/veascan-inbox-arb-sepolia/version/latest
3-
export VEASCAN_OUTBOX_SUBGRAPH=61738/veascan-outbox-sepolia/version/latest
2+
export VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA=61738/veascan-inbox-arb-sepolia/version/latest
3+
export VEASCAN_OUTBOX_SUBGRAPH_CHIADO=61738/veascan-outbox-chiado/version/latest
4+
export VEASCAN_OUTBOX_SUBGRAPH_SEPOLIA=61738/veascan-outbox-sepolia/version/latest

veascan-web/codegen.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import type { CodegenConfig } from "@graphql-codegen/cli";
33
const config: CodegenConfig = {
44
overwrite: true,
55
schema: [
6-
`https://api.studio.thegraph.com/query/${process.env.VEASCAN_INBOX_SUBGRAPH}`,
7-
`https://api.studio.thegraph.com/query/${process.env.VEASCAN_OUTBOX_SUBGRAPH}`,
6+
`https://api.studio.thegraph.com/query/${process.env.VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA}`,
7+
`https://api.studio.thegraph.com/query/${process.env.VEASCAN_OUTBOX_SUBGRAPH_CHIADO}`,
8+
`https://api.studio.thegraph.com/query/${process.env.VEASCAN_OUTBOX_SUBGRAPH_SEPOLIA}`,
89
],
910
documents: "src/hooks/queries/*.ts",
1011
generates: {

0 commit comments

Comments
 (0)