Documentation
¶
Index ¶
Constants ¶
View Source
const ( SenderCountBufferSize = 20000 PayloadIndexerSize = 5000 )
View Source
const ( TxTimeBufferSize = 20000 TxTurnPeriod = 8 * time.Second TxTurnPeriodLatency = 1 * time.Second TxTurnNonces = 32 )
Variables ¶
View Source
var (
ErrNotEnoughGasPower = errors.New("not enough gas power")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
VersionToPublish string
Validator ValidatorConfig
EmitIntervals EmitIntervals // event emission intervals
MaxTxsPerAddress int
MaxParents idx.Event
// thresholds on GasLeft
LimitedTpsThreshold uint64
NoTxsThreshold uint64
EmergencyThreshold uint64
TxsCacheInvalidation time.Duration
PrevEmittedEventFile PrevEmittedEventFile
}
Config is the configuration of events emitter.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configurations for the events emitter.
func FakeConfig ¶
FakeConfig returns the testing configurations for the events emitter.
type EmitIntervals ¶
type EmitIntervals struct {
Min time.Duration
Max time.Duration
Confirming time.Duration // emit time when there's no txs to originate, but at least 1 tx to confirm
ParallelInstanceProtection time.Duration
DoublesignProtection time.Duration
}
EmitIntervals is the configuration of emit intervals.
func (EmitIntervals) RandomizeEmitTime ¶
func (cfg EmitIntervals) RandomizeEmitTime(r *rand.Rand) EmitIntervals
RandomizeEmitTime and return new config
type Emitter ¶
func (*Emitter) EmitEvent ¶
func (em *Emitter) EmitEvent() *inter.EventPayload
func (*Emitter) OnEventConfirmed ¶
func (*Emitter) OnEventConnected ¶
func (em *Emitter) OnEventConnected(e inter.EventPayloadI)
OnEventConnected tracks new events
func (*Emitter) OnNewEpoch ¶
func (em *Emitter) OnNewEpoch(newValidators *pos.Validators, newEpoch idx.Epoch)
OnNewEpoch should be called after each epoch change, and on startup
type External ¶
type External interface {
sync.Locker
Reader
Check(e *inter.EventPayload, parents inter.Events) error
Process(*inter.EventPayload) error
Broadcast(*inter.EventPayload)
Build(*inter.MutableEventPayload, func()) error
DagIndex() *vecmt.Index
IsBusy() bool
IsSynced() bool
PeersNum() int
}
External world
type PrevEmittedEventFile ¶
type Reader ¶
type Reader interface {
GetLatestBlockIndex() idx.Block
GetEpochValidators() (*pos.Validators, idx.Epoch)
GetEvent(hash.Event) *inter.Event
GetEventPayload(hash.Event) *inter.EventPayload
GetLastEvent(epoch idx.Epoch, from idx.ValidatorID) *hash.Event
GetHeads(idx.Epoch) hash.Events
GetGenesisTime() inter.Timestamp
GetRules() photon.Rules
GetRecommendedGasPrice() *big.Int
}
Reader is a callback for getting events from an external storage.
type TxPool ¶
type TxPool interface {
// Has returns an indicator whether txpool has a transaction cached with the
// given hash.
Has(hash common.Hash) bool
// Pending should return pending transactions.
// The slice should be modifiable by the caller.
Pending() (map[common.Address]types.Transactions, error)
// SubscribeNewTxsNotify should return an event subscription of
// NewTxsNotify and send events to the given channel.
SubscribeNewTxsNotify(chan<- evmcore.NewTxsNotify) notify.Subscription
// Count returns the total number of transactions
Count() int
}
type ValidatorConfig ¶
type ValidatorConfig struct {
ID idx.ValidatorID
PubKey validatorpk.PubKey
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.