core

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirstBlockNumber = 1
	MempoolSize      = 99999 // must be less than or equal to types.MaxBlockTxesNum

)
View Source
const (
	DefaultExitBondAmount = 123456789
)
View Source
const RootChainABI = "" /* 3633-byte string literal not displayed */
View Source
const RootChainBin = `` /* 30780-byte string literal not displayed */

Variables

View Source
var (
	ErrMempoolFull = errors.New("mempool is full")

	ErrBlockNotFound = errors.New("block is not found")
	ErrEmptyBlock    = errors.New("block is empty")

	ErrTxNotFound                     = errors.New("tx is not found")
	ErrInvalidTxSignature             = errors.New("tx signature is invalid")
	ErrInvalidTxConfirmationSignature = errors.New("tx confirmation signature is invalid")
	ErrInvalidTxBalance               = errors.New("tx balance is invalid")

	ErrTxInNotFound         = errors.New("txin is not found")
	ErrInvalidTxIn          = errors.New("txin is invalid")
	ErrNullTxInConfirmation = errors.New("null txin cannot be confirmed")

	ErrTxOutNotFound      = errors.New("txout is not found")
	ErrTxOutAlreadySpent  = errors.New("txout was already spent")
	ErrTxOutAlreadyExited = errors.New("txout was already exited")

	ErrNullConfirmationSignature = errors.New("confirmation signature is null")
)

Functions

This section is empty.

Types

type ChildChain

type ChildChain struct{}

func NewChildChain

func NewChildChain(txn *badger.Txn) (*ChildChain, error)

func (*ChildChain) AddBlock

func (cc *ChildChain) AddBlock(txn *badger.Txn, signer *types.Account) (uint64, error)

func (*ChildChain) AddDepositBlock

func (cc *ChildChain) AddDepositBlock(txn *badger.Txn, ownerAddr common.Address, amount *big.Int, signer *types.Account) (uint64, error)

func (*ChildChain) AddTxToMempool

func (cc *ChildChain) AddTxToMempool(txn *badger.Txn, tx *types.Tx) error

func (*ChildChain) ConfirmTx

func (cc *ChildChain) ConfirmTx(txn *badger.Txn, txInPos types.Position, confSig types.Signature) error

func (*ChildChain) ExitTxOut added in v0.2.0

func (cc *ChildChain) ExitTxOut(txn *badger.Txn, txOutPos types.Position) error

func (*ChildChain) GetBlock

func (cc *ChildChain) GetBlock(txn *badger.Txn, blkNum uint64) (*types.Block, error)

func (*ChildChain) GetCurrentBlockNumber

func (cc *ChildChain) GetCurrentBlockNumber(txn *badger.Txn) (uint64, error)

func (*ChildChain) GetTx

func (cc *ChildChain) GetTx(txn *badger.Txn, txPos types.Position) (*types.Tx, error)

func (*ChildChain) GetTxProof

func (cc *ChildChain) GetTxProof(txn *badger.Txn, txPos types.Position) ([]byte, error)

func (*ChildChain) GetUTXOPositions

func (cc *ChildChain) GetUTXOPositions(txn *badger.Txn, addr common.Address) ([]types.Position, error)

func (*ChildChain) RestoreTxOut added in v0.4.0

func (cc *ChildChain) RestoreTxOut(txn *badger.Txn, txOutPos types.Position) error

func (*ChildChain) ValidateTx

func (cc *ChildChain) ValidateTx(txn *badger.Txn, tx *types.Tx) error

type RootChain

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

func NewRootChain

func NewRootChain(conf RootChainConfig) (*RootChain, error)

func (*RootChain) ChallengeExit

func (rc *RootChain) ChallengeExit(a *types.Account, txOutPos types.Position, spendingTx *types.Tx, spendingInIndex uint64) (*gethtypes.Transaction, error)

func (*RootChain) CommitPlasmaBlockRoot

func (rc *RootChain) CommitPlasmaBlockRoot(a *types.Account, rootHash common.Hash) (*gethtypes.Transaction, error)

func (*RootChain) CurrentPlasmaBlockNumber

func (rc *RootChain) CurrentPlasmaBlockNumber() (uint64, error)

func (*RootChain) Deposit

func (rc *RootChain) Deposit(a *types.Account, amount *big.Int) (*gethtypes.Transaction, error)

func (*RootChain) Ping added in v0.3.0

func (rc *RootChain) Ping() error

func (*RootChain) PlasmaExits

func (rc *RootChain) PlasmaExits(txOutPos types.Position) (types.Exit, error)

func (*RootChain) ProcessExits

func (rc *RootChain) ProcessExits(a *types.Account) (*gethtypes.Transaction, error)

func (*RootChain) StartExit

func (rc *RootChain) StartExit(a *types.Account, txOutPos types.Position, tx *types.Tx, txProofBytes []byte) (*gethtypes.Transaction, error)

func (*RootChain) WatchDepositCreated

func (rc *RootChain) WatchDepositCreated(ctx context.Context, sink chan<- *RootChainDepositCreated) (event.Subscription, error)

func (*RootChain) WatchExitStarted added in v0.2.0

func (rc *RootChain) WatchExitStarted(ctx context.Context, sink chan<- *RootChainExitStarted) (event.Subscription, error)

type RootChainConfig

type RootChainConfig struct {
	RPC        string `json:"rpc"`
	WS         string `json:"ws"`
	AddressStr string `json:"address"`
}

func (RootChainConfig) Address

func (conf RootChainConfig) Address() (common.Address, error)

type RootChainDepositCreated

type RootChainDepositCreated struct {
	Owner        common.Address
	Amount       *big.Int
	DepositBlock *big.Int
	Raw          gethtypes.Log
}

type RootChainExitStarted added in v0.2.0

type RootChainExitStarted struct {
	Owner        common.Address
	UtxoPosition *big.Int
	Amount       *big.Int
	Raw          gethtypes.Log
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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