cstestutils

package
v1.0.0-b1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNodeSetEmail string = "test@nodeset.io"
)

Variables

View Source
var (
	DefaultStandardTestHarnessOptions = &StandardTestHarnessOptions{
		WalletIndex:            4,
		SetupOracleDao:         true,
		OracleDaoWalletIndices: []uint{10, 11, 12},
	}
)

Functions

func BuildAndSubmitCreateMinipoolTxs

func BuildAndSubmitCreateMinipoolTxs(t *testing.T, deployment *db.ConstellationDeployment, nodes []*cstesting.ConstellationNode, addresses []common.Address, mpsPerNode int, salts [][]*big.Int, rpSuperNode *node.Node) ([][]*csapi.MinipoolCreateData, [][]common.Hash)

Builds and submits multiple minipool creation TXs, returning the minipool data and transaction hashes

func BuildAndSubmitStakeMinipoolTxs

func BuildAndSubmitStakeMinipoolTxs(t *testing.T, nodes []*cstesting.ConstellationNode, creationData [][]*csapi.MinipoolCreateData) [][]common.Hash

Builds and submits multiple minipool stake TXs, returning the transaction hashes

func BuildAndVerifyCreateMinipoolTx

func BuildAndVerifyCreateMinipoolTx(t *testing.T, deployment *db.ConstellationDeployment, csNode *cstesting.ConstellationNode, nodeAddress common.Address, salt *big.Int, rpSuperNode *node.Node, shouldSucceed bool) *csapi.MinipoolCreateData

Creates the TX for creating a new minipool, and verifies it simulated successfully

func BuildAndVerifyCreateMinipoolTxBeforeTest

func BuildAndVerifyCreateMinipoolTxBeforeTest(logger *slog.Logger, deployment *db.ConstellationDeployment, csNode *cstesting.ConstellationNode, nodeAddress common.Address, salt *big.Int, rpSuperNode *node.Node, shouldSucceed bool) (*csapi.MinipoolCreateData, error)

Creates the TX for creating a new minipool, and verifies it simulated successfully

func CreateMinipool

func CreateMinipool(t *testing.T, testMgr *cstesting.ConstellationTestManager, csNode *cstesting.ConstellationNode, nodeAddress common.Address, salt *big.Int, rpSuperNode *node.Node, mpMgr *minipool.MinipoolManager) minipool.IMinipool

Deposits into Constellation, creating a new minipool

func CreateMinipoolBeforeTest

func CreateMinipoolBeforeTest(testHarness *StandardTestHarness, csNode *cstesting.ConstellationNode, nodeAddress common.Address, salt *big.Int, rpSuperNode *node.Node, mpMgr *minipool.MinipoolManager) (minipool.IMinipool, error)

Deposits into Constellation, creating a new minipool

func DepositToRplVault

func DepositToRplVault(t *testing.T, testMgr *cstesting.ConstellationTestManager, rplVault contracts.IErc4626Token, rpl *tokens.TokenRpl, amount *big.Int, opts *bind.TransactOpts)

Deposits RPL to the RPL vault and verifies the contract balances have been updated

func DepositToRplVaultBeforeTest

func DepositToRplVaultBeforeTest(testHarness *StandardTestHarness, rplVault contracts.IErc4626Token, rpl *tokens.TokenRpl, amount *big.Int, opts *bind.TransactOpts) error

Deposits RPL to the RPL vault and verifies the contract balances have been updated

func DepositToWethVault

func DepositToWethVault(t *testing.T, testMgr *cstesting.ConstellationTestManager, wethVault contracts.IErc4626Token, weth *contracts.Weth, amount *big.Int, opts *bind.TransactOpts)

Deposits WETH to the WETH vault and verifies the contract balances have been updated

func DepositToWethVaultBeforeTest

func DepositToWethVaultBeforeTest(testHarness *StandardTestHarness, wethVault contracts.IErc4626Token, weth *contracts.Weth, amount *big.Int, opts *bind.TransactOpts) error

Deposits WETH to the WETH vault and verifies the contract balances have been updated

func RegisterWithConstellation

func RegisterWithConstellation(t *testing.T, testMgr *cstesting.ConstellationTestManager, csNode *cstesting.ConstellationNode)

Registers the node with Constellation, ensuring it wasn't previously registered beforehand

func RegisterWithConstellationBeforeTest

func RegisterWithConstellationBeforeTest(testHarness *StandardTestHarness, csNode *cstesting.ConstellationNode)

Registers the node with Constellation, ensuring it wasn't previously registered beforehand

func SaveValidatorKey

func SaveValidatorKey(t *testing.T, csNode *cstesting.ConstellationNode, data *csapi.MinipoolCreateData)

Saves the validator key created as part of a minipool creation TX to disk

func SaveValidatorKeyBeforeTest

func SaveValidatorKeyBeforeTest(logger *slog.Logger, csNode *cstesting.ConstellationNode, data *csapi.MinipoolCreateData) error

Saves the validator key created as part of a minipool creation TX to disk

func StakeMinipool

func StakeMinipool(t *testing.T, testMgr *cstesting.ConstellationTestManager, csNode *cstesting.ConstellationNode, nodeAddress common.Address, mp minipool.IMinipool)

Stakes a minipool

func StakeMinipoolBeforeTest

func StakeMinipoolBeforeTest(testHarness *StandardTestHarness, csNode *cstesting.ConstellationNode, nodeAddress common.Address, mp minipool.IMinipool) error

Stakes a minipool

func VerifyMinipoolAfterCreation

func VerifyMinipoolAfterCreation(t *testing.T, qMgr *eth.QueryManager, rpSuperNode *node.Node, superNodeMpIndex uint64, expectedMinipoolAddress common.Address, mpMgr *minipool.MinipoolManager) minipool.IMinipool

Verifies the supernode's minipool address at the provided index is expected and the minipool status is prelaunch

func VerifyMinipoolAfterCreationBeforeTest

func VerifyMinipoolAfterCreationBeforeTest(logger *slog.Logger, qMgr *eth.QueryManager, rpSuperNode *node.Node, superNodeMpIndex uint64, expectedMinipoolAddress common.Address, mpMgr *minipool.MinipoolManager) (minipool.IMinipool, error)

Verifies the supernode's minipool address at the provided index is expected and the minipool status is prelaunch

Types

type ContractBindings

type ContractBindings struct {
	// Rocket Pool bindings
	DepositPoolManager *deposit.DepositPoolManager
	Rpl                *tokens.TokenRpl
	ProtocolDaoManager *protocol.ProtocolDaoManager
	OracleDaoManager   *oracle.OracleDaoManager
	MinipoolManager    *minipool.MinipoolManager
	NetworkManager     *network.NetworkManager
	NodeManager        *node.NodeManager
	RocketVault        *core.Contract
	RewardsPool        *rewards.RewardsPool
	SmoothingPool      *core.Contract

	// Constellation bindings
	Weth                                     *contracts.Weth
	RpSuperNode                              *node.Node
	NodeSetOperatorRewardsDistributorAddress common.Address
}

Common contract bindings that are used across tests

func CreateBindings

Create a new contract bindings instance

type StandardTestHarness

type StandardTestHarness struct {
	TestManager  *cstesting.ConstellationTestManager
	Logger       *slog.Logger
	NodeSetEmail string
	KeyGenerator *keys.KeyGenerator
	DeployerOpts *bind.TransactOpts
	AdminOpts    *bind.TransactOpts
	Bindings     *ContractBindings

	// Primary CS node
	MainNode        *cstesting.ConstellationNode
	MainNodeAddress common.Address

	// Oracle DAO
	OdaoOpts  []*bind.TransactOpts
	OdaoNodes []*node.Node
}

func CreateStandardTestHarness

func CreateStandardTestHarness(options *StandardTestHarnessOptions) (*StandardTestHarness, error)

Creates a standard test harness and bootstrapped chain deployment using the default configuration

func (*StandardTestHarness) Close

func (h *StandardTestHarness) Close() error

type StandardTestHarnessOptions

type StandardTestHarnessOptions struct {
	WalletIndex            uint64
	SetupOracleDao         bool
	OracleDaoWalletIndices []uint
}

Jump to

Keyboard shortcuts

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