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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enclave

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

func NewMockedEnclave

func NewMockedEnclave() *Enclave

func (*Enclave) BalanceProofs

func (e *Enclave) BalanceProofs() (ret []*tee.BalanceProof, err error)

func (*Enclave) DepositProofs

func (e *Enclave) DepositProofs() (ret []*tee.DepositProof, err error)

func (*Enclave) Init

func (e *Enclave) Init() (common.Address, []byte, error)

func (*Enclave) Log

func (e *Enclave) Log() *log.Entry

func (*Enclave) ProcessBlocks

func (e *Enclave) ProcessBlocks(...*tee.Block) error

func (*Enclave) ProcessTXs

func (e *Enclave) ProcessTXs(txs ...*tee.Transaction) error

func (*Enclave) PushBalanceProof

func (e *Enclave) PushBalanceProof(proof *tee.BalanceProof)

func (*Enclave) PushDepositProof

func (e *Enclave) PushDepositProof(proof *tee.DepositProof)

func (*Enclave) Run

func (e *Enclave) Run(tee.Parameters) error

func (*Enclave) SetProcessTXsError

func (e *Enclave) SetProcessTXsError(err error)

func (*Enclave) Shutdown

func (e *Enclave) Shutdown()

func (*Enclave) Transactions

func (e *Enclave) Transactions() <-chan *tee.Transaction

type RPCOperator

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

RPCOperator is a mocked operator.WireAPI. It can be used as an WireAPI for testing the operators RPC module, since it expects an operator.WireAPI.

There are two functions for setting errors that should be returned when the mocked functions are called.

func NewRPROperator

func NewRPROperator(enclave *Enclave) *RPCOperator

NewRPROperator returns a new mocked WireAPI.

func (*RPCOperator) Run

func (r *RPCOperator) Run()

Run pulls the proofs from the enclave and writes them to the subscriptions. This is normally done by the Operator. Returns immediately.

func (*RPCOperator) Send

func (r *RPCOperator) Send(tx tee.Transaction) error

Send is part of the operator.WireAPI interface and adds a Transaction to the enclave. Can be read back from Transactions() which bufferes one TX. Returns the error that was set by SetSendError.

func (*RPCOperator) SetSubscribeProofsError

func (r *RPCOperator) SetSubscribeProofsError(err error)

SetSubscribeProofsError sets the error that should be returned by SubscribeProofs.

func (*RPCOperator) SubscribeProofs

func (r *RPCOperator) SubscribeProofs(addr common.Address) (op.ClientSub, error)

SubscribeProofs subscribed to the proofs that can be added via PushDepositProof and PushBalanceProof which buffers one proof. Returns the error that was set by SetSubscribeProofsError.

type User

type User struct {
	*testing.T

	TargetBalance int64
	// contains filtered or unexported fields
}

User represents a TEE Plasma user.

func CreateUser

func CreateUser(
	t *testing.T,
	ethURL string,
	wallet accounts.Wallet,
	account accounts.Account,
	rpcHost string, rpcPort uint16,
	contractAddress common.Address,
	enclaveParameters tee.Parameters,
) *User

CreateUser creates a new user and connects it to the operator.

func (*User) Account

func (u *User) Account() accounts.Account

Account returns the user's account.

func (*User) Address

func (u *User) Address() common.Address

Address returns the user's account address.

func (*User) BalanceProof

func (u *User) BalanceProof(ctx context.Context)

BalanceProof returns the balance proof for the last epoch.

func (*User) Challenge

func (u *User) Challenge()

Challenge challenges the operator for the balance proof of the current epoch.

func (*User) Deposit

func (u *User) Deposit()

Deposit deposits the current target balance at the TEE Plasma.

func (*User) DepositProof

func (u *User) DepositProof(ctx context.Context)

DepositProof returns the deposit proof for the last epoch.

func (*User) Nonce

func (u *User) Nonce() uint64

Nonce returns the next nonce.

func (*User) SubscribeExitEvents

func (u *User) SubscribeExitEvents() (event.Subscription, chan *bindings.ErdstallExiting)

SubscribeExitEvents subscribes the user the exit events.

func (*User) Transfer

func (u *User) Transfer(ctx context.Context, receiver *User, amount int64)

Transfer transfers the specified amount to the specified receiver.

func (*User) TxReceipt

func (u *User) TxReceipt(ctx context.Context) tee.Transaction

TxReceipt returns the next transaction receipt.

Jump to

Keyboard shortcuts

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