Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type EmitIntervals
- type Emitter
- func (em *Emitter) EmitEvent() (*inter.EventPayload, error)
- func (em *Emitter) OnEventConfirmed(he inter.EventI)
- func (em *Emitter) OnEventConnected(e inter.EventPayloadI)
- func (em *Emitter) OnNewEpoch(newValidators *pos.Validators, newEpoch idx.Epoch)
- func (em *Emitter) Start()
- func (em *Emitter) Stop()
- type External
- type FileConfig
- type LlrReader
- type Reader
- type Signer
- type TxPool
- type TxSigner
- type ValidatorConfig
- type World
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 FileConfig PrevBlockVotesFile FileConfig PrevEpochVoteFile FileConfig }
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) 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 FileConfig ¶ added in v1.0.2
type LlrReader ¶ added in v1.0.2
type LlrReader interface { GetLowestBlockToDecide() idx.Block GetLastBV(id idx.ValidatorID) *idx.Block GetBlockRecordHash(idx.Block) *hash.Hash GetBlockEpoch(idx.Block) idx.Epoch GetLowestEpochToDecide() idx.Epoch GetLastEV(id idx.ValidatorID) *idx.Epoch GetEpochRecordHash(epoch idx.Epoch) *hash.Hash }
type Reader ¶
type Reader interface { LlrReader 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() ncogearthchain.Rules }
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(enforceTips bool) (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.