Skip to content

Conversation

@mani99brar
Copy link
Contributor

@mani99brar mani99brar commented Apr 21, 2025

VerificationStarted event handler

Added it in veascan-subgraph-outbox, its not used in veascan but it's needed to for validator-cli

Renamed taken to saved

Renamed all references of snapshot.taken to snapshot.save and other related calls.

Redeployed subgraphs

Redeployed relayer-subgraph-inbox, veascan-subgraph-inbox and veascan-subgraph-outbox for testnet redeployments and latest changes.


PR-Codex overview

This PR primarily focuses on updating version numbers across several packages, modifying the handling of snapshot statuses from taken to saved, and enhancing the GraphQL queries to reflect these changes. It introduces new fields for verification and updates related components.

Detailed summary

  • Updated version in package.json files for multiple packages.
  • Changed taken status to saved in various components and schemas.
  • Enhanced mapDataForAccordion to accept statusFilter.
  • Updated GraphQL queries to use saved instead of taken.
  • Added new fields in verification: verifiedTimestamp, verifiedCaller, verifiedTxHash.
  • Modified subgraph.yaml addresses and start blocks for veascan-subgraph-inbox and relayer-subgraph-inbox.
  • Introduced handling for VerificationStarted event in VeaOutbox.ts.

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

Summary by CodeRabbit

  • New Features
    • Added support for tracking the start of verification events, capturing separate metadata for the start and completion phases of verifications.
  • Improvements
    • Updated contract addresses and start blocks for multiple subgraphs to reflect the latest deployments.
    • Enhanced the verification schema to distinguish between start and verified metadata.
    • Renamed the snapshot status field from "taken" to "saved" for improved clarity.
    • Updated UI components and queries to reflect the renamed snapshot status and verification metadata fields.
    • Dynamic display of network name added to snapshot filter header.
  • Version Updates
    • Incremented package versions for several subgraph packages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 21, 2025

Walkthrough

This update introduces several changes across the subgraph packages. Contract addresses and start block numbers are updated in the subgraph configuration files for both inbox and outbox packages. In the veascan-subgraph-inbox, the Snapshot entity's boolean field is renamed from taken to saved, with corresponding code updates. The veascan-subgraph-outbox sees a schema change to the Verification entity, splitting single timestamp, caller, and transaction hash fields into distinct start and verified phases. A new event handler for VerificationStarted is added, and related mappings are updated accordingly. Package versions are incremented throughout.

Changes

File(s) Change Summary
relayer-subgraph-inbox/package.json
veascan-subgraph-inbox/package.json
veascan-subgraph-outbox/package.json
Incremented package version numbers.
relayer-subgraph-inbox/subgraph.yaml
veascan-subgraph-inbox/subgraph.yaml
Updated contract addresses and start block numbers for Ethereum data sources in subgraph configurations.
veascan-subgraph-inbox/schema.graphql Renamed taken field to saved in the Snapshot entity.
veascan-subgraph-inbox/src/VeaInbox.ts Replaced all usage of the taken property with saved for the Snapshot entity.
veascan-subgraph-outbox/schema.graphql Replaced single timestamp, caller, and txHash fields in Verification entity with start* and verified* fields.
veascan-subgraph-outbox/src/VeaOutbox.ts Added handleVerificationStarted event handler; updated handleVerified to use new verification metadata fields and load-or-create pattern.
veascan-subgraph-outbox/subgraph.yaml Updated contract addresses, start blocks, and added event handler for VerificationStarted event in data source mappings.
veascan-web/src/App.tsx Added statusFilter argument to mapDataForAccordion call.
veascan-web/src/components/SnapshotAccordion/AccordionTitle/ColoredLabel.tsx Renamed color variant key from "Taken" to "Saved".
veascan-web/src/components/SnapshotAccordion/AccordionTitle/index.tsx Renamed taken property to saved in interface; updated default return from "Taken" to "Saved" in parseStatus.
veascan-web/src/components/TxFilterHeader/index.tsx Added network from filters context; updated header text to include current network name.
veascan-web/src/gql/gql.ts Updated GraphQL queries to replace taken with saved in snapshots and rename verification fields to verified*.
veascan-web/src/gql/graphql.ts Refactored GraphQL schema: replaced taken with saved in Snapshot; split Verification fields into start* and verified*.
veascan-web/src/hooks/queries/getInboxData.ts Updated queries to replace taken with saved in snapshot selections.
veascan-web/src/hooks/queries/getOutboxData.ts Updated queries to rename verification fields from timestamp, caller, txHash to verifiedTimestamp, verifiedCaller, verifiedTxHash.
veascan-web/src/utils/mapDataForAccordion.tsx Added statusFilter parameter; replaced verification fields with verified* fields; removed internal use of filters context.

Sequence Diagram(s)

sequenceDiagram
    participant Ethereum as Ethereum Network
    participant Subgraph as Subgraph Mapping
    participant Verification as Verification Entity

    Ethereum->>Subgraph: VerificationStarted(event)
    Subgraph->>Verification: Create Verification entity with start* metadata

    Ethereum->>Subgraph: Verified(event)
    Subgraph->>Verification: Load or create Verification entity
    Subgraph->>Verification: Update verified* metadata
Loading

Possibly related PRs

Suggested labels

Type: Enhancement :sparkles:, Package: VeaScan Subgraph

Suggested reviewers

  • alcercu

Poem

Hopping through the fields of code,
I see new addresses on the road.
Snapshots now are "saved," not "taken,"
Verification’s start and end awaken.
With every block and every byte,
This bunny’s heart is full of delight!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

veascan-web/src/App.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/veascan-web".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "veascan-web/.eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

veascan-subgraph-outbox/src/VeaOutbox.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/veascan-subgraph-outbox".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "veascan-subgraph-outbox/.eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

veascan-web/src/components/SnapshotAccordion/AccordionTitle/ColoredLabel.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/veascan-web".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "veascan-web/.eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 7 others

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@netlify
Copy link

netlify bot commented Apr 21, 2025

Deploy Preview for veascan ready!

Name Link
🔨 Latest commit 22fdfb6
🔍 Latest deploy log https://app.netlify.com/sites/veascan/deploys/68064e7f9ede600008ab3568
😎 Deploy Preview https://deploy-preview-420--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 site configuration.

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 (2)
veascan-subgraph-inbox/src/VeaInbox.ts (1)

1-247: 💡 Verification agent

🧩 Analysis chain

Verify all instances of 'taken' have been renamed to 'saved'.

The renaming from 'taken' to 'saved' appears to be complete in this file. However, it's worth verifying that no references to 'taken' remain in other files or in any imports or exports not shown in this review.


🏁 Script executed:

#!/bin/bash
# Search for any remaining instances of 'taken' in the codebase that might need to be renamed

echo "Searching for remaining instances of 'taken' in the codebase..."
rg -i "taken" --type ts --type graphql

Length of output: 213


Let’s broaden the search to include all TypeScript and GraphQL files by extension rather than relying on ripgrep’s file types:


🏁 Script executed:

#!/bin/bash
echo "Searching for any remaining instances of 'taken' in .ts, .tsx, and .graphql files..."
rg -i taken -g '*.ts' -g '*.tsx' -g '*.graphql'

Length of output: 9589


Fix remaining “taken” references across the codebase

Several parts of the repo still use the old taken nomenclature—they need to be renamed to saved (and your GraphQL schema/types regenerated) to keep everything in sync:

• veascan-web/src/gql/graphql.ts
– SnapshotTaken enum value and all taken, taken?, taken_in, etc. fields
• veascan-web/src/gql/gql.ts
– All GraphQL queries (getSnapshot, getSnapshots, getResolvingSnapshots, searchSnapshots) still request the taken field
• veascan-web/src/components/SnapshotAccordion/AccordionTitle/ColoredLabel.tsx
– Label constant “Taken”
• veascan-web/src/components/SnapshotAccordion/AccordionTitle/index.tsx
– Prop taken: boolean and display text
• veascan-web/src/hooks/queries/getInboxData.ts
– Query selection taken
• validator-cli/src/utils/devnet.ts
– Comment and log message referencing “snapshot already taken”

Next steps:

  1. Rename all GraphQL schema fields from taken to saved and regenerate your client types (graphql.ts).
  2. Update all UI components, hooks, and CLI code to use saved instead of taken.
  3. Run your GraphQL codegen/build process to ensure no stray taken identifiers remain.
🧰 Tools
🪛 Biome (1.9.4)

[error] 3-3: Do not shadow the global "BigInt" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)


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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

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

72-114: 💡 Verification agent

🧩 Analysis chain

Verify that the web frontend handles the updated Verification entity schema

According to the code snippet from veascan-web/src/gql/graphql.ts, the frontend is still using the old schema with single timestamp, caller, and txHash fields. Ensure that the frontend is updated to work with the new schema.


🏁 Script executed:

#!/bin/bash
# Check for GraphQL queries that might need updating for the new schema
echo "Checking for GraphQL queries using Verification entity..."
rg "Verification {" -A 10 -B 2 --type graphql

echo "Checking for TypeScript/React components using Verification data..."
rg "verification\." -A 2 -B 2 --type ts --type tsx

Length of output: 490


🏁 Script executed:

#!/bin/bash
# Locate the generated GraphQL types file in the veascan-web project
echo "Searching for graphql.ts file..."
file=$(find veascan-web -type f -name 'graphql.ts' | head -n1)
if [ -z "$file" ]; then
  echo "graphql.ts not found"
  exit 0
fi
echo "Found file: $file"
echo "Printing first 200 lines to inspect Verification type:"
sed -n '1,200p' "$file"

Length of output: 7724


🏁 Script executed:

#!/bin/bash
echo "Inspecting Verification type definition in GraphQL schema..."
rg -n "export type Verification" -A 20 veascan-web/src/gql/graphql.ts

Length of output: 1544


Update web frontend to match the new Verification schema
The generated GraphQL types in veascan-web/src/gql/graphql.ts still define Verification with the old single timestamp, caller, and txHash fields. You’ll need to:

  • Update your subgraph schema to expose the new startTimestamp, startCaller, startTxHash, verifiedTimestamp, verifiedCaller, and verifiedTxHash fields on the Verification entity.
  • Re-run your GraphQL code generation (e.g. graphql-codegen) so that veascan-web/src/gql/graphql.ts reflects the updated fields.
  • Audit and update any GraphQL queries or fragments in your React/TS code that fetch Verification data to request the new fields instead of the old ones.
  • Refactor any components or TypeScript types expecting verification.timestamp/verification.caller/verification.txHash to use the new properties.

This will ensure the frontend continues to work correctly with the expanded Verification entity.

🧰 Tools
🪛 Biome (1.9.4)

[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)

🧹 Nitpick comments (1)
veascan-subgraph-outbox/src/VeaOutbox.ts (1)

72-91: Well-implemented VerificationStarted event handler

The handler correctly implements the first phase of verification tracking by:

  1. Finding the relevant claim by epoch
  2. Creating and populating a Verification entity with start-phase data
  3. Saving the entity to connect it with the claim

The implementation follows the same pattern as other handlers in this file.

Consider using optional chaining as suggested by the static analysis tool:

-if (claim && claim.epoch.equals(event.params._epoch)) {
+if (claim?.epoch.equals(event.params._epoch)) {
🧰 Tools
🪛 Biome (1.9.4)

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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a169262 and d06941a.

📒 Files selected for processing (10)
  • relayer-subgraph-inbox/package.json (1 hunks)
  • relayer-subgraph-inbox/subgraph.yaml (2 hunks)
  • veascan-subgraph-inbox/package.json (1 hunks)
  • veascan-subgraph-inbox/schema.graphql (1 hunks)
  • veascan-subgraph-inbox/src/VeaInbox.ts (6 hunks)
  • veascan-subgraph-inbox/subgraph.yaml (1 hunks)
  • veascan-subgraph-outbox/package.json (1 hunks)
  • veascan-subgraph-outbox/schema.graphql (1 hunks)
  • veascan-subgraph-outbox/src/VeaOutbox.ts (3 hunks)
  • veascan-subgraph-outbox/subgraph.yaml (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
veascan-subgraph-outbox/src/VeaOutbox.ts (1)
veascan-web/src/gql/graphql.ts (2)
  • Claim (147-161)
  • Verification (1128-1135)
🪛 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)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: test
  • GitHub Check: Scorecard analysis
  • GitHub Check: Analyze (javascript)
  • GitHub Check: dependency-review
🔇 Additional comments (19)
veascan-subgraph-inbox/package.json (1)

3-3: Version bump to 0.2.3 looks good.

The package version has been updated from 0.2.1 to 0.2.3, matching the coordinated version updates across the subgraph packages to support the changes in this PR.

relayer-subgraph-inbox/package.json (1)

3-3: Version bump to 0.2.4 looks good.

The package version has been incremented from 0.2.3 to 0.2.4, aligning with the updates to contract addresses and start block numbers in the subgraph configuration.

veascan-subgraph-inbox/schema.graphql (1)

37-37: Field rename from 'taken' to 'saved' looks good.

This change correctly renames the Boolean field in the Snapshot entity schema from 'taken' to 'saved', aligning with the PR objective to rename this variable throughout the codebase.

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

11-11: Contract address update looks good.

The contract address for VeaInboxArbToEthTestnet has been updated to point to the new deployment on the arbitrum-sepolia network.


13-13: Start block update looks good.

The startBlock parameter has been updated to 139057282, which properly aligns with the new contract deployment. This ensures the subgraph will begin indexing events from the correct block.

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

64-64: Field rename from 'taken' to 'saved' in snapshot initialization.

This change correctly updates the field name from 'taken' to 'saved' in the initial snapshot creation, aligning with the schema change.


87-87: Field rename from 'taken' to 'saved' in snapshot creation.

This change correctly updates the field name from 'taken' to 'saved' when creating a new snapshot, ensuring consistency with the schema change.


130-130: Field rename from 'taken' to 'saved' in handleSnapshotSaved.

This change correctly updates the field name from 'taken' to 'saved' when marking a snapshot as saved during the handleSnapshotSaved event, maintaining consistent naming.


150-150: Field rename from 'taken' to 'saved' in new snapshot initialization.

This change correctly updates the field name from 'taken' to 'saved' when initializing a new snapshot after saving the current one.


207-207: Field rename from 'taken' to 'saved' in handleSnapshotSent.

This change correctly updates the field name from 'taken' to 'saved' when handling a snapshot sent event, ensuring consistent naming throughout the codebase.


228-228: Field rename from 'taken' to 'saved' in new snapshot creation.

This change correctly updates the field name from 'taken' to 'saved' when creating a new snapshot in the handleSnapshotSent function.

relayer-subgraph-inbox/subgraph.yaml (2)

91-93:

Details

✅ Verification successful

Verify updated Gnosis Testnet source configuration
The address and startBlock for VeaInboxArbToGnosisTestnet have been updated. Ensure these values correspond to the new deployment on arbitrum-sepolia and that the previous address/block (0x62403e9Fbac618301175C89fb21920e4FF235A6a / 129094170) no longer appears in any subgraph configs.


🏁 Script executed:

#!/usr/bin/env bash
# Check for new and old Gnosis Testnet contract configs across the repo
rg -e "0xa0d410b202D69C36871d5135ce42fC7D379BBB1c" -e "139057386"
rg -e "0x62403e9Fbac618301175C89fb21920e4FF235A6a" -e "129094170"

Length of output: 898


Gnosis Testnet source configuration validated
A repository-wide search confirms that the new address (0xa0d410b202D69C36871d5135ce42fC7D379BBB1c) and startBlock (139057386) only appear in:

  • relayer-subgraph-inbox/subgraph.yaml
  • contracts/README.md
  • contracts/deployments/arbitrumSepolia/VeaInboxArbToGnosisTestnet.json

The previous address (0x62403e9Fbac618301175C89fb21920e4FF235A6a) and block (129094170) are no longer present in any subgraph or deployment configuration. No further changes are needed.


35-37:

Details

✅ Verification successful

Verify updated Testnet source configuration
The address and startBlock for VeaInboxArbToEthTestnet have been updated to the redeployed contract on arbitrum-sepolia testnet. Please confirm these values match the on‑chain deployment and that no lingering references to the old values remain.


🏁 Script executed:

#!/usr/bin/env bash
# Check for new and old Testnet contract configs across the repo
rg -e "0xAA4F00c86bf956C0Fae603D030CBc2B7C5B" -e "139057282"
rg -e "0xE12daFE59Bc3A996362d54b37DFd2BA9279cAd06" -e "77452741"

Length of output: 348


🏁 Script executed:

#!/usr/bin/env bash
# Re‑verify presence of the corrected new Testnet address/block and absence of the old ones
rg -e "0xAA4F00c86bf956C0Fae603D030CBc2dA7f8B7C5B" -e "139057282"
rg -e "0xE12daFE59Bc3A996362d54b37DFd2BA9279cAd06" -e "77452741"

Length of output: 1047


All old Testnet references removed and new values applied
I’ve searched the entire repo and confirmed that:

  • No occurrences of the old address 0xE12daFE59Bc3A996362d54b37DFd2BA9279cAd06 or block 77452741 remain.
  • The new address 0xAA4F00c86bf956C0Fae603D030CBc2dA7f8B7C5B and startBlock 139057282 are consistently referenced in:
    • relayer-subgraph-inbox/subgraph.yaml
    • veascan-subgraph-inbox/subgraph.yaml
    • contracts/deployments/arbitrumSepolia/VeaInboxArbToEthTestnet.json
    • contracts/deployments/sepolia/VeaOutboxArbToEthTestnet.json
    • contracts/README.md

Please proceed once you’ve cross‑checked these values against the on‑chain deployment.

veascan-subgraph-outbox/package.json (1)

3-3: Appropriate version bump for feature addition

The version increment from 0.2.3 to 0.2.4 correctly follows semantic versioning principles for the addition of the new VerificationStarted event handler and schema changes without breaking backward compatibility.

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

9-11: Contract address and start block updated for testnet redeployment

The updates to the contract address and start block align with the PR objective of redeploying to testnet.


21-21: New VerificationStarted entity and event handler added

The addition of the VerificationStarted entity and corresponding event handler is consistent with the schema changes and implementation in VeaOutbox.ts.

Also applies to: 34-35


53-53: Consistent event handler implementation across data sources

The VerificationStarted entity and handler are consistently added to both data sources, ensuring uniform behavior.

Also applies to: 66-67

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

7-7: Added import for the new VerificationStarted event type

The import statement is properly updated to include the new event type.


106-114: Updated handleVerified to work with the new two-phase verification model

The modifications correctly implement the second phase of verification:

  1. First trying to load an existing Verification entity (which may have been created during the start phase)
  2. Creating a new one if needed
  3. Updating the verified-phase metadata fields

This approach maintains compatibility with both the new two-phase verification model and the previous single-phase model.

@sonarqubecloud
Copy link

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: 2

🧹 Nitpick comments (6)
veascan-web/src/gql/graphql.ts (6)

582-583: Consistent naming across enums

SnapshotSaved is now present in both Fallback_OrderBy and Message_OrderBy.
If you add more snapshot‑related enums later, update them in lock‑step (ideally via a code‑gen template) so the API surface stays symmetrical.


1059-1062: Filter bloat warning

The four new saved* filters add yet another set of boolean predicates. To keep the API surface manageable:

-type Snapshot_Filter { … saved? saved_in? saved_not? saved_not_in? … }
+"""Prefer compound predicates over a Cartesian explosion of *_not/_in flags."""

You can rely on GraphQL’s built‑in not / and instead of adding _not variants for every scalar.
This keeps generated TypeScript lighter and improves DX.


1124-1125: Ordering by saved

Snapshot_OrderBy.Saved is handy but easily mis‑used.
Sorting large result sets on a low‑cardinality boolean often yields non‑deterministic ordering; pair it with timestamp in the UI to avoid flickering rows.


1135-1141: Splitting Verification fields – don’t forget the “start” side

Only the verified* properties are queried in the generated documents, while start* remain unused.
Either:

  1. Extend the UI to surface “verification started” data, or
  2. Drop the unused fields to keep the schema lean.

Otherwise you pay indexing cost without product value.


1177-1232: Indexing overhead of the expanded Verification_Filter

The filter section ballooned to 60+ new predicates. This can slow down type‑generation and increase bundle size.

If advanced filtering is not a requirement on the web app, consider using codegen --omitDeprecatedFields or a custom GraphQL transform to exclude unused filter fields from the generated TypeScript.


1618-1628: Large generated file committed – consider ignoring it

graphql.ts is a 13 000+‑line generated artifact. Keeping it in VCS greatly increases diff noise (as seen in this PR) and merge‑conflict likelihood.

Suggestion:

 # .gitignore
 /src/gql/graphql.ts

and generate the file in CI (or prebuild) instead.
If you need the types at publish time, commit only the declaration file (.d.ts) or enable incremental codegen caching.

Also applies to: 1700-1747

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between d06941a and 22fdfb6.

📒 Files selected for processing (10)
  • veascan-subgraph-outbox/src/VeaOutbox.ts (3 hunks)
  • veascan-web/src/App.tsx (1 hunks)
  • veascan-web/src/components/SnapshotAccordion/AccordionTitle/ColoredLabel.tsx (1 hunks)
  • veascan-web/src/components/SnapshotAccordion/AccordionTitle/index.tsx (2 hunks)
  • veascan-web/src/components/TxFilterHeader/index.tsx (1 hunks)
  • veascan-web/src/gql/gql.ts (3 hunks)
  • veascan-web/src/gql/graphql.ts (26 hunks)
  • veascan-web/src/hooks/queries/getInboxData.ts (4 hunks)
  • veascan-web/src/hooks/queries/getOutboxData.ts (5 hunks)
  • veascan-web/src/utils/mapDataForAccordion.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (4)
  • veascan-web/src/components/SnapshotAccordion/AccordionTitle/ColoredLabel.tsx
  • veascan-web/src/hooks/queries/getInboxData.ts
  • veascan-web/src/hooks/queries/getOutboxData.ts
  • veascan-web/src/gql/gql.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • veascan-subgraph-outbox/src/VeaOutbox.ts
🧰 Additional context used
🧬 Code Graph Analysis (3)
veascan-web/src/components/TxFilterHeader/index.tsx (1)
veascan-web/src/contexts/FiltersContext.tsx (1)
  • useFiltersContext (189-189)
veascan-web/src/App.tsx (1)
veascan-web/src/utils/mapDataForAccordion.tsx (1)
  • mapDataForAccordion (45-151)
veascan-web/src/utils/mapDataForAccordion.tsx (2)
veascan-web/src/hooks/useSnapshots.ts (2)
  • InboxData (20-22)
  • OutboxData (24-24)
veascan-web/src/utils/formatTimestampToHumanReadable.tsx (1)
  • formatTimestampToHumanReadable (1-30)
⏰ 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: test
  • GitHub Check: Scorecard analysis
  • GitHub Check: dependency-review
  • GitHub Check: sonarcloud
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
veascan-web/src/App.tsx (1)

78-78: Updated function call to pass statusFilter parameter

The code now correctly passes the statusFilter value from the filters context to the mapDataForAccordion function, which enables proper filtering of snapshots based on their status. This change aligns with the updated function signature in mapDataForAccordion.tsx.

veascan-web/src/components/TxFilterHeader/index.tsx (2)

71-77: Add network to destructured properties

Correctly added network to the destructured properties from useFiltersContext() to support the dynamic header text.


81-81: Enhanced header with network information

The header now dynamically includes the network name, making it clearer to users which network environment they're viewing (mainnet or testnet). This change supports the PR objective related to testnet redeployments.

veascan-web/src/components/SnapshotAccordion/AccordionTitle/index.tsx (2)

62-62: Renamed property from 'taken' to 'saved'

The taken property in the SnapshotInboxDataType interface has been renamed to saved, which aligns with the PR objective to rename this variable throughout the codebase.


133-133: Updated default status label

Changed the default return value of the parseStatus function from "Taken" to "Saved" to maintain consistency with the renamed property. This ensures the UI displays the correct label.

veascan-web/src/utils/mapDataForAccordion.tsx (2)

46-48: Updated function signature to accept statusFilter parameter

The mapDataForAccordion function now accepts statusFilter as a parameter instead of retrieving it internally through the context. This is a better design as it makes the function more reusable and explicit about its dependencies.


109-120: Updated verification property access

The code now uses the verified* prefixed properties (verifiedTxHash, verifiedTimestamp, verifiedCaller) instead of the original properties. This change supports the new VerificationStarted event handler implementation mentioned in the PR objectives, where verification data now has separate fields for start and verified phases.

veascan-web/src/gql/graphql.ts (2)

278-285: Ordering by the newly‑nested verification fields may not be supported on all index versions

You introduced six new verification__* order‑by values. The subgraph must expose the corresponding @derivedFrom or @index directives, otherwise orderBy: verification__startCaller (etc.) will be rejected at query‑time.
Please double‑check that the outbox schema contains:

type Claim @entity {
  verification: Verification @derivedFrom(field: "claim")
  ...
}

type Verification @entity {
  startCaller: Bytes @index
  ...
}

and that the subgraph has been re‑synced after the re‑deploy.
If any of the new fields are not indexed, consider dropping them from the enum to avoid runtime errors.


950-951: saved field semantics

Snapshot.saved is now a mandatory (non‑null) boolean.

  • If historical snapshots exist without this flag, they will now be stored as false – confirm that this matches the intended business rule.
  • Consider adding a one‑off migration (or a re‑index script) that sets saved = true for legacy taken = true records to preserve data fidelity.

@mani99brar
Copy link
Contributor Author

I haven't redeployed the subgraphs for the latest changes in my last commit for the issue marked by sonar review, it's a refactored condition so I believe it's not needed.

@mani99brar mani99brar marked this pull request as ready for review April 21, 2025 14:09
@mani99brar mani99brar merged commit 50a5f0a into dev Apr 28, 2025
13 of 15 checks passed
@mani99brar mani99brar deleted the feat/verification-started-event-handler branch May 12, 2025 13:47
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.

3 participants