Documentation ¶
Index ¶
- func CopyDir(source, destination string) error
- func RunEdgeCommand(args []string, stdout io.Writer) error
- type ClusterOption
- func WithBlockGasLimit(blockGasLimit uint64) ClusterOption
- func WithBootnodeCount(cnt int) ClusterOption
- func WithBridgeAllowListAdmin(addr types.Address) ClusterOption
- func WithBridgeAllowListEnabled(addr types.Address) ClusterOption
- func WithBridgeBlockListAdmin(addr types.Address) ClusterOption
- func WithBridgeBlockListEnabled(addr types.Address) ClusterOption
- func WithBurnContract(burnContract *polybft.BurnContractInfo) ClusterOption
- func WithContractDeployerAllowListAdmin(addr types.Address) ClusterOption
- func WithContractDeployerAllowListEnabled(addr types.Address) ClusterOption
- func WithContractDeployerBlockListAdmin(addr types.Address) ClusterOption
- func WithContractDeployerBlockListEnabled(addr types.Address) ClusterOption
- func WithEpochReward(epochReward int) ClusterOption
- func WithEpochSize(epochSize int) ClusterOption
- func WithGenesisState(databasePath string, stateRoot types.Hash) ClusterOption
- func WithNativeTokenConfig(tokenConfigRaw string) ClusterOption
- func WithNonValidators(num int) ClusterOption
- func WithNumBlockConfirmations(numBlockConfirmations uint64) ClusterOption
- func WithPremine(addresses ...types.Address) ClusterOption
- func WithPropertyTestLogging() ClusterOption
- func WithSecretsCallback(fn func([]types.Address, *TestClusterConfig)) ClusterOption
- func WithTestRewardToken() ClusterOption
- func WithTransactionsAllowListAdmin(addr types.Address) ClusterOption
- func WithTransactionsAllowListEnabled(addr types.Address) ClusterOption
- func WithTransactionsBlockListAdmin(addr types.Address) ClusterOption
- func WithTransactionsBlockListEnabled(addr types.Address) ClusterOption
- func WithValidatorSnapshot(validatorsLen uint64) ClusterOption
- func WithoutBridge() ClusterOption
- type TestBridge
- func (t *TestBridge) Deposit(token bridgeCommon.TokenType, rootTokenAddr, rootPredicateAddr types.Address, ...) error
- func (t *TestBridge) FundValidators(tokenAddress types.Address, secretsPaths []string, amounts []*big.Int) error
- func (t *TestBridge) JSONRPCAddr() string
- func (t *TestBridge) SendExitTransaction(exitHelper types.Address, exitID uint64, childJSONRPCAddr string) error
- func (t *TestBridge) Start() error
- func (t *TestBridge) Stop()
- func (t *TestBridge) WaitUntil(pollFrequency, timeout time.Duration, handler func() (bool, error)) error
- func (t *TestBridge) Withdraw(token bridgeCommon.TokenType, ...) error
- type TestCluster
- func (c *TestCluster) Call(t *testing.T, to types.Address, method *abi.Method, args ...interface{}) map[string]interface{}
- func (c *TestCluster) Deploy(t *testing.T, sender ethgo.Key, bytecode []byte) *TestTxn
- func (c *TestCluster) ExistsCode(t *testing.T, addr ethgo.Address) bool
- func (c *TestCluster) Fail(err error)
- func (c *TestCluster) InitSecrets(prefix string, count int) ([]types.Address, error)
- func (c *TestCluster) InitTestServer(t *testing.T, dataDir string, bridgeJSONRPC string, isValidator bool, ...)
- func (c *TestCluster) MethodTxn(t *testing.T, sender ethgo.Key, target types.Address, input []byte) *TestTxn
- func (c *TestCluster) SendTxn(t *testing.T, sender ethgo.Key, txn *ethgo.Transaction) *TestTxn
- func (c *TestCluster) Stats(t *testing.T)
- func (c *TestCluster) Stop()
- func (c *TestCluster) Transfer(t *testing.T, sender ethgo.Key, target types.Address, value *big.Int) *TestTxn
- func (c *TestCluster) WaitForBlock(n uint64, timeout time.Duration) error
- func (c *TestCluster) WaitForGeneric(dur time.Duration, fn func(*TestServer) bool) error
- func (c *TestCluster) WaitForReady(t *testing.T)
- func (c *TestCluster) WaitUntil(timeout, pollFrequency time.Duration, handler func() bool) error
- type TestClusterConfig
- type TestServer
- func (t *TestServer) BridgeJSONRPCAddr() string
- func (t *TestServer) Conn() proto.SystemClient
- func (t *TestServer) DataDir() string
- func (t *TestServer) GrpcAddr() string
- func (t *TestServer) HasValidatorSealed(firstBlock, lastBlock uint64, validators validator.AccountSet, ...) (bool, error)
- func (t *TestServer) JSONRPC() *jsonrpc.Client
- func (t *TestServer) JSONRPCAddr() string
- func (t *TestServer) RegisterValidator(supernetManagerAddr types.Address) error
- func (t *TestServer) RootchainFund(stakeToken types.Address, amount *big.Int) error
- func (t *TestServer) RootchainFundFor(accounts []types.Address, amounts []*big.Int, stakeToken types.Address) error
- func (t *TestServer) Stake(polybftConfig polybft.PolyBFTConfig, amount *big.Int) error
- func (t *TestServer) Start()
- func (t *TestServer) Stop()
- func (t *TestServer) TxnPoolOperator() txpoolProto.TxnPoolOperatorClient
- func (t *TestServer) Unstake(amount *big.Int) error
- func (t *TestServer) WaitForNonZeroBalance(address ethgo.Address, dur time.Duration) (*big.Int, error)
- func (t *TestServer) WhitelistValidators(addresses []string, supernetManager types.Address) error
- func (t *TestServer) WithdrawChildChain() error
- func (t *TestServer) WithdrawRewards() error
- func (t *TestServer) WithdrawRootChain(recipient string, amount *big.Int, stakeManager ethgo.Address, ...) error
- type TestServerConfig
- type TestServerConfigCallback
- type TestTxn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClusterOption ¶
type ClusterOption func(*TestClusterConfig)
func WithBlockGasLimit ¶
func WithBlockGasLimit(blockGasLimit uint64) ClusterOption
func WithBootnodeCount ¶
func WithBootnodeCount(cnt int) ClusterOption
func WithBridgeAllowListAdmin ¶ added in v0.9.0
func WithBridgeAllowListAdmin(addr types.Address) ClusterOption
func WithBridgeAllowListEnabled ¶ added in v0.9.0
func WithBridgeAllowListEnabled(addr types.Address) ClusterOption
func WithBridgeBlockListAdmin ¶ added in v0.9.0
func WithBridgeBlockListAdmin(addr types.Address) ClusterOption
func WithBridgeBlockListEnabled ¶ added in v0.9.0
func WithBridgeBlockListEnabled(addr types.Address) ClusterOption
func WithBurnContract ¶ added in v0.9.0
func WithBurnContract(burnContract *polybft.BurnContractInfo) ClusterOption
func WithContractDeployerAllowListAdmin ¶
func WithContractDeployerAllowListAdmin(addr types.Address) ClusterOption
func WithContractDeployerAllowListEnabled ¶
func WithContractDeployerAllowListEnabled(addr types.Address) ClusterOption
func WithContractDeployerBlockListAdmin ¶ added in v0.9.0
func WithContractDeployerBlockListAdmin(addr types.Address) ClusterOption
func WithContractDeployerBlockListEnabled ¶ added in v0.9.0
func WithContractDeployerBlockListEnabled(addr types.Address) ClusterOption
func WithEpochReward ¶
func WithEpochReward(epochReward int) ClusterOption
func WithEpochSize ¶
func WithEpochSize(epochSize int) ClusterOption
func WithGenesisState ¶
func WithGenesisState(databasePath string, stateRoot types.Hash) ClusterOption
func WithNativeTokenConfig ¶ added in v0.9.0
func WithNativeTokenConfig(tokenConfigRaw string) ClusterOption
func WithNonValidators ¶
func WithNonValidators(num int) ClusterOption
func WithNumBlockConfirmations ¶
func WithNumBlockConfirmations(numBlockConfirmations uint64) ClusterOption
func WithPremine ¶
func WithPremine(addresses ...types.Address) ClusterOption
func WithPropertyTestLogging ¶ added in v0.9.0
func WithPropertyTestLogging() ClusterOption
func WithSecretsCallback ¶
func WithSecretsCallback(fn func([]types.Address, *TestClusterConfig)) ClusterOption
func WithTestRewardToken ¶ added in v0.9.0
func WithTestRewardToken() ClusterOption
func WithTransactionsAllowListAdmin ¶ added in v0.9.0
func WithTransactionsAllowListAdmin(addr types.Address) ClusterOption
func WithTransactionsAllowListEnabled ¶ added in v0.9.0
func WithTransactionsAllowListEnabled(addr types.Address) ClusterOption
func WithTransactionsBlockListAdmin ¶ added in v0.9.0
func WithTransactionsBlockListAdmin(addr types.Address) ClusterOption
func WithTransactionsBlockListEnabled ¶ added in v0.9.0
func WithTransactionsBlockListEnabled(addr types.Address) ClusterOption
func WithValidatorSnapshot ¶
func WithValidatorSnapshot(validatorsLen uint64) ClusterOption
func WithoutBridge ¶ added in v0.9.0
func WithoutBridge() ClusterOption
type TestBridge ¶
type TestBridge struct {
// contains filtered or unexported fields
}
func NewTestBridge ¶
func NewTestBridge(t *testing.T, clusterConfig *TestClusterConfig) (*TestBridge, error)
func (*TestBridge) Deposit ¶ added in v0.9.0
func (t *TestBridge) Deposit(token bridgeCommon.TokenType, rootTokenAddr, rootPredicateAddr types.Address, senderKey, receivers, amounts, tokenIDs, jsonRPCAddr, minterKey string, childChainMintable bool) error
Deposit function invokes bridge deposit of ERC tokens (from the root to the child chain) with given receivers, amounts and/or token ids
func (*TestBridge) FundValidators ¶ added in v1.0.0
func (t *TestBridge) FundValidators(tokenAddress types.Address, secretsPaths []string, amounts []*big.Int) error
FundValidators sends tokens to a rootchain validators
func (*TestBridge) JSONRPCAddr ¶
func (t *TestBridge) JSONRPCAddr() string
func (*TestBridge) SendExitTransaction ¶
func (t *TestBridge) SendExitTransaction(exitHelper types.Address, exitID uint64, childJSONRPCAddr string) error
SendExitTransaction sends exit transaction to the root chain
func (*TestBridge) Start ¶
func (t *TestBridge) Start() error
func (*TestBridge) Stop ¶
func (t *TestBridge) Stop()
func (*TestBridge) Withdraw ¶ added in v0.9.0
func (t *TestBridge) Withdraw(token bridgeCommon.TokenType, senderKey, receivers, amounts, tokenIDs, jsonRPCAddr string, childPredicate, childToken types.Address, childChainMintable bool) error
Withdraw function is used to invoke bridge withdrawals for any kind of ERC tokens (from the child to the root chain) with given receivers, amounts and/or token ids
type TestCluster ¶
type TestCluster struct { Config *TestClusterConfig Servers []*TestServer Bridge *TestBridge // contains filtered or unexported fields }
func NewPropertyTestCluster ¶ added in v0.9.0
func NewPropertyTestCluster(t *testing.T, validatorsCount int, opts ...ClusterOption) *TestCluster
func NewTestCluster ¶
func NewTestCluster(t *testing.T, validatorsCount int, opts ...ClusterOption) *TestCluster
func (*TestCluster) ExistsCode ¶
func (*TestCluster) Fail ¶
func (c *TestCluster) Fail(err error)
func (*TestCluster) InitSecrets ¶
InitSecrets initializes account(s) secrets with given prefix. (secrets are being stored in the temp directory created by given e2e test execution)
func (*TestCluster) InitTestServer ¶
func (*TestCluster) SendTxn ¶
func (c *TestCluster) SendTxn(t *testing.T, sender ethgo.Key, txn *ethgo.Transaction) *TestTxn
SendTxn sends a transaction
func (*TestCluster) Stats ¶
func (c *TestCluster) Stats(t *testing.T)
func (*TestCluster) Stop ¶
func (c *TestCluster) Stop()
func (*TestCluster) WaitForBlock ¶
func (c *TestCluster) WaitForBlock(n uint64, timeout time.Duration) error
func (*TestCluster) WaitForGeneric ¶
func (c *TestCluster) WaitForGeneric(dur time.Duration, fn func(*TestServer) bool) error
WaitForGeneric waits until all running servers returns true from fn callback or timeout defined by dur occurs
func (*TestCluster) WaitForReady ¶
func (c *TestCluster) WaitForReady(t *testing.T)
type TestClusterConfig ¶
type TestClusterConfig struct { Name string Premine []string // address[:amount] PremineValidators []string // address[:amount] StakeAmounts []*big.Int WithoutBridge bool BootnodeCount int NonValidatorCount int WithLogs bool WithStdout bool LogsDir string TmpDir string BlockGasLimit uint64 BurnContract *polybft.BurnContractInfo ValidatorPrefix string Binary string ValidatorSetSize uint64 EpochSize int EpochReward int NativeTokenConfigRaw string SecretsCallback func([]types.Address, *TestClusterConfig) ContractDeployerAllowListAdmin []types.Address ContractDeployerAllowListEnabled []types.Address ContractDeployerBlockListAdmin []types.Address ContractDeployerBlockListEnabled []types.Address TransactionsAllowListAdmin []types.Address TransactionsAllowListEnabled []types.Address TransactionsBlockListAdmin []types.Address TransactionsBlockListEnabled []types.Address BridgeAllowListAdmin []types.Address BridgeAllowListEnabled []types.Address BridgeBlockListAdmin []types.Address BridgeBlockListEnabled []types.Address NumBlockConfirmations uint64 InitialTrieDB string InitialStateRoot types.Hash IsPropertyTest bool TestRewardToken string // contains filtered or unexported fields }
func (*TestClusterConfig) Dir ¶
func (c *TestClusterConfig) Dir(name string) string
type TestServer ¶
type TestServer struct {
// contains filtered or unexported fields
}
func NewTestServer ¶
func NewTestServer(t *testing.T, clusterConfig *TestClusterConfig, bridgeJSONRPC string, callback TestServerConfigCallback) *TestServer
func (*TestServer) BridgeJSONRPCAddr ¶ added in v0.9.0
func (t *TestServer) BridgeJSONRPCAddr() string
func (*TestServer) Conn ¶
func (t *TestServer) Conn() proto.SystemClient
func (*TestServer) DataDir ¶
func (t *TestServer) DataDir() string
func (*TestServer) GrpcAddr ¶
func (t *TestServer) GrpcAddr() string
func (*TestServer) HasValidatorSealed ¶
func (t *TestServer) HasValidatorSealed(firstBlock, lastBlock uint64, validators validator.AccountSet, validatorAddr ethgo.Address) (bool, error)
HasValidatorSealed checks whether given validator has signed at least single block for the given range of blocks
func (*TestServer) JSONRPC ¶
func (t *TestServer) JSONRPC() *jsonrpc.Client
func (*TestServer) JSONRPCAddr ¶
func (t *TestServer) JSONRPCAddr() string
func (*TestServer) RegisterValidator ¶
func (t *TestServer) RegisterValidator(supernetManagerAddr types.Address) error
RegisterValidator is a wrapper function which registers new validator on a root chain
func (*TestServer) RootchainFund ¶ added in v0.9.0
RootchainFund funds given validator account on the rootchain
func (*TestServer) RootchainFundFor ¶ added in v1.0.0
func (t *TestServer) RootchainFundFor(accounts []types.Address, amounts []*big.Int, stakeToken types.Address) error
RootchainFundFor funds given account on the rootchain
func (*TestServer) Stake ¶
func (t *TestServer) Stake(polybftConfig polybft.PolyBFTConfig, amount *big.Int) error
Stake stakes given amount to validator account encapsulated by given server instance
func (*TestServer) Start ¶
func (t *TestServer) Start()
func (*TestServer) Stop ¶
func (t *TestServer) Stop()
func (*TestServer) TxnPoolOperator ¶
func (t *TestServer) TxnPoolOperator() txpoolProto.TxnPoolOperatorClient
func (*TestServer) Unstake ¶
func (t *TestServer) Unstake(amount *big.Int) error
Unstake unstakes given amount from validator account encapsulated by given server instance
func (*TestServer) WaitForNonZeroBalance ¶
func (*TestServer) WhitelistValidators ¶ added in v0.9.0
func (t *TestServer) WhitelistValidators(addresses []string, supernetManager types.Address) error
WhitelistValidators invokes whitelist-validators helper CLI command, that whitelists validators on the root chain
func (*TestServer) WithdrawChildChain ¶ added in v0.9.0
func (t *TestServer) WithdrawChildChain() error
WithdrawChildChain withdraws available balance from child chain
func (*TestServer) WithdrawRewards ¶ added in v0.9.0
func (t *TestServer) WithdrawRewards() error
WithdrawRewards withdraws pending rewards for given validator on RewardPool contract
func (*TestServer) WithdrawRootChain ¶ added in v0.9.0
func (t *TestServer) WithdrawRootChain(recipient string, amount *big.Int, stakeManager ethgo.Address, bridgeJSONRPC string) error
WithdrawRootChain withdraws available balance from root chain
type TestServerConfig ¶
type TestServerConfigCallback ¶
type TestServerConfigCallback func(*TestServerConfig)
type TestTxn ¶
type TestTxn struct {
// contains filtered or unexported fields
}
func (*TestTxn) Reverted ¶
Reverted returns whether the transaction failed and was reverted consuming all the gas from the call
func (*TestTxn) Txn ¶
func (t *TestTxn) Txn() *ethgo.Transaction
Txn returns the raw transaction that was sent