Documentation ¶
Index ¶
- type Acc
- type Enclave
- func (e *Enclave) BalanceProofs() ([]*tee.BalanceProof, error)
- func (e *Enclave) BlockNum() uint64
- func (e *Enclave) DepositProofs() ([]*tee.DepositProof, error)
- func (e *Enclave) Init() (_ common.Address, _ []byte, err error)
- func (e *Enclave) IsAtPhaseEnd() bool
- func (e *Enclave) ProcessBlocks(blocks ...*tee.Block) error
- func (e *Enclave) ProcessTXs(txs ...*tee.Transaction) error
- func (e *Enclave) Run(params tee.Parameters) error
- func (e *Enclave) Shutdown()
- type Epoch
- func (e *Epoch) ApplyDeposits(deposits ...*erdstallDepEvent)
- func (e *Epoch) Balance(who common.Address) *big.Int
- func (e *Epoch) DepositNum() tee.Epoch
- func (e *Epoch) ExitNum() tee.Epoch
- func (e *Epoch) IsExitLocked(who common.Address) bool
- func (e *Epoch) Outcome() (o Outcome)
- func (e *Epoch) ProcessTx(contract common.Address, tx *tee.Transaction) error
- func (e *Epoch) RegisterExits(exitReqs ...*erdstallExitEvent)
- func (e *Epoch) TxNum() tee.Epoch
- type Outcome
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Enclave ¶
type Enclave struct { *State // The enclave's essential state. // contains filtered or unexported fields }
func NewEnclave ¶
func NewEnclaveWithAccount ¶
func (*Enclave) BalanceProofs ¶
func (e *Enclave) BalanceProofs() ([]*tee.BalanceProof, error)
BalanceProofs returns all balance proofs at the end of each transaction phase.
Note that all blocks of the epoch's transaction phase (+k) need to be known to the Enclave. This call blocks until all necessary blocks are received and processed.
It should be called in a loop by the operator.
func (*Enclave) DepositProofs ¶
func (e *Enclave) DepositProofs() ([]*tee.DepositProof, error)
DepositProofs returns the deposit proofs of all deposits made in an epoch at the end of the deposit phase.
Note that all blocks of the epoch's deposit phase (+k) need to be known to the Enclave. This call blocks until all necessary blocks are received and processed.
It should be called in a loop by the operator.
func (*Enclave) Init ¶
Init initializes the enclave, generating a new secp256k1 ECDSA key and storing it as the enclave's signing key.
It returns the public key derived Ethereum address and attestation of correct initialization of the enclave with the generated address. The attestation can be used to verify the enclave with the TEE vendor.
The Operator must deploy the contract with the Enclave's address after calling Init.
func (*Enclave) IsAtPhaseEnd ¶
func (*Enclave) ProcessBlocks ¶
ProcessBlocks instantaneously processes a list of blocks. If any of the blocks are erroneous, they are simply ignored, without affecting the rest of the blocks. Returns the accumulated error messages.
func (*Enclave) ProcessTXs ¶
func (e *Enclave) ProcessTXs(txs ...*tee.Transaction) error
ProcessTXs should be called by the Operator whenever they receive new transactions from users. After a transaction epoch has finished and an additional k blocks made known to the Enclave, the epoch's balance proofs can be received by calling BalanceProofs.
func (*Enclave) Run ¶
func (e *Enclave) Run(params tee.Parameters) error
Run starts the enclave's main loop.
Run must be called after Init.
Run can be stopped by calling Shutdown. However, Run will process blocks and transactions until the current phase has finished.
func (*Enclave) Shutdown ¶
func (e *Enclave) Shutdown()
Shutdown lets the Enclave gracefully shutdown after the next phase is sealed. It will continue receiving transactions and blocks until the last block of the current phase is received via ProcessBlocks.
The Enclave Interface methods will return an tee.ErrEnclaveStopped error after the Enclave shut down.
type Epoch ¶
type Epoch struct {
// contains filtered or unexported fields
}
Epoch manages deposits, transactions, and exits, as well as the progression of time in the system.
func (*Epoch) ApplyDeposits ¶
func (e *Epoch) ApplyDeposits(deposits ...*erdstallDepEvent)
ApplyDeposits applies a series deposit events and makes the deposited values available instantly.
func (*Epoch) DepositNum ¶
DepositNum is the current deposit epoch number.
func (*Epoch) IsExitLocked ¶
IsExitLocked returns whether an account is exit locked.
func (*Epoch) Outcome ¶
Outcome has to be called exactly once after each phase shift and contains all accounts that exited within this epoch, as well as all balances at the end of the epoch. It blocks until the epoch in which it was last called ends.
func (*Epoch) ProcessTx ¶
ProcessTx processes a transaction. If it is invalid, does nothing and returns an error. A transaction is invalid if either party is currently locked for withdrawal or the transaction is otherwise invalid (e.g., insufficient funds, invalid signature, ...). Valid transactions increase the sender's nonce.
func (*Epoch) RegisterExits ¶
func (e *Epoch) RegisterExits(exitReqs ...*erdstallExitEvent)
RegisterExits registers a exit requests for the end of the current phase. The requested accounts are locked for one epoch before they can be withdrawn.
type Outcome ¶
type Outcome struct { TxEpoch tee.Epoch // The finished TX epoch. Exits map[common.Address]*Acc // Exited accounts. Accounts map[common.Address]*Acc // Final balances and nonces. }
Outcome contains all of an epoch's final balances, as well as all accounts that exited the system at the end of the epoch.
type State ¶
type State struct { Params *tee.Parameters // The fixed enclave parameters. Epoch tee.Epoch // The current epoch. LastBlock uint64 // The last known block height. LastBlockHash common.Hash // The last known block's hash. Accounts map[common.Address]*Acc // The users' accounts. }
State contains all essential enclave state.