Documentation ¶
Index ¶
- Constants
- type BalanceReport
- type Client
- func (c *Client) ActiveBlock() uint64
- func (c *Client) Address() common.Address
- func (c *Client) BalanceProofWatcher()
- func (c *Client) ChainURL() string
- func (c *Client) CmdBench(status chan *CmdStatus, args ...string)
- func (c *Client) CmdChallenge(status chan *CmdStatus, args ...string)
- func (c *Client) CmdDeposit(status chan *CmdStatus, args ...string)
- func (c *Client) CmdLeave(status chan *CmdStatus, args ...string)
- func (c *Client) CmdSend(status chan *CmdStatus, args ...string)
- func (c *Client) LastBlock() uint64
- func (c *Client) Run() error
- type CmdStatus
- type EpochBalance
- type Event
- type EventType
- type RPC
- type Result
- type Subscription
- type Trust
Constants ¶
const ( UNKNOWN = "😕 Unknown" TRUSTED = "😀 Benevolent" UNTRUSTED = "😠 Malicious" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalanceReport ¶
BalanceReport will be displayed by the GUI.
type Client ¶
type Client struct { psync.Closer // Initialized in NewClient Config config.ClientConfig OpConfig config.OpClientConfig // contains filtered or unexported fields }
func NewClient ¶
func NewClient(cfg config.ClientConfig, ccfg config.OpClientConfig, conn *RPC, events chan *Event, ethClient *eth.Client, signer tee.TextSigner) *Client
func (*Client) ActiveBlock ¶
func (*Client) BalanceProofWatcher ¶
func (c *Client) BalanceProofWatcher()
BalanceProofWatcher waits for the balance proof of an epoch and disputes if non was received after the TxPhase + balanceProofGrace. Can currently only deal with one deposit per deposit-phase. Should be started in a go-routine.
func (*Client) CmdChallenge ¶
func (*Client) CmdDeposit ¶
type EpochBalance ¶
type EpochBalance struct { tee.Balance Dep *tee.DepositProof Bal *tee.BalanceProof }
EpochBalance describes the balance that a specific user has/has in a epoch. Currently, onls only one deposit per Epoch is allowed otherwise it would need a slice of `*DepositProof`s. The Proofs are initialized to nil, the DepositProof should be set after the Deposit succeeded. The BalanceProof should be set at the end of a Transaction phase.
func (*EpochBalance) Clone ¶
func (e *EpochBalance) Clone() *EpochBalance
type Event ¶
type Event struct { Type EventType Params tee.Parameters // SET_PARAMS Report BalanceReport // SET_BALANCE OpTrust Trust Result Result Message string // CHAIN_MSG BlockNum uint64 // NEW_BLOCK EpochNum uint64 // NEW_EPOCH ExitAvailable *EpochBalance // SET_EXIT_AVAIL }
type RPC ¶
RPC connects the client with the operator over websockets.
func NewRPC ¶
NewRPC returns a new RPC object. RPC immediately tries to connect to the operator and starts to handle incomming data. You may want to call Subscribe afterwards if you need balance and/or deposit proofs.
func (*RPC) ClientCfg ¶
func (r *RPC) ClientCfg() config.OpClientConfig
ClientCfg returns the operator's client config.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription is returned by Subscribe() and can be used to iterate over the deposit and balance proofs.
func (*Subscription) BalanceProof ¶
func (s *Subscription) BalanceProof(ctx context.Context) (tee.BalanceProof, error)
BalanceProof blocks until it can return the next balance proof from the operator.
func (*Subscription) DepositProof ¶
func (s *Subscription) DepositProof(ctx context.Context) (tee.DepositProof, error)
DepositProof blocks until it can return the next deposit proof from the operator.
func (*Subscription) Log ¶
func (r *Subscription) Log() *log.Entry
func (*Subscription) TxReceipt ¶
func (s *Subscription) TxReceipt(ctx context.Context) (tee.Transaction, error)
TxReceipt blocks until it can return the next pending incoming transaction from the operator.