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

move node types and handlings to separate packages #729

Open
wants to merge 8 commits into
base: move-atomic-sync
Choose a base branch
from

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Jan 3, 2025

Why this should be merged

Moves declaration of message.NodeType to separate pkgs

How this works

This pull request includes several changes to the plugin/evm package, primarily focusing on the atomic trie synchronization and request handling.

Atomic Trie Synchronization:

Request Handling:

  • plugin/evm/message/handler.go: Simplified the RequestHandler interface by merging HandleStateTrieLeafsRequest and HandleAtomicTrieLeafsRequest into a single HandleLeafsRequest method. [1] [2]
  • plugin/evm/message/leafs_request.go: Updated LeafsRequest to use a single NodeType field and removed the distinction between state and atomic trie nodes. [1] [2]
  • plugin/evm/vm.go: Introduced RegisterLeafRequestHandler that can register different message.NodeTypes and passes configs to networkHandler to handle registered NodeTypes accordingly by creating leaf request handlers for each type.

Test Updates:

Additional Changes:

These changes collectively simplify the codebase and improve the maintainability of the atomic trie synchronization and request handling logic.

How this was tested

Existing UTs

Need to be documented?

No

Need to update RELEASES.md?

No

return nil
}

func (vm *VM) RegisterLeafRequestHandler(nodeType message.NodeType, metricName string, trieDB *triedb.Database, trieKeyLen int, useSnapshot bool) error {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm I wonder if we should register an interface rather than nodeType directly. I feel like there is definitely room to improve this PR in general, but did not want to break it anything further.

@ceyonur ceyonur marked this pull request as ready for review January 6, 2025 15:09
@ceyonur ceyonur requested review from darioush and a team as code owners January 6, 2025 15:09
@ceyonur ceyonur self-assigned this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant