Skip to content

Fix evmreader reliability: subscription retry/liveness, idempotent inputs, input count validation, and unified fetch logic#755

Merged
vfusco merged 14 commits intonext/2.0from
feature/evmreader-review
Mar 16, 2026
Merged

Fix evmreader reliability: subscription retry/liveness, idempotent inputs, input count validation, and unified fetch logic#755
vfusco merged 14 commits intonext/2.0from
feature/evmreader-review

Conversation

@vfusco
Copy link
Collaborator

@vfusco vfusco commented Mar 12, 2026

No description provided.

@vfusco vfusco added this to the 2.0.0 milestone Mar 12, 2026
@vfusco vfusco self-assigned this Mar 12, 2026
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 PR improves evmreader reliability through several interconnected changes: WebSocket subscription retry logic with liveness detection, idempotent input handling, input count validation against on-chain state, unified fetchInputs logic replacing duplicated code, and adapter caching with staleness detection.

Changes:

  • Added WebSocket liveness timeout, retry counter reset logic, and Alive()/Ready() health checks backed by atomic.Bool
  • Unified fetchInputsForEpoch and fetchApplicationInputs into a single fetchInputs method with bounds filtering, duplicate detection, and input count validation
  • Introduced adapter caching per application address with config-change invalidation, replaced time.Sleep in tests with deterministic flushHeaders, and moved test infrastructure to dedicated files

Reviewed changes

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

Show a summary per file
File Description
internal/evmreader/evmreader.go Adapter caching, liveness timer, retry logic with consecutive failure tracking
internal/evmreader/service.go WS config fields, alive/ready atomics, Serve() goroutine lifecycle
internal/evmreader/input.go indexInputsIntoEpochs pure function, unified fetchInputs, input count validation
internal/evmreader/sealedepochs.go Use unified fetchInputs, overlap-block search fix, input count mismatch check
internal/evmreader/util.go insertSorted returns duplicate flag, removed indexApps
internal/evmreader/output.go Fixed copy-paste naming (inputs→outputs in comments/variables)
internal/repository/postgres/epoch.go ON CONFLICT DO NOTHING for idempotent input inserts
internal/config/generated.go New WS config: liveness timeout, max retries, reconnect interval
internal/config/generate/Config.toml Config definitions for new WS settings
internal/evmreader/*_test.go Comprehensive tests: mocks refactored, deterministic flush, new edge case/error path coverage
internal/evmreader/testdata/*.json Removed embedded JSON fixtures, replaced with programmatic makeHeader/makeInputEvent

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

You can also share your feedback on Copilot code review. Take the survey.

@vfusco vfusco marked this pull request as ready for review March 12, 2026 17:43
@vfusco vfusco force-pushed the feature/small-improvements branch from dc29507 to 8f38d9b Compare March 12, 2026 17:59
@vfusco vfusco force-pushed the feature/evmreader-review branch from c8c4fa5 to 437642e Compare March 12, 2026 18:03
Base automatically changed from feature/small-improvements to next/2.0 March 13, 2026 13:06
mpolitzer
mpolitzer previously approved these changes Mar 13, 2026
@github-project-automation github-project-automation bot moved this from Todo to Waiting Merge in Rollups SDK Mar 13, 2026
@vfusco vfusco force-pushed the feature/evmreader-review branch from 437642e to 28f484f Compare March 13, 2026 23:59
@vfusco vfusco force-pushed the feature/evmreader-review branch from 28f484f to 80d058c Compare March 14, 2026 00:22
@vfusco vfusco force-pushed the feature/evmreader-review branch from 80d058c to e59b130 Compare March 14, 2026 00:38
mpolitzer
mpolitzer previously approved these changes Mar 15, 2026
@vfusco vfusco dismissed mpolitzer’s stale review March 16, 2026 08:26

The merge-base changed after approval.

mpolitzer
mpolitzer previously approved these changes Mar 16, 2026
@vfusco vfusco dismissed mpolitzer’s stale review March 16, 2026 09:21

The merge-base changed after approval.

renatomaia
renatomaia previously approved these changes Mar 16, 2026
@vfusco vfusco dismissed renatomaia’s stale review March 16, 2026 12:38

The merge-base changed after approval.

@vfusco vfusco changed the base branch from next/2.0 to main March 16, 2026 12:47
@vfusco vfusco changed the base branch from main to next/2.0 March 16, 2026 12:48
@vfusco vfusco merged commit e59b130 into next/2.0 Mar 16, 2026
8 checks passed
@github-project-automation github-project-automation bot moved this from Waiting Merge to Done in Rollups SDK Mar 16, 2026
@vfusco vfusco deleted the feature/evmreader-review branch March 16, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants