e2e

package
v0.2300.11 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 56 Imported by: 1

Documentation

Overview

Package e2e implements the Oasis e2e test scenarios.

Index

Constants

View Source
const (
	PreserveValidatorRuntimeStorage uint8 = iota
	PreserveValidatorLocalStorage
	ForceValidatorReset
	PreserveComputeWorkerRuntimeStorage
	PreserveComputeWorkerLocalStorage
	ForceComputeWorkerReset
	PreserveClientRuntimeStorage
	PreserveClientLocalStorage
	ForceClientReset
	PreserveByzantineRuntimeStorage
	PreserveByzantineLocalStorage
	ForceByzantineReset
	PreserveSentryRuntimeStorage
	PreserveSentryLocalStorage
	ForceSentryReset
	PreserveKeymanagerRuntimeStorage
	PreserveKeymanagerLocalStorage
	ForceKeymanagerReset
)

Flag for consensus state reset.

Variables

View Source
var (
	// ByzantineVRFBeaconHonest is the honest byzantine VRF beacon scenario.
	ByzantineVRFBeaconHonest scenario.Scenario = &byzantineVRFBeaconImpl{
		Scenario: *NewScenario("byzantine/beacon-vrf-honest"),
		extraArgs: []oasis.Argument{
			{Name: byzantine.CfgVRFBeaconMode, Values: []string{byzantine.ModeVRFBeaconHonest.String()}},
		},
		identitySeed: byzantineBeaconIdentitySeed,
	}

	// ByzantineVRFBeaconEarly is the early-proof byzantine beacon scenario.
	ByzantineVRFBeaconEarly scenario.Scenario = &byzantineVRFBeaconImpl{
		Scenario: *NewScenario("byzantine/beacon-vrf-early"),
		extraArgs: []oasis.Argument{
			{Name: byzantine.CfgVRFBeaconMode, Values: []string{byzantine.ModeVRFBeaconEarly.String()}},
		},
		identitySeed: byzantineBeaconIdentitySeed,
	}

	// ByzantineVRFBeaconMissing is the missing-proof byzantine beacon scenario.
	ByzantineVRFBeaconMissing scenario.Scenario = &byzantineVRFBeaconImpl{
		Scenario: *NewScenario("byzantine/beacon-vrf-missing"),
		extraArgs: []oasis.Argument{
			{Name: byzantine.CfgVRFBeaconMode, Values: []string{byzantine.ModeVRFBeaconMissing.String()}},
		},
		identitySeed: byzantineBeaconIdentitySeed,
	}
)
View Source
var (
	// GasFeesStaking is the staking gas fees scenario.
	GasFeesStaking scenario.Scenario = &gasFeesImpl{
		Scenario: *NewScenario("gas-fees/staking"),
	}

	// GasFeesStakingDumpRestore is the staking gas fees scenario with
	// dump-restore.
	GasFeesStakingDumpRestore scenario.Scenario = &gasFeesImpl{
		Scenario:    *NewScenario("gas-fees/staking-dump-restore"),
		dumpRestore: true,
	}
)
View Source
var (
	TestEntityAccount    = stakingTests.AddressFromString("oasis1qq7us2p22udg2t24u6ry4m29wzql005pjsske8gt")
	DeterministicEntity1 = stakingTests.AddressFromString("oasis1qqncl383h8458mr9cytatygctzwsx02n4c5f8ed7")
	DeterministicEntity2 = stakingTests.AddressFromString("oasis1qznshq4ttrgh83d9wqvgmsuq3pfsndg3tus7lx98")
	DeterministicEntity3 = stakingTests.AddressFromString("oasis1qrz6kjp9lu6vc6snhlszq3p2nlx76qasaqr2auqk")
	DeterministicEntity4 = stakingTests.AddressFromString("oasis1qqw3ka3eeuy5qaytyhesxtj4fe5pp0xkdy954uwk")

	DeterministicValidator0 = stakingTests.AddressFromString("oasis1qpt202cf6t0s5ugkk34p83yf0c30gpjkny92u7dh")
	DeterministicValidator1 = stakingTests.AddressFromString("oasis1qryg8qf3ydzcphr328l8psz007fms9dxeuy8lgzq")
	DeterministicValidator2 = stakingTests.AddressFromString("oasis1qz74khszg55gfnmpxut3t3gdymn76hfchu9nhtd0")
	DeterministicValidator3 = stakingTests.AddressFromString("oasis1qqkspsglt3quhpkghr837trfwm048srjuv8g92jj")

	DeterministicCompute0 = stakingTests.AddressFromString("oasis1qp6tl30ljsrrqnw2awxxu2mtxk0qxyy2nymtsy90")
	DeterministicCompute1 = stakingTests.AddressFromString("oasis1qr77y0cqdzcqgz2wqkv59yz0j4vfvyryfv8vxllt")
	DeterministicCompute2 = stakingTests.AddressFromString("oasis1qzyw75ds6nw0af98xfmmpl3z8sgf3mdslvtzzcn6")
	DeterministicCompute3 = stakingTests.AddressFromString("oasis1qrp7l53vn6h2z7p242ldtkqtttz2jf9dwsgu05aa")
	DeterministicCompute4 = stakingTests.AddressFromString("oasis1qzpgrrd7435s2vaxr6s7xhqxusu4muq3y5qyph7u")

	DeterministicStorage0 = stakingTests.AddressFromString("oasis1qrhp36j49ncpaac0aufwyuvtk04nfxcj2yq7y4my")
	DeterministicStorage1 = stakingTests.AddressFromString("oasis1qzc2fexm30puzq2cmlm832fvpnyaxrq33cx4zukj")
	DeterministicStorage2 = stakingTests.AddressFromString("oasis1qq2t9c27y6kylqz4n6qmh3vn9zessh8guglsg8qc")
	DeterministicStorage3 = stakingTests.AddressFromString("oasis1qz359ng7waf2lp7j8c6vzd6qw4g4xtelysr0hl6x")

	DeterministicKeyManager0 = stakingTests.AddressFromString("oasis1qpx0k28va6n0r25qd2j4jdh9f42n5vex6s9lp780")
	DeterministicKeyManager1 = stakingTests.AddressFromString("oasis1qz30d8mqzrsrsu7fr0e6nxk0ze7ffdkj8ur7sqp0")
)

Deterministic Test Accounts.

View Source
var (
	// NodeUpgradeDummy is the node upgrade dummy scenario.
	NodeUpgradeDummy scenario.Scenario = newNodeUpgradeImpl(migrations.DummyUpgradeHandler, &dummyUpgradeChecker{})
	// NodeUpgradeMaxAllowances is the node upgrade max allowances scenario.
	NodeUpgradeMaxAllowances scenario.Scenario = newNodeUpgradeImpl(migrations.ConsensusMaxAllowances16Handler, &noOpUpgradeChecker{})
	// NodeUpgradeV62 is the node consensus V61 migration scenario.
	NodeUpgradeV62 scenario.Scenario = newNodeUpgradeImpl(migrations.ConsensusV62, &upgradeV62Checker{})
	// NodeUpgradeEmpty is the empty node upgrade scenario.
	NodeUpgradeEmpty scenario.Scenario = newNodeUpgradeImpl(migrations.EmptyHandler, &noOpUpgradeChecker{})
)
View Source
var ChangeParametersMinCommissionRate scenario.Scenario = newConsensusParameterUpgradeImpl(
	"change-parameters-min-commission-rate",
	&api.ChangeParametersProposal{
		Module:  staking.ModuleName,
		Changes: cbor.Marshal(minCommissionRateChanges),
	},
	&minCommissionRateChecker{},
)

ChangeParametersMinCommissionRate is the governance change parameters scenario that changes minimum commission rate.

View Source
var ChangeParametersRewardSchedule scenario.Scenario = newChangeRewardScheduleImpl(
	"change-parameters-reward-schedule",
	&api.ChangeParametersProposal{
		Module:  staking.ModuleName,
		Changes: cbor.Marshal(rewardScheduleChanges),
	},
)

ChangeParametersRewardSchedule is the governance change parameters scenario that changes the reward schedule.

View Source
var ConsensusStateSync scenario.Scenario = &consensusStateSyncImpl{
	Scenario: *NewScenario("consensus-state-sync"),
}

ConsensusStateSync is the consensus state sync scenario.

View Source
var Debond scenario.Scenario = &debondImpl{
	Scenario: *NewScenario("debond"),
}

Debond tests debonding records created in the genesis document.

View Source
var GenesisFile scenario.Scenario = &genesisFileImpl{
	Scenario: *NewScenario("genesis-file"),
}

GenesisFile is the scenario for testing the correctness of marshalled genesis documents.

View Source
var IdentityCLI scenario.Scenario = &identityCLIImpl{
	Scenario: *NewScenario("identity-cli"),
}

IdentityCLI is the identity CLI scenario.

View Source
var (
	MinTransactBalance scenario.Scenario = &minTransactBalanceImpl{
		Scenario: *NewScenario("min-transact-balance"),
	}
)
View Source
var MultipleSeeds scenario.Scenario = &multipleSeeds{
	Scenario: *NewScenario("multiple-seeds"),
}

MultipleSeeds is the scenario where multiple seed nodes are used.

View Source
var NodeUpgradeCancel scenario.Scenario = newNodeUpgradeCancelImpl()

NodeUpgradeCancel is the node upgrade scenario.

View Source
var ParamsDummyScenario = NewScenario("")

ParamsDummyScenario is a dummy instance of E2E scenario used to register global E2E flags.

View Source
var SeedAPI scenario.Scenario = &seedAPI{
	Scenario: *NewScenario("seed-api"),
}

SeedAPI is the scenario where seed node control and consensus APIs are tested.

View Source
var ValidatorEquivocation scenario.Scenario = &validatorEquivocationImpl{
	Scenario: *NewScenario("validator-equivocation"),
}

ValidatorEquivocation is the validator equivocation scenario.

Functions

func RegisterScenarios

func RegisterScenarios() error

RegisterScenarios registers all end-to-end scenarios.

Types

type Scenario added in v0.2202.9

type Scenario struct {
	Net    *oasis.Network
	Flags  *env.ParameterFlagSet
	Logger *logging.Logger
	// contains filtered or unexported fields
}

Scenario is a base scenario for oasis-node end-to-end tests.

func NewScenario added in v0.2202.9

func NewScenario(name string) *Scenario

NewScenario creates a new base scenario for oasis-node end-to-end tests.

func (*Scenario) ChainContext added in v0.2300.0

func (sc *Scenario) ChainContext(ctx context.Context) (string, error)

ChainContext returns the consensus chain context.

func (*Scenario) Clone added in v0.2202.9

func (sc *Scenario) Clone() scenario.Scenario

Clone implements scenario.Scenario.

func (*Scenario) DumpRestoreNetwork added in v0.2202.9

func (sc *Scenario) DumpRestoreNetwork(
	childEnv *env.Env,
	fixture *oasis.NetworkFixture,
	doDbDump bool,
	genesisMapFn func(*genesis.Document),
	resetFlags map[uint8]bool,
) error

DumpRestoreNetwork first dumps the current network state and then attempts to restore it.

func (*Scenario) EnsureProposalFinalized added in v0.2300.0

func (sc *Scenario) EnsureProposalFinalized(ctx context.Context, content *governance.ProposalContent, entity *oasis.Entity, entityNonce uint64, currentEpoch beacon.EpochTime) (*governance.Proposal, uint64, beacon.EpochTime, error)

EnsureProposalFinalized submits a proposal, votes for it and ensures the proposal is finalized.

func (*Scenario) EntityNonce added in v0.2300.0

func (sc *Scenario) EntityNonce(ctx context.Context, ent *entity.Entity) (uint64, error)

EntityNonce returns the nonce of the specified entity.

func (*Scenario) EntityNonceByID added in v0.2300.0

func (sc *Scenario) EntityNonceByID(ctx context.Context, id signature.PublicKey) (uint64, error)

EntityNonceByID returns the nonce of the specified entity.

func (*Scenario) ExportedGenesisFiles added in v0.2300.0

func (sc *Scenario) ExportedGenesisFiles(skipCompute bool) ([]string, error)

ExportedGenesisFiles gathers exported genesis files and ensures all exported genesis files match.

func (*Scenario) Fixture added in v0.2202.9

func (sc *Scenario) Fixture() (*oasis.NetworkFixture, error)

Fixture implements scenario.Scenario.

func (*Scenario) Init added in v0.2202.9

func (sc *Scenario) Init(_ *env.Env, net *oasis.Network) error

Init implements scenario.Scenario.

func (*Scenario) Name added in v0.2202.9

func (sc *Scenario) Name() string

Name implements scenario.Scenario.

func (*Scenario) Network added in v0.2300.2

func (sc *Scenario) Network() *oasis.Network

Network implements scenario.Scenario.

func (*Scenario) Parameters added in v0.2202.9

func (sc *Scenario) Parameters() *env.ParameterFlagSet

Parameters implements scenario.Scenario.

func (*Scenario) PreInit added in v0.2202.9

func (sc *Scenario) PreInit() error

PreInit implements scenario.Scenario.

func (*Scenario) RegisterEntity added in v0.2300.0

func (sc *Scenario) RegisterEntity(childEnv *env.Env, cli *cli.Helpers, ent *oasis.Entity, nonce uint64) error

RegisterEntity registers the specified entity.

func (*Scenario) RegisterRuntime added in v0.2300.0

func (sc *Scenario) RegisterRuntime(childEnv *env.Env, cli *cli.Helpers, rt registry.Runtime, nonce uint64) error

RegisterRuntime registers the specified runtime.

func (*Scenario) ResetConsensusState added in v0.2202.9

func (sc *Scenario) ResetConsensusState(childEnv *env.Env, flags map[uint8]bool) error

ResetConsensusState removes all consensus state, preserving runtime storage and node-local storage databases unless specified with flags otherwise.

func (*Scenario) Run added in v0.2300.2

func (sc *Scenario) Run(context.Context, *env.Env) error

Run implements scenario.Scenario.

func (*Scenario) TestEntityNonce added in v0.2300.0

func (sc *Scenario) TestEntityNonce(ctx context.Context) (uint64, error)

TestEntityNonce returns the nonce of the test entity.

func (*Scenario) TrustRoot added in v0.2300.0

func (sc *Scenario) TrustRoot(ctx context.Context) (*TrustRoot, error)

TrustRoot returns a suitable trust root after running the network for a few blocks.

func (*Scenario) WaitBlocks added in v0.2300.0

func (sc *Scenario) WaitBlocks(ctx context.Context, n int) (*consensus.Block, error)

WaitBlocks waits for the specified number of blocks.

func (*Scenario) WaitEpochs added in v0.2300.0

func (sc *Scenario) WaitEpochs(ctx context.Context, n beacon.EpochTime) error

WaitEpochs waits for the specified number of epochs.

type TrustRoot added in v0.2300.0

type TrustRoot struct {
	Height       string
	Hash         string
	ChainContext string
}

TrustRoot is a consensus trust root.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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