-
Notifications
You must be signed in to change notification settings - Fork 6
Chore/veascan vars rename #421
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
base: dev
Are you sure you want to change the base?
Conversation
WalkthroughThis set of changes updates multiple subgraph and web application components to align with new contract deployments and schema evolutions. Contract addresses and start blocks for several data sources are updated in subgraph configurations. The Changes
Sequence Diagram(s)sequenceDiagram
participant SmartContract as Smart Contract
participant Subgraph as Subgraph Mapping
participant UI as Web UI
SmartContract->>Subgraph: emit VerificationStarted(epoch)
Subgraph->>Subgraph: handleVerificationStarted(event)
Subgraph->>Subgraph: Create Verification (start fields)
SmartContract->>Subgraph: emit Verified(epoch)
Subgraph->>Subgraph: handleVerified(event)
Subgraph->>Subgraph: Update Verification (verified fields)
UI->>Subgraph: Query Verification (start & verified fields)
Subgraph-->>UI: Return Verification data
sequenceDiagram
participant SmartContract as Smart Contract
participant Subgraph as Subgraph Mapping
participant UI as Web UI
SmartContract->>Subgraph: emit SnapshotSaved
Subgraph->>Subgraph: Update Snapshot.saved = true
UI->>Subgraph: Query Snapshots (saved field)
Subgraph-->>UI: Return Snapshots with saved field
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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
veascan-web/src/gql/gql.tsOops! 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:
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. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (7)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for veascan ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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
🧹 Nitpick comments (2)
veascan-web/src/utils/mapDataForAccordion.tsx (1)
146-150
: Filter implementation looks good, consider using strict equality.The filtering logic correctly filters data based on currentStatus when statusFilter is not zero.
Consider using strict equality (
===
) instead of loose equality (==
) for better type safety:- ? data.filter((item) => item.currentStatus == statusFilter) + ? data.filter((item) => item.currentStatus === statusFilter)veascan-subgraph-outbox/src/VeaOutbox.ts (1)
106-114
: Minor readability: early‑return & optional chainingThe load‑or‑create pattern is good, but the surrounding conditional can be tightened:
- if (claim && claim.epoch.equals(event.params._epoch)) { + if (claim?.epoch && claim.epoch.equals(event.params._epoch)) {Coupled with extracting the lookup helper (previous comment) you can reduce the nesting and make control flow clearer:
const claim = findClaimByEpoch(event.address, event.params._epoch); if (!claim) return; claim.verified = true; claim.save(); let verification = Verification.load(claim.id) ?? new Verification(claim.id); ...(optional chaining also satisfies the Biome “useOptionalChain” hint)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
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)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)
🧰 Additional context used
🧬 Code Graph Analysis (4)
veascan-web/src/App.tsx (1)
veascan-web/src/utils/mapDataForAccordion.tsx (1)
mapDataForAccordion
(45-151)
veascan-web/src/components/TxFilterHeader/index.tsx (1)
veascan-web/src/contexts/FiltersContext.tsx (1)
useFiltersContext
(189-189)
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)
veascan-subgraph-outbox/src/VeaOutbox.ts (1)
veascan-web/src/gql/graphql.ts (2)
Claim
(147-161)Verification
(1131-1141)
🪛 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: dependency-review
- GitHub Check: Scorecard analysis
- GitHub Check: Analyze (javascript)
🔇 Additional comments (34)
relayer-subgraph-inbox/package.json (1)
3-3
: Version bump looks good.The version increment from 0.2.3 to 0.2.4 is appropriate for the scope of changes in this PR, maintaining consistency with the other package versions.
veascan-subgraph-outbox/package.json (1)
3-3
: Version bump looks good.This version increment to 0.2.4 correctly aligns with the version in the relayer-subgraph-inbox package, maintaining consistency across related packages.
veascan-subgraph-inbox/package.json (1)
3-3
: Version increment to 0.2.3 is appropriate.The version bump from 0.2.1 to 0.2.3 reflects the schema changes (renaming
taken
tosaved
). This keeps the versioning aligned with related packages in the ecosystem.veascan-subgraph-inbox/schema.graphql (1)
37-37
:✅ Verification successful
Field rename from
taken
tosaved
looks good.This change correctly implements the variable rename mentioned in the PR objectives. The boolean type and non-null constraint have been preserved.
🏁 Script executed:
#!/bin/bash # Verify that all references to the 'taken' field have been updated to 'saved' echo "Checking for remaining references to 'taken' field in the codebase..." rg "\.taken\b|\btaken:" --type ts --type graphqlLength of output: 237
To ensure we catch references in
.graphql
files too, let’s search for the baretaken
token across all files:
🏁 Script executed:
#!/bin/bash echo "Searching for any remaining 'taken' references across the entire codebase..." rg -n '\btaken\b'Length of output: 66655
Let’s check specifically within the subgraph directory to ensure no leftover
taken
references:
🏁 Script executed:
#!/bin/bash echo "Searching for any remaining 'taken' references in veascan‑subgraph‑inbox..." rg -n '\btaken\b' veascan-subgraph-inboxLength of output: 209
✅ Field rename complete:
taken
→saved
No occurrences of
taken
remain in theveascan-subgraph-inbox
directory. The schema field and all references have been updated to:
- veascan-subgraph-inbox/schema.graphql (line 37):
saved: Boolean!
Approving these changes for merge.
veascan-web/src/components/TxFilterHeader/index.tsx (2)
71-77
: Good addition of network to the destructured context properties.The addition of
network
to the destructured properties fromuseFiltersContext()
is correctly implemented.
81-81
: UI update for network name in title looks great.The header now correctly displays the network name as specified in the PR objectives, making it clearer to users which network they're viewing snapshots for.
veascan-web/src/components/SnapshotAccordion/AccordionTitle/ColoredLabel.tsx (1)
12-12
: Good rename from "Taken" to "Saved" in the variant colors.This change correctly implements the requested variable renaming from "Taken" to "Saved" while maintaining the same color value "lightYellow". This aligns with the broader renaming effort described in the PR objectives.
veascan-web/src/App.tsx (1)
78-78
: Proper update to pass statusFilter to mapDataForAccordion.The addition of the
statusFilter
parameter ensures that snapshot data is correctly filtered according to the user's selection in the UI. This change correctly adapts to the updated function signature in themapDataForAccordion
utility.veascan-subgraph-inbox/subgraph.yaml (2)
11-11
: Updated contract address for VeaInboxArbToEthTestnet.The contract address has been updated for the
VeaInboxArbToEthTestnet
data source on the arbitrum-sepolia network. This appears to align with a new contract deployment.
13-13
: Updated start block for VeaInboxArbToEthTestnet indexing.The start block has been significantly increased from 77452741 to 139057282, which corresponds with the new contract deployment. This ensures the subgraph will begin indexing from the correct block.
veascan-web/src/hooks/queries/getInboxData.ts (1)
13-13
: Consistent rename of "taken" to "saved" across all GraphQL queries.The rename from
taken
tosaved
has been consistently applied across all four GraphQL queries in this file. This ensures that the frontend properly retrieves the renamed field from the subgraph, maintaining consistency with the schema changes.Also applies to: 44-44, 83-83, 116-116
veascan-web/src/components/SnapshotAccordion/AccordionTitle/index.tsx (2)
62-62
: Rename fromtaken
tosaved
looks good.Property renamed consistently with PR objectives. This change aligns with the terminology update throughout the codebase.
133-133
: Default status label updated from "Taken" to "Saved".The default return value in the
parseStatus
function has been updated to reflect the new terminology. This ensures UI consistency with the data model changes.veascan-web/src/hooks/queries/getOutboxData.ts (2)
22-24
: Field names updated inverification
object.The verification fields have been renamed to be more specific:
timestamp
→verifiedTimestamp
caller
→verifiedCaller
txHash
→verifiedTxHash
This change adds clarity by explicitly indicating these are verification-related timestamps.
63-65
: Consistent renaming of verification fields across all queries.The verification field renames have been consistently applied across all queries in the file. This ensures uniformity in the data structure throughout the application.
Also applies to: 104-106, 145-147, 186-188
veascan-subgraph-inbox/src/VeaInbox.ts (3)
64-64
: Initialization of new snapshots updated to usesaved
property.The property has been renamed from
taken
tosaved
in the snapshot initialization, maintaining consistent terminology throughout the codebase.Also applies to: 87-87
130-130
: Snapshot status update inhandleSnapshotSaved
renamed tosaved
.The property used to mark a snapshot as taken/saved has been updated in the event handler, maintaining consistent terminology changes.
150-150
: All remaining occurrences oftaken
renamed tosaved
.The rename has been consistently applied throughout all relevant functions in the file, including in
handleSnapshotSent
event handler for both existing and new snapshots.Also applies to: 207-207, 228-228
relayer-subgraph-inbox/subgraph.yaml (2)
35-37
: Updated contract address and start block for VeaInboxArbToEthTestnet.The data source has been updated to point to a new contract deployment:
- New address:
0xAA4F00c86bf956C0Fae603D030CBc2dA7f8B7C5B
- New start block:
139057282
This change ensures the subgraph indexes events from the latest contract deployment.
91-93
: Updated contract address and start block for VeaInboxArbToGnosisTestnet.The data source has been updated to point to a new contract deployment:
- New address:
0xa0d410b202D69C36871d5135ce42fC7D379BBB1c
- New start block:
139057386
This change ensures the subgraph indexes events from the latest contract deployment.
veascan-web/src/utils/mapDataForAccordion.tsx (2)
46-47
: Function signature update looks good.The function now accepts
statusFilter
as a parameter instead of retrieving it from context, which improves testability and decouples the function from context.
109-120
: Verification property access correctly updated.The code correctly accesses the new verification field names (
verifiedTxHash
,verifiedTimestamp
,verifiedCaller
) which aligns with the schema changes in the Verification entity.veascan-subgraph-outbox/schema.graphql (1)
33-38
: Verification entity refactoring looks good.The schema change properly splits the verification lifecycle into two phases by replacing the single set of mandatory fields with two sets of optional fields:
- Start phase:
startTimestamp
,startCaller
,startTxHash
- Verified phase:
verifiedTimestamp
,verifiedCaller
,verifiedTxHash
This provides more granular tracking of the verification process.
veascan-subgraph-outbox/subgraph.yaml (5)
9-11
: Contract address and start block updates look good.The contract address and start block have been updated for the VeaOutboxArbToEthTestnet data source.
21-21
: Entity list update is consistent.Adding
VerificationStarted
to the entities list is consistent with the new event handling.
34-35
: New event handler added correctly.The event handler for
VerificationStarted
has been properly added to support the enhanced verification lifecycle tracking.
53-53
: Entity list update for Devnet is consistent.Similar to the Testnet configuration, adding
VerificationStarted
to the Devnet entities list maintains consistency.
66-67
: Event handler added for Devnet as well.The
VerificationStarted
event handler has been properly added to the Devnet data source, maintaining consistency between environments.veascan-web/src/gql/gql.ts (4)
16-35
: GraphQL queries correctly updated for snapshots.All snapshot-related queries have been updated to use
saved
instead oftaken
, maintaining consistency with the schema changes.
88-113
: Verification field names correctly updated in queries.All claim-related queries have been updated to use the new verification field names (
verifiedTimestamp
,verifiedCaller
,verifiedTxHash
), maintaining consistency with the schema changes.
58-77
: Type-safe function signatures updated correctly.The GraphQL function signatures have been updated to match the new query strings for snapshot-related queries.
94-113
: Type-safe function signatures updated for claim queries.The GraphQL function signatures have been updated to match the new query strings for claim-related queries with the updated verification fields.
veascan-subgraph-outbox/src/VeaOutbox.ts (1)
7-8
: Import looks correct – no issues foundThe additional
VerificationStarted
import is accurate and scoped to the same generated ABI as the other events.veascan-web/src/gql/graphql.ts (1)
278-285
: Generated file – skipping detailed review
graphql.ts
is auto‑generated by GraphQL code‑gen. All changes are the mechanical result of the schema rename (taken → saved
) and the newVerification
fields. Manual edits here will be overwritten, so no action required.Also applies to: 381-389, 582-589, 950-956, 1059-1063, 1124-1129, 1135-1141, 1177-1233, 1247-1253, 1307-1308, 1336-1337, 1367-1368, 1397-1398, 1456-1459, 1491-1494, 1526-1529, 1561-1564, 1596-1599, 1701-1702, 1862-1863, 2060-2061, 2234-2235, 2534-2543, 2706-2715, 2880-2890, 3054-3065, 3230-3240
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; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Factor‑out duplicate “claim lookup” logic & guard against overwriting an existing Verification
Both handleVerificationStarted
and handleVerified
walk ref.totalClaims → 0
to locate the claim for a given epoch. Duplicating this loop:
- Increases maintenance overhead.
- Risks subtle divergence if one of the handlers is updated later.
- Slightly hurts indexing performance for large claim sets.
In addition, if for any reason VerificationStarted
fires more than once for the same claim (re‑org, buggy contract, etc.) the current code will overwrite the existing entity, wiping any previously written verified*
fields.
- const verification = new Verification(claim.id);
- verification.claim = claim.id;
+ let verification = Verification.load(claim.id);
+ if (!verification) {
+ verification = new Verification(claim.id);
+ verification.claim = claim.id;
+ }
Consider extracting the “findClaimByEpoch” loop into a small helper:
function findClaimByEpoch(outbox: Address, epoch: BigInt): Claim | null {
const ref = getRef(outbox);
for (let i = ref.totalClaims.minus(BigInt.fromI32(1)); i.ge(BigInt.fromI32(0)); i = i.minus(BigInt.fromI32(1))) {
const claim = Claim.load(outbox.toHexString() + "-" + i.toString());
if (claim?.epoch.equals(epoch)) return claim;
}
return null;
}
That would turn the handler into:
const claim = findClaimByEpoch(event.address, event.params._epoch);
if (claim) {
let verification = Verification.load(claim.id) ?? new Verification(claim.id);
...
}
This keeps both handlers DRY and prevents accidental field loss.
🧰 Tools
🪛 Biome (1.9.4)
[error] 81-81: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
The merge-base changed after approval.
|
Updated var
taken
tosaved
taken
withsaved
UI Changes
Taken
status updated withSaved
PR-Codex overview
This PR primarily focuses on updating GraphQL query definitions in the
gql.ts
file to improve clarity and structure by formatting the queries with consistent indentation and spacing.Detailed summary
getSnapshots
query for better readability.getResolvingSnapshots
query for improved structure.searchSnapshots
query with consistent indentation.Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Style
Chores