test

package
v0.0.0-...-f39f649 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Nonce uint64
	// contains filtered or unexported fields
}

func NewClient

func NewClient(params tee.Parameters, wallet tee.TextSigner, ethClient *eth.Client, tr tee.Transactor) (*Client, error)

NewClient creates a testing Erdstall client. The wallet w must contain the Account of ethClient for Erdstall TX sending.

func (*Client) AddBalance

func (c *Client) AddBalance(amount *big.Int)

func (*Client) Address

func (c *Client) Address() common.Address

func (*Client) Balance

func (c *Client) Balance() *big.Int

func (*Client) Deposit

func (c *Client) Deposit(ctx context.Context, amount *big.Int) error

Deposit deposits amount to the Erdstall contract and waits until the deposit TX is mined. The minedBlockNum is updated automatically.

func (*Client) Exit

func (c *Client) Exit(ctx context.Context, bal *tee.BalanceProof) error

Exit exits the Erdstall contract and waits until the exit TX is mined. The minedBlockNum is updated automatically.

func (*Client) InvalidTxs

func (c *Client) InvalidTxs(rng *rand.Rand, validRecipient common.Address) (txs []*tee.Transaction)

InvalidTxs generates a list of several invalid transactions, each having one of the following fields set to an invalid value: - Sig (random) - Nonce (+-1) - Epoch (+-1) - Sender (random) - Amount (1 above max, -1) The remaining fields are set to a valid value.

func (*Client) Send

func (c *Client) Send(recipient common.Address, amount *big.Int) error

Send sends amount to the given recipient. If you need proper balance tracking for testing, use SendToClient instead.

func (*Client) SendInvalidTxs

func (c *Client) SendInvalidTxs(rng *rand.Rand, validRecipient common.Address) (errs []error)

SendInvalidTxs sends several invalid transactions. It uses InvalidTxs, see its documentation for which invalid transactions are used.

func (*Client) SendToClient

func (c *Client) SendToClient(recipient *Client, amount *big.Int) error

SendToClient sends amount to the given recipient. Use this if you need proper balance tracking in your tests.

func (*Client) SetMinedBlockNum

func (c *Client) SetMinedBlockNum(n uint64)

func (*Client) SignTx

func (c *Client) SignTx(tx *tee.Transaction)

func (*Client) TxEpoch

func (c *Client) TxEpoch() tee.Epoch

TxEpoch return the current transaction epoch as calculated from the currently mined block number known to the client and the enclave parameters.

func (*Client) UpdateLastBlockNum

func (c *Client) UpdateLastBlockNum()

func (*Client) Withdraw

func (c *Client) Withdraw(ctx context.Context, bal *tee.BalanceProof) error

Withdraw withdraws the balance with the given `tee.BalanceProof` and waits until the withdraw TX is mined. The minedBlockNum is updated automatically.

type EnclaveTransactor

type EnclaveTransactor struct {
	Enclave tee.Enclave
}

func (*EnclaveTransactor) Send

func (et *EnclaveTransactor) Send(tx *tee.Transaction) error

Jump to

Keyboard shortcuts

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