Documentation ¶
Index ¶
- Variables
- type Pool
- func (p *Pool) AddTx(ctx context.Context, tx types.Transaction) error
- func (p *Pool) CountPendingTransactions(ctx context.Context) (uint64, error)
- func (p *Pool) GetGasPrice(ctx context.Context) (uint64, error)
- func (p *Pool) GetPendingTxHashesSince(ctx context.Context, since time.Time) ([]common.Hash, error)
- func (p *Pool) GetPendingTxs(ctx context.Context, isClaims bool, limit uint64) ([]Transaction, error)
- func (p *Pool) GetSelectedTxs(ctx context.Context, limit uint64) ([]Transaction, error)
- func (p *Pool) IsTxPending(ctx context.Context, hash common.Hash) (bool, error)
- func (p *Pool) MarkReorgedTxsAsPending(ctx context.Context) error
- func (p *Pool) SetGasPrice(ctx context.Context, gasPrice uint64) error
- func (p *Pool) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus TxStatus) error
- type Transaction
- type TxStatus
- type ZkCounters
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidChainID is returned when the transaction has a different chain id // than the chain id of the network ErrInvalidChainID = errors.New("invalid chain id") // ErrTxTypeNotSupported is returned if a transaction is not supported in the // current network configuration. ErrTxTypeNotSupported = types.ErrTxTypeNotSupported // ErrOversizedData is returned if the input data of a transaction is greater // than some meaningful limit a user might use. This is not a consensus error // making the transaction invalid, rather a DOS protection. ErrOversizedData = errors.New("oversized data") // ErrNegativeValue is a sanity error to ensure no one is able to specify a // transaction with a negative value. ErrNegativeValue = errors.New("negative value") // ErrInvalidSender is returned if the transaction contains an invalid signature. ErrInvalidSender = errors.New("invalid sender") // ErrNonceTooLow is returned if the nonce of a transaction is lower than the // one present in the local chain. ErrNonceTooLow = errors.New("nonce too low") // ErrInsufficientFunds is returned if the total cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value") )
var ( // ErrAlreadyKnown is returned if the transactions is already contained // within the pool. ErrAlreadyKnown = errors.New("already known") // ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced // with a different one without the required price bump. ErrReplaceUnderpriced = errors.New("replacement transaction underpriced") )
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is an implementation of the Pool interface that uses a postgres database to store the data
func (*Pool) CountPendingTransactions ¶
CountPendingTransactions get number of pending transactions used in bench tests
func (*Pool) GetGasPrice ¶
GetGasPrice returns the current gas price
func (*Pool) GetPendingTxHashesSince ¶
GetPendingTxHashesSince returns the hashes of pending tx since the given date.
func (*Pool) GetPendingTxs ¶
func (p *Pool) GetPendingTxs(ctx context.Context, isClaims bool, limit uint64) ([]Transaction, error)
GetPendingTxs from the pool limit parameter is used to limit amount of pending txs from the db, if limit = 0, then there is no limit
func (*Pool) GetSelectedTxs ¶
GetSelectedTxs gets selected txs from the pool db
func (*Pool) IsTxPending ¶
IsTxPending check if tx is still pending
func (*Pool) MarkReorgedTxsAsPending ¶
MarkReorgedTxsAsPending updated reorged txs status from selected to pending
func (*Pool) SetGasPrice ¶
SetGasPrice allows an external component to define the gas price
type Transaction ¶
type Transaction struct { types.Transaction Status TxStatus IsClaims bool ZkCounters FailedCounter uint64 ReceivedAt time.Time }
Transaction represents a pool tx
type TxStatus ¶
type TxStatus string
TxStatus represents the state of a tx
const ( // TxStatusPending represents a tx that has not been processed TxStatusPending TxStatus = "pending" // TxStatusInvalid represents an invalid tx TxStatusInvalid TxStatus = "invalid" // TxStatusSelected represents a tx that has been selected TxStatusSelected TxStatus = "selected" // TxStatusFailed represents a tx that has been failed after processing, but can be processed in the future TxStatusFailed TxStatus = "failed" )
type ZkCounters ¶
type ZkCounters struct { CumulativeGasUsed int64 UsedKeccakHashes int32 UsedPoseidonHashes int32 UsedPoseidonPaddings int32 UsedMemAligns int32 UsedArithmetics int32 UsedBinaries int32 UsedSteps int32 }
ZkCounters counters for the tx
func (*ZkCounters) IsZkCountersBelowZero ¶
func (zkc *ZkCounters) IsZkCountersBelowZero() bool
IsZkCountersBelowZero checks if any of the counters are below zero
func (*ZkCounters) SumUpZkCounters ¶
func (zkc *ZkCounters) SumUpZkCounters(txZkCounters ZkCounters)
SumUpZkCounters sum ups zk counters with passed tx zk counters