txselector

package
v1.4.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: AGPL-3.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 CoordAccount

type CoordAccount struct {
	Addr                ethCommon.Address
	BJJ                 babyjub.PublicKeyComp
	AccountCreationAuth []byte // signature in byte array format
}

CoordAccount contains the data of the Coordinator account, that will be used to create new transactions of CreateAccountDeposit type to add new TokenID accounts for the Coordinator to receive the fees.

type TxSelector

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

TxSelector implements all the functionalities to select the txs for the next batch

func NewTxSelector

func NewTxSelector(coordAccount *CoordAccount, dbpath string,
	synchronizerStateDB *statedb.StateDB, l2 *l2db.L2DB) (*TxSelector, error)

NewTxSelector returns a *TxSelector

func (*TxSelector) GetL1L2TxSelection

func (txsel *TxSelector) GetL1L2TxSelection(selectionConfig txprocessor.Config,
	l1UserTxs, l1UserFutureTxs []common.L1Tx) ([]common.Idx, [][]byte, []common.L1Tx,
	[]common.L1Tx, []common.PoolL2Tx, []common.PoolL2Tx, error)

GetL1L2TxSelection returns the selection of L1 + L2 txs. It returns: the CoordinatorIdxs used to receive the fees of the selected L2Txs. An array of bytearrays with the signatures of the AccountCreationAuthorization of the accounts of the users created by the Coordinator with L1CoordinatorTxs of those accounts that does not exist yet but there is a transactions to them and the authorization of account creation exists. The L1UserTxs, L1CoordinatorTxs, PoolL2Txs that will be included in the next batch.

func (*TxSelector) GetL2TxSelection

func (txsel *TxSelector) GetL2TxSelection(selectionConfig txprocessor.Config, l1UserFutureTxs []common.L1Tx) ([]common.Idx,
	[][]byte, []common.L1Tx, []common.PoolL2Tx, []common.PoolL2Tx, error)

GetL2TxSelection returns the L1CoordinatorTxs and a selection of the L2Txs for the next batch, from the L2DB pool. It returns: the CoordinatorIdxs used to receive the fees of the selected L2Txs. An array of bytearrays with the signatures of the AccountCreationAuthorization of the accounts of the users created by the Coordinator with L1CoordinatorTxs of those accounts that does not exist yet but there is a transactions to them and the authorization of account creation exists. The L1UserTxs, L1CoordinatorTxs, PoolL2Txs that will be included in the next batch.

func (*TxSelector) LocalAccountsDB

func (txsel *TxSelector) LocalAccountsDB() *statedb.LocalStateDB

LocalAccountsDB returns the LocalStateDB of the TxSelector

func (*TxSelector) Reset

func (txsel *TxSelector) Reset(batchNum common.BatchNum, fromSynchronizer bool) error

Reset tells the TxSelector to get it's internal AccountsDB from the required `batchNum`

Jump to

Keyboard shortcuts

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