Skip to content
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

Refactor uptime tracking #1388

Merged
merged 152 commits into from
Nov 15, 2024
Merged

Refactor uptime tracking #1388

merged 152 commits into from
Nov 15, 2024

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Nov 14, 2024

Why this should be merged

Current VM package was operating state + uptime manager together and had an increased Initialialize complexity. This PR is to move that to another component.

How this works

This pull request introduces significant changes to the validator management system in the subnet-evm plugin. The main focus is on refactoring the code to use a new validatorsManager for managing validators instead of the previous validatorState and uptimeManager. Additionally, it includes the introduction of new interfaces and restructuring of existing code to improve modularity and maintainability.

Key changes include:

Refactoring and Code Improvements:

  • Refactored the GetCurrentValidators function in plugin/evm/service.go to use validatorsManager instead of validatorState for retrieving validator information.
  • Introduced new interfaces in plugin/evm/validators/interfaces/interfaces.go to define ValidatorReader and Manager for better abstraction and modularity.
  • Added a new manager implementation in plugin/evm/validators/manager.go to handle validator synchronization and state management.

Testing Enhancements:

  • Added comprehensive tests in plugin/evm/validators/manager_test.go to validate the new validator management functionality, including scenarios for adding, updating, and removing validators.

File Restructuring:

  • Renamed and moved several files for better organization, including renaming plugin/evm/validators/codec.go to plugin/evm/validators/state/codec.go and plugin/evm/validators/interfaces/interface.go to plugin/evm/validators/state/interfaces/state.go. [1] [2]

Code Cleanup:

  • Removed the noop_state.go file from plugin/evm/validators/validatorstest as it is no longer needed.

These changes collectively aim to enhance the maintainability and functionality of the validator management system in the subnet-evm plugin.

How this was tested

Locally and UTs

Need to be documented?

No

Need to update RELEASES.md?

No

@ceyonur ceyonur requested review from darioush and a team as code owners November 14, 2024 22:50
plugin/evm/vm.go Show resolved Hide resolved
plugin/evm/vm_test.go Outdated Show resolved Hide resolved
warp/backend.go Outdated Show resolved Hide resolved
darioush
darioush previously approved these changes Nov 15, 2024
plugin/evm/validators/interfaces/interfaces.go Outdated Show resolved Hide resolved
plugin/evm/validators/manager.go Outdated Show resolved Hide resolved
plugin/evm/validators/manager.go Show resolved Hide resolved
plugin/evm/vm.go Show resolved Hide resolved
Co-authored-by: Darioush Jalali <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
@darioush darioush enabled auto-merge (squash) November 15, 2024 18:47
@darioush darioush merged commit fad48ec into master Nov 15, 2024
14 checks passed
@darioush darioush deleted the refactor-uptime-tracking branch November 15, 2024 19:01
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.

2 participants