-
Notifications
You must be signed in to change notification settings - Fork 3
runtime/accounts: Include first-activity in API response #1229
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: main
Are you sure you want to change the base?
Conversation
3c08a44 to
6502806
Compare
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.
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_activitycolumn toruntime_accountstable 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.
analyzer/queries/queries.go
Outdated
| 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)` |
Copilot
AI
Dec 23, 2025
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.
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.
| SET first_activity = LEAST(accounts.first_activity, excluded.first_activity)` | |
| SET first_activity = LEAST(runtime_accounts.first_activity, excluded.first_activity)` |
6502806 to
f3adc2d
Compare
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.
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.
263710a to
404a33c
Compare
404a33c to
6dfc41f
Compare
Fixes: #1214