Skip to content

Conversation

JonathanOppenheimer
Copy link
Member

@JonathanOppenheimer JonathanOppenheimer commented Aug 11, 2025

Why this should be merged

There are packages in subnet-evm and coreth that share a lot of functionality / are mirrored. These packages should be uplifted to AvalancheGo to prevent the duplicative maintenance of two sets of the same code. This is part of that effort, specifically in assisting the uplifting of the warp package. Closes #4207

Validators has no external imports but there are a couple things worth noting:

  • validators/locked_reader.go is similar to snow/uptime.LockedCalculator (thread-safe reads) but not a duplicate: it also returns validator metadata atomically with uptime.
  • There is a minor name overlap with validatorData it exists in proposervm but with different fields and in a different package

How this was tested

This is currently 'dead' code; after a new AvalancheGo release is dropped, we can use the code in the evm repositories.

Need to be documented in RELEASES.md?

No

@JonathanOppenheimer JonathanOppenheimer changed the title uplift: Add validators warp package from evm repositories uplift: Add validators package from evm repositories Aug 11, 2025
@JonathanOppenheimer JonathanOppenheimer marked this pull request as ready for review August 11, 2025 20:21
@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 20:21
Copy link
Contributor

@Copilot 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 uplifts the validators package from subnet-evm and coreth repositories to AvalancheGo to prevent duplicative maintenance of shared functionality, specifically to assist in uplifting the warp package.

  • Adds a complete validators package with state management, uptime tracking, and manager functionality
  • Implements pausable uptime management that can pause/resume validator tracking based on active status
  • Provides thread-safe validator reader with atomic uptime and metadata retrieval

Reviewed Changes

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

Show a summary per file
File Description
vms/evm/plugin/validators/manager.go Core manager implementation for validator state and uptime synchronization
vms/evm/plugin/validators/state/state.go Validator state CRUD operations with database persistence
vms/evm/plugin/validators/uptime/pausable_manager.go Pausable uptime manager that wraps AvalancheGo's uptime manager
vms/evm/plugin/validators/locked_reader.go Thread-safe reader for atomic validator and uptime retrieval
vms/evm/plugin/validators/interfaces/ Interface definitions for manager, state, and uptime components
vms/evm/plugin/validators/state/codec.go Serialization codec for validator data persistence
vms/evm/plugin/validators/README.md Comprehensive documentation of the validators package
Test files Comprehensive test coverage for all components

@joshua-kim joshua-kim self-requested a review August 12, 2025 19:44
@joshua-kim joshua-kim self-assigned this Aug 12, 2025
@joshua-kim joshua-kim moved this to Ready 🚦 in avalanchego Aug 12, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

This package (everything under validators/) has a ton of sprawl - I think we could reasonably put this under one file. We need to figure out a package name/type name.... maybe something like evm/state/validators.go? I'm not sure what plugin means in this context.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's discuss the structure after the code clean up first - think it'll make more sense then as I'm sure a lot of stuff will change / get deleted etc.

plugin is the name from the EVM repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready 🚦
Development

Successfully merging this pull request may close these issues.

Uplift validators package
2 participants