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 NewTestTransport(hid sessions.NodeID, helperSetupSrv *setup.Service, ...) *testTransport
- func ValidateConfig(config Config, nl List) error
- type Address
- type App
- type Config
- type Coordinator
- type Event
- type Info
- type List
- type LocalTest
- type LocalTestConfig
- type Node
- func (node *Node) Address() Address
- func (node *Node) GetAggregationOutput(ctx context.Context, pd protocols.Descriptor) (*protocols.AggregationOutput, error)
- func (node *Node) GetCiphertext(ctx context.Context, ctID sessions.CiphertextID) (*sessions.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) GetEncryptor(ctx context.Context) (*rlwe.Encryptor, error)
- func (node *Node) GetGaloisKey(ctx context.Context, galEl uint64) (*rlwe.GaloisKey, error)
- func (node *Node) GetOperand(opl circuits.OperandLabel) (*circuits.Operand, bool)
- func (node *Node) GetParameters(ctx context.Context) (sessions.FHEParameters, error)
- func (node *Node) GetRelinearizationKey(ctx context.Context) (*rlwe.RelinearizationKey, error)
- func (node *Node) GetSessionFromContext(ctx context.Context) (*sessions.Session, bool)
- func (node *Node) GetSessionFromID(sessionID sessions.ID) (*sessions.Session, bool)
- func (node *Node) HasAddress() bool
- func (node *Node) ID() sessions.NodeID
- func (node *Node) IsHelperNode() bool
- func (node *Node) Logf(msg string, v ...any)
- func (node *Node) NodeList() List
- func (node *Node) PutCiphertext(ctx context.Context, ct sessions.Ciphertext) error
- func (node *Node) PutOperand(opl circuits.OperandLabel, op *circuits.Operand) error
- func (node *Node) Register(peer sessions.NodeID) error
- func (node *Node) Run(ctx context.Context, app App, ip compute.InputProvider, upstream Coordinator, ...) (cdescs chan<- circuits.Descriptor, outs <-chan circuits.Output, err error)
- func (node *Node) Unregister(peer sessions.NodeID) error
- func (node *Node) WaitForSetupDone(ctx context.Context) error
- type ServicesCoordinator
- type TLSConfig
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestTransport ¶ added in v0.2.0
func ValidateConfig ¶
ValidateConfig checks that the configuration is valid.
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 sessions.NodeID Address Address HelperID sessions.NodeID SessionParameters []sessions.Parameters SetupConfig setup.ServiceConfig ComputeConfig compute.ServiceConfig ObjectStoreConfig objectstore.Config TLSConfig 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 Coordinator ¶ added in v0.2.0
type Coordinator coordinator.Coordinator[Event]
type List ¶ added in v0.2.0
type List []Info
List is a list of known nodes in the network. It must contains all nodes for a given application, including the current node. It does not need to contain an address for all nodes, except for the helper node.
type LocalTest ¶
type LocalTest struct { Nodes []*Node PeerNodes []*Node HelperNode *Node Params bgv.Parameters *sessions.TestSession HelperConfig Config SessNodeConfigs []Config List // contains filtered or unexported fields }
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 *sessions.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 (*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 sessions.CiphertextID) (*sessions.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) 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) GetOperand ¶ added in v0.2.0
func (*Node) GetParameters ¶ added in v0.2.0
GetParameters returns the parameters from the context's session.
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) PutOperand ¶ added in v0.2.0
func (*Node) Run ¶
func (node *Node) Run(ctx context.Context, app App, ip compute.InputProvider, upstream Coordinator, trans Transport) (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.
type ServicesCoordinator ¶ added in v0.2.0
type ServicesCoordinator struct {
// contains filtered or unexported fields
}
type TLSConfig ¶ added in v0.2.0
type TLSConfig struct { InsecureChannels bool // if set, disables TLS authentication FromDirectory string // path to a directory containing the TLS material as files PeerPKs map[sessions.NodeID]string // Mapping of <node, pubKey> where pubKey is PEM encoded PeerCerts map[sessions.NodeID]string // Mapping of <node, certifcate> where pubKey is PEM encoded ASN.1 DER string CACert string // Root CA certificate as a PEM encoded ASN.1 DER string OwnCert string // Own certificate as a PEM encoded ASN.1 DER string OwnPk string // Own public key as a PEM encoded string OwnSk string // Own secret key as a PEM encoded string }
TLSConfig is a struct for specifying TLS-related configuration. TLS is not supported yet.