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 Compute
- func (worker *Compute) AddArgs(args *argBuilder) error
- func (worker *Compute) ConsensusKeyPath() string
- func (worker *Compute) ExportsPath() string
- func (worker *Compute) IdentityKeyPath() string
- func (worker *Compute) P2PKeyPath() string
- 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 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) P2PKeyPath() string
- func (km *Keymanager) TLSCertPath() string
- func (km *Keymanager) TLSKeyPath() string
- type KeymanagerCfg
- type KeymanagerFixture
- type KeymanagerPolicy
- type KeymanagerPolicyCfg
- type KeymanagerPolicyFixture
- 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) NewStorage(cfg *StorageCfg) (*Storage, 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) Start() error
- func (net *Network) Stop()
- func (net *Network) StorageWorkers() []*Storage
- func (net *Network) Validators() []*Validator
- type NetworkCfg
- type NetworkFixture
- type Node
- func (n *Node) BinaryPath() 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) SetConsensusStateSync(cfg *ConsensusStateSyncCfg)
- func (n *Node) SocketPath() string
- func (n *Node) Start() error
- func (n *Node) Stop() error
- func (n *Node) WaitReady(ctx context.Context) error
- type NodeCfg
- type NodeFixture
- type Runtime
- type RuntimeCfg
- type RuntimeFixture
- type RuntimePrunerCfg
- type Seed
- type SeedCfg
- type SeedFixture
- type Sentry
- type SentryCfg
- type SentryFixture
- type Storage
- func (worker *Storage) AddArgs(args *argBuilder) error
- func (worker *Storage) ConsensusKeyPath() string
- func (worker *Storage) DatabasePath() string
- func (worker *Storage) ExportsPath() string
- func (worker *Storage) GetClientAddress() string
- func (worker *Storage) IdentityKeyPath() string
- func (worker *Storage) P2PKeyPath() string
- func (worker *Storage) PauseCheckpointer(ctx context.Context, runtimeID common.Namespace, pause bool) error
- func (worker *Storage) TLSCertPath() string
- func (worker *Storage) TLSKeyPath() string
- func (worker *Storage) WaitForRound(ctx context.Context, runtimeID common.Namespace, round uint64) (uint64, error)
- type StorageCfg
- type StorageWorkerFixture
- type TEEFixture
- type Validator
- type ValidatorCfg
- type ValidatorFixture
Constants ¶
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) CustomStart ¶ added in v0.2102.0
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.
type Client ¶
type Client struct { *Node // contains filtered or unexported fields }
Client is an Oasis client node.
type ClientCfg ¶
type ClientCfg struct { NodeCfg Runtimes []int 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"` // 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.
type Compute ¶
Compute is an Oasis compute node.
func (*Compute) ConsensusKeyPath ¶
ConsensusKeyPath returns the path to the node's consensus key.
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) P2PKeyPath ¶
P2PKeyPath returns the path to the node's P2P key.
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 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"` NoAutoStart bool `json:"no_auto_start,omitempty"` 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.
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 ¶
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 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 ¶
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
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 { // UseRegistry specifies whether the IAS proxy should use the registry // instead of the genesis document for authenticating runtime IDs. UseRegistry bool `json:"use_registry,omitempty"` // 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 }
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"` AllowEarlyTermination bool `json:"allow_early_termination"` AllowErrorTermination bool `json:"allow_error_termination"` NoAutoStart bool `json:"no_auto_start,omitempty"` 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 ¶
KeymanagerPolicyCfg is an Oasis key manager policy document configuration.
type KeymanagerPolicyFixture ¶
KeymangerPolicyFixgure 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 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 ¶
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) 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
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) StorageWorkers ¶
StorageWorkers returns the storage worker nodes associated with the network.
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"` // 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) 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.
type Node ¶
type Node struct { sync.Mutex Name string NodeID signature.PublicKey Args *argBuilder // contains filtered or unexported fields }
Node defines the common fields for all node types.
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) 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) 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.
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 }
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"` }
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) Kind ¶
func (rt *Runtime) Kind() registry.RuntimeKind
Kind returns the runtime kind.
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 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"` 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.
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) TLSCertPath ¶
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.
type Storage ¶
type Storage struct { *Node // contains filtered or unexported fields }
Storage is an Oasis storage node.
func (*Storage) ConsensusKeyPath ¶
ConsensusKeyPath returns the path to the node's consensus key.
func (*Storage) DatabasePath ¶
DatabasePath returns the path to the node's database.
func (*Storage) ExportsPath ¶
Exports path returns the path to the node's exports data dir.
func (*Storage) GetClientAddress ¶
GetClientAddress returns the storage node endpoint address.
func (*Storage) IdentityKeyPath ¶
IdentityKeyPath returns the path to the node's identity key.
func (*Storage) P2PKeyPath ¶
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 ¶
TLSCertPath returns the path to the node's TLS certificate.
func (*Storage) TLSKeyPath ¶
TLSKeyPath returns the path to the node's TLS key.
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"` NoAutoStart bool `json:"no_auto_start,omitempty"` 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.
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 ¶
Exports path returns the path to the node's exports data dir.
func (*Validator) ExternalGRPCAddress ¶
ExternalGRPCAddress returns the address of the node's external gRPC server.
func (*Validator) IdentityKeyPath ¶
IdentityKeyPath returns the path to the node's identity key.
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"` NoAutoStart bool `json:"no_auto_start,omitempty"` 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.