mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
Major refactoring to reduce EVM's dependency on node: External packages now used: - github.com/luxfi/p2p v1.0.2 (network/p2p, gossip, lp118) - github.com/luxfi/upgrade v1.0.0 (upgrade configs) - github.com/luxfi/vms v0.1.0 (VM interfaces) - github.com/luxfi/codec (codec utilities) - github.com/luxfi/units (unit constants) - github.com/luxfi/constants (network constants) - github.com/luxfi/utils (wrappers, json codec) Remaining node dependencies (minimal, for plugin model): - node/vms/rpcchainvm (RPC plugin server) - node/api (API utilities) - node/utils/rpc (RPC utilities) - node/version (version info) This follows the principle: ONE canonical package for each concern.
Peer Package
The peer package handles networking for the VM.
Network
The Network interface implements the networking portion of the required VM interface. The VM utilizes the Network interface to:
- Set an App Gossip handler for incoming VM gossip messages
- Set an App Request handler for incoming VM request messages
- Send App Requests to peers in the network and specify a response handler to be called upon receiving a response or failure notification
- Send App Gossip messages to the network
Client
The client utilizes the Network interface to send requests to peers on the network and utilizes the waitingHandler to wait until a response or failure is received from the Luxd networking layer.
This allows the user of Client to treat it as if it were returning results from the network synchronously.
result, err := client.Request(nodeID, request) // Blocks until receiving a response from the network
if err != nil {
return err
}
foo(result) // do something with the result