Skip to content

Chore/arb to gnosis subgraphs and veascan config #426

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

mani99brar
Copy link
Contributor

@mani99brar mani99brar commented Jun 11, 2025

PR-Codex overview

This PR focuses on updating the veascan project, including version increments, environment variable adjustments, and changes to the subgraph configurations for Ethereum networks, specifically regarding the VeaInbox and VeaOutbox components.

Detailed summary

  • Updated version in package.json from 0.2.3 to 0.2.4.
  • Modified environment variables in .env.public for VEASCAN_INBOX_SUBGRAPH and VEASCAN_OUTBOX_SUBGRAPH.
  • Changed API endpoints in codegen.ts to reflect new environment variable names.
  • Updated VeaInbox logic in VeaInbox.ts to use veaInbox instead of contract.
  • Adjusted imports in VeaOutbox.ts to reference VeaOutboxArbToGnosisDevnet.
  • Enhanced condition checks for claim in handleVerificationStarted and handleVerified functions.
  • Added new data sources in subgraph.yaml for VeaInboxArbToGnosisDevnet and VeaOutboxArbToGnosisDevnet.
  • Updated data source configurations for Gnosis network in subgraph.yaml.
  • Introduced a new script for updating subgraph configurations based on network parameters.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added support for bridging between Arbitrum Sepolia and Gnosis Chiado networks, including new bridge configuration and contract deployments.
    • Introduced separate subgraph endpoints for inbox and outbox on different networks for improved granularity.
  • Configuration

    • Updated environment variables and GraphQL schema endpoints to distinguish between Arbitrum Sepolia, Gnosis Chiado, and Sepolia networks.
    • Added new data sources to subgraph configurations for Arbitrum-to-Gnosis bridges and updated outbox data sources to target Gnosis Chiado.
  • Refactor

    • Improved internal script logic for updating subgraph configurations, enhancing clarity and reliability.
    • Renamed variables and imports internally for clearer code readability.
  • Bug Fixes

    • Enhanced null checks in event handlers to prevent potential runtime errors.

Copy link

netlify bot commented Jun 11, 2025

Deploy Preview for veascan ready!

Name Link
🔨 Latest commit 053bee4
🔍 Latest deploy log https://app.netlify.com/projects/veascan/deploys/684bb1bb63509c00080e186d
😎 Deploy Preview https://deploy-preview-426--veascan.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

coderabbitai bot commented Jun 11, 2025

Walkthrough

This update adds two new Arbitrum-to-Gnosis inbox data sources to the subgraph configuration, updates related contract addresses and ABI references, and extends the frontend to support these new bridge routes. Supporting scripts, environment variables, and configuration files are refactored for multi-network support and improved clarity.

Changes

File(s) Change Summary
veascan-subgraph-inbox/subgraph.yaml Added two new data sources (VeaInboxArbToGnosisDevnet, VeaInboxArbToGnosisTestnet) for Arbitrum Sepolia to Gnosis networks, with corresponding contract addresses, ABIs, and start blocks.
veascan-subgraph-inbox/src/VeaInbox.ts Renamed the contract variable to veaInbox and updated related method calls; replaced unused import with dataSource. No logic changes.
veascan-subgraph-inbox/package.json Bumped package version from 0.2.3 to 0.2.4.
veascan-subgraph-outbox/subgraph.yaml Switched data sources from Sepolia to Gnosis Chiado, updated contract addresses, ABI references, and start blocks; renamed data sources accordingly.
veascan-subgraph-outbox/src/VeaOutbox.ts Changed event type imports to Gnosis Devnet variant; replaced optional chaining on claim with explicit null checks in handlers.
veascan-subgraph-outbox/scripts/update.sh Refactored script: removed function, added explicit looping over data sources, enforced argument checks, improved backup and error handling, and updated patching logic for multi-network support.
veascan-web/.env.public Split subgraph endpoint variables by network: renamed inbox and outbox variables to include network identifiers; added separate endpoints for Chiado and Sepolia.
veascan-web/codegen.ts Updated GraphQL schema config to use three environment variables for inbox and outbox subgraph endpoints (Arbitrum Sepolia, Gnosis Chiado, Sepolia).
veascan-web/src/consts/bridges.ts Added new Arbitrum Sepolia to Gnosis Chiado bridge entry, imported relevant contract deployments, and updated bridge and endpoint mappings.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WebApp
    participant Subgraph (Inbox)
    participant Subgraph (Outbox)
    participant Arbitrum Sepolia
    participant Gnosis Chiado

    User->>WebApp: Selects Arbitrum Sepolia → Gnosis Chiado bridge
    WebApp->>Subgraph (Inbox): Queries via VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA
    WebApp->>Subgraph (Outbox): Queries via VEASCAN_OUTBOX_SUBGRAPH_CHIADO
    Subgraph (Inbox)->>Arbitrum Sepolia: Fetches events from VeaInboxArbToGnosis contracts
    Subgraph (Outbox)->>Gnosis Chiado: Fetches events from VeaOutboxArbToGnosis contracts
    WebApp->>User: Displays bridge status and message data
Loading

Possibly related PRs

Suggested labels

Package: VeaScan Subgraph

Suggested reviewers

  • alcercu

Poem

A hop and a skip, across chains we go,
From Arbitrum to Gnosis, new bridges now show.
Subgraphs updated, endpoints split neat,
Scripts refactored for a multi-chain feat.
🐇 With every deploy, the network will grow—
Hooray for the bridges, onward we flow!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3029fa and 3a2202b.

📒 Files selected for processing (1)
  • veascan-subgraph-outbox/scripts/update.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • veascan-subgraph-outbox/scripts/update.sh
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Redirect rules - veascan
  • GitHub Check: Header rules - veascan
  • GitHub Check: Pages changed - veascan
  • GitHub Check: Scorecard analysis
  • GitHub Check: test
  • GitHub Check: Analyze (javascript)
  • GitHub Check: sonarcloud
  • GitHub Check: dependency-review
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
veascan-web/src/consts/bridges.ts (1)

75-83: ⚠️ Potential issue

Environment variables are typed string | undefined – runtime risk

inboxEndpoint/outboxEndpoint expect plain string, but process.env.* is string | undefined.
If the env var is missing the URL turns into "https://api.studio.thegraph.com/query/undefined" which fails silently.

-    inboxEndpoint: `https://api.studio.thegraph.com/query/${process.env.VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA}`,
+    inboxEndpoint: ensureEnv("VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA"),

Add a tiny guard:

function ensureEnv(key: string): string {
  const v = process.env[key];
  if (!v) throw new Error(`Missing env ${key}`);
  return `https://api.studio.thegraph.com/query/${v}`;
}
🧹 Nitpick comments (9)
veascan-subgraph-inbox/package.json (1)

3-3: Add matching CHANGELOG entry for the patch bump

The patch‐level version increment to 0.2.4 is fine, but please remember to append a brief note to the project’s CHANGELOG so downstream users can quickly see what changed.

veascan-subgraph-inbox/src/VeaInbox.ts (2)

6-7: Remove unused dataSource import

dataSource is imported but never referenced, which will raise an “unused import” warning in the AssemblyScript compiler and some CI linters.

-import {
+import {
   Address,
   BigInt,
   ByteArray,
   Bytes,
-  dataSource,
 } from "@graphprotocol/graph-ts";

125-129: Consider renaming the bound contract type for cross-network clarity

You bind the event address to VeaInboxArbToEthDevnet, even for the new Arb → Gnosis data sources.
Functionally this works (ABI is identical), but the mis-named symbol will confuse future readers when debugging multi-network issues.

Two low-effort options:

  1. Generate a shared interface (e.g., VeaInboxCommon) in the subgraph manifest and import that here.
  2. At minimum, add a short comment explaining that the ETH-devnet ABI is reused intentionally.
veascan-web/.env.public (1)

2-4: Verify docs & CI pick up the renamed variables

The old VEASCAN_INBOX/OUTBOX_SUBGRAPH names were replaced. Make sure:

  1. Any deployment or local-dev docs reference the new names.
  2. CI pipelines (e.g., Vercel, GH Actions) have the variables updated, otherwise the web app will query undefined.
veascan-web/src/consts/bridges.ts (2)

6-10: Import names leak implementation details – consider path/alias consolidation

Six nearly-identical import statements for every deployment artefact quickly bloat this constants file and make future additions error-prone.
A small helper that builds the path from {network}/{name}.json would remove duplication and centralise naming rules.


42-51: arbToGnosisContracts duplicates logic – extract to factory helper

arbToEthContracts and arbToGnosisContracts only differ in artefact variables. A one-liner helper such as buildContracts(inbox,outbox) would keep the section DRY.

veascan-subgraph-inbox/subgraph.yaml (1)

77-81: Redundant ABI entries inflate code-gen time

For the new Arb→Gnosis data sources you still include the VeaInboxArbToEthDevnet ABI.
Unless the mapping intentionally uses both ABIs, drop the unused one to speed up graph-codegen and avoid accidental signature mismatches.

Also applies to: 105-108

veascan-subgraph-outbox/scripts/update.sh (2)

59-66: Missing artifact guard prints nothing useful

When the artefact is absent, the script only echoes “Artifact not found for dataSource[$i]:” without the expected path, hindering debugging.

- echo "Artifact not found for dataSource[$i]:"
+ echo "Artifact not found for dataSource[$i] ($artifact)"

75-79: Hard-coding ‘gnosis-chiado’ twice – leverage variable

You already pass graphNetwork; derive the actual Graph network name once to avoid drift:

graph_yaml_network=$([[ $graphNetwork == "chiado" ]] && echo "gnosis-chiado" || echo "$graphNetwork")
...
yq -i ".dataSources[$i].network = \"$graph_yaml_network\"" "$SUBGRAPH_YAML"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd7f009 and c3029fa.

📒 Files selected for processing (9)
  • veascan-subgraph-inbox/package.json (1 hunks)
  • veascan-subgraph-inbox/src/VeaInbox.ts (2 hunks)
  • veascan-subgraph-inbox/subgraph.yaml (1 hunks)
  • veascan-subgraph-outbox/scripts/update.sh (1 hunks)
  • veascan-subgraph-outbox/src/VeaOutbox.ts (3 hunks)
  • veascan-subgraph-outbox/subgraph.yaml (4 hunks)
  • veascan-web/.env.public (1 hunks)
  • veascan-web/codegen.ts (1 hunks)
  • veascan-web/src/consts/bridges.ts (3 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
veascan-subgraph-outbox/src/VeaOutbox.ts

[error] 81-81: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 102-102: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Redirect rules - veascan
  • GitHub Check: Header rules - veascan
  • GitHub Check: Pages changed - veascan
  • GitHub Check: dependency-review
  • GitHub Check: test
  • GitHub Check: Scorecard analysis
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
veascan-web/codegen.ts (1)

6-9: Guard against missing env-vars to avoid failing graphql-codegen

If any of the three environment variables are undefined, the composed URL becomes
https://api.studio.thegraph.com/query/undefined and code-generation will throw.

-  schema: [
-    `https://api.studio.thegraph.com/query/${process.env.VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA}`,
-    `https://api.studio.thegraph.com/query/${process.env.VEASCAN_OUTBOX_SUBGRAPH_CHIADO}`,
-    `https://api.studio.thegraph.com/query/${process.env.VEASCAN_OUTBOX_SUBGRAPH_SEPOLIA}`,
-  ],
+  schema: [
+    process.env.VEASCAN_INBOX_SUBGRAPH_ARBSEPOLIA,
+    process.env.VEASCAN_OUTBOX_SUBGRAPH_CHIADO,
+    process.env.VEASCAN_OUTBOX_SUBGRAPH_SEPOLIA,
+  ]
+    .filter(Boolean)                               // drop undefined
+    .map((p) => `https://api.studio.thegraph.com/query/${p}`),

This fails fast in CI instead of producing an obscure network error at run-time.

veascan-subgraph-outbox/src/VeaOutbox.ts (3)

8-8: Import path change looks correct

The switch to VeaOutboxArbToGnosisDevnet aligns with the updated subgraph manifest. No additional action required.


81-83: Explicit null-check is safer than optional chaining in AssemblyScript

Using claim && claim.epoch… avoids the optional-chaining edge cases that Biome flags but which often break with --target web compilation. Good call.

🧰 Tools
🪛 Biome (1.9.4)

[error] 81-81: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


102-103: Same explicit null-check style consistently applied

Maintaining the same pattern across handlers keeps the codebase uniform and avoids the optional-chain pitfalls noted above.

🧰 Tools
🪛 Biome (1.9.4)

[error] 102-102: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

veascan-subgraph-outbox/subgraph.yaml (1)

16-35: VerificationStarted handler is kept but its entity was dropped – double-check mapping logic

The entities: array no longer lists VerificationStarted, yet the handler is still declared for that event.
If handleVerificationStarted writes/updates the VerificationStarted entity in store, removal here will break type-gen and fail at runtime.

Please confirm the mapping file no longer creates/updates a VerificationStarted entity or add it back:

 entities:
   - Challenged
   - Claimed
   - MessageRelayed
   - Verified
+  - VerificationStarted

Also applies to: 47-66

veascan-web/src/consts/bridges.ts (1)

85-91: Both bridges share the same inbox endpoint – intentional?

id:0 (Arb→Eth) and id:1 (Arb→Gnosis) point to the identical inbox subgraph.
That makes sense because both originate on Arbitrum, but if the inbox schema diverges per route this will cause data overlap.

Copy link

@mani99brar mani99brar marked this pull request as ready for review June 16, 2025 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant