Documentation
¶
Overview ¶
Package node provides the main entry point for the Helium library. It defines the Node type, which implements the parties in the MHE-based MPC procotoles.
The current implementation specifically targets the helper-assisted setting, in which a single helper node coordinates the execution of the setup and compute phases, and serves as an aggregator and circuit evaluator.
Index ¶
- func ValidateConfig(config Config, nl helium.NodesList) error
- type App
- type Config
- type LocalTest
- type LocalTestConfig
- type Node
- func (node *Node) Close() error
- func (node *Node) Connect(ctx context.Context) error
- func (node *Node) GetAggregationOutput(ctx context.Context, pd protocols.Descriptor) (*protocols.AggregationOutput, error)
- func (node *Node) GetCiphertext(ctx context.Context, ctID helium.CiphertextID) (*helium.Ciphertext, error)
- func (node *Node) GetCollectivePublicKey(ctx context.Context) (*rlwe.PublicKey, error)
- func (node *Node) GetDecryptor(ctx context.Context) (*rlwe.Decryptor, error)
- func (node *Node) GetEncoder(ctx context.Context) (*bgv.Encoder, error)
- func (node *Node) GetEncryptor(ctx context.Context) (*rlwe.Encryptor, error)
- func (node *Node) GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
- func (node *Node) GetNetworkStats() centralized.NetStats
- func (node *Node) GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
- func (node *Node) GetSessionFromContext(ctx context.Context) (*session.Session, bool)
- func (node *Node) GetSessionFromID(sessionID helium.SessionID) (*session.Session, bool)
- func (node *Node) HasAddress() bool
- func (node *Node) ID() helium.NodeID
- func (node *Node) IsHelperNode() bool
- func (node *Node) Logf(msg string, v ...any)
- func (node *Node) NodeList() helium.NodesList
- func (node *Node) PutCiphertext(ctx context.Context, ct helium.Ciphertext) error
- func (node *Node) PutShare(ctx context.Context, s protocols.Share) error
- func (node *Node) Register(peer helium.NodeID) error
- func (node *Node) Run(ctx context.Context, app App, ip compute.InputProvider) (cdescs chan<- circuits.Descriptor, outs <-chan circuits.Output, err error)
- func (node *Node) Unregister(peer helium.NodeID) error
- func (node *Node) WaitForSetupDone()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
App represents an Helium application. It specifes the setup phase and declares the circuits that can be executed by the nodes.
type Config ¶
type Config struct { ID helium.NodeID Address helium.NodeAddress HelperID helium.NodeID SessionParameters []session.Parameters SetupConfig setup.ServiceConfig ComputeConfig compute.ServiceConfig ObjectStoreConfig objectstore.Config TLSConfig centralized.TLSConfig }
Config is the configuration of a node. The struct is meant to be encoded and decoded to JSON with the standard library's encoding/json package.
In the current implementation, only a single session per node is supported.
func LoadConfigFromFile ¶
LoadConfigFromFile loads a node configuration from a JSON file.
type LocalTest ¶
type LocalTest struct { Nodes []*Node PeerNodes []*Node HelperNode *Node Params bgv.Parameters *session.TestSession HelperConfig Config SessNodeConfigs []Config helium.NodesList }
LocalTest represent a local test setting with several nodes and a single session with group secret key.
func NewLocalTest ¶
func NewLocalTest(config LocalTestConfig) (test *LocalTest, err error)
NewLocalTest creates a new LocalTest from the configuration and returns it.
func (LocalTest) SessionNodes ¶
SessionNodes returns the set of nodes in the local test that are part of the session.
func (LocalTest) SessionNodesIds ¶
type LocalTestConfig ¶
type LocalTestConfig struct { PeerNodes int // Number of peer nodes in the session SessionParams *session.Parameters InsecureChannels bool // use TLS for this test. TODO: fix TLS ObjectStoreConfig *objectstore.Config // nodes's object store configuration for this test }
LocalTestConfig is a configuration structure for LocalTest types.
type Node ¶
type Node struct { objectstore.ObjectStore // contains filtered or unexported fields }
Node represents a Helium node. It is the main entry point for the Helium library. The node is responsible for managing the setup and compute services, and instantiates the transport layer.
Two types of nodes are supported in the current implementation:
- the helper node coordinates the execution of the setup and compute phases, and serves a an aggregator and circuit evaluator. The helper node must have an address.
- the peer nodes connect to the helper node and provide their protocol shares and encrypted inputs to the compuation. Peer nodes do not need to have an address.
func New ¶
New creates a new Helium node from the provided config and node list. The method returns an error if the config is invalid or if the node list is empty.
func RunNew ¶
func RunNew(ctx context.Context, config Config, nodeList helium.NodesList, app App, ip compute.InputProvider) (node *Node, cdescs chan<- circuits.Descriptor, outs <-chan circuits.Output, err error)
RunNew creates a new Helium node from the provided config and node list, and runs the node with the provided app under the given context.
func (*Node) Close ¶
Close releases all the resources allocated by the node. If the node is the helper node, it stops the server and waits for the peers to disconnect.
func (*Node) Connect ¶
Connect connects the node's transport layer to the network. If the node has an address, it starts a server at the address. If the node does not have an address, it connects to the helper node.
func (*Node) GetAggregationOutput ¶
func (node *Node) GetAggregationOutput(ctx context.Context, pd protocols.Descriptor) (*protocols.AggregationOutput, error)
GetAggregationOutput returns the aggregation output for a given protocol descriptor. If this node is the helper node, the method retrieves the output from the services. If this node is a peer node, the method retrieves the output from the helper node.
func (*Node) GetCiphertext ¶
func (node *Node) GetCiphertext(ctx context.Context, ctID helium.CiphertextID) (*helium.Ciphertext, error)
GetCiphertext returns a ciphertext from the compute service. If this node is the helper node, the method retrieves the ciphertext from the service. If this node is a peer node, the method retrieves the ciphertext from the helper node.
func (*Node) GetCollectivePublicKey ¶
GetCollectivePublicKey returns the collective public key.
func (*Node) GetDecryptor ¶
GetDecryptor returns a lattigo decryptor from the context's session. The decryptor is initialized with the node's secret key.
func (*Node) GetEncoder ¶
GetEncoder returns a lattigo encoder from the context's session.
func (*Node) GetEncryptor ¶
GetEncryptor returns a lattigo encryptor from the context's session. The encryptor is initialized with the collective public key.
func (*Node) GetGaloisKey ¶
GetGaloisKey returns the Galois keys for galois element galEl.
func (*Node) GetNetworkStats ¶
func (node *Node) GetNetworkStats() centralized.NetStats
func (*Node) GetRelinearizationKey ¶
GetRelinearizationKey returns the relinearization key.
func (*Node) GetSessionFromContext ¶
GetSessionFromContext returns the session by extracting the session id from the provided context.
func (*Node) GetSessionFromID ¶
GetSessionFromID returns the session with the given ID.
func (*Node) HasAddress ¶
HasAddress returns true if the node has an address.
func (*Node) IsHelperNode ¶
IsHelperNode returns true if the node is the helper node.
func (*Node) PutCiphertext ¶
PutCiphertext registers a new ciphertext for the compute service. If this node is the helper node, the method registers the ciphertext with the service. If this node is a peer node, the method sends the ciphertext to the helper node.
func (*Node) Run ¶
func (node *Node) Run(ctx context.Context, app App, ip compute.InputProvider) (cdescs chan<- circuits.Descriptor, outs <-chan circuits.Output, err error)
Run runs the node with the provided app under the given context. The method returns channels to send circuit descriptors and receive circuit outputs.
In the current implementation:
- the method runs the setup and compute phases sequentially.
- only the helper node can issue circuit descriptors.
- loading and verification of the state from persistent storage is not implemented.
func (*Node) Unregister ¶
Unregister is called by the transport upon disconnection of a peer node.
func (*Node) WaitForSetupDone ¶
func (node *Node) WaitForSetupDone()
WaitForSetupDone blocks until the setup phase is done.