osha

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: AGPL-3.0 Imports: 15 Imported by: 1

README

osha

Comprehensive test tooling for Ethereum node management software

Documentation

Index

Constants

View Source
const (
	// The environment variable for the locally running Hardhat instance
	HardhatEnvVar string = "HARDHAT_URL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service added in v0.2.0

type Service int

Service represents a service provided by OSHA

const (
	// Represents the Execution client and Beacon node services
	Service_EthClients Service = 1 << iota

	// Represents the Docker client and compose services
	Service_Docker

	// Represents the underlying filesystem
	Service_Filesystem

	// Represents all of the services provided by OSHA
	Service_All Service = Service_EthClients | Service_Docker | Service_Filesystem
)

func (Service) Contains added in v0.2.0

func (s Service) Contains(service Service) bool

Check if a service value contains a specific service flag

type TestManager

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

TestManager provides bootstrapping and a test service provider, useful for testing

func NewTestManager

func NewTestManager() (*TestManager, error)

Creates a new TestManager instance

func (*TestManager) AdvanceSlots

func (m *TestManager) AdvanceSlots(slots uint, includeBlocks bool) error

Advances the chain by a number of slots. If includeBlocks is true, an EL block will be mined for each slot and the slot will reference that block. If includeBlocks is false, each slot (until the last one) will be "missed", so no EL block will be mined for it.

func (*TestManager) Close added in v0.2.0

func (m *TestManager) Close() error

Cleans up the test environment, including the testing folder that houses any generated files

func (*TestManager) CommitBlock

func (m *TestManager) CommitBlock() error

Commits a new block in the EC and BN, advancing the chain

func (*TestManager) CreateCustomSnapshot

func (m *TestManager) CreateCustomSnapshot(services Service) (string, error)

Takes a snapshot of the service states

func (*TestManager) GetBeaconClient

func (m *TestManager) GetBeaconClient() beacon.IBeaconClient

func (*TestManager) GetBeaconMockManager

func (m *TestManager) GetBeaconMockManager() *manager.BeaconMockManager

func (*TestManager) GetDockerMockManager added in v0.2.0

func (m *TestManager) GetDockerMockManager() *docker.DockerMockManager

func (*TestManager) GetExecutionClient

func (m *TestManager) GetExecutionClient() eth.IExecutionClient

func (*TestManager) GetHardhatRpcClient

func (m *TestManager) GetHardhatRpcClient() *rpc.Client

func (*TestManager) GetLogger

func (m *TestManager) GetLogger() *slog.Logger

func (*TestManager) GetTestDir

func (m *TestManager) GetTestDir() string

Get the path of the test directory - use this to store whatever files you need for testing.

func (*TestManager) RevertToBaseline

func (m *TestManager) RevertToBaseline() error

Reverts the services to the baseline snapshot

func (*TestManager) RevertToCustomSnapshot

func (m *TestManager) RevertToCustomSnapshot(snapshotID string) error

Revert the services to a snapshot state

func (*TestManager) SetBeaconHeadSlot

func (m *TestManager) SetBeaconHeadSlot(slot uint64)

Set the highest slot (the head slot) of the Beacon chain, while keeping the local chain head on the client the same. Useful for simulating an unsynced client.

func (*TestManager) SetMiningInterval added in v0.3.0

func (m *TestManager) SetMiningInterval(interval uint) error

Set the interval for interval mining mode

func (*TestManager) ToggleAutoMine added in v0.3.0

func (m *TestManager) ToggleAutoMine(enabled bool) error

Toggle automining where each TX will automatically be mine into its own block

Directories

Path Synopsis
api
db

Jump to

Keyboard shortcuts

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