Documentation ¶
Index ¶
- Constants
- Variables
- func ReadGasPowerContext(s *Store, a *app.App, validators *pos.Validators, epoch idx.Epoch, ...) *gaspowercheck.ValidationContext
- type Config
- type Consensus
- type EmitIntervals
- type Emitter
- func (em *Emitter) EmitEvent() *inter.Event
- func (em *Emitter) GetValidator() (idx.StakerID, common.Address)
- func (em *Emitter) OnNewEpoch(newValidators *pos.Validators, newEpoch idx.Epoch)
- func (em *Emitter) OnNewEvent(e *inter.Event)
- func (em *Emitter) SetValidator(addr common.Address)
- func (em *Emitter) StartEventEmission()
- func (em *Emitter) StopEventEmission()
- type EmitterConfig
- type EmitterWorld
- type Enr
- type EthAPIBackend
- func (b *EthAPIBackend) AccountManager() *accounts.Manager
- func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*evmcore.EvmBlock, error)
- func (b *EthAPIBackend) ChainConfig() *params.ChainConfig
- func (b *EthAPIBackend) CurrentBlock() *evmcore.EvmBlock
- func (b *EthAPIBackend) CurrentEpoch(ctx context.Context) idx.Epoch
- func (b *EthAPIBackend) ExtRPCEnabled() bool
- func (b *EthAPIBackend) ForEachEvent(ctx context.Context, epoch rpc.BlockNumber, ...) error
- func (b *EthAPIBackend) GetBlock(ctx context.Context, h common.Hash) (*evmcore.EvmBlock, error)
- func (b *EthAPIBackend) GetConsensusTime(ctx context.Context, shortEventID string) (uint64, error)
- func (b *EthAPIBackend) GetDelegatorsOf(ctx context.Context, stakerID idx.StakerID) ([]sfctype.SfcDelegatorAndAddr, error)
- func (b *EthAPIBackend) GetEVM(ctx context.Context, msg evmcore.Message, state *state.StateDB, ...) (*vm.EVM, func() error, error)
- func (b *EthAPIBackend) GetEpochStats(ctx context.Context, requestedEpoch rpc.BlockNumber) (*sfctype.EpochStats, error)
- func (b *EthAPIBackend) GetEvent(ctx context.Context, shortEventID string) (*inter.Event, error)
- func (b *EthAPIBackend) GetEventHeader(ctx context.Context, shortEventID string) (*inter.EventHeaderData, error)
- func (b *EthAPIBackend) GetEventTime(ctx context.Context, id hash.Event, arrivalTime bool) inter.Timestamp
- func (b *EthAPIBackend) GetFullEventID(shortEventID string) (hash.Event, error)
- func (b *EthAPIBackend) GetHeads(ctx context.Context, epoch rpc.BlockNumber) (heads hash.Events, err error)
- func (b *EthAPIBackend) GetLogs(ctx context.Context, block common.Hash) ([][]*types.Log, error)
- func (b *EthAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
- func (b *EthAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
- func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error)
- func (b *EthAPIBackend) GetReceiptsByHash(ctx context.Context, block common.Hash) (types.Receipts, error)
- func (b *EthAPIBackend) GetReceiptsByNumber(ctx context.Context, number rpc.BlockNumber) (types.Receipts, error)
- func (b *EthAPIBackend) GetRewardWeights(ctx context.Context, stakerID idx.StakerID) (*big.Int, *big.Int, error)
- func (b *EthAPIBackend) GetStaker(ctx context.Context, stakerID idx.StakerID) (*sfctype.SfcStaker, error)
- func (b *EthAPIBackend) GetStakerID(ctx context.Context, addr common.Address) (idx.StakerID, error)
- func (b *EthAPIBackend) GetStakers(ctx context.Context) ([]sfctype.SfcStakerAndID, error)
- func (b *EthAPIBackend) GetTd(blockHash common.Hash) *big.Int
- func (b *EthAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, uint64, uint64, error)
- func (b *EthAPIBackend) GetValidators(ctx context.Context) *pos.Validators
- func (b *EthAPIBackend) HeaderByHash(ctx context.Context, h common.Hash) (*evmcore.EvmHeader, error)
- func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*evmcore.EvmHeader, error)
- func (b *EthAPIBackend) Progress() ethapi.PeerProgress
- func (b *EthAPIBackend) ProtocolVersion() int
- func (b *EthAPIBackend) RPCGasCap() *big.Int
- func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
- func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *evmcore.EvmHeader, error)
- func (b *EthAPIBackend) Stats() (pending int, queued int)
- func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) notify.Subscription
- func (b *EthAPIBackend) SubscribeNewBlockEvent(ch chan<- evmcore.ChainHeadNotify) notify.Subscription
- func (b *EthAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) notify.Subscription
- func (b *EthAPIBackend) SubscribeNewTxsNotify(ch chan<- evmcore.NewTxsNotify) notify.Subscription
- func (b *EthAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)
- func (b *EthAPIBackend) TtfReport(ctx context.Context, untilBlock rpc.BlockNumber, maxBlocks idx.Block, ...) (map[hash.Event]time.Duration, error)
- func (b *EthAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
- func (b *EthAPIBackend) ValidatorTimeDrifts(ctx context.Context, epoch rpc.BlockNumber, maxEvents idx.Event) (map[idx.StakerID]map[hash.Event]time.Duration, error)
- type EvmStateReader
- func (r *EvmStateReader) CurrentBlock() *evmcore.EvmBlock
- func (r *EvmStateReader) CurrentHeader() *evmcore.EvmHeader
- func (r *EvmStateReader) GetBlock(h common.Hash, n uint64) *evmcore.EvmBlock
- func (r *EvmStateReader) GetDagBlock(h hash.Event, n idx.Block) *evmcore.EvmBlock
- func (r *EvmStateReader) GetDagHeader(h hash.Event, n idx.Block) *evmcore.EvmHeader
- func (r *EvmStateReader) GetHeader(h common.Hash, n uint64) *evmcore.EvmHeader
- func (r *EvmStateReader) StateAt(root common.Hash) *state.StateDB
- type GasPowerCheckReader
- type GenesisMismatchError
- type HeavyCheckReader
- type HookedEngine
- func (hook *HookedEngine) Bootstrap(callbacks inter.ConsensusCallbacks)
- func (hook *HookedEngine) GetConsensusTime(id hash.Event) (inter.Timestamp, error)
- func (hook *HookedEngine) GetEpoch() idx.Epoch
- func (hook *HookedEngine) GetEpochValidators() (*pos.Validators, idx.Epoch)
- func (hook *HookedEngine) GetGenesisHash() common.Hash
- func (hook *HookedEngine) GetValidators() *pos.Validators
- func (hook *HookedEngine) GetVectorIndex() *vector.Index
- func (hook *HookedEngine) LastBlock() (idx.Block, hash.Event)
- func (hook *HookedEngine) Prepare(e *inter.Event) *inter.Event
- func (hook *HookedEngine) ProcessEvent(e *inter.Event) error
- type NodeInfo
- type PackInfo
- type PeerInfo
- type PeerProgress
- type ProtocolConfig
- type ProtocolManager
- type PublicEthereumAPI
- func (api *PublicEthereumAPI) ChainId() hexutil.Uint64
- func (api *PublicEthereumAPI) Coinbase() (common.Address, error)
- func (api *PublicEthereumAPI) Etherbase() (common.Address, error)
- func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64
- func (api *PublicEthereumAPI) Validator() (common.Address, error)
- type Service
- type ServiceFeed
- func (f *ServiceFeed) SubscribeNewBlock(ch chan<- evmcore.ChainHeadNotify) notify.Subscription
- func (f *ServiceFeed) SubscribeNewEmitted(ch chan<- *inter.Event) notify.Subscription
- func (f *ServiceFeed) SubscribeNewEpoch(ch chan<- idx.Epoch) notify.Subscription
- func (f *ServiceFeed) SubscribeNewLogs(ch chan<- []*types.Log) notify.Subscription
- func (f *ServiceFeed) SubscribeNewPack(ch chan<- idx.Pack) notify.Subscription
- func (f *ServiceFeed) SubscribeNewTxs(ch chan<- core.NewTxsEvent) notify.Subscription
- type Store
- func (s *Store) AddHead(epoch idx.Epoch, id hash.Event)
- func (s *Store) AddLastHeader(epoch idx.Epoch, header *inter.EventHeaderData)
- func (s *Store) AddToPack(epoch idx.Epoch, idx idx.Pack, e hash.Event)
- func (s *Store) ApplyGenesis(net *lachesis.Config, state *evmcore.EvmBlock) (genesisAtropos hash.Event, genesisState common.Hash, new bool, err error)
- func (s *Store) Close()
- func (s *Store) Commit(flushID []byte, immediately bool) error
- func (s *Store) DelEventHeader(epoch idx.Epoch, h hash.Event)
- func (s *Store) DelGasPowerRefunds(epoch idx.Epoch)
- func (s *Store) DelHead(epoch idx.Epoch, id hash.Event)
- func (s *Store) DelLastHeader(epoch idx.Epoch, creator idx.StakerID)
- func (s *Store) DelLastHeaders(epoch idx.Epoch)
- func (s *Store) DeleteEvent(epoch idx.Epoch, id hash.Event)
- func (s *Store) FindEventHashes(epoch idx.Epoch, lamport idx.Lamport, hashPrefix []byte) hash.Events
- func (s *Store) ForEachEvent(epoch idx.Epoch, onEvent func(event *inter.Event) bool)
- func (s *Store) GetBlock(n idx.Block) *inter.Block
- func (s *Store) GetBlockByHash(id hash.Event) *inter.Block
- func (s *Store) GetBlockDecidedBy(block idx.Block) hash.Event
- func (s *Store) GetBlockIndex(id hash.Event) *idx.Block
- func (s *Store) GetDirtyEpochStats() *sfctype.EpochStats
- func (s *Store) GetEpochStats(epoch idx.Epoch) *sfctype.EpochStats
- func (s *Store) GetEvent(id hash.Event) *inter.Event
- func (s *Store) GetEventHeader(epoch idx.Epoch, h hash.Event) *inter.EventHeaderData
- func (s *Store) GetEventRLP(id hash.Event) rlp.RawValue
- func (s *Store) GetEventReceivingTime(e hash.Event) inter.Timestamp
- func (s *Store) GetGasPowerRefund(epoch idx.Epoch, stakerID idx.StakerID) uint64
- func (s *Store) GetGasPowerRefunds(epoch idx.Epoch) map[idx.StakerID]uint64
- func (s *Store) GetHeads(epoch idx.Epoch) hash.Events
- func (s *Store) GetLastEvent(epoch idx.Epoch, from idx.StakerID) *hash.Event
- func (s *Store) GetLastHeaders(epoch idx.Epoch) inter.HeadersByCreator
- func (s *Store) GetPack(epoch idx.Epoch, idx idx.Pack) hash.Events
- func (s *Store) GetPackInfo(epoch idx.Epoch, idx idx.Pack) *PackInfo
- func (s *Store) GetPackInfoOrDefault(epoch idx.Epoch, idx idx.Pack) PackInfo
- func (s *Store) GetPackInfoRLP(epoch idx.Epoch, idx idx.Pack) rlp.RawValue
- func (s *Store) GetPacksNum(epoch idx.Epoch) (idx.Pack, bool)
- func (s *Store) GetPacksNumOrDefault(epoch idx.Epoch) idx.Pack
- func (s *Store) GetTxPosition(txid common.Hash) *app.TxPosition
- func (s *Store) HasEvent(h hash.Event) bool
- func (s *Store) HasEventHeader(h hash.Event) bool
- func (s *Store) IncGasPowerRefund(epoch idx.Epoch, stakerID idx.StakerID, diff uint64)
- func (s *Store) IsHead(epoch idx.Epoch, id hash.Event) bool
- func (s *Store) SetBlock(b *inter.Block)
- func (s *Store) SetBlockDecidedBy(block idx.Block, event hash.Event)
- func (s *Store) SetBlockIndex(id hash.Event, n idx.Block)
- func (s *Store) SetDirtyEpochStats(value *sfctype.EpochStats)
- func (s *Store) SetEpochStats(epoch idx.Epoch, value *sfctype.EpochStats)
- func (s *Store) SetEvent(e *inter.Event)
- func (s *Store) SetEventHeader(epoch idx.Epoch, h hash.Event, e *inter.EventHeaderData)
- func (s *Store) SetEventReceivingTime(e hash.Event, time inter.Timestamp)
- func (s *Store) SetGasPowerRefund(epoch idx.Epoch, stakerID idx.StakerID, refund uint64)
- func (s *Store) SetLastEvent(epoch idx.Epoch, from idx.StakerID, id hash.Event)
- func (s *Store) SetPackInfo(epoch idx.Epoch, idx idx.Pack, value PackInfo)
- func (s *Store) SetPacksNum(epoch idx.Epoch, num idx.Pack)
- func (s *Store) SetTxPosition(txid common.Hash, position *app.TxPosition)
- type StoreConfig
- type ValidatorsPubKeys
Constants ¶
const ( MimetypeEvent = "application/event" TxTimeBufferSize = 20000 TxTurnPeriod = 4 * time.Second TxTurnNonces = 8 )
const ( // Protocol messages belonging to eth/62 EthStatusMsg = 0x00 EvmTxMsg = 0x02 // Signals about the current synchronization status. // The current peer's status is used during packs downloading, // and to estimate may peer be interested in the new event or not // (based on peer's epoch). ProgressMsg = 0xf0 // Non-aggressive events propagation. Signals about newly-connected // batch of events, sending only their IDs. NewEventHashesMsg = 0xf1 // Request the batch of events by IDs GetEventsMsg = 0xf2 // Contains the batch of events. // May be an answer to GetEventsMsg, or be sent during aggressive events propagation. EventsMsg = 0xf3 // Request pack infos by epoch:pack indexes GetPackInfosMsg = 0xf4 // Contains the requested pack infos. An answer to GetPackInfosMsg. PackInfosMsg = 0xf5 // Request pack by epoch:pack index GetPackMsg = 0xf6 // Contains the requested pack. An answer to GetPackMsg. PackMsg = 0xf7 )
protocol message codes
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIDMismatch ErrGenesisMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer ErrEmptyMessage = 0xf00 )
Variables ¶
var ErrNotImplemented = func(name string) error { return errors.New(name + " method is not implemented yet") }
var ProtocolVersions = []uint{lachesis62}
ProtocolVersions are the supported versions of the protocol (first is primary).
Functions ¶
func ReadGasPowerContext ¶
func ReadGasPowerContext(s *Store, a *app.App, validators *pos.Validators, epoch idx.Epoch, cfg *lachesis.EconomyConfig) *gaspowercheck.ValidationContext
ReadGasPowerContext reads current validation context for gaspowercheck
Types ¶
type Config ¶
type Config struct { Net lachesis.Config Emitter EmitterConfig TxPool evmcore.TxPoolConfig StoreConfig TxIndex bool // Whether to enable indexing transactions and receipts or not DecisiveEventsIndex bool // Whether to enable indexing events which decide blocks or not EventLocalTimeIndex bool // Whether to enable indexing arrival time of events or not // Protocol options Protocol ProtocolConfig // Gas Price Oracle options GPO gasprice.Config // Enables tracking of SHA3 preimages in the VM EnablePreimageRecording bool // TODO // Type of the EWASM interpreter ("" for default) EWASMInterpreter string // Type of the EVM interpreter ("" for default) EVMInterpreter string // TODO custom interpreter // RPCGasCap is the global gas cap for eth-call variants. RPCGasCap *big.Int `toml:",omitempty"` ExtRPCEnabled bool }
Config for the gossip service.
func DefaultConfig ¶
DefaultConfig returns the default configurations for the gossip service.
type Consensus ¶
type Consensus interface { // PushEvent takes event for processing. ProcessEvent(e *inter.Event) error // GetGenesisHash returns hash of genesis poset works with. GetGenesisHash() common.Hash // GetVectorIndex returns internal vector clock if exists GetVectorIndex() *vector.Index // Sets consensus fields. Returns nil if event should be dropped. Prepare(e *inter.Event) *inter.Event // LastBlock returns current block. LastBlock() (idx.Block, hash.Event) // GetEpoch returns current epoch num. GetEpoch() idx.Epoch // GetValidators returns validators of current epoch. GetValidators() *pos.Validators // GetEpochValidators atomically returns validators of current epoch, and the epoch. GetEpochValidators() (*pos.Validators, idx.Epoch) // GetConsensusTime calc consensus timestamp for given event. GetConsensusTime(id hash.Event) (inter.Timestamp, error) // Bootstrap must be called (once) before calling other methods Bootstrap(callbacks inter.ConsensusCallbacks) }
Consensus is a consensus interface.
type EmitIntervals ¶
type EmitIntervals struct { Min time.Duration `json:"min"` Max time.Duration `json:"max"` Confirming time.Duration `json:"confirming"` // emit time when there's no txs to originate, but at least 1 tx to confirm SelfForkProtection time.Duration `json:"selfForkProtection"` }
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 NewEmitter ¶
func NewEmitter( net *lachesis.Config, config *EmitterConfig, world EmitterWorld, ) *Emitter
NewEmitter creation.
func (*Emitter) GetValidator ¶
GetValidator gets event creator.
func (*Emitter) OnNewEpoch ¶
func (em *Emitter) OnNewEpoch(newValidators *pos.Validators, newEpoch idx.Epoch)
OnNewEpoch should be called after each epoch change, and on startup
func (*Emitter) OnNewEvent ¶
OnNewEvent tracks new events to find out am I properly synced or not
func (*Emitter) SetValidator ¶
SetValidator sets event creator.
func (*Emitter) StartEventEmission ¶
func (em *Emitter) StartEventEmission()
StartEventEmission starts event emission.
func (*Emitter) StopEventEmission ¶
func (em *Emitter) StopEventEmission()
StopEventEmission stops event emission.
type EmitterConfig ¶
type EmitterConfig struct { VersionToPublish string Validator common.Address `json:"validator"` EmitIntervals EmitIntervals `json:"emitIntervals"` // event emission intervals MaxGasRateGrowthFactor float64 `json:"maxGasRateGrowthFactor"` // fine to use float, because no need in determinism MaxTxsFromSender int `json:"maxTxsFromSender"` EpochTailLength idx.Frame `json:"epochTailLength"` // number of frames before event is considered epoch MaxParents int `json:"maxParents"` // thresholds on GasLeft SmoothTpsThreshold uint64 `json:"smoothTpsThreshold"` NoTxsThreshold uint64 `json:"noTxsThreshold"` EmergencyThreshold uint64 `json:"emergencyThreshold"` }
EmitterConfig is the configuration of events emitter.
func DefaultEmitterConfig ¶
func DefaultEmitterConfig() EmitterConfig
DefaultEmitterConfig returns the default configurations for the events emitter.
func FakeEmitterConfig ¶
func FakeEmitterConfig() EmitterConfig
FakeEmitterConfig returns the testing configurations for the events emitter.
type EmitterWorld ¶
type EmitterWorld struct { Store *Store App *app.App Engine Consensus EngineMu *sync.RWMutex Txpool txPool Am *accounts.Manager OccurredTxs *occuredtxs.Buffer Checkers *eventcheck.Checkers OnEmitted func(e *inter.Event) IsSynced func() bool PeersNum func() int AddVersion func(e *inter.Event) *inter.Event }
EmitterWorld is emitter's external world
type Enr ¶
type Enr struct { ForkID forkid.ID // Ignore additional fields (for forward compatibility). Rest []rlp.RawValue `rlp:"tail"` }
Enr is ENR entry which advertises eth protocol on the discovery network.
type EthAPIBackend ¶
type EthAPIBackend struct { *app.EthAPIBackend // contains filtered or unexported fields }
EthAPIBackend implements ethapi.Backend.
func (*EthAPIBackend) AccountManager ¶
func (b *EthAPIBackend) AccountManager() *accounts.Manager
func (*EthAPIBackend) BlockByNumber ¶
func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*evmcore.EvmBlock, error)
BlockByNumber returns block by its number.
func (*EthAPIBackend) ChainConfig ¶
func (b *EthAPIBackend) ChainConfig() *params.ChainConfig
ChainConfig returns the active chain configuration.
func (*EthAPIBackend) CurrentBlock ¶
func (b *EthAPIBackend) CurrentBlock() *evmcore.EvmBlock
func (*EthAPIBackend) CurrentEpoch ¶
func (b *EthAPIBackend) CurrentEpoch(ctx context.Context) idx.Epoch
CurrentEpoch returns current epoch number.
func (*EthAPIBackend) ExtRPCEnabled ¶
func (b *EthAPIBackend) ExtRPCEnabled() bool
func (*EthAPIBackend) ForEachEvent ¶
func (b *EthAPIBackend) ForEachEvent(ctx context.Context, epoch rpc.BlockNumber, onEvent func(event *inter.Event) bool) error
ForEachEvent iterates all the events which are observed by head, and accepted by a filter. filter CANNOT called twice for the same event.
func (*EthAPIBackend) GetConsensusTime ¶
GetConsensusTime returns event's consensus time, if event is confirmed.
func (*EthAPIBackend) GetDelegatorsOf ¶
func (b *EthAPIBackend) GetDelegatorsOf(ctx context.Context, stakerID idx.StakerID) ([]sfctype.SfcDelegatorAndAddr, error)
GetDelegatorsOf returns SFC delegators who delegated to a staker
func (*EthAPIBackend) GetEpochStats ¶
func (b *EthAPIBackend) GetEpochStats(ctx context.Context, requestedEpoch rpc.BlockNumber) (*sfctype.EpochStats, error)
GetEpochStats returns epoch statistics. * When epoch is "pending" the statistics for latest epoch are returned. * When epoch is "latest" the statistics for latest sealed epoch are returned.
func (*EthAPIBackend) GetEventHeader ¶
func (b *EthAPIBackend) GetEventHeader(ctx context.Context, shortEventID string) (*inter.EventHeaderData, error)
GetEventHeader returns the Lachesis event header by hash or short ID.
func (*EthAPIBackend) GetEventTime ¶
func (b *EthAPIBackend) GetEventTime(ctx context.Context, id hash.Event, arrivalTime bool) inter.Timestamp
GetEventTime returns estimation of when event was created
func (*EthAPIBackend) GetFullEventID ¶
func (b *EthAPIBackend) GetFullEventID(shortEventID string) (hash.Event, error)
GetFullEventID "converts" ShortID to full event's hash, by searching in events DB.
func (*EthAPIBackend) GetHeads ¶
func (b *EthAPIBackend) GetHeads(ctx context.Context, epoch rpc.BlockNumber) (heads hash.Events, err error)
GetHeads returns IDs of all the epoch events with no descendants. * When epoch is "pending" the heads for latest epoch are returned. * When epoch is "latest" the heads for latest sealed epoch are returned.
func (*EthAPIBackend) GetPoolNonce ¶
func (*EthAPIBackend) GetPoolTransaction ¶
func (b *EthAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
func (*EthAPIBackend) GetPoolTransactions ¶
func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error)
func (*EthAPIBackend) GetReceiptsByHash ¶
func (b *EthAPIBackend) GetReceiptsByHash(ctx context.Context, block common.Hash) (types.Receipts, error)
GetReceiptsByHash returns receipts by block hash.
func (*EthAPIBackend) GetReceiptsByNumber ¶
func (b *EthAPIBackend) GetReceiptsByNumber(ctx context.Context, number rpc.BlockNumber) (types.Receipts, error)
GetReceiptsByNumber returns receipts by block number.
func (*EthAPIBackend) GetRewardWeights ¶
func (b *EthAPIBackend) GetRewardWeights(ctx context.Context, stakerID idx.StakerID) (*big.Int, *big.Int, error)
GetRewardWeights returns staker's reward weights.
func (*EthAPIBackend) GetStaker ¶
func (b *EthAPIBackend) GetStaker(ctx context.Context, stakerID idx.StakerID) (*sfctype.SfcStaker, error)
GetStaker returns SFC staker's info
func (*EthAPIBackend) GetStakerID ¶
GetStakerID returns SFC staker's Id by address
func (*EthAPIBackend) GetStakers ¶
func (b *EthAPIBackend) GetStakers(ctx context.Context) ([]sfctype.SfcStakerAndID, error)
GetStakers returns SFC stakers info
func (*EthAPIBackend) GetTransaction ¶
func (b *EthAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, uint64, uint64, error)
func (*EthAPIBackend) GetValidators ¶
func (b *EthAPIBackend) GetValidators(ctx context.Context) *pos.Validators
func (*EthAPIBackend) HeaderByHash ¶
func (b *EthAPIBackend) HeaderByHash(ctx context.Context, h common.Hash) (*evmcore.EvmHeader, error)
HeaderByHash returns evm header by its (atropos) hash.
func (*EthAPIBackend) HeaderByNumber ¶
func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*evmcore.EvmHeader, error)
func (*EthAPIBackend) Progress ¶
func (b *EthAPIBackend) Progress() ethapi.PeerProgress
Progress returns current synchronization status of this node
func (*EthAPIBackend) ProtocolVersion ¶
func (b *EthAPIBackend) ProtocolVersion() int
func (*EthAPIBackend) RPCGasCap ¶
func (b *EthAPIBackend) RPCGasCap() *big.Int
func (*EthAPIBackend) SendTx ¶
func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
func (*EthAPIBackend) StateAndHeaderByNumber ¶
func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *evmcore.EvmHeader, error)
func (*EthAPIBackend) Stats ¶
func (b *EthAPIBackend) Stats() (pending int, queued int)
func (*EthAPIBackend) SubscribeLogsEvent ¶
func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) notify.Subscription
func (*EthAPIBackend) SubscribeNewBlockEvent ¶
func (b *EthAPIBackend) SubscribeNewBlockEvent(ch chan<- evmcore.ChainHeadNotify) notify.Subscription
func (*EthAPIBackend) SubscribeNewTxsEvent ¶
func (b *EthAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) notify.Subscription
func (*EthAPIBackend) SubscribeNewTxsNotify ¶
func (b *EthAPIBackend) SubscribeNewTxsNotify(ch chan<- evmcore.NewTxsNotify) notify.Subscription
func (*EthAPIBackend) SuggestPrice ¶
func (*EthAPIBackend) TtfReport ¶
func (b *EthAPIBackend) TtfReport(ctx context.Context, untilBlock rpc.BlockNumber, maxBlocks idx.Block, mode string) (map[hash.Event]time.Duration, error)
TtfReport for a range of blocks
func (*EthAPIBackend) TxPoolContent ¶
func (b *EthAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
type EvmStateReader ¶
type EvmStateReader struct { *ServiceFeed // contains filtered or unexported fields }
func (*EvmStateReader) CurrentBlock ¶
func (r *EvmStateReader) CurrentBlock() *evmcore.EvmBlock
func (*EvmStateReader) CurrentHeader ¶
func (r *EvmStateReader) CurrentHeader() *evmcore.EvmHeader
func (*EvmStateReader) GetDagBlock ¶
func (*EvmStateReader) GetDagHeader ¶
type GasPowerCheckReader ¶
GasPowerCheckReader is a helper to run gas power check
func (*GasPowerCheckReader) GetValidationContext ¶
func (r *GasPowerCheckReader) GetValidationContext() *gaspowercheck.ValidationContext
GetValidationContext returns current validation context for gaspowercheck
type GenesisMismatchError ¶
GenesisMismatchError is raised when trying to overwrite an existing genesis block with an incompatible one.
func (*GenesisMismatchError) Error ¶
func (e *GenesisMismatchError) Error() string
Error implements error interface.
type HeavyCheckReader ¶
HeavyCheckReader is a helper to run heavy power checks
func (*HeavyCheckReader) GetEpochPubKeys ¶
GetEpochPubKeys is safe for concurrent use
type HookedEngine ¶
type HookedEngine struct {
// contains filtered or unexported fields
}
HookedEngine is a wrapper around any engine, which hooks ProcessEvent()
func (*HookedEngine) Bootstrap ¶
func (hook *HookedEngine) Bootstrap(callbacks inter.ConsensusCallbacks)
Bootstrap restores poset's state from store.
func (*HookedEngine) GetConsensusTime ¶
GetConsensusTime calc consensus timestamp for given event, if event is confirmed.
func (*HookedEngine) GetEpoch ¶
func (hook *HookedEngine) GetEpoch() idx.Epoch
GetEpoch returns current epoch num to 3rd party.
func (*HookedEngine) GetEpochValidators ¶
func (hook *HookedEngine) GetEpochValidators() (*pos.Validators, idx.Epoch)
GetEpochValidators atomically returns validators of current epoch, and the epoch.
func (*HookedEngine) GetGenesisHash ¶
func (hook *HookedEngine) GetGenesisHash() common.Hash
GetGenesisHash returns PrevEpochHash of first epoch.
func (*HookedEngine) GetValidators ¶
func (hook *HookedEngine) GetValidators() *pos.Validators
GetValidators returns validators of current epoch.
func (*HookedEngine) GetVectorIndex ¶
func (hook *HookedEngine) GetVectorIndex() *vector.Index
GetVectorIndex returns vector clock.
func (*HookedEngine) LastBlock ¶
func (hook *HookedEngine) LastBlock() (idx.Block, hash.Event)
LastBlock returns current block.
func (*HookedEngine) Prepare ¶
func (hook *HookedEngine) Prepare(e *inter.Event) *inter.Event
Prepare fills consensus-related fields: Frame, IsRoot, MedianTimestamp, PrevEpochHash, GasPowerLeft returns nil if event should be dropped
func (*HookedEngine) ProcessEvent ¶
func (hook *HookedEngine) ProcessEvent(e *inter.Event) error
ProcessEvent takes event into processing. Event order matter: parents first. ProcessEvent is not safe for concurrent use
type NodeInfo ¶
type NodeInfo struct { Network uint64 `json:"network"` // network ID Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis object Epoch idx.Epoch `json:"epoch"` NumOfBlocks idx.Block `json:"blocks"` }
NodeInfo represents a short summary of the sub-protocol metadata known about the host peer.
type PeerInfo ¶
type PeerInfo struct { Version int `json:"version"` // protocol version negotiated Epoch idx.Epoch `json:"epoch"` NumOfBlocks idx.Block `json:"blocks"` }
PeerInfo represents a short summary of the sub-protocol metadata known about a connected peer.
type PeerProgress ¶
type PeerProgress struct { Epoch idx.Epoch NumOfBlocks idx.Block LastPackInfo PackInfo LastBlock hash.Event }
PeerProgress is synchronization status of a peer
func (*PeerProgress) Less ¶
func (a *PeerProgress) Less(b PeerProgress) bool
type ProtocolConfig ¶
type ProtocolConfig struct { // 0/M means "optimize only for throughput", N/0 means "optimize only for latency", N/M is a balanced mode LatencyImportance int ThroughputImportance int }
ProtocolConfig is config for p2p protocol
type ProtocolManager ¶
func NewProtocolManager ¶
func NewProtocolManager( config *Config, notifier dagNotifier, txpool txPool, engineMu *sync.RWMutex, checkers *eventcheck.Checkers, s *Store, engine Consensus, serverPool *serverPool, ) ( *ProtocolManager, error, )
NewProtocolManager returns a new Fantom sub protocol manager. The Fantom sub protocol manages peers capable with the Fantom network.
func (*ProtocolManager) BroadcastEvent ¶
BroadcastEvent will either propagate a event to a subset of it's peers, or will only announce it's availability (depending what's requested).
func (*ProtocolManager) BroadcastTxs ¶
func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
BroadcastTxs will propagate a batch of transactions to all peers which are not known to already have the given transaction.
func (*ProtocolManager) NodeInfo ¶
func (pm *ProtocolManager) NodeInfo() *NodeInfo
NodeInfo retrieves some protocol metadata about the running host node.
func (*ProtocolManager) Start ¶
func (pm *ProtocolManager) Start(maxPeers int)
func (*ProtocolManager) Stop ¶
func (pm *ProtocolManager) Stop()
type PublicEthereumAPI ¶
type PublicEthereumAPI struct {
// contains filtered or unexported fields
}
PublicEthereumAPI provides an API to access Ethereum-like information. It is a github.com/ethereum/go-ethereum/eth simulation for console.
func NewPublicEthereumAPI ¶
func NewPublicEthereumAPI(s *Service) *PublicEthereumAPI
NewPublicEthereumAPI creates a new Ethereum protocol API for gossip.
func (*PublicEthereumAPI) ChainId ¶
func (api *PublicEthereumAPI) ChainId() hexutil.Uint64
ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func (*PublicEthereumAPI) Coinbase ¶
func (api *PublicEthereumAPI) Coinbase() (common.Address, error)
Coinbase is the validator address
func (*PublicEthereumAPI) Etherbase ¶
func (api *PublicEthereumAPI) Etherbase() (common.Address, error)
Etherbase is the validator address
func (*PublicEthereumAPI) Hashrate ¶
func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64
Hashrate returns the POW hashrate
type Service ¶
type Service struct { // server Name string Topic discv5.Topic EthAPI *EthAPIBackend logger.Instance // contains filtered or unexported fields }
Service implements go-ethereum/node.Service interface.
func NewService ¶
func (*Service) AccountManager ¶
AccountManager return node's account manager
func (*Service) GetEvmStateReader ¶
func (s *Service) GetEvmStateReader() *EvmStateReader
type ServiceFeed ¶
type ServiceFeed struct {
// contains filtered or unexported fields
}
func (*ServiceFeed) SubscribeNewBlock ¶
func (f *ServiceFeed) SubscribeNewBlock(ch chan<- evmcore.ChainHeadNotify) notify.Subscription
func (*ServiceFeed) SubscribeNewEmitted ¶
func (f *ServiceFeed) SubscribeNewEmitted(ch chan<- *inter.Event) notify.Subscription
func (*ServiceFeed) SubscribeNewEpoch ¶
func (f *ServiceFeed) SubscribeNewEpoch(ch chan<- idx.Epoch) notify.Subscription
func (*ServiceFeed) SubscribeNewLogs ¶
func (f *ServiceFeed) SubscribeNewLogs(ch chan<- []*types.Log) notify.Subscription
func (*ServiceFeed) SubscribeNewPack ¶
func (f *ServiceFeed) SubscribeNewPack(ch chan<- idx.Pack) notify.Subscription
func (*ServiceFeed) SubscribeNewTxs ¶
func (f *ServiceFeed) SubscribeNewTxs(ch chan<- core.NewTxsEvent) notify.Subscription
type Store ¶
type Store struct { EpochDbs *temporary.Dbs logger.Instance // contains filtered or unexported fields }
Store is a node persistent storage working over physical key-value database.
func NewStore ¶
func NewStore(dbs *flushable.SyncedPool, cfg StoreConfig) *Store
NewStore creates store over key-value db.
func (*Store) AddLastHeader ¶
func (s *Store) AddLastHeader(epoch idx.Epoch, header *inter.EventHeaderData)
AddLastHeader adds/updates a records about last header from a validator
func (*Store) ApplyGenesis ¶
func (s *Store) ApplyGenesis(net *lachesis.Config, state *evmcore.EvmBlock) (genesisAtropos hash.Event, genesisState common.Hash, new bool, err error)
ApplyGenesis writes initial state.
func (*Store) DelEventHeader ¶
DelEventHeader removes stored event header.
func (*Store) DelGasPowerRefunds ¶
DelGasPowerRefunds erases all record on epoch
func (*Store) DelLastHeader ¶
DelLastHeader deletes record about last header from a validator
func (*Store) DelLastHeaders ¶
DelLastHeaders deletes all the records about last headers
func (*Store) DeleteEvent ¶
DeleteEvent deletes event.
func (*Store) FindEventHashes ¶
func (*Store) ForEachEvent ¶
func (*Store) GetBlockByHash ¶
GetBlockByHash get block by block hash
func (*Store) GetBlockDecidedBy ¶
GetBlockDecidedBy get event which decided block (off-chain data)
func (*Store) GetBlockIndex ¶
GetBlockIndex returns stored block index.
func (*Store) GetDirtyEpochStats ¶
func (s *Store) GetDirtyEpochStats() *sfctype.EpochStats
GetDirtyEpochStats returns EpochStats for current (not sealed) epoch
func (*Store) GetEpochStats ¶
func (s *Store) GetEpochStats(epoch idx.Epoch) *sfctype.EpochStats
GetEpochStats returns EpochStats for an already sealed epoch
func (*Store) GetEventHeader ¶
GetEventHeader returns stored event header.
func (*Store) GetEventRLP ¶
GetEventRLP returns stored event. Serialized.
func (*Store) GetEventReceivingTime ¶
GetEventReceivingTime get local event time (off-chain data)
func (*Store) GetGasPowerRefund ¶
GetGasPowerRefund returns stored amount of gas power to refund
func (*Store) GetGasPowerRefunds ¶
GetGasPowerRefunds returns all stored amount of gas power to refund
func (*Store) GetLastEvent ¶
GetLastEvent returns stored last unconfirmed event from a validator (off-chain)
func (*Store) GetLastHeaders ¶
func (s *Store) GetLastHeaders(epoch idx.Epoch) inter.HeadersByCreator
GetLastHeaders retrieves all the records about last headers from validators
func (*Store) GetPackInfoOrDefault ¶
returns default value if not found
func (*Store) GetPackInfoRLP ¶
func (*Store) GetTxPosition ¶
func (s *Store) GetTxPosition(txid common.Hash) *app.TxPosition
GetTxPosition returns stored transaction block and position.
func (*Store) HasEventHeader ¶
HasEvent returns true if event exists.
func (*Store) IncGasPowerRefund ¶
IncGasPowerRefund increments amount of gas power to refund
func (*Store) SetBlockDecidedBy ¶
SetBlockDecidedBy stores event which decided block (off-chain data)
func (*Store) SetBlockIndex ¶
SetBlockIndex stores chain block index.
func (*Store) SetDirtyEpochStats ¶
func (s *Store) SetDirtyEpochStats(value *sfctype.EpochStats)
SetDirtyEpochStats set EpochStats for current (not sealed) epoch
func (*Store) SetEpochStats ¶
func (s *Store) SetEpochStats(epoch idx.Epoch, value *sfctype.EpochStats)
SetEpochStats set EpochStats for an already sealed epoch
func (*Store) SetEventHeader ¶
SetEventHeader returns stored event header.
func (*Store) SetEventReceivingTime ¶
SetEventReceivingTime stores local event time (off-chain data)
func (*Store) SetGasPowerRefund ¶
SetGasPowerRefund stores amount of gas power to refund
func (*Store) SetLastEvent ¶
SetLastEvent stores last unconfirmed event from a validator (off-chain)
func (*Store) SetPackInfo ¶
func (*Store) SetTxPosition ¶
func (s *Store) SetTxPosition(txid common.Hash, position *app.TxPosition)
SetTxPosition stores transaction block and position.
type StoreConfig ¶
type StoreConfig struct { // Cache size for Events. EventsCacheSize int // Cache size for EventHeaderData (Epoch db). EventsHeadersCacheSize int // Cache size for Block. BlockCacheSize int // Cache size for PackInfos. PackInfosCacheSize int // Cache size for TxPositions. TxPositionsCacheSize int // Cache size for EpochStats. EpochStatsCacheSize int }
StoreConfig is a config for store db.
type ValidatorsPubKeys ¶
ValidatorsPubKeys stores info to authenticate validators
func ReadEpochPubKeys ¶
func ReadEpochPubKeys(a *app.App, epoch idx.Epoch) *ValidatorsPubKeys
ReadEpochPubKeys is the same as GetEpochValidators, but returns only addresses
Source Files ¶
- api.go
- apply_genesis.go
- checker_helpers.go
- config.go
- config_emitter.go
- consensus.go
- consensus_callbacks.go
- dummy_tx_pool.go
- emitter.go
- enr_entry.go
- ethapi_backend.go
- event_local_time.go
- evm_state_reader.go
- execqueue.go
- gas_refunds.go
- handler.go
- metrics.go
- pack.go
- peer.go
- poset_hook.go
- protocol.go
- randselect.go
- serverpool.go
- service.go
- sfc_index.go
- store.go
- store_block.go
- store_epoch.go
- store_epoch_stats.go
- store_event.go
- store_heads.go
- store_last_headers.go
- store_migration.go
- store_pack.go
- store_refund.go
- store_tx_position.go
- sync.go
Directories ¶
Path | Synopsis |
---|---|
Package filters implements an ethereum filtering system for block, transactions and log events.
|
Package filters implements an ethereum filtering system for block, transactions and log events. |