Documentation ¶
Overview ¶
Package txs is a generated GoMock package.
Index ¶
- Constants
- Variables
- func ShuffleWithNonceOrder(logger *zap.Logger, rng *rand.Rand, numTXs int, ntxs []*NanoTX, ...) []types.TransactionID
- type CSConfig
- type Cache
- func (c *Cache) Add(ctx context.Context, db *sql.Database, tx *types.Transaction, ...) error
- func (c *Cache) ApplyLayer(ctx context.Context, db *sql.Database, lid types.LayerID, bid types.BlockID, ...) error
- func (c *Cache) BuildFromTXs(rst []*types.MeshTransaction, blockSeed []byte) error
- func (c *Cache) Get(tid types.TransactionID) *NanoTX
- func (c *Cache) GetMempool(logger *zap.Logger) map[types.Address][]*NanoTX
- func (c *Cache) GetProjection(addr types.Address) (uint64, uint64)
- func (c *Cache) Has(tid types.TransactionID) bool
- func (c *Cache) LinkTXsWithBlock(db *sql.Database, lid types.LayerID, bid types.BlockID, ...) error
- func (c *Cache) LinkTXsWithProposal(db *sql.Database, lid types.LayerID, pid types.ProposalID, ...) error
- func (c *Cache) MoreInDB(addr types.Address) bool
- func (c *Cache) RevertToLayer(db *sql.Database, revertTo types.LayerID) error
- type ConservativeState
- func (cs *ConservativeState) AddToCache(ctx context.Context, tx *types.Transaction, received time.Time) error
- func (cs *ConservativeState) AddToDB(tx *types.Transaction) error
- func (cs *ConservativeState) GetMeshHash(lid types.LayerID) (types.Hash32, error)
- func (cs *ConservativeState) GetMeshTransaction(tid types.TransactionID) (*types.MeshTransaction, error)
- func (cs *ConservativeState) GetMeshTransactions(ids []types.TransactionID) ([]*types.MeshTransaction, map[types.TransactionID]struct{})
- func (cs *ConservativeState) GetProjection(addr types.Address) (uint64, uint64)
- func (cs *ConservativeState) GetTransactionsByAddress(from, to types.LayerID, address types.Address) ([]*types.MeshTransaction, error)
- func (cs *ConservativeState) HasTx(tid types.TransactionID) (bool, error)
- func (cs *ConservativeState) LinkTXsWithBlock(lid types.LayerID, bid types.BlockID, tids []types.TransactionID) error
- func (cs *ConservativeState) LinkTXsWithProposal(lid types.LayerID, pid types.ProposalID, tids []types.TransactionID) error
- func (cs *ConservativeState) RevertCache(revertTo types.LayerID) error
- func (cs *ConservativeState) SelectProposalTXs(lid types.LayerID, numEligibility int) []types.TransactionID
- func (cs *ConservativeState) UpdateCache(ctx context.Context, lid types.LayerID, bid types.BlockID, ...) error
- func (cs *ConservativeState) Validation(raw types.RawTx) system.ValidationRequest
- type ConservativeStateOpt
- type MockconStateCache
- type MockconStateCacheGetMempoolCall
- func (c *MockconStateCacheGetMempoolCall) Do(f func(*zap.Logger) map[types.Address][]*NanoTX) *MockconStateCacheGetMempoolCall
- func (c *MockconStateCacheGetMempoolCall) DoAndReturn(f func(*zap.Logger) map[types.Address][]*NanoTX) *MockconStateCacheGetMempoolCall
- func (c *MockconStateCacheGetMempoolCall) Return(arg0 map[types.Address][]*NanoTX) *MockconStateCacheGetMempoolCall
- type MockconStateCacheMockRecorder
- type MockconservativeState
- func (m *MockconservativeState) AddToCache(arg0 context.Context, arg1 *types.Transaction, arg2 time.Time) error
- func (m *MockconservativeState) AddToDB(arg0 *types.Transaction) error
- func (m *MockconservativeState) EXPECT() *MockconservativeStateMockRecorder
- func (m *MockconservativeState) GetMeshTransaction(arg0 types.TransactionID) (*types.MeshTransaction, error)
- func (m *MockconservativeState) HasTx(arg0 types.TransactionID) (bool, error)
- func (m *MockconservativeState) Validation(arg0 types.RawTx) system.ValidationRequest
- type MockconservativeStateAddToCacheCall
- func (c *MockconservativeStateAddToCacheCall) Do(f func(context.Context, *types.Transaction, time.Time) error) *MockconservativeStateAddToCacheCall
- func (c *MockconservativeStateAddToCacheCall) DoAndReturn(f func(context.Context, *types.Transaction, time.Time) error) *MockconservativeStateAddToCacheCall
- func (c *MockconservativeStateAddToCacheCall) Return(arg0 error) *MockconservativeStateAddToCacheCall
- type MockconservativeStateAddToDBCall
- func (c *MockconservativeStateAddToDBCall) Do(f func(*types.Transaction) error) *MockconservativeStateAddToDBCall
- func (c *MockconservativeStateAddToDBCall) DoAndReturn(f func(*types.Transaction) error) *MockconservativeStateAddToDBCall
- func (c *MockconservativeStateAddToDBCall) Return(arg0 error) *MockconservativeStateAddToDBCall
- type MockconservativeStateGetMeshTransactionCall
- func (c *MockconservativeStateGetMeshTransactionCall) Do(f func(types.TransactionID) (*types.MeshTransaction, error)) *MockconservativeStateGetMeshTransactionCall
- func (c *MockconservativeStateGetMeshTransactionCall) DoAndReturn(f func(types.TransactionID) (*types.MeshTransaction, error)) *MockconservativeStateGetMeshTransactionCall
- func (c *MockconservativeStateGetMeshTransactionCall) Return(arg0 *types.MeshTransaction, arg1 error) *MockconservativeStateGetMeshTransactionCall
- type MockconservativeStateHasTxCall
- func (c *MockconservativeStateHasTxCall) Do(f func(types.TransactionID) (bool, error)) *MockconservativeStateHasTxCall
- func (c *MockconservativeStateHasTxCall) DoAndReturn(f func(types.TransactionID) (bool, error)) *MockconservativeStateHasTxCall
- func (c *MockconservativeStateHasTxCall) Return(arg0 bool, arg1 error) *MockconservativeStateHasTxCall
- type MockconservativeStateMockRecorder
- func (mr *MockconservativeStateMockRecorder) AddToCache(arg0, arg1, arg2 any) *MockconservativeStateAddToCacheCall
- func (mr *MockconservativeStateMockRecorder) AddToDB(arg0 any) *MockconservativeStateAddToDBCall
- func (mr *MockconservativeStateMockRecorder) GetMeshTransaction(arg0 any) *MockconservativeStateGetMeshTransactionCall
- func (mr *MockconservativeStateMockRecorder) HasTx(arg0 any) *MockconservativeStateHasTxCall
- func (mr *MockconservativeStateMockRecorder) Validation(arg0 any) *MockconservativeStateValidationCall
- type MockconservativeStateValidationCall
- func (c *MockconservativeStateValidationCall) Do(f func(types.RawTx) system.ValidationRequest) *MockconservativeStateValidationCall
- func (c *MockconservativeStateValidationCall) DoAndReturn(f func(types.RawTx) system.ValidationRequest) *MockconservativeStateValidationCall
- func (c *MockconservativeStateValidationCall) Return(arg0 system.ValidationRequest) *MockconservativeStateValidationCall
- type MockvmState
- func (m *MockvmState) EXPECT() *MockvmStateMockRecorder
- func (m *MockvmState) GetAllAccounts() ([]*types.Account, error)
- func (m *MockvmState) GetBalance(arg0 types.Address) (uint64, error)
- func (m *MockvmState) GetLayerApplied(arg0 types.TransactionID) (types.LayerID, error)
- func (m *MockvmState) GetLayerStateRoot(arg0 types.LayerID) (types.Hash32, error)
- func (m *MockvmState) GetNonce(arg0 types.Address) (types.Nonce, error)
- func (m *MockvmState) GetStateRoot() (types.Hash32, error)
- func (m *MockvmState) Validation(arg0 types.RawTx) system.ValidationRequest
- type MockvmStateGetAllAccountsCall
- func (c *MockvmStateGetAllAccountsCall) Do(f func() ([]*types.Account, error)) *MockvmStateGetAllAccountsCall
- func (c *MockvmStateGetAllAccountsCall) DoAndReturn(f func() ([]*types.Account, error)) *MockvmStateGetAllAccountsCall
- func (c *MockvmStateGetAllAccountsCall) Return(arg0 []*types.Account, arg1 error) *MockvmStateGetAllAccountsCall
- type MockvmStateGetBalanceCall
- func (c *MockvmStateGetBalanceCall) Do(f func(types.Address) (uint64, error)) *MockvmStateGetBalanceCall
- func (c *MockvmStateGetBalanceCall) DoAndReturn(f func(types.Address) (uint64, error)) *MockvmStateGetBalanceCall
- func (c *MockvmStateGetBalanceCall) Return(arg0 uint64, arg1 error) *MockvmStateGetBalanceCall
- type MockvmStateGetLayerAppliedCall
- func (c *MockvmStateGetLayerAppliedCall) Do(f func(types.TransactionID) (types.LayerID, error)) *MockvmStateGetLayerAppliedCall
- func (c *MockvmStateGetLayerAppliedCall) DoAndReturn(f func(types.TransactionID) (types.LayerID, error)) *MockvmStateGetLayerAppliedCall
- func (c *MockvmStateGetLayerAppliedCall) Return(arg0 types.LayerID, arg1 error) *MockvmStateGetLayerAppliedCall
- type MockvmStateGetLayerStateRootCall
- func (c *MockvmStateGetLayerStateRootCall) Do(f func(types.LayerID) (types.Hash32, error)) *MockvmStateGetLayerStateRootCall
- func (c *MockvmStateGetLayerStateRootCall) DoAndReturn(f func(types.LayerID) (types.Hash32, error)) *MockvmStateGetLayerStateRootCall
- func (c *MockvmStateGetLayerStateRootCall) Return(arg0 types.Hash32, arg1 error) *MockvmStateGetLayerStateRootCall
- type MockvmStateGetNonceCall
- func (c *MockvmStateGetNonceCall) Do(f func(types.Address) (types.Nonce, error)) *MockvmStateGetNonceCall
- func (c *MockvmStateGetNonceCall) DoAndReturn(f func(types.Address) (types.Nonce, error)) *MockvmStateGetNonceCall
- func (c *MockvmStateGetNonceCall) Return(arg0 types.Nonce, arg1 error) *MockvmStateGetNonceCall
- type MockvmStateGetStateRootCall
- func (c *MockvmStateGetStateRootCall) Do(f func() (types.Hash32, error)) *MockvmStateGetStateRootCall
- func (c *MockvmStateGetStateRootCall) DoAndReturn(f func() (types.Hash32, error)) *MockvmStateGetStateRootCall
- func (c *MockvmStateGetStateRootCall) Return(arg0 types.Hash32, arg1 error) *MockvmStateGetStateRootCall
- type MockvmStateMockRecorder
- func (mr *MockvmStateMockRecorder) GetAllAccounts() *MockvmStateGetAllAccountsCall
- func (mr *MockvmStateMockRecorder) GetBalance(arg0 any) *MockvmStateGetBalanceCall
- func (mr *MockvmStateMockRecorder) GetLayerApplied(arg0 any) *MockvmStateGetLayerAppliedCall
- func (mr *MockvmStateMockRecorder) GetLayerStateRoot(arg0 any) *MockvmStateGetLayerStateRootCall
- func (mr *MockvmStateMockRecorder) GetNonce(arg0 any) *MockvmStateGetNonceCall
- func (mr *MockvmStateMockRecorder) GetStateRoot() *MockvmStateGetStateRootCall
- func (mr *MockvmStateMockRecorder) Validation(arg0 any) *MockvmStateValidationCall
- type MockvmStateValidationCall
- func (c *MockvmStateValidationCall) Do(f func(types.RawTx) system.ValidationRequest) *MockvmStateValidationCall
- func (c *MockvmStateValidationCall) DoAndReturn(f func(types.RawTx) system.ValidationRequest) *MockvmStateValidationCall
- func (c *MockvmStateValidationCall) Return(arg0 system.ValidationRequest) *MockvmStateValidationCall
- type NanoTX
- type TxHandler
- func (th *TxHandler) HandleBlockTransaction(_ context.Context, expHash types.Hash32, _ p2p.Peer, data []byte) error
- func (th *TxHandler) HandleGossipTransaction(ctx context.Context, peer p2p.Peer, msg []byte) error
- func (th *TxHandler) HandleProposalTransaction(ctx context.Context, expHash types.Hash32, _ p2p.Peer, msg []byte) error
- func (th *TxHandler) VerifyAndCacheTx(ctx context.Context, msg []byte) error
Constants ¶
const (
MinTXGas = uint64(1) // gas required for the most basic transaction
)
const (
RawFromDB = "raw"
)
Variables ¶
var ( RawTxCount = metrics.NewCounter( "raw_txs", namespace, "number of unparsed/raw transactions", []string{"outcome"}, ) )
Functions ¶
func ShuffleWithNonceOrder ¶
func ShuffleWithNonceOrder( logger *zap.Logger, rng *rand.Rand, numTXs int, ntxs []*NanoTX, byAddrAndNonce map[types.Address][]*NanoTX, ) []types.TransactionID
ShuffleWithNonceOrder perform a Fisher-Yates shuffle on the transactions. note that after shuffling, the original list of transactions are no longer in nonce order within the same principal. we simply check which principal occupies the spot after the shuffle and retrieve their transactions in nonce order.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) ApplyLayer ¶
func (c *Cache) ApplyLayer( ctx context.Context, db *sql.Database, lid types.LayerID, bid types.BlockID, results []types.TransactionWithResult, ineffective []types.Transaction, ) error
ApplyLayer retires the applied transactions from the cache and updates the balances.
func (*Cache) BuildFromTXs ¶
func (c *Cache) BuildFromTXs(rst []*types.MeshTransaction, blockSeed []byte) error
BuildFromTXs builds the cache from the provided transactions.
func (*Cache) Get ¶
func (c *Cache) Get(tid types.TransactionID) *NanoTX
Get gets a transaction from the cache.
func (*Cache) GetMempool ¶
GetMempool returns all the transactions that eligible for a proposal/block.
func (*Cache) GetProjection ¶
GetProjection returns the projected nonce and balance for an account, including pending transactions that are paced in proposals/blocks but not yet applied to the state.
func (*Cache) Has ¶
func (c *Cache) Has(tid types.TransactionID) bool
Has returns true if transaction exists in the cache.
func (*Cache) LinkTXsWithBlock ¶
func (c *Cache) LinkTXsWithBlock( db *sql.Database, lid types.LayerID, bid types.BlockID, tids []types.TransactionID, ) error
LinkTXsWithBlock associates the transactions to a block.
func (*Cache) LinkTXsWithProposal ¶
func (c *Cache) LinkTXsWithProposal( db *sql.Database, lid types.LayerID, pid types.ProposalID, tids []types.TransactionID, ) error
LinkTXsWithProposal associates the transactions to a proposal.
type ConservativeState ¶
type ConservativeState struct {
// contains filtered or unexported fields
}
ConservativeState provides the conservative version of the VM state by taking into accounts of nonce and balances for pending transactions in un-applied blocks and mempool.
func NewConservativeState ¶
func NewConservativeState(state vmState, db *sql.Database, opts ...ConservativeStateOpt) *ConservativeState
NewConservativeState returns a ConservativeState.
func (*ConservativeState) AddToCache ¶
func (cs *ConservativeState) AddToCache(ctx context.Context, tx *types.Transaction, received time.Time) error
AddToCache adds the provided transaction to the conservative cache.
func (*ConservativeState) AddToDB ¶
func (cs *ConservativeState) AddToDB(tx *types.Transaction) error
AddToDB adds a transaction to the database.
func (*ConservativeState) GetMeshHash ¶
GetMeshHash gets the aggregated layer hash at the specified layer.
func (*ConservativeState) GetMeshTransaction ¶
func (cs *ConservativeState) GetMeshTransaction(tid types.TransactionID) (*types.MeshTransaction, error)
GetMeshTransaction retrieves a tx by its id.
func (*ConservativeState) GetMeshTransactions ¶
func (cs *ConservativeState) GetMeshTransactions( ids []types.TransactionID, ) ([]*types.MeshTransaction, map[types.TransactionID]struct{})
GetMeshTransactions retrieves a list of txs by their id's.
func (*ConservativeState) GetProjection ¶
func (cs *ConservativeState) GetProjection(addr types.Address) (uint64, uint64)
GetProjection returns the projected nonce and balance for an account, including pending transactions that are paced in proposals/blocks but not yet applied to the state.
func (*ConservativeState) GetTransactionsByAddress ¶
func (cs *ConservativeState) GetTransactionsByAddress( from, to types.LayerID, address types.Address, ) ([]*types.MeshTransaction, error)
GetTransactionsByAddress retrieves txs for a single address in between layers [from, to]. Guarantees that transaction will appear exactly once, even if origin and recipient is the same, and in insertion order.
func (*ConservativeState) HasTx ¶
func (cs *ConservativeState) HasTx(tid types.TransactionID) (bool, error)
HasTx returns true if transaction exists in the database.
func (*ConservativeState) LinkTXsWithBlock ¶
func (cs *ConservativeState) LinkTXsWithBlock(lid types.LayerID, bid types.BlockID, tids []types.TransactionID) error
LinkTXsWithBlock associates the transactions to a block.
func (*ConservativeState) LinkTXsWithProposal ¶
func (cs *ConservativeState) LinkTXsWithProposal( lid types.LayerID, pid types.ProposalID, tids []types.TransactionID, ) error
LinkTXsWithProposal associates the transactions to a proposal.
func (*ConservativeState) RevertCache ¶
func (cs *ConservativeState) RevertCache(revertTo types.LayerID) error
RevertCache reverts the conservative cache to the given layer.
func (*ConservativeState) SelectProposalTXs ¶
func (cs *ConservativeState) SelectProposalTXs(lid types.LayerID, numEligibility int) []types.TransactionID
SelectProposalTXs picks a specific number of random txs for miner to pack in a proposal.
func (*ConservativeState) UpdateCache ¶
func (cs *ConservativeState) UpdateCache( ctx context.Context, lid types.LayerID, bid types.BlockID, results []types.TransactionWithResult, ineffective []types.Transaction, ) error
func (*ConservativeState) Validation ¶
func (cs *ConservativeState) Validation(raw types.RawTx) system.ValidationRequest
Validation initializes validation request.
type ConservativeStateOpt ¶
type ConservativeStateOpt func(cs *ConservativeState)
ConservativeStateOpt for configuring conservative state.
func WithCSConfig ¶
func WithCSConfig(cfg CSConfig) ConservativeStateOpt
WithCSConfig defines the config used for the conservative state.
func WithLogger ¶
func WithLogger(logger *zap.Logger) ConservativeStateOpt
WithLogger defines logger for conservative state.
type MockconStateCache ¶
type MockconStateCache struct {
// contains filtered or unexported fields
}
MockconStateCache is a mock of conStateCache interface.
func NewMockconStateCache ¶
func NewMockconStateCache(ctrl *gomock.Controller) *MockconStateCache
NewMockconStateCache creates a new mock instance.
func (*MockconStateCache) EXPECT ¶
func (m *MockconStateCache) EXPECT() *MockconStateCacheMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockconStateCache) GetMempool ¶
GetMempool mocks base method.
type MockconStateCacheGetMempoolCall ¶ added in v1.4.0
MockconStateCacheGetMempoolCall wrap *gomock.Call
func (*MockconStateCacheGetMempoolCall) Do ¶ added in v1.4.0
func (c *MockconStateCacheGetMempoolCall) Do(f func(*zap.Logger) map[types.Address][]*NanoTX) *MockconStateCacheGetMempoolCall
Do rewrite *gomock.Call.Do
func (*MockconStateCacheGetMempoolCall) DoAndReturn ¶ added in v1.4.0
func (c *MockconStateCacheGetMempoolCall) DoAndReturn(f func(*zap.Logger) map[types.Address][]*NanoTX) *MockconStateCacheGetMempoolCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockconStateCacheGetMempoolCall) Return ¶ added in v1.4.0
func (c *MockconStateCacheGetMempoolCall) Return(arg0 map[types.Address][]*NanoTX) *MockconStateCacheGetMempoolCall
Return rewrite *gomock.Call.Return
type MockconStateCacheMockRecorder ¶
type MockconStateCacheMockRecorder struct {
// contains filtered or unexported fields
}
MockconStateCacheMockRecorder is the mock recorder for MockconStateCache.
func (*MockconStateCacheMockRecorder) GetMempool ¶
func (mr *MockconStateCacheMockRecorder) GetMempool(arg0 any) *MockconStateCacheGetMempoolCall
GetMempool indicates an expected call of GetMempool.
type MockconservativeState ¶
type MockconservativeState struct {
// contains filtered or unexported fields
}
MockconservativeState is a mock of conservativeState interface.
func NewMockconservativeState ¶
func NewMockconservativeState(ctrl *gomock.Controller) *MockconservativeState
NewMockconservativeState creates a new mock instance.
func (*MockconservativeState) AddToCache ¶
func (m *MockconservativeState) AddToCache(arg0 context.Context, arg1 *types.Transaction, arg2 time.Time) error
AddToCache mocks base method.
func (*MockconservativeState) AddToDB ¶
func (m *MockconservativeState) AddToDB(arg0 *types.Transaction) error
AddToDB mocks base method.
func (*MockconservativeState) EXPECT ¶
func (m *MockconservativeState) EXPECT() *MockconservativeStateMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockconservativeState) GetMeshTransaction ¶
func (m *MockconservativeState) GetMeshTransaction(arg0 types.TransactionID) (*types.MeshTransaction, error)
GetMeshTransaction mocks base method.
func (*MockconservativeState) HasTx ¶
func (m *MockconservativeState) HasTx(arg0 types.TransactionID) (bool, error)
HasTx mocks base method.
func (*MockconservativeState) Validation ¶
func (m *MockconservativeState) Validation(arg0 types.RawTx) system.ValidationRequest
Validation mocks base method.
type MockconservativeStateAddToCacheCall ¶ added in v1.4.0
MockconservativeStateAddToCacheCall wrap *gomock.Call
func (*MockconservativeStateAddToCacheCall) Do ¶ added in v1.4.0
func (c *MockconservativeStateAddToCacheCall) Do(f func(context.Context, *types.Transaction, time.Time) error) *MockconservativeStateAddToCacheCall
Do rewrite *gomock.Call.Do
func (*MockconservativeStateAddToCacheCall) DoAndReturn ¶ added in v1.4.0
func (c *MockconservativeStateAddToCacheCall) DoAndReturn(f func(context.Context, *types.Transaction, time.Time) error) *MockconservativeStateAddToCacheCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockconservativeStateAddToCacheCall) Return ¶ added in v1.4.0
func (c *MockconservativeStateAddToCacheCall) Return(arg0 error) *MockconservativeStateAddToCacheCall
Return rewrite *gomock.Call.Return
type MockconservativeStateAddToDBCall ¶ added in v1.4.0
MockconservativeStateAddToDBCall wrap *gomock.Call
func (*MockconservativeStateAddToDBCall) Do ¶ added in v1.4.0
func (c *MockconservativeStateAddToDBCall) Do(f func(*types.Transaction) error) *MockconservativeStateAddToDBCall
Do rewrite *gomock.Call.Do
func (*MockconservativeStateAddToDBCall) DoAndReturn ¶ added in v1.4.0
func (c *MockconservativeStateAddToDBCall) DoAndReturn(f func(*types.Transaction) error) *MockconservativeStateAddToDBCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockconservativeStateAddToDBCall) Return ¶ added in v1.4.0
func (c *MockconservativeStateAddToDBCall) Return(arg0 error) *MockconservativeStateAddToDBCall
Return rewrite *gomock.Call.Return
type MockconservativeStateGetMeshTransactionCall ¶ added in v1.4.0
MockconservativeStateGetMeshTransactionCall wrap *gomock.Call
func (*MockconservativeStateGetMeshTransactionCall) Do ¶ added in v1.4.0
func (c *MockconservativeStateGetMeshTransactionCall) Do(f func(types.TransactionID) (*types.MeshTransaction, error)) *MockconservativeStateGetMeshTransactionCall
Do rewrite *gomock.Call.Do
func (*MockconservativeStateGetMeshTransactionCall) DoAndReturn ¶ added in v1.4.0
func (c *MockconservativeStateGetMeshTransactionCall) DoAndReturn(f func(types.TransactionID) (*types.MeshTransaction, error)) *MockconservativeStateGetMeshTransactionCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockconservativeStateGetMeshTransactionCall) Return ¶ added in v1.4.0
func (c *MockconservativeStateGetMeshTransactionCall) Return(arg0 *types.MeshTransaction, arg1 error) *MockconservativeStateGetMeshTransactionCall
Return rewrite *gomock.Call.Return
type MockconservativeStateHasTxCall ¶ added in v1.4.0
MockconservativeStateHasTxCall wrap *gomock.Call
func (*MockconservativeStateHasTxCall) Do ¶ added in v1.4.0
func (c *MockconservativeStateHasTxCall) Do(f func(types.TransactionID) (bool, error)) *MockconservativeStateHasTxCall
Do rewrite *gomock.Call.Do
func (*MockconservativeStateHasTxCall) DoAndReturn ¶ added in v1.4.0
func (c *MockconservativeStateHasTxCall) DoAndReturn(f func(types.TransactionID) (bool, error)) *MockconservativeStateHasTxCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockconservativeStateHasTxCall) Return ¶ added in v1.4.0
func (c *MockconservativeStateHasTxCall) Return(arg0 bool, arg1 error) *MockconservativeStateHasTxCall
Return rewrite *gomock.Call.Return
type MockconservativeStateMockRecorder ¶
type MockconservativeStateMockRecorder struct {
// contains filtered or unexported fields
}
MockconservativeStateMockRecorder is the mock recorder for MockconservativeState.
func (*MockconservativeStateMockRecorder) AddToCache ¶
func (mr *MockconservativeStateMockRecorder) AddToCache(arg0, arg1, arg2 any) *MockconservativeStateAddToCacheCall
AddToCache indicates an expected call of AddToCache.
func (*MockconservativeStateMockRecorder) AddToDB ¶
func (mr *MockconservativeStateMockRecorder) AddToDB(arg0 any) *MockconservativeStateAddToDBCall
AddToDB indicates an expected call of AddToDB.
func (*MockconservativeStateMockRecorder) GetMeshTransaction ¶
func (mr *MockconservativeStateMockRecorder) GetMeshTransaction(arg0 any) *MockconservativeStateGetMeshTransactionCall
GetMeshTransaction indicates an expected call of GetMeshTransaction.
func (*MockconservativeStateMockRecorder) HasTx ¶
func (mr *MockconservativeStateMockRecorder) HasTx(arg0 any) *MockconservativeStateHasTxCall
HasTx indicates an expected call of HasTx.
func (*MockconservativeStateMockRecorder) Validation ¶
func (mr *MockconservativeStateMockRecorder) Validation(arg0 any) *MockconservativeStateValidationCall
Validation indicates an expected call of Validation.
type MockconservativeStateValidationCall ¶ added in v1.4.0
MockconservativeStateValidationCall wrap *gomock.Call
func (*MockconservativeStateValidationCall) Do ¶ added in v1.4.0
func (c *MockconservativeStateValidationCall) Do(f func(types.RawTx) system.ValidationRequest) *MockconservativeStateValidationCall
Do rewrite *gomock.Call.Do
func (*MockconservativeStateValidationCall) DoAndReturn ¶ added in v1.4.0
func (c *MockconservativeStateValidationCall) DoAndReturn(f func(types.RawTx) system.ValidationRequest) *MockconservativeStateValidationCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockconservativeStateValidationCall) Return ¶ added in v1.4.0
func (c *MockconservativeStateValidationCall) Return(arg0 system.ValidationRequest) *MockconservativeStateValidationCall
Return rewrite *gomock.Call.Return
type MockvmState ¶
type MockvmState struct {
// contains filtered or unexported fields
}
MockvmState is a mock of vmState interface.
func NewMockvmState ¶
func NewMockvmState(ctrl *gomock.Controller) *MockvmState
NewMockvmState creates a new mock instance.
func (*MockvmState) EXPECT ¶
func (m *MockvmState) EXPECT() *MockvmStateMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockvmState) GetAllAccounts ¶
func (m *MockvmState) GetAllAccounts() ([]*types.Account, error)
GetAllAccounts mocks base method.
func (*MockvmState) GetBalance ¶
func (m *MockvmState) GetBalance(arg0 types.Address) (uint64, error)
GetBalance mocks base method.
func (*MockvmState) GetLayerApplied ¶
func (m *MockvmState) GetLayerApplied(arg0 types.TransactionID) (types.LayerID, error)
GetLayerApplied mocks base method.
func (*MockvmState) GetLayerStateRoot ¶
GetLayerStateRoot mocks base method.
func (*MockvmState) GetStateRoot ¶
func (m *MockvmState) GetStateRoot() (types.Hash32, error)
GetStateRoot mocks base method.
func (*MockvmState) Validation ¶
func (m *MockvmState) Validation(arg0 types.RawTx) system.ValidationRequest
Validation mocks base method.
type MockvmStateGetAllAccountsCall ¶ added in v1.4.0
MockvmStateGetAllAccountsCall wrap *gomock.Call
func (*MockvmStateGetAllAccountsCall) Do ¶ added in v1.4.0
func (c *MockvmStateGetAllAccountsCall) Do(f func() ([]*types.Account, error)) *MockvmStateGetAllAccountsCall
Do rewrite *gomock.Call.Do
func (*MockvmStateGetAllAccountsCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateGetAllAccountsCall) DoAndReturn(f func() ([]*types.Account, error)) *MockvmStateGetAllAccountsCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateGetAllAccountsCall) Return ¶ added in v1.4.0
func (c *MockvmStateGetAllAccountsCall) Return(arg0 []*types.Account, arg1 error) *MockvmStateGetAllAccountsCall
Return rewrite *gomock.Call.Return
type MockvmStateGetBalanceCall ¶ added in v1.4.0
MockvmStateGetBalanceCall wrap *gomock.Call
func (*MockvmStateGetBalanceCall) Do ¶ added in v1.4.0
func (c *MockvmStateGetBalanceCall) Do(f func(types.Address) (uint64, error)) *MockvmStateGetBalanceCall
Do rewrite *gomock.Call.Do
func (*MockvmStateGetBalanceCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateGetBalanceCall) DoAndReturn(f func(types.Address) (uint64, error)) *MockvmStateGetBalanceCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateGetBalanceCall) Return ¶ added in v1.4.0
func (c *MockvmStateGetBalanceCall) Return(arg0 uint64, arg1 error) *MockvmStateGetBalanceCall
Return rewrite *gomock.Call.Return
type MockvmStateGetLayerAppliedCall ¶ added in v1.4.0
MockvmStateGetLayerAppliedCall wrap *gomock.Call
func (*MockvmStateGetLayerAppliedCall) Do ¶ added in v1.4.0
func (c *MockvmStateGetLayerAppliedCall) Do(f func(types.TransactionID) (types.LayerID, error)) *MockvmStateGetLayerAppliedCall
Do rewrite *gomock.Call.Do
func (*MockvmStateGetLayerAppliedCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateGetLayerAppliedCall) DoAndReturn(f func(types.TransactionID) (types.LayerID, error)) *MockvmStateGetLayerAppliedCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateGetLayerAppliedCall) Return ¶ added in v1.4.0
func (c *MockvmStateGetLayerAppliedCall) Return(arg0 types.LayerID, arg1 error) *MockvmStateGetLayerAppliedCall
Return rewrite *gomock.Call.Return
type MockvmStateGetLayerStateRootCall ¶ added in v1.4.0
MockvmStateGetLayerStateRootCall wrap *gomock.Call
func (*MockvmStateGetLayerStateRootCall) Do ¶ added in v1.4.0
func (c *MockvmStateGetLayerStateRootCall) Do(f func(types.LayerID) (types.Hash32, error)) *MockvmStateGetLayerStateRootCall
Do rewrite *gomock.Call.Do
func (*MockvmStateGetLayerStateRootCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateGetLayerStateRootCall) DoAndReturn(f func(types.LayerID) (types.Hash32, error)) *MockvmStateGetLayerStateRootCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateGetLayerStateRootCall) Return ¶ added in v1.4.0
func (c *MockvmStateGetLayerStateRootCall) Return(arg0 types.Hash32, arg1 error) *MockvmStateGetLayerStateRootCall
Return rewrite *gomock.Call.Return
type MockvmStateGetNonceCall ¶ added in v1.4.0
MockvmStateGetNonceCall wrap *gomock.Call
func (*MockvmStateGetNonceCall) Do ¶ added in v1.4.0
func (c *MockvmStateGetNonceCall) Do(f func(types.Address) (types.Nonce, error)) *MockvmStateGetNonceCall
Do rewrite *gomock.Call.Do
func (*MockvmStateGetNonceCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateGetNonceCall) DoAndReturn(f func(types.Address) (types.Nonce, error)) *MockvmStateGetNonceCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateGetNonceCall) Return ¶ added in v1.4.0
func (c *MockvmStateGetNonceCall) Return(arg0 types.Nonce, arg1 error) *MockvmStateGetNonceCall
Return rewrite *gomock.Call.Return
type MockvmStateGetStateRootCall ¶ added in v1.4.0
MockvmStateGetStateRootCall wrap *gomock.Call
func (*MockvmStateGetStateRootCall) Do ¶ added in v1.4.0
func (c *MockvmStateGetStateRootCall) Do(f func() (types.Hash32, error)) *MockvmStateGetStateRootCall
Do rewrite *gomock.Call.Do
func (*MockvmStateGetStateRootCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateGetStateRootCall) DoAndReturn(f func() (types.Hash32, error)) *MockvmStateGetStateRootCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateGetStateRootCall) Return ¶ added in v1.4.0
func (c *MockvmStateGetStateRootCall) Return(arg0 types.Hash32, arg1 error) *MockvmStateGetStateRootCall
Return rewrite *gomock.Call.Return
type MockvmStateMockRecorder ¶
type MockvmStateMockRecorder struct {
// contains filtered or unexported fields
}
MockvmStateMockRecorder is the mock recorder for MockvmState.
func (*MockvmStateMockRecorder) GetAllAccounts ¶
func (mr *MockvmStateMockRecorder) GetAllAccounts() *MockvmStateGetAllAccountsCall
GetAllAccounts indicates an expected call of GetAllAccounts.
func (*MockvmStateMockRecorder) GetBalance ¶
func (mr *MockvmStateMockRecorder) GetBalance(arg0 any) *MockvmStateGetBalanceCall
GetBalance indicates an expected call of GetBalance.
func (*MockvmStateMockRecorder) GetLayerApplied ¶
func (mr *MockvmStateMockRecorder) GetLayerApplied(arg0 any) *MockvmStateGetLayerAppliedCall
GetLayerApplied indicates an expected call of GetLayerApplied.
func (*MockvmStateMockRecorder) GetLayerStateRoot ¶
func (mr *MockvmStateMockRecorder) GetLayerStateRoot(arg0 any) *MockvmStateGetLayerStateRootCall
GetLayerStateRoot indicates an expected call of GetLayerStateRoot.
func (*MockvmStateMockRecorder) GetNonce ¶
func (mr *MockvmStateMockRecorder) GetNonce(arg0 any) *MockvmStateGetNonceCall
GetNonce indicates an expected call of GetNonce.
func (*MockvmStateMockRecorder) GetStateRoot ¶
func (mr *MockvmStateMockRecorder) GetStateRoot() *MockvmStateGetStateRootCall
GetStateRoot indicates an expected call of GetStateRoot.
func (*MockvmStateMockRecorder) Validation ¶
func (mr *MockvmStateMockRecorder) Validation(arg0 any) *MockvmStateValidationCall
Validation indicates an expected call of Validation.
type MockvmStateValidationCall ¶ added in v1.4.0
MockvmStateValidationCall wrap *gomock.Call
func (*MockvmStateValidationCall) Do ¶ added in v1.4.0
func (c *MockvmStateValidationCall) Do(f func(types.RawTx) system.ValidationRequest) *MockvmStateValidationCall
Do rewrite *gomock.Call.Do
func (*MockvmStateValidationCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvmStateValidationCall) DoAndReturn(f func(types.RawTx) system.ValidationRequest) *MockvmStateValidationCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvmStateValidationCall) Return ¶ added in v1.4.0
func (c *MockvmStateValidationCall) Return(arg0 system.ValidationRequest) *MockvmStateValidationCall
Return rewrite *gomock.Call.Return
type NanoTX ¶
type NanoTX struct { types.TxHeader ID types.TransactionID Received time.Time Block types.BlockID Layer types.LayerID }
NanoTX represents minimal info about a transaction for the conservative cache/mempool.
func NewNanoTX ¶
func NewNanoTX(mtx *types.MeshTransaction) *NanoTX
NewNanoTX converts a NanoTX instance from a MeshTransaction.
func (*NanoTX) Better ¶
Better returns true if this transaction takes priority than `other`. when the block seed is non-empty, this tx is being considered for a block. the block seed then is used to tie-break (deterministically) transactions for the same account/nonce.
func (*NanoTX) MaxSpending ¶
MaxSpending returns the maximal amount a transaction can spend.
func (*NanoTX) UpdateLayer ¶
UpdateLayer updates the layer of a transaction.
type TxHandler ¶
type TxHandler struct {
// contains filtered or unexported fields
}
TxHandler handles the transactions received via gossip or sync.
func NewTxHandler ¶
NewTxHandler returns a new TxHandler.
func (*TxHandler) HandleBlockTransaction ¶
func (th *TxHandler) HandleBlockTransaction(_ context.Context, expHash types.Hash32, _ p2p.Peer, data []byte) error
HandleBlockTransaction handles transactions received as a reference to a block.
func (*TxHandler) HandleGossipTransaction ¶
HandleGossipTransaction handles data received on the transactions gossip channel.