oasis

package
v0.2103.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 94 Imported by: 5

Documentation

Overview

Package oasis provides the Oasis network/node/client related test helpers.

Index

Constants

View Source
const (
	ByzantineDefaultIdentitySeed = "ekiden byzantine node worker, luck=6" // Slot 3.
	ByzantineSlot1IdentitySeed   = "ekiden byzantine node worker, luck=1"
)

Variables

This section is empty.

Functions

func GenerateDeterministicNodeKeys added in v0.2100.0

func GenerateDeterministicNodeKeys(dir *env.Dir, rawSeed string, roles []signature.SignerRole) ([]signature.PublicKey, error)

GenerateDeterministicNodeKeys generates and returns deterministic node keys.

func LogAssertCheckpointSync added in v0.2010.0

func LogAssertCheckpointSync() log.WatcherHandlerFactory

LogAssertCheckpointSync returns a handler which checks whether initial storage sync from a checkpoint was successful or not.

func LogAssertDiscrepancyMajorityFailure added in v0.2100.0

func LogAssertDiscrepancyMajorityFailure() log.WatcherHandlerFactory

LogAssertDiscrepancyMajorityFailure returns a handler which checks whether a discrepancy resolution resulted in MajorityFailure.

func LogAssertEvent

func LogAssertEvent(event, message string) log.WatcherHandlerFactory

LogAssertEvent returns a handler which checks whether a specific log event was emitted based on JSON log output.

func LogAssertExecutionDiscrepancyDetected

func LogAssertExecutionDiscrepancyDetected() log.WatcherHandlerFactory

LogAssertExecutionDiscrepancyDetected returns a handler which checks whether an execution discrepancy was detected based on JSON log output.

func LogAssertNoExecutionDiscrepancyDetected

func LogAssertNoExecutionDiscrepancyDetected() log.WatcherHandlerFactory

LogAssertNoExecutionDiscrepancyDetected returns a handler which checks whether an execution discrepancy was not detected based on JSON log output.

func LogAssertNoRoundFailures

func LogAssertNoRoundFailures() log.WatcherHandlerFactory

LogAssertNoRoundFailures returns a handler which checks whether a round failure was detected based on JSON log output.

func LogAssertNoTimeouts

func LogAssertNoTimeouts() log.WatcherHandlerFactory

LogAssertNoTimeouts returns a handler which checks whether a timeout was detected based on JSON log output.

func LogAssertNoUpgradeConsensus added in v0.2100.0

func LogAssertNoUpgradeConsensus() log.WatcherHandlerFactory

LogAssertNoUpgradeConsensus returns a handler which checks that no consensus migration handler was run based on JSON log output.

func LogAssertNoUpgradeStartup added in v0.2100.0

func LogAssertNoUpgradeStartup() log.WatcherHandlerFactory

LogAssertNoUpgradeStartup returns a handler which checks that no startup migration handler was run based on JSON log output.

func LogAssertNotEvent

func LogAssertNotEvent(event, message string) log.WatcherHandlerFactory

LogAssertNotEvent returns a handler which checks whether a specific log event was not emitted based on JSON log output.

func LogAssertPeerExchangeDisabled

func LogAssertPeerExchangeDisabled() log.WatcherHandlerFactory

LogAssertPeerExchangeDisabled returns a handler which checks whether a peer exchange disabled event was detected based on JSON log output.

func LogAssertRoothashRoothashReindexing

func LogAssertRoothashRoothashReindexing() log.WatcherHandlerFactory

LogAssertRoothashRoothashReindexing returns a handler which checks whether roothash reindexing was run based on JSON log output.

func LogAssertRoundFailures added in v0.2010.0

func LogAssertRoundFailures() log.WatcherHandlerFactory

LogAssertRoundFailures returns a handler which ensures that a round failure was detected based on JSON log output.

func LogAssertTimeouts

func LogAssertTimeouts() log.WatcherHandlerFactory

LogAssertTimeouts returns a handler which checks whether a timeout was detected based on JSON log output.

func LogAssertUpgradeConsensus

func LogAssertUpgradeConsensus() log.WatcherHandlerFactory

LogAssertUpgradeConsensus returns a handler which checks whether a consensus migration handler was run based on JSON log output.

func LogAssertUpgradeIncompatibleBinary added in v0.2100.0

func LogAssertUpgradeIncompatibleBinary() log.WatcherHandlerFactory

LogAssertUpgradeIncompatibleBinary returns a handler which checks whether the binary was deemed incompatible with the upgrade based on JSON log output.

func LogAssertUpgradeStartup

func LogAssertUpgradeStartup() log.WatcherHandlerFactory

LogAssertUpgradeStartup returns a handler which checks whether a startup migration handler was run based on JSON log output.

func LogEventABCIPruneDelete

func LogEventABCIPruneDelete() log.WatcherHandlerFactory

LogEventABCIPruneDelete returns a handler which checks whether a ABCI pruning delete was detected based on JSON log output.

func LogEventABCIStateSyncComplete added in v0.2100.0

func LogEventABCIStateSyncComplete() log.WatcherHandlerFactory

LogEventABCIStateSyncComplete returns a handler which checks whether an ABCI state sync completion was detected based on JSON log output.

Types

type Argument added in v0.2102.0

type Argument struct {
	// Name is the name of the argument, i.e. the leading dashed component.
	Name string `json:"name"`
	// Values is the array of values passed to this argument.
	Values []string `json:"values"`
	// MultiValued tells the system that multiple occurrences of the same argument
	// should have their value arrays merged.
	MultiValued bool `json:"multi_valued"`
}

Argument is a single argument on the commandline, including its values.

type Byzantine

type Byzantine struct {
	*Node
	// contains filtered or unexported fields
}

Byzantine is an Oasis byzantine node.

func (*Byzantine) AddArgs added in v0.2102.0

func (worker *Byzantine) AddArgs(args *argBuilder) error

func (*Byzantine) CustomStart added in v0.2102.0

func (worker *Byzantine) CustomStart(args *argBuilder) error

type ByzantineCfg

type ByzantineCfg struct {
	NodeCfg

	Script    string
	ExtraArgs []Argument

	IdentitySeed string

	ActivationEpoch beacon.EpochTime
	Runtime         int
}

ByzantineCfg is the Oasis byzantine node configuration.

type ByzantineFixture

type ByzantineFixture struct {
	NodeFixture

	Script    string     `json:"script"`
	ExtraArgs []Argument `json:"extra_args"`

	IdentitySeed string `json:"identity_seed"`
	Entity       int    `json:"entity"`

	EnableProfiling bool `json:"enable_profiling"`

	ActivationEpoch beacon.EpochTime `json:"activation_epoch"`
	Runtime         int              `json:"runtime"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`

	EnableDefaultLogWatcherHandlerFactories bool                        `json:"enable_default_log_fac"`
	LogWatcherHandlerFactories              []log.WatcherHandlerFactory `json:"-"`
}

ByzantineFixture is a byzantine node fixture.

func (*ByzantineFixture) Create

func (f *ByzantineFixture) Create(net *Network) (*Byzantine, error)

Create instantiates the byzantine node described by the fixture.

type Client

type Client struct {
	*Node
	// contains filtered or unexported fields
}

Client is an Oasis client node.

func (*Client) AddArgs added in v0.2102.0

func (client *Client) AddArgs(args *argBuilder) error

type ClientCfg

type ClientCfg struct {
	NodeCfg

	Runtimes           []int
	RuntimeProvisioner string
	RuntimeConfig      map[int]map[string]interface{}
	MaxTransactionAge  int64
}

ClientCfg is the Oasis client node provisioning configuration.

type ClientFixture

type ClientFixture struct {
	NodeFixture

	AllowErrorTermination bool `json:"allow_error_termination"`
	AllowEarlyTermination bool `json:"allow_early_termination"`

	EnableProfiling bool `json:"enable_profiling"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`

	// Runtimes contains the indexes of the runtimes to enable.
	Runtimes []int `json:"runtimes,omitempty"`

	RuntimeProvisioner string `json:"runtime_provisioner"`

	// RuntimeConfig contains the per-runtime node-local configuration.
	RuntimeConfig map[int]map[string]interface{} `json:"runtime_config,omitempty"`

	// MaxTransactionAge configures the MaxTransactionAge configuration of the client.
	MaxTransactionAge int64 `json:"max_transaction_age"`
}

ClientFixture is a client node fixture.

func (*ClientFixture) Create

func (f *ClientFixture) Create(net *Network) (*Client, error)

Create instantiates the client node described by the fixture.

type Compute

type Compute struct {
	sync.RWMutex

	*Node
	// contains filtered or unexported fields
}

Compute is an Oasis compute node.

func (*Compute) AddArgs added in v0.2102.0

func (worker *Compute) AddArgs(args *argBuilder) error

func (*Compute) ConsensusKeyPath

func (worker *Compute) ConsensusKeyPath() string

ConsensusKeyPath returns the path to the node's consensus key.

func (*Compute) ExportsPath

func (worker *Compute) ExportsPath() string

ExportsPath returns the path to the node's exports data dir.

func (*Compute) IdentityKeyPath

func (worker *Compute) IdentityKeyPath() string

IdentityKeyPath returns the path to the node's identity key.

func (*Compute) P2PKeyPath

func (worker *Compute) P2PKeyPath() string

P2PKeyPath returns the path to the node's P2P key.

func (*Compute) TLSCertPath

func (worker *Compute) TLSCertPath() string

TLSCertPath returns the path to the node's TLS certificate.

func (*Compute) TLSKeyPath

func (worker *Compute) TLSKeyPath() string

TLSKeyPath returns the path to the node's TLS key.

func (*Compute) UpdateRuntimes

func (worker *Compute) UpdateRuntimes(runtimes []int)

UpdateRuntimes updates the worker node runtimes.

type ComputeCfg

type ComputeCfg struct {
	NodeCfg

	RuntimeProvisioner string

	Runtimes      []int
	RuntimeConfig map[int]map[string]interface{}
}

ComputeCfg is the Oasis compute node configuration.

type ComputeWorkerFixture

type ComputeWorkerFixture struct {
	NodeFixture

	Entity int `json:"entity"`

	RuntimeProvisioner string `json:"runtime_provisioner"`

	AllowEarlyTermination bool `json:"allow_early_termination"`
	AllowErrorTermination bool `json:"allow_error_termination"`

	EnableProfiling bool `json:"enable_profiling"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`

	CrashPointsProbability float64 `json:"crash_point_probability"`

	LogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"`

	// Runtimes contains the indexes of the runtimes to enable.
	Runtimes []int `json:"runtimes,omitempty"`

	// RuntimeConfig contains the per-runtime node-local configuration.
	RuntimeConfig map[int]map[string]interface{} `json:"runtime_config,omitempty"`
}

ComputeWorkerFixture is a compute worker fixture.

func (*ComputeWorkerFixture) Create

func (f *ComputeWorkerFixture) Create(net *Network) (*Compute, error)

Create instantiates the compute worker described by the fixture.

type ConsensusFixture

type ConsensusFixture struct {
	// MinGasPrice specifies the minimum gas price accepted by a validator node.
	MinGasPrice uint64 `json:"min_gas_price"`
	// SubmissionGasPrice is the gas price to use when submitting consensus transactions.
	SubmissionGasPrice uint64 `json:"submission_gas_price"`

	// PruneNumKept is the number of blocks to keep (zero disables pruning).
	PruneNumKept uint64 `json:"prune_num_kept"`

	// TendermintRecoverCorruptedWAL enables automatic recovery of corrupted Tendermint's WAL.
	TendermintRecoverCorruptedWAL bool `json:"tendermint_recover_corrupted_wal"`

	// EnableConsensusRPCWorker enables the public consensus RPC services worker.
	EnableConsensusRPCWorker bool `json:"enable_consensusrpc_worker,omitempty"`

	// SupplementarySanityInterval configures the sanity check application.
	SupplementarySanityInterval uint64 `json:"supplementary_sanity_interval,omitempty"`
}

ConsensusFixture is a fixture containing consensus-related configuration.

type ConsensusStateSyncCfg

type ConsensusStateSyncCfg struct {
	ConsensusNodes []string
	TrustHeight    uint64
	TrustHash      string
}

ConsensusStateSyncCfg is a node's consensus state sync configuration.

type Controller

type Controller struct {
	control.DebugController
	control.NodeController

	Beacon        beacon.Backend
	Consensus     consensus.ClientBackend
	Staking       staking.Backend
	Governance    governance.Backend
	Registry      registry.Backend
	Roothash      roothash.Backend
	RuntimeClient runtimeClient.RuntimeClient
	Storage       storage.Backend
	Keymanager    *keymanager.KeymanagerClient

	StorageWorker workerStorage.StorageWorker
	// contains filtered or unexported fields
}

Controller is a network controller that connects to one of the Oasis nodes and enables queries and issuing commands.

func NewController

func NewController(socketPath string) (*Controller, error)

NewController creates a new node controller given the path to a node's internal socket.

func (*Controller) Close

func (c *Controller) Close()

Close closes the gRPC connection with the node the controller is controlling.

type CustomStartFeature added in v0.2102.0

type CustomStartFeature interface {
	CustomStart(args *argBuilder) error
}

CustomStartFeature is a feature with a customized start method.

type Entity

type Entity struct {
	// contains filtered or unexported fields
}

Entity is an Oasis entity.

func (*Entity) DescriptorPath

func (ent *Entity) DescriptorPath() string

DescriptorPath returns the path to the entity descriptor.

func (*Entity) EntityKeyPath

func (ent *Entity) EntityKeyPath() string

EntityKeyPath returns the path to the entity private key.

func (*Entity) ID added in v0.2100.0

func (ent *Entity) ID() signature.PublicKey

ID returns the entity's ID.

func (*Entity) Inner

func (ent *Entity) Inner() (*entity.Entity, signature.Signer)

Inner returns the actual Oasis entity and it's signer.

func (*Entity) Signer

func (ent *Entity) Signer() signature.Signer

Signer returns the entity signer.

type EntityCfg

type EntityCfg struct {
	IsDebugTestEntity bool
	Restore           bool
}

EntityCfg is the Oasis entity provisioning configuration.

type Feature added in v0.2102.0

type Feature interface {
	AddArgs(args *argBuilder) error
}

Feature is a feature or worker hosted by a concrete oasis-node process.

type IASCfg

type IASCfg struct {
	// Mock specifies if Mock IAS Proxy should be used.
	Mock bool `json:"mock,omitempty"`
}

IASCfg is the Oasis test network IAS configuration.

type Keymanager

type Keymanager struct {
	*Node
	// contains filtered or unexported fields
}

Keymanager is an Oasis key manager.

func (*Keymanager) AddArgs added in v0.2102.0

func (km *Keymanager) AddArgs(args *argBuilder) error

func (*Keymanager) ConsensusKeyPath

func (km *Keymanager) ConsensusKeyPath() string

ConsensusKeyPath returns the path to the node's consensus key.

func (*Keymanager) ExportsPath

func (km *Keymanager) ExportsPath() string

ExportsPath returns the path to the node's exports data dir.

func (*Keymanager) IdentityKeyPath

func (km *Keymanager) IdentityKeyPath() string

IdentityKeyPath returns the paths to the node's identity key.

func (*Keymanager) P2PKeyPath

func (km *Keymanager) P2PKeyPath() string

P2PKeyPath returns the paths to the node's P2P key.

func (*Keymanager) TLSCertPath

func (km *Keymanager) TLSCertPath() string

TLSCertPath returns the path to the node's TLS certificate.

func (*Keymanager) TLSKeyPath

func (km *Keymanager) TLSKeyPath() string

TLSKeyPath returns the path to the node's TLS key.

type KeymanagerCfg

type KeymanagerCfg struct {
	NodeCfg

	SentryIndices []int

	Runtime            *Runtime
	Policy             *KeymanagerPolicy
	RuntimeProvisioner string
}

KeymanagerCfg is the Oasis key manager provisioning configuration.

type KeymanagerFixture

type KeymanagerFixture struct {
	NodeFixture

	Runtime int `json:"runtime"`
	Entity  int `json:"entity"`
	Policy  int `json:"policy"`

	RuntimeProvisioner string `json:"runtime_provisioner"`

	AllowEarlyTermination bool `json:"allow_early_termination"`
	AllowErrorTermination bool `json:"allow_error_termination"`

	EnableProfiling bool `json:"enable_profiling"`

	Sentries []int `json:"sentries,omitempty"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`

	CrashPointsProbability float64 `json:"crash_points_probability,omitempty"`

	LogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"`
}

KeymanagerFixture is a key manager fixture.

func (*KeymanagerFixture) Create

func (f *KeymanagerFixture) Create(net *Network) (*Keymanager, error)

Create instantiates the key manager described by the fixture.

type KeymanagerPolicy

type KeymanagerPolicy struct {
	// contains filtered or unexported fields
}

KeymanagerPolicy is an Oasis key manager policy document.

type KeymanagerPolicyCfg

type KeymanagerPolicyCfg struct {
	Runtime *Runtime
	Serial  int
}

KeymanagerPolicyCfg is an Oasis key manager policy document configuration.

type KeymanagerPolicyFixture

type KeymanagerPolicyFixture struct {
	Runtime int `json:"runtime"`
	Serial  int `json:"serial"`
}

KeymangerPolicyFixgure is a key manager policy fixture.

func (*KeymanagerPolicyFixture) Create

Create instantiates the key manager policy described in the fixture.

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network is a test Oasis network.

func New

func New(env *env.Env, cfg *NetworkCfg) (*Network, error)

New creates a new test Oasis network.

func (*Network) AddLogWatcher

func (net *Network) AddLogWatcher(node *Node) error

AddLogWatcher adds a log watcher for the given node and creates log watcher handlers from the networks's default and node's specific log watcher handler factories.

func (*Network) BasePath

func (net *Network) BasePath() string

BasePath returns the path to the network base directory.

func (*Network) Byzantine

func (net *Network) Byzantine() []*Byzantine

Byzantine returns the byzantine nodes associated with the network.

func (*Network) CheckLogWatchers

func (net *Network) CheckLogWatchers() (err error)

CheckLogWatchers closes all log watchers and checks if any errors were reported while the log watchers were running.

func (*Network) ClientController

func (net *Network) ClientController() *Controller

ClientController returns the client controller connected to the first client node.

func (*Network) Clients

func (net *Network) Clients() []*Client

Clients returns the client nodes associated with the network.

func (*Network) ComputeWorkers

func (net *Network) ComputeWorkers() []*Compute

ComputeWorkers returns the compute worker nodes associated with the network.

func (*Network) Config

func (net *Network) Config() *NetworkCfg

Config returns the network configuration.

func (*Network) Controller

func (net *Network) Controller() *Controller

Controller returns the network controller.

func (*Network) Entities

func (net *Network) Entities() []*Entity

Entities returns the entities associated with the network.

func (*Network) Errors

func (net *Network) Errors() <-chan error

Errors returns the channel by which node failures will be conveyed.

func (*Network) GenesisPath

func (net *Network) GenesisPath() string

GenesisPath returns the path to the genesis file for the network.

func (*Network) GetCLIConfig

func (net *Network) GetCLIConfig() cli.Config

Implements cli.Factory.

func (*Network) GetNamedNode added in v0.2102.0

func (net *Network) GetNamedNode(defaultName string, cfg *NodeCfg) (*Node, error)

GetNamedNode retrieves the node object for the node with the given name and loads the given node config into it. If no node with the given name exists, a new one is created.

func (*Network) Keymanagers

func (net *Network) Keymanagers() []*Keymanager

Keymanagers returns the keymanagers associated with the network.

func (*Network) MakeGenesis added in v0.2011.0

func (net *Network) MakeGenesis() error

MakeGenesis generates a new Genesis file.

func (*Network) NewByzantine

func (net *Network) NewByzantine(cfg *ByzantineCfg) (*Byzantine, error)

NewByzantine provisions a new byzantine node and adds it to the network.

func (*Network) NewClient

func (net *Network) NewClient(cfg *ClientCfg) (*Client, error)

NewClient provisions a new client node and adds it to the network.

func (*Network) NewCompute

func (net *Network) NewCompute(cfg *ComputeCfg) (*Compute, error)

NewCompute provisions a new compute node and adds it to the network.

func (*Network) NewEntity

func (net *Network) NewEntity(cfg *EntityCfg) (*Entity, error)

NewEntity provisions a new entity and adds it to the network.

func (*Network) NewKeymanager

func (net *Network) NewKeymanager(cfg *KeymanagerCfg) (*Keymanager, error)

NewKeymanager provisions a new keymanager and adds it to the network.

func (*Network) NewKeymanagerPolicy

func (net *Network) NewKeymanagerPolicy(cfg *KeymanagerPolicyCfg) (*KeymanagerPolicy, error)

NewKeymanagerPolicy provisions a new keymanager policy and adds it to the network.

func (*Network) NewRuntime

func (net *Network) NewRuntime(cfg *RuntimeCfg) (*Runtime, error)

NewRuntime provisions a new runtime and adds it to the network.

func (*Network) NewSeed added in v0.2011.2

func (net *Network) NewSeed(cfg *SeedCfg) (*Seed, error)

NewSeed provisions a new seed node and adds it to the network.

func (*Network) NewSentry

func (net *Network) NewSentry(cfg *SentryCfg) (*Sentry, error)

NewSentry provisions a new sentry node and adds it to the network.

func (*Network) NewStorage

func (net *Network) NewStorage(cfg *StorageCfg) (*Storage, error)

NewStorage provisions a new storage node and adds it to the network.

func (*Network) NewValidator

func (net *Network) NewValidator(cfg *ValidatorCfg) (*Validator, error)

NewValidator provisions a new validator and adds it to the network.

func (*Network) Nodes added in v0.2010.0

func (net *Network) Nodes() []*Node

Nodes returns all the validator, compute, storage, keymanager and client nodes associated with the network.

Seed, sentry, byzantine and IAS proxy nodes are omitted if they're only hosting these single features.

func (*Network) NumRegisterNodes

func (net *Network) NumRegisterNodes() int

NumRegisterNodes returns the number of all nodes that need to register.

func (*Network) Runtimes

func (net *Network) Runtimes() []*Runtime

Runtimes returns the runtimes associated with the network.

func (*Network) Seeds added in v0.2011.2

func (net *Network) Seeds() []*Seed

Seeds returns the seed node associated with the network.

func (*Network) Sentries

func (net *Network) Sentries() []*Sentry

Sentries returns the sentry nodes associated with the network.

func (*Network) SetClientController added in v0.2103.0

func (net *Network) SetClientController(ctrl *Controller)

SetClientController sets the client controller.

func (*Network) Start

func (net *Network) Start() error

Start starts the network.

func (*Network) Stop

func (net *Network) Stop()

Stop stops the network.

func (*Network) StorageWorkers

func (net *Network) StorageWorkers() []*Storage

StorageWorkers returns the storage worker nodes associated with the network.

func (*Network) Validators

func (net *Network) Validators() []*Validator

Validators returns the validators associated with the network.

type NetworkCfg

type NetworkCfg struct {
	// GenesisFile is an optional genesis file to use.
	GenesisFile string `json:"genesis_file,omitempty"`

	// NodeBinary is the path to the Oasis node binary.
	NodeBinary string `json:"node_binary"`

	// RuntimeSGXLoaderBinary is the path to the Oasis SGX runtime loader.
	RuntimeSGXLoaderBinary string `json:"runtime_loader_binary"`

	// Consensus are the network-wide consensus parameters.
	Consensus consensusGenesis.Genesis `json:"consensus"`

	// InitialHeight is the initial block height.
	InitialHeight int64 `json:"initial_height,omitempty"`

	// HaltEpoch is the halt epoch height flag.
	HaltEpoch uint64 `json:"halt_epoch"`

	// Beacon is the network-wide beacon parameters.
	Beacon beacon.ConsensusParameters `json:"beacon"`

	// DeterministicIdentities is the deterministic identities flag.
	DeterministicIdentities bool `json:"deterministic_identities"`

	// RestoreIdentities is the restore identities flag.
	RestoreIdentities bool `json:"restore_identities"`

	// FundEntities is the fund entities flag.
	FundEntities bool `json:"fund_entities"`

	// IAS is the Network IAS configuration.
	IAS IASCfg `json:"ias"`

	// StakingGenesis is the staking genesis data to be included if
	// GenesisFile is not set.
	StakingGenesis *staking.Genesis `json:"staking_genesis,omitempty"`

	// GovernanceParameters are the governance consensus parameters.
	GovernanceParameters *governance.ConsensusParameters `json:"governance_parameters,omitempty"`

	// A set of log watcher handler factories used by default on all nodes
	// created in this test network.
	DefaultLogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"`

	// UseShortGrpcSocketPaths specifies whether nodes should use internal.sock in datadir or
	// externally-provided.
	UseShortGrpcSocketPaths bool `json:"-"`

	// Nodes lists the names of nodes to be created, enabling an N:M mapping between physical node
	// processes and the features they host. If a feature is specified as attached to a node that
	// isn't listed here, a new node will be created automatically, so this list can normally be
	// left empty. Nodes are started in the order in which they appear here (automatically created
	// nodes are appended).
	Nodes []string
}

NetworkCfg is the Oasis test network configuration.

func (*NetworkCfg) SetInsecureBeacon added in v0.2103.0

func (cfg *NetworkCfg) SetInsecureBeacon()

SetInsecureBeacon force-enables the insecure (faster) beacon backend.

func (*NetworkCfg) SetMockEpoch added in v0.2100.0

func (cfg *NetworkCfg) SetMockEpoch()

SetMockEpoch force-enables the mock epoch time keeping.

type NetworkFixture

type NetworkFixture struct {
	TEE                TEEFixture                `json:"tee,omitempty"`
	Network            NetworkCfg                `json:"network,omitempty"`
	Entities           []EntityCfg               `json:"entities,omitempty"`
	Runtimes           []RuntimeFixture          `json:"runtimes,omitempty"`
	Validators         []ValidatorFixture        `json:"validators,omitempty"`
	Keymanagers        []KeymanagerFixture       `json:"keymanagers,omitempty"`
	KeymanagerPolicies []KeymanagerPolicyFixture `json:"keymanager_policies,omitempty"`
	StorageWorkers     []StorageWorkerFixture    `json:"storage_workers,omitempty"`
	ComputeWorkers     []ComputeWorkerFixture    `json:"compute_workers,omitempty"`
	Sentries           []SentryFixture           `json:"sentries,omitempty"`
	Clients            []ClientFixture           `json:"clients,omitempty"`
	Seeds              []SeedFixture             `json:"seeds,omitempty"`
	ByzantineNodes     []ByzantineFixture        `json:"byzantine_nodes,omitempty"`
}

NetworkFixture describes configuration for the test Oasis network and all the spawned nodes.

func (*NetworkFixture) Create

func (f *NetworkFixture) Create(env *env.Env) (*Network, error)

Create instantiates the network described by the fixture.

type Node

type Node struct {
	sync.Mutex

	Name   string
	NodeID signature.PublicKey
	// contains filtered or unexported fields
}

Node defines the common fields for all node types.

func (*Node) BinaryPath

func (n *Node) BinaryPath() string

BinaryPath returns the path to the running node's process' image, or an empty string if the node isn't running yet. This can be used as a replacement for NetworkCfg.NodeBinary in cases where the test runner is actually using a wrapper to start the node.

func (*Node) Consensus added in v0.2010.0

func (n *Node) Consensus() ConsensusFixture

Consensus returns the node's consensus configuration.

func (*Node) DataDir

func (n *Node) DataDir() string

DataDir returns the path to the node's data directory.

func (*Node) Exit

func (n *Node) Exit() chan error

Exit returns a channel that will close once the node shuts down. If the node shut down due to an error, that error will be sent through this channel.

func (*Node) LoadIdentity

func (n *Node) LoadIdentity() (*identity.Identity, error)

LoadIdentity loads the node's identity.

func (*Node) LogPath

func (n *Node) LogPath() string

LogPath returns the path to the node's log.

func (*Node) RequestShutdown added in v0.2012.3

func (n *Node) RequestShutdown(ctx context.Context, wait bool) error

RequestShutdown is a helper for creating a controller and calling node's RequestShutdown.

func (*Node) Restart

func (n *Node) Restart(ctx context.Context) error

Restart kills the node, waits for it to stop, and starts it again.

func (*Node) RestartAfter added in v0.2011.0

func (n *Node) RestartAfter(ctx context.Context, startDelay time.Duration) error

RestartAfter kills the node, waits for it to stop, and starts it again after delay.

func (*Node) SetConsensusStateSync

func (n *Node) SetConsensusStateSync(cfg *ConsensusStateSyncCfg)

SetConsensusStateSync configures whether a node should perform consensus state sync.

func (*Node) SocketPath

func (n *Node) SocketPath() string

SocketPath returns the path of the node's gRPC unix socket.

func (*Node) Start added in v0.2102.0

func (n *Node) Start() error

Start starts the node.

func (*Node) Stop

func (n *Node) Stop() error

Stop stops the node.

func (*Node) WaitReady

func (n *Node) WaitReady(ctx context.Context) error

WaitReady is a helper for creating a controller and calling node's WaitReady.

type NodeCfg

type NodeCfg struct {
	Name string

	AllowEarlyTermination       bool
	AllowErrorTermination       bool
	CrashPointsProbability      float64
	SupplementarySanityInterval uint64
	EnableProfiling             bool

	NoAutoStart bool

	DisableDefaultLogWatcherHandlerFactories bool
	LogWatcherHandlerFactories               []log.WatcherHandlerFactory

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture

	Entity *Entity

	ExtraArgs []Argument
}

NodeCfg defines the common node configuration options.

func (*NodeCfg) Into added in v0.2102.0

func (cfg *NodeCfg) Into(node *Node)

Into sets node parameters of an existing node object from the configuration.

type NodeFixture added in v0.2102.0

type NodeFixture struct {
	// Name is the name of the node that hosts the feature. Leave empty
	// to automatically instantiate a dedicated node with a default name.
	Name string `json:"node_name,omitempty"`

	NoAutoStart bool `json:"no_auto_start,omitempty"`

	ExtraArgs []Argument `json:"extra_args,omitempty"`
}

NodeFixture is a common subset of settings for node-backed fixtures.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime is an Oasis runtime.

func (*Runtime) GetEnclaveIdentity

func (rt *Runtime) GetEnclaveIdentity() *sgx.EnclaveIdentity

GetEnclaveIdentity returns the runtime's enclave ID.

func (*Runtime) ID

func (rt *Runtime) ID() common.Namespace

ID returns the runtime ID.

func (*Runtime) Kind

func (rt *Runtime) Kind() registry.RuntimeKind

Kind returns the runtime kind.

func (*Runtime) RefreshEnclaveIdentity added in v0.2103.0

func (rt *Runtime) RefreshEnclaveIdentity() error

RefreshEnclaveIdentity refreshes the enclave identity for the runtime.

func (*Runtime) ToRuntimeDescriptor

func (rt *Runtime) ToRuntimeDescriptor() registry.Runtime

ToRuntimeDescriptor returns a registry runtime descriptor for this runtime.

type RuntimeCfg

type RuntimeCfg struct {
	ID          common.Namespace
	Kind        registry.RuntimeKind
	Entity      *Entity
	Keymanager  *Runtime
	TEEHardware node.TEEHardware
	MrSigner    *sgx.MrSigner
	Version     version.Version

	Binaries         map[node.TEEHardware][]string
	GenesisState     storage.WriteLog
	GenesisStatePath string
	GenesisRound     uint64

	Executor     registry.ExecutorParameters
	TxnScheduler registry.TxnSchedulerParameters
	Storage      registry.StorageParameters

	AdmissionPolicy registry.RuntimeAdmissionPolicy
	Constraints     map[scheduler.CommitteeKind]map[scheduler.Role]registry.SchedulingConstraints
	Staking         registry.RuntimeStakingParameters

	GovernanceModel registry.RuntimeGovernanceModel

	Pruner RuntimePrunerCfg

	ExcludeFromGenesis bool
}

RuntimeCfg is the Oasis runtime provisioning configuration.

type RuntimeFixture

type RuntimeFixture struct {
	ID         common.Namespace     `json:"id"`
	Kind       registry.RuntimeKind `json:"kind"`
	Entity     int                  `json:"entity"`
	Keymanager int                  `json:"keymanager"`
	Version    version.Version      `json:"version"`

	Binaries         map[node.TEEHardware][]string `json:"binaries"`
	GenesisState     storage.WriteLog              `json:"genesis_state,omitempty"`
	GenesisStatePath string                        `json:"genesis_state_path,omitempty"`
	GenesisRound     uint64                        `json:"genesis_round,omitempty"`

	Executor     registry.ExecutorParameters     `json:"executor"`
	TxnScheduler registry.TxnSchedulerParameters `json:"txn_scheduler"`
	Storage      registry.StorageParameters      `json:"storage"`

	AdmissionPolicy registry.RuntimeAdmissionPolicy                                               `json:"admission_policy"`
	Constraints     map[scheduler.CommitteeKind]map[scheduler.Role]registry.SchedulingConstraints `json:"constraints,omitempty"`
	Staking         registry.RuntimeStakingParameters                                             `json:"staking,omitempty"`

	GovernanceModel registry.RuntimeGovernanceModel `json:"governance_model"`

	Pruner RuntimePrunerCfg `json:"pruner,omitempty"`

	ExcludeFromGenesis bool `json:"exclude_from_genesis,omitempty"`
}

RuntimeFixture is a runtime fixture.

func (*RuntimeFixture) Create

func (f *RuntimeFixture) Create(netFixture *NetworkFixture, net *Network) (*Runtime, error)

Create instantiates the runtime described by the fixture.

type RuntimePrunerCfg

type RuntimePrunerCfg struct {
	Strategy string        `json:"strategy"`
	Interval time.Duration `json:"interval"`

	NumKept uint64 `json:"num_kept"`
}

RuntimePrunerCfg is the pruner configuration for an Oasis runtime.

type Seed added in v0.2011.2

type Seed struct {
	*Node
	// contains filtered or unexported fields
}

Seed is an Oasis seed node.

func (*Seed) AddArgs added in v0.2102.0

func (seed *Seed) AddArgs(args *argBuilder) error

type SeedCfg added in v0.2011.2

type SeedCfg struct {
	Name string

	DisableAddrBookFromGenesis bool
}

SeedCfg is the Oasis seed node configuration.

type SeedFixture added in v0.2011.2

type SeedFixture struct {
	NodeFixture

	DisableAddrBookFromGenesis bool `json:"disable_addr_book_from_genesis"`
}

SeedFixture is a seed node fixture.

func (*SeedFixture) Create added in v0.2011.2

func (f *SeedFixture) Create(net *Network) (*Seed, error)

Create instantiates the seed node described by the fixture.

type Sentry

type Sentry struct {
	*Node
	// contains filtered or unexported fields
}

Sentry is an Oasis sentry node.

func (*Sentry) AddArgs added in v0.2102.0

func (sentry *Sentry) AddArgs(args *argBuilder) error

func (*Sentry) GetSentryAddress

func (sentry *Sentry) GetSentryAddress() string

GetSentryAddress returns the sentry grpc endpoint address.

func (*Sentry) GetSentryControlAddress

func (sentry *Sentry) GetSentryControlAddress() string

GetSentryControlAddress returns the sentry control endpoint address.

func (*Sentry) GetTLSPubKey

func (sentry *Sentry) GetTLSPubKey() signature.PublicKey

GetTLSPubKey returns the sentry TLS public key.

func (*Sentry) TLSCertPath

func (sentry *Sentry) TLSCertPath() string

TLSCertPath returns the path to the node's TLS certificate.

type SentryCfg

type SentryCfg struct {
	NodeCfg

	ValidatorIndices  []int
	StorageIndices    []int
	KeymanagerIndices []int
}

SentryCfg is the Oasis sentry node configuration.

type SentryFixture

type SentryFixture struct {
	NodeFixture

	LogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"`

	CrashPointsProbability float64 `json:"crash_points_probability,omitempty"`

	EnableProfiling bool `json:"enable_profiling"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`

	Validators        []int `json:"validators"`
	StorageWorkers    []int `json:"storage_workers"`
	KeymanagerWorkers []int `json:"keymanager_workers"`
}

SentryFixture is a sentry node fixture.

func (*SentryFixture) Create

func (f *SentryFixture) Create(net *Network) (*Sentry, error)

Create instantiates the sentry node described by the fixture.

type Storage

type Storage struct {
	*Node
	// contains filtered or unexported fields
}

Storage is an Oasis storage node.

func (*Storage) AddArgs added in v0.2102.0

func (worker *Storage) AddArgs(args *argBuilder) error

func (*Storage) ConsensusKeyPath

func (worker *Storage) ConsensusKeyPath() string

ConsensusKeyPath returns the path to the node's consensus key.

func (*Storage) DatabasePath

func (worker *Storage) DatabasePath() string

DatabasePath returns the path to the node's database.

func (*Storage) ExportsPath

func (worker *Storage) ExportsPath() string

Exports path returns the path to the node's exports data dir.

func (*Storage) GetClientAddress

func (worker *Storage) GetClientAddress() string

GetClientAddress returns the storage node endpoint address.

func (*Storage) IdentityKeyPath

func (worker *Storage) IdentityKeyPath() string

IdentityKeyPath returns the path to the node's identity key.

func (*Storage) P2PKeyPath

func (worker *Storage) P2PKeyPath() string

P2PKeyPath returns the path to the node's P2P key.

func (*Storage) PauseCheckpointer added in v0.2102.0

func (worker *Storage) PauseCheckpointer(ctx context.Context, runtimeID common.Namespace, pause bool) error

PauseCheckpointer pauses or unpauses the storage worker's checkpointer.

func (*Storage) TLSCertPath

func (worker *Storage) TLSCertPath() string

TLSCertPath returns the path to the node's TLS certificate.

func (*Storage) TLSKeyPath

func (worker *Storage) TLSKeyPath() string

TLSKeyPath returns the path to the node's TLS key.

func (*Storage) WaitForRound added in v0.2102.0

func (worker *Storage) WaitForRound(ctx context.Context, runtimeID common.Namespace, round uint64) (uint64, error)

WaitForRoot waits until the node syncs up to the given root.

type StorageCfg

type StorageCfg struct {
	NodeCfg

	SentryIndices []int
	Backend       string

	DisableCertRotation     bool
	DisablePublicRPC        bool
	IgnoreApplies           bool
	CheckpointSyncDisabled  bool
	CheckpointCheckInterval time.Duration

	Runtimes []int
}

StorageCfg is the Oasis storage node configuration.

type StorageWorkerFixture

type StorageWorkerFixture struct {
	NodeFixture

	Backend string `json:"backend"`
	Entity  int    `json:"entity"`

	AllowEarlyTermination bool `json:"allow_early_termination"`
	AllowErrorTermination bool `json:"allow_error_termination"`

	EnableProfiling bool `json:"enable_profiling"`

	DisableCertRotation bool `json:"disable_cert_rotation"`
	DisablePublicRPC    bool `json:"disable_public_rpc"`

	LogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"`

	Sentries []int `json:"sentries,omitempty"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`

	CheckpointCheckInterval time.Duration `json:"checkpoint_check_interval,omitempty"`
	IgnoreApplies           bool          `json:"ignore_applies,omitempty"`
	CheckpointSyncEnabled   bool          `json:"checkpoint_sync_enabled,omitempty"`

	CrashPointsProbability float64 `json:"crash_points_probability,omitempty"`

	// Runtimes contains the indexes of the runtimes to enable. Leave
	// empty or nil for the default behaviour (i.e. include all runtimes).
	Runtimes []int `json:"runtimes,omitempty"`
}

StorageWorkerFixture is a storage worker fixture.

func (*StorageWorkerFixture) Create

func (f *StorageWorkerFixture) Create(net *Network) (*Storage, error)

Create instantiates the storage worker described by the fixture.

type TEEFixture

type TEEFixture struct {
	Hardware node.TEEHardware `json:"hardware"`
	MrSigner *sgx.MrSigner    `json:"mr_signer"`
}

TEEFixture is a TEE configuration fixture.

type Validator

type Validator struct {
	*Node
	// contains filtered or unexported fields
}

Validator is an Oasis validator.

func (*Validator) AddArgs added in v0.2102.0

func (val *Validator) AddArgs(args *argBuilder) error

func (*Validator) ConsensusKeyPath

func (val *Validator) ConsensusKeyPath() string

ConsensusKeyPath returns the path to the node's consensus key.

func (*Validator) ExportsPath

func (val *Validator) ExportsPath() string

Exports path returns the path to the node's exports data dir.

func (*Validator) ExternalGRPCAddress

func (val *Validator) ExternalGRPCAddress() string

ExternalGRPCAddress returns the address of the node's external gRPC server.

func (*Validator) IdentityKeyPath

func (val *Validator) IdentityKeyPath() string

IdentityKeyPath returns the path to the node's identity key.

func (*Validator) P2PKeyPath

func (val *Validator) P2PKeyPath() string

P2PKeyPath returns the path to the node's P2P key.

type ValidatorCfg

type ValidatorCfg struct {
	NodeCfg

	Sentries []*Sentry

	DisableCertRotation bool
}

ValidatorCfg is the Oasis validator provisioning configuration.

type ValidatorFixture

type ValidatorFixture struct {
	NodeFixture

	AllowEarlyTermination bool `json:"allow_early_termination"`
	AllowErrorTermination bool `json:"allow_error_termination"`

	CrashPointsProbability float64 `json:"crash_points_probability,omitempty"`

	EnableProfiling bool `json:"enable_profiling"`

	DisableCertRotation bool `json:"disable_cert_rotation"`

	Entity int `json:"entity"`

	LogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"`

	Sentries []int `json:"sentries,omitempty"`

	// Consensus contains configuration for the consensus backend.
	Consensus ConsensusFixture `json:"consensus"`
}

ValidatorFixture is a validator fixture.

func (*ValidatorFixture) Create

func (f *ValidatorFixture) Create(net *Network) (*Validator, error)

Create instantiates the validator described by the fixture.

Directories

Path Synopsis
Package cli contains helpers for various oasis-node subcommands.
Package cli contains helpers for various oasis-node subcommands.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL