archethic-foundation / archethic-foundation/archethic-node
Refactory nodes list to use only first public key
- Dominant language
- Elixir
- Stars
- 82
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
### Is your feature request related to a problem?
All the nodes are identified by their first public key. Almost everywhere in the code we only need this first public key (sending message, verifying message, ensure node is part of an election ...)
But we often use lists with full node data stored in the `Node` struct. Currently this struct takes about 1.5 Ko since we often have 200 nodes in lists, they takes about 315 Ko in memory.
### Describe the solution you'd like
The main function that return node, list of node should by default return only a list of the first public key, and only when a process needs more information about the node we could retrieve those info using `P2P.get_node_info`.
We could also create a new function `P2P.get_node_election_info` for the Election data that are often use which will return only the needed information for the election process
### Additional context
_No response_
### Epic
_No response_
Contributor guide
Research direction
Trace the Node struct and the callers that return node lists, especially message sending, verification, and election checks; compare those uses with P2P.get_node_info. Define the smaller key-only representation and assess whether election callers need a focused API such as P2P.get_node_election_info; done means node lists no longer retain full Node data unless required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- blockchain, distributed-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100