Documentation ¶
Overview ¶
Package oasis provides the Oasis network/node/client related test helpers.
Index ¶
- Constants
- func GenerateDeterministicNodeKeys(dir *env.Dir, rawSeed string, roles []signature.SignerRole) ([]signature.PublicKey, error)
- func LogAssertCheckpointSync() log.WatcherHandlerFactory
- func LogAssertDiscrepancyMajorityFailure() log.WatcherHandlerFactory
- func LogAssertEvent(event, message string) log.WatcherHandlerFactory
- func LogAssertExecutionDiscrepancyDetected() log.WatcherHandlerFactory
- func LogAssertNoExecutionDiscrepancyDetected() log.WatcherHandlerFactory
- func LogAssertNoRoundFailures() log.WatcherHandlerFactory
- func LogAssertNoTimeouts() log.WatcherHandlerFactory
- func LogAssertNoUpgradeConsensus() log.WatcherHandlerFactory
- func LogAssertNoUpgradeStartup() log.WatcherHandlerFactory
- func LogAssertNotEvent(event, message string) log.WatcherHandlerFactory
- func LogAssertPeerExchangeDisabled() log.WatcherHandlerFactory
- func LogAssertRoothashRoothashReindexing() log.WatcherHandlerFactory
- func LogAssertRoundFailures() log.WatcherHandlerFactory
- func LogAssertTimeouts() log.WatcherHandlerFactory
- func LogAssertUpgradeConsensus() log.WatcherHandlerFactory
- func LogAssertUpgradeIncompatibleBinary() log.WatcherHandlerFactory
- func LogAssertUpgradeStartup() log.WatcherHandlerFactory
- func LogEventABCIPruneDelete() log.WatcherHandlerFactory
- func LogEventABCIStateSyncComplete() log.WatcherHandlerFactory
- type Argument
- type Byzantine
- type ByzantineCfg
- type ByzantineFixture
- type Client
- type ClientCfg
- type ClientFixture
- type ComponentCfg
- type Compute
- func (worker *Compute) AddArgs(args *argBuilder) error
- func (worker *Compute) ConsensusKeyPath() string
- func (worker *Compute) DatabasePath() string
- func (worker *Compute) ExportsPath() string
- func (worker *Compute) IdentityKeyPath() string
- func (worker *Compute) ModifyConfig() error
- func (worker *Compute) P2PKeyPath() string
- func (worker *Compute) PauseCheckpointer(ctx context.Context, runtimeID common.Namespace, pause bool) error
- func (worker *Compute) TLSCertPath() string
- func (worker *Compute) TLSKeyPath() string
- func (worker *Compute) UpdateRuntimes(runtimes []int)
- type ComputeCfg
- type ComputeWorkerFixture
- type ConsensusFixture
- type ConsensusStateSyncCfg
- type Controller
- type CustomStartFeature
- type DeploymentCfg
- type Entity
- type EntityCfg
- type Feature
- type IASCfg
- type Keymanager
- func (km *Keymanager) AddArgs(args *argBuilder) error
- func (km *Keymanager) ConsensusKeyPath() string
- func (km *Keymanager) ExportsPath() string
- func (km *Keymanager) IdentityKeyPath() string
- func (km *Keymanager) ModifyConfig() error
- func (km *Keymanager) P2PKeyPath() string
- func (km *Keymanager) P2PPort() uint16
- func (km *Keymanager) TLSCertPath() string
- func (km *Keymanager) TLSKeyPath() string
- type KeymanagerCfg
- type KeymanagerFixture
- type KeymanagerPolicy
- type KeymanagerPolicyCfg
- type KeymanagerPolicyFixture
- type MetricsCfg
- type Network
- func (net *Network) AddLogWatcher(node *Node) error
- func (net *Network) BasePath() string
- func (net *Network) Byzantine() []*Byzantine
- func (net *Network) CheckLogWatchers() (err error)
- func (net *Network) ClientController() *Controller
- func (net *Network) Clients() []*Client
- func (net *Network) ComputeWorkers() []*Compute
- func (net *Network) Config() *NetworkCfg
- func (net *Network) Controller() *Controller
- func (net *Network) Entities() []*Entity
- func (net *Network) Errors() <-chan error
- func (net *Network) GenesisPath() string
- func (net *Network) GetCLIConfig() cli.Config
- func (net *Network) GetNamedNode(defaultName string, cfg *NodeCfg) (*Node, error)
- func (net *Network) Keymanagers() []*Keymanager
- func (net *Network) MakeGenesis() error
- func (net *Network) NewByzantine(cfg *ByzantineCfg) (*Byzantine, error)
- func (net *Network) NewClient(cfg *ClientCfg) (*Client, error)
- func (net *Network) NewCompute(cfg *ComputeCfg) (*Compute, error)
- func (net *Network) NewEntity(cfg *EntityCfg) (*Entity, error)
- func (net *Network) NewKeymanager(cfg *KeymanagerCfg) (*Keymanager, error)
- func (net *Network) NewKeymanagerPolicy(cfg *KeymanagerPolicyCfg) (*KeymanagerPolicy, error)
- func (net *Network) NewRuntime(cfg *RuntimeCfg) (*Runtime, error)
- func (net *Network) NewSeed(cfg *SeedCfg) (*Seed, error)
- func (net *Network) NewSentry(cfg *SentryCfg) (*Sentry, error)
- func (net *Network) NewValidator(cfg *ValidatorCfg) (*Validator, error)
- func (net *Network) Nodes() []*Node
- func (net *Network) NumRegisterNodes() int
- func (net *Network) Runtimes() []*Runtime
- func (net *Network) Seeds() []*Seed
- func (net *Network) Sentries() []*Sentry
- func (net *Network) SetClientController(ctrl *Controller)
- func (net *Network) Start() error
- func (net *Network) Stop()
- func (net *Network) Validators() []*Validator
- type NetworkCfg
- type NetworkFixture
- type Node
- func (n *Node) AddSeedNodesToConfig()
- func (n *Node) AddSeedNodesToConfigExcept(excludeSeedNodeName string)
- func (n *Node) AddSentriesToConfig(sentries []*Sentry)
- func (n *Node) BinaryPath() string
- func (n *Node) ConfigFile() string
- func (n *Node) Consensus() ConsensusFixture
- func (n *Node) DataDir() string
- func (n *Node) Exit() chan error
- func (n *Node) LoadIdentity() (*identity.Identity, error)
- func (n *Node) LogPath() string
- func (n *Node) RequestShutdown(ctx context.Context, wait bool) error
- func (n *Node) Restart(ctx context.Context) error
- func (n *Node) RestartAfter(ctx context.Context, startDelay time.Duration) error
- func (n *Node) SetArchiveMode(archive bool)
- func (n *Node) SetConsensusStateSync(cfg *ConsensusStateSyncCfg)
- func (n *Node) SocketPath() string
- func (n *Node) Start() error
- func (n *Node) Stop() error
- func (n *Node) StopGracefully() error
- func (n *Node) WaitReady(ctx context.Context) error
- type NodeCfg
- type NodeFixture
- type Runtime
- func (rt *Runtime) BundlePaths() []string
- func (rt *Runtime) GetEnclaveIdentity(deploymentIndex int) *sgx.EnclaveIdentity
- func (rt *Runtime) ID() common.Namespace
- func (rt *Runtime) Kind() registry.RuntimeKind
- func (rt *Runtime) RefreshRuntimeBundle(deploymentIndex int) error
- func (rt *Runtime) RefreshRuntimeBundles() error
- func (rt *Runtime) ToRuntimeBundles() ([]*bundle.Bundle, error)
- func (rt *Runtime) ToRuntimeDescriptor() registry.Runtime
- type RuntimeCfg
- type RuntimeFixture
- type RuntimePrunerCfg
- type Seed
- type SeedCfg
- type SeedFixture
- type Sentry
- type SentryCfg
- type SentryFixture
- type TEEFixture
- type Validator
- type ValidatorCfg
- type ValidatorFixture
Constants ¶
const ( // ByzantineDefaultIdentitySeed for slot 3. ByzantineDefaultIdentitySeed = "ekiden byzantine node worker, luck=6" 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) CustomStart ¶ added in v0.2102.0
func (*Byzantine) ModifyConfig ¶ added in v0.2300.0
type ByzantineCfg ¶
type ByzantineCfg struct { NodeCfg Script string ExtraArgs []Argument ForceElectParams *scheduler.ForceElectCommitteeRole 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"` ForceElectParams *scheduler.ForceElectCommitteeRole `json:"scheduler_force_params,omitempty"` // 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.
type Client ¶
type Client struct { *Node // contains filtered or unexported fields }
Client is an Oasis client node.
func (*Client) ModifyConfig ¶ added in v0.2300.0
type ClientCfg ¶
type ClientCfg struct { NodeCfg Runtimes []int RuntimeProvisioner runtimeConfig.RuntimeProvisioner RuntimeConfig map[int]map[string]interface{} }
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 runtimeConfig.RuntimeProvisioner `json:"runtime_provisioner"` // RuntimeConfig contains the per-runtime node-local configuration. RuntimeConfig map[int]map[string]interface{} `json:"runtime_config,omitempty"` }
ClientFixture is a client node fixture.
type ComponentCfg ¶ added in v0.2400.0
type ComponentCfg struct { Kind component.Kind `json:"kind"` Binaries map[node.TEEHardware]string `json:"binaries"` }
ComponentCfg is a runtime component configuration.
type Compute ¶
Compute is an Oasis compute node.
func (*Compute) ConsensusKeyPath ¶
ConsensusKeyPath returns the path to the node's consensus key.
func (*Compute) DatabasePath ¶ added in v0.2200.0
DatabasePath returns the path to the node's database.
func (*Compute) ExportsPath ¶
ExportsPath returns the path to the node's exports data dir.
func (*Compute) IdentityKeyPath ¶
IdentityKeyPath returns the path to the node's identity key.
func (*Compute) ModifyConfig ¶ added in v0.2300.0
func (*Compute) P2PKeyPath ¶
P2PKeyPath returns the path to the node's P2P key.
func (*Compute) PauseCheckpointer ¶ added in v0.2200.0
func (worker *Compute) PauseCheckpointer(ctx context.Context, runtimeID common.Namespace, pause bool) error
PauseCheckpointer pauses or unpauses the storage worker's checkpointer.
func (*Compute) TLSCertPath ¶
TLSCertPath returns the path to the node's TLS certificate.
func (*Compute) TLSKeyPath ¶
TLSKeyPath returns the path to the node's TLS key.
func (*Compute) UpdateRuntimes ¶
UpdateRuntimes updates the worker node runtimes.
type ComputeCfg ¶
type ComputeCfg struct { NodeCfg RuntimeProvisioner runtimeConfig.RuntimeProvisioner Runtimes []int RuntimeConfig map[int]map[string]interface{} RuntimeStatePaths map[int]string SentryIndices []int StorageBackend string DisablePublicRPC bool CheckpointSyncDisabled bool CheckpointCheckInterval time.Duration }
ComputeCfg is the Oasis compute node configuration.
type ComputeWorkerFixture ¶
type ComputeWorkerFixture struct { NodeFixture Entity int `json:"entity"` RuntimeProvisioner runtimeConfig.RuntimeProvisioner `json:"runtime_provisioner"` AllowEarlyTermination bool `json:"allow_early_termination"` AllowErrorTermination bool `json:"allow_error_termination"` EnableProfiling bool `json:"enable_profiling"` StorageBackend string `json:"storage_backend,omitempty"` DisablePublicRPC bool `json:"disable_public_rpc"` // Consensus contains configuration for the consensus backend. Consensus ConsensusFixture `json:"consensus"` CrashPointsProbability float64 `json:"crash_point_probability"` LogWatcherHandlerFactories []log.WatcherHandlerFactory `json:"-"` Sentries []int `json:"sentries,omitempty"` CheckpointCheckInterval time.Duration `json:"checkpoint_check_interval,omitempty"` CheckpointSyncEnabled bool `json:"checkpoint_sync_enabled,omitempty"` // Runtimes contains the indexes of the runtimes to enable. Runtimes []int `json:"runtimes,omitempty"` // RuntimeStatePaths are the paths to runtime state that will be copied to the compute worker node. RuntimeStatePaths map[int]string `json:"runtime_state_paths"` // RuntimeConfig contains the per-runtime node-local configuration. RuntimeConfig map[int]map[string]interface{} `json:"runtime_config,omitempty"` }
ComputeWorkerFixture is a compute worker 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"` // PruneInterval is the prune interval. PruneInterval time.Duration `json:"prune_interval"` // CometBFTRecoverCorruptedWAL enables automatic recovery of corrupted CometBFT's WAL. CometBFTRecoverCorruptedWAL bool `json:"cometbft_recover_corrupted_wal"` // SupplementarySanityInterval configures the sanity check application. SupplementarySanityInterval uint64 `json:"supplementary_sanity_interval,omitempty"` // EnableArchiveMode enables the archive node mode. EnableArchiveMode bool `json:"enable_archive_mode,omitempty"` }
ConsensusFixture is a fixture containing consensus-related configuration.
type ConsensusStateSyncCfg ¶
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 Vault vault.Backend 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 DeploymentCfg ¶ added in v0.2200.0
type DeploymentCfg struct { Version version.Version `json:"version"` ValidFrom beacon.EpochTime `json:"valid_from"` Components []ComponentCfg `json:"components"` // DeprecatedBinaries is deprecated, use Components.Binaries instead. DeprecatedBinaries map[node.TEEHardware]string `json:"binaries"` }
DeploymentCfg is a deployment configuration.
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
Entity is an Oasis entity.
func (*Entity) DescriptorPath ¶
DescriptorPath returns the path to the entity descriptor.
func (*Entity) EntityKeyPath ¶
EntityKeyPath returns the path to the entity private key.
type Feature ¶ added in v0.2102.0
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) ModifyConfig ¶ added in v0.2300.0
func (km *Keymanager) ModifyConfig() error
func (*Keymanager) P2PKeyPath ¶
func (km *Keymanager) P2PKeyPath() string
P2PKeyPath returns the paths to the node's P2P key.
func (*Keymanager) P2PPort ¶ added in v0.2300.0
func (km *Keymanager) P2PPort() uint16
P2PPort returns the node's P2P port.
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 runtimeConfig.RuntimeProvisioner // PrivatePeerPubKeys is a list of base64-encoded libp2p public keys of peers who may call non-public methods. PrivatePeerPubKeys []string // ChurpIDs is a list of supported CHURP schemes. ChurpIDs []uint8 }
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"` SkipPolicy bool `json:"skip_policy,omitempty"` RuntimeProvisioner runtimeConfig.RuntimeProvisioner `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:"-"` PrivatePeerPubKeys []string `json:"private_peer_pub_keys,omitempty"` ChurpIDs []uint8 `json:"churp_ids,omitempty"` }
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 MasterSecretRotationInterval beacon.EpochTime }
KeymanagerPolicyCfg is an Oasis key manager policy document configuration.
type KeymanagerPolicyFixture ¶
type KeymanagerPolicyFixture struct { Runtime int `json:"runtime"` Serial int `json:"serial"` MasterSecretRotationInterval beacon.EpochTime `json:"master_secret_rotation_interval,omitempty"` }
KeymanagerPolicyFixture is a key manager policy fixture.
func (*KeymanagerPolicyFixture) Create ¶
func (f *KeymanagerPolicyFixture) Create(net *Network) (*KeymanagerPolicy, error)
Create instantiates the key manager policy described in the fixture.
type MetricsCfg ¶ added in v0.2300.0
type MetricsCfg struct { // Prometheus address. Address string `json:"address"` // Push interval. Interval time.Duration `json:"interval"` }
MetricsCfg is the Oasis test network metrics configuration.
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 ¶
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) CheckLogWatchers ¶
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) ComputeWorkers ¶
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) GenesisPath ¶
GenesisPath returns the path to the genesis file for the network.
func (*Network) GetCLIConfig ¶
GetCLIConfig implements cli.Factory.
func (*Network) GetNamedNode ¶ added in v0.2102.0
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
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) NewCompute ¶
func (net *Network) NewCompute(cfg *ComputeCfg) (*Compute, error)
NewCompute provisions a new compute node 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
NewSeed provisions a new seed 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
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 ¶
NumRegisterNodes returns the number of all nodes that need to register.
func (*Network) SetClientController ¶ added in v0.2103.0
func (net *Network) SetClientController(ctrl *Controller)
SetClientController sets the client controller.
func (*Network) Validators ¶
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"` // RuntimeAttestInterval is the interval for periodic runtime re-attestation. If not specified // a default will be used. RuntimeAttestInterval time.Duration `json:"runtime_attest_interval,omitempty"` // RuntimeDefaultMaxAttestationAge is the default maximum attestation age (in blocks). RuntimeDefaultMaxAttestationAge uint64 `json:"runtime_max_attestation_age,omitempty"` // 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"` // Metrics is the network metrics configuration. Metrics MetricsCfg `json:"metrics,omitempty"` // 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"` // RoothashParameters are the roothash consensus parameters. RoothashParameters *roothash.ConsensusParameters `json:"roothash_parameters,omitempty"` // SchedulerWeakAlpkaOk is for disabling the VRF alpha entropy requirement. SchedulerWeakAlphaOk bool `json:"scheduler_weak_alpha_ok,omitempty"` // SchedulerForceElect are the rigged committee elections. SchedulerForceElect map[common.Namespace]map[signature.PublicKey]*scheduler.ForceElectCommitteeRole `json:"scheduler_force_elect,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:"-"` // NodeLogLevel is the log level to use for created nodes. NodeLogLevel string `json:"node_log_level,omitempty"` // NodeLogFormat is the log format to use for created nodes. NodeLogFormat string `json:"node_log_format,omitempty"` // 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"` 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.
type Node ¶
type Node struct { sync.Mutex Name string NodeID signature.PublicKey Config config.Config // contains filtered or unexported fields }
Node defines the common fields for all node types.
func (*Node) AddSeedNodesToConfig ¶ added in v0.2300.0
func (n *Node) AddSeedNodesToConfig()
AddSeedNodesToConfig appends the network's seed nodes to the node's config.
func (*Node) AddSeedNodesToConfigExcept ¶ added in v0.2300.0
AddSeedNodesToConfigExcept appends the network's seed nodes to the node's config, except for the given seed node.
func (*Node) AddSentriesToConfig ¶ added in v0.2300.0
AddSentriesToConfig appends the given sentry nodes to the node's config.
func (*Node) BinaryPath ¶
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) ConfigFile ¶ added in v0.2300.0
ConfigFile returns the path to the node's config file.
func (*Node) Consensus ¶ added in v0.2010.0
func (n *Node) Consensus() ConsensusFixture
Consensus returns the node's consensus configuration.
func (*Node) Exit ¶
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 ¶
LoadIdentity loads the node's identity.
func (*Node) RequestShutdown ¶ added in v0.2012.3
RequestShutdown is a helper for creating a controller and calling node's RequestShutdown.
func (*Node) RestartAfter ¶ added in v0.2011.0
RestartAfter kills the node, waits for it to stop, and starts it again after delay.
func (*Node) SetArchiveMode ¶ added in v0.2103.13
SetArchiveMode sets the archive mode.
func (*Node) SetConsensusStateSync ¶
func (n *Node) SetConsensusStateSync(cfg *ConsensusStateSyncCfg)
SetConsensusStateSync configures whether a node should perform consensus state sync.
func (*Node) SocketPath ¶
SocketPath returns the path of the node's gRPC unix socket.
func (*Node) StopGracefully ¶ added in v0.2200.0
StopGracefully stops the node by sending it an interrupt signal which gives it time to perform a graceful shutdown and cleanup.
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.
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) BundlePaths ¶ added in v0.2200.0
BundlePaths returns the paths to the dynamically generated bundles.
func (*Runtime) GetEnclaveIdentity ¶
func (rt *Runtime) GetEnclaveIdentity(deploymentIndex int) *sgx.EnclaveIdentity
GetEnclaveIdentity returns the runtime's enclave ID for the given deployment.
func (*Runtime) Kind ¶
func (rt *Runtime) Kind() registry.RuntimeKind
Kind returns the runtime kind.
func (*Runtime) RefreshRuntimeBundle ¶ added in v0.2300.0
RefreshRuntimeBundle makes sure the generated runtime bundle is refreshed.
func (*Runtime) RefreshRuntimeBundles ¶ added in v0.2200.0
RefreshRuntimeBundles makes sure the generated runtime bundles are refreshed.
func (*Runtime) ToRuntimeBundles ¶ added in v0.2200.0
ToRuntimeBundles serializes the runtime to disk and returns the bundle.
func (*Runtime) ToRuntimeDescriptor ¶
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 Deployments []DeploymentCfg GenesisRound uint64 GenesisStateRoot *hash.Hash 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 KeepBundles 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"` Deployments []DeploymentCfg `json:"deployments"` GenesisRound uint64 `json:"genesis_round,omitempty"` GenesisStateRoot *hash.Hash `json:"genesis_state_root,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"` KeepBundles bool `json:"keep_bundles,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) ModifyConfig ¶ added in v0.2300.0
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.
type Sentry ¶
type Sentry struct { *Node // contains filtered or unexported fields }
Sentry is an Oasis sentry node.
func (*Sentry) GetSentryAddress ¶
GetSentryAddress returns the sentry grpc endpoint address.
func (*Sentry) GetSentryControlAddress ¶
GetSentryControlAddress returns the sentry control endpoint address.
func (*Sentry) GetTLSPubKey ¶
GetTLSPubKey returns the sentry TLS public key.
func (*Sentry) ModifyConfig ¶ added in v0.2300.0
func (*Sentry) TLSCertPath ¶
TLSCertPath returns the path to the node's TLS certificate.
type SentryCfg ¶
type SentryCfg struct { NodeCfg ValidatorIndices []int ComputeIndices []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"` ComputeWorkers []int `json:"compute_workers"` KeymanagerWorkers []int `json:"keymanager_workers"` }
SentryFixture is a sentry node 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) ConsensusKeyPath ¶
ConsensusKeyPath returns the path to the node's consensus key.
func (*Validator) ExportsPath ¶
ExportsPath returns the path to the node's exports data dir.
func (*Validator) IdentityKeyPath ¶
IdentityKeyPath returns the path to the node's identity key.
func (*Validator) ModifyConfig ¶ added in v0.2300.0
func (*Validator) P2PKeyPath ¶
P2PKeyPath returns the path to the node's P2P key.
type ValidatorCfg ¶
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"` 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.