Skip to content

Conversation

@ptrus
Copy link
Member

@ptrus ptrus commented Dec 22, 2025

Fixes: #1214

@ptrus ptrus force-pushed the ptrus/feature/runtime-first-activity branch 2 times, most recently from 3c08a44 to 6502806 Compare December 23, 2025 12:00
@ptrus ptrus requested a review from Copilot December 23, 2025 12:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds a first_activity field to runtime accounts to track the timestamp of the first transaction involving each account. This enhancement addresses issue #1214 by exposing when an account was first active on the runtime.

Key changes:

  • Added first_activity column to runtime_accounts table with migration and backfill logic
  • Updated account queries and API responses to include the new timestamp field
  • Modified fast-sync recomputation to recalculate first activity timestamps

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
storage/migrations/53_runtime_accounts_first_activity.up.sql Database migration adding first_activity column and backfilling existing data
storage/client/queries/queries.go Updated query to select first_activity field
storage/client/client.go Added scanning of first_activity into account struct
analyzer/queries/queries.go Added upsert and recompute queries for first_activity
analyzer/runtime/runtime.go Integrated first_activity updates during processing and fast-sync
api/spec/v1.yaml Added first_activity field to API schema
tests/e2e_regression/* Updated test expectations with first_activity data
.changelog/1229.feature.md Added changelog entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

INSERT INTO chain.runtime_accounts AS accounts (runtime, address, first_activity)
VALUES ($1, $2, $3)
ON CONFLICT (runtime, address) DO UPDATE
SET first_activity = LEAST(accounts.first_activity, excluded.first_activity)`
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The UPSERT logic uses accounts.first_activity which refers to the existing row value, but in SQL the table alias inside DO UPDATE should reference the target table. The correct syntax should be runtime_accounts.first_activity or the query should maintain consistency with the alias used in the INSERT clause.

Suggested change
SET first_activity = LEAST(accounts.first_activity, excluded.first_activity)`
SET first_activity = LEAST(runtime_accounts.first_activity, excluded.first_activity)`

Copilot uses AI. Check for mistakes.
@ptrus ptrus force-pushed the ptrus/feature/runtime-first-activity branch from 6502806 to f3adc2d Compare December 24, 2025 09:52
@ptrus ptrus requested a review from Copilot December 24, 2025 09:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ptrus ptrus force-pushed the ptrus/feature/runtime-first-activity branch 2 times, most recently from 263710a to 404a33c Compare December 24, 2025 14:46
@ptrus ptrus force-pushed the ptrus/feature/runtime-first-activity branch from 404a33c to 6dfc41f Compare December 24, 2025 19:38
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.

Return first_activity for Sapphire accounts

2 participants