Documentation ¶
Index ¶
- Variables
- type BlockImportDigestHandler
- type BlockState
- type CodeSubstitutedState
- type Config
- type GrandpaState
- type KeyPair
- type Network
- type QueryKeyValueChanges
- type Service
- func (s *Service) DecodeSessionKeys(encodedSessionKeys []byte) ([]byte, error)
- func (s *Service) GetMetadata(bhash *common.Hash) (metadata []byte, err error)
- func (s *Service) GetReadProofAt(block common.Hash, keys [][]byte) (hash common.Hash, proofForKeys [][]byte, err error)
- func (s *Service) GetRuntimeVersion(bhash *common.Hash) (version runtime.Version, err error)
- func (s *Service) HandleBlockImport(block *types.Block, state *rtstorage.TrieState, announce bool) error
- func (s *Service) HandleBlockProduced(block *types.Block, state *rtstorage.TrieState) error
- func (s *Service) HandleSubmittedExtrinsic(ext types.Extrinsic) error
- func (s *Service) HandleTransactionMessage(peerID peer.ID, msg *network.TransactionMessage) (bool, error)
- func (s *Service) HasKey(pubKeyStr, keystoreType string) (bool, error)
- func (s *Service) InsertKey(kp KeyPair, keystoreType string) error
- func (s *Service) Start() error
- func (s *Service) Stop() error
- func (s *Service) StorageRoot() (common.Hash, error)
- func (s *Service) TransactionsCount() int
- type StorageState
- type Telemetry
- type TransactionState
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BlockImportDigestHandler ¶ added in v0.8.0
type BlockState ¶
type BlockState interface { BestBlockHash() common.Hash BestBlockHeader() (*types.Header, error) AddBlock(*types.Block) error GetBlockStateRoot(bhash common.Hash) (common.Hash, error) RangeInMemory(start, end common.Hash) ([]common.Hash, error) GetBlockBody(hash common.Hash) (*types.Body, error) HandleRuntimeChanges(newState *rtstorage.TrieState, in runtime.Instance, bHash common.Hash) error GetRuntime(blockHash common.Hash) (instance runtime.Instance, err error) StoreRuntime(blockHash common.Hash, runtime runtime.Instance) LowestCommonAncestor(a, b common.Hash) (common.Hash, error) }
BlockState interface for block state methods
type CodeSubstitutedState ¶ added in v0.7.0
CodeSubstitutedState interface to handle storage of code substitute state
type Config ¶
type Config struct { LogLvl log.Level BlockState BlockState StorageState StorageState TransactionState TransactionState GrandpaState GrandpaState Network Network Keystore *keystore.GlobalKeystore Runtime runtime.Instance CodeSubstitutes map[common.Hash]string CodeSubstitutedState CodeSubstitutedState OnBlockImport BlockImportDigestHandler }
Config holds the configuration for the core Service.
type GrandpaState ¶ added in v0.8.0
GrandpaState is the interface for the state.GrandpaState
type KeyPair ¶ added in v0.8.0
type KeyPair interface { Type() crypto.KeyType Sign(msg []byte) ([]byte, error) Public() crypto.PublicKey }
KeyPair is a key pair to sign messages and from which the public key and key type can be obtained.
type Network ¶ added in v0.2.0
type Network interface { GossipMessage(network.NotificationsMessage) IsSynced() bool ReportPeer(change peerset.ReputationChange, p peer.ID) }
Network is the interface for the network service
type QueryKeyValueChanges ¶ added in v0.7.0
QueryKeyValueChanges represents the key-value data inside a block storage
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an overhead layer that allows communication between the runtime, BABE session, and network service. It deals with the validation of transactions and blocks by calling their respective validation functions in the runtime.
func NewService ¶
NewService returns a new core service that connects the runtime, BABE session, and network service.
func (*Service) DecodeSessionKeys ¶ added in v0.7.0
DecodeSessionKeys executes the runtime DecodeSessionKeys and return the scale encoded keys
func (*Service) GetMetadata ¶
GetMetadata calls runtime Metadata_metadata function
func (*Service) GetReadProofAt ¶ added in v0.7.0
func (s *Service) GetReadProofAt(block common.Hash, keys [][]byte) ( hash common.Hash, proofForKeys [][]byte, err error)
GetReadProofAt will return an array with the proofs for the keys passed as params based on the block hash passed as param as well, if block hash is nil then the current state will take place
func (*Service) GetRuntimeVersion ¶
GetRuntimeVersion gets the current RuntimeVersion
func (*Service) HandleBlockImport ¶ added in v0.7.0
func (s *Service) HandleBlockImport(block *types.Block, state *rtstorage.TrieState, announce bool) error
HandleBlockImport handles a block that was imported via the network
func (*Service) HandleBlockProduced ¶ added in v0.7.0
HandleBlockProduced handles a block that was produced by us It is handled the same as an imported block in terms of state updates; the only difference is we send a BlockAnnounceMessage to our peers.
func (*Service) HandleSubmittedExtrinsic ¶
HandleSubmittedExtrinsic is used to send a Transaction message containing a Extrinsic @ext
func (*Service) HandleTransactionMessage ¶ added in v0.3.0
func (s *Service) HandleTransactionMessage(peerID peer.ID, msg *network.TransactionMessage) (bool, error)
HandleTransactionMessage validates each transaction in the message and adds valid transactions to the transaction queue of the BABE session returns boolean for transaction propagation, true - transactions should be propagated
func (*Service) HasKey ¶
HasKey returns true if given hex encoded public key string is found in keystore, false otherwise, error if there are issues decoding string
func (*Service) StorageRoot ¶
StorageRoot returns the hash of the storage root
func (*Service) TransactionsCount ¶ added in v0.7.0
TransactionsCount returns number for pending transactions in pool
type StorageState ¶
type StorageState interface { TrieState(root *common.Hash) (*rtstorage.TrieState, error) StoreTrie(*rtstorage.TrieState, *types.Header) error GetStateRootFromBlock(bhash *common.Hash) (*common.Hash, error) GenerateTrieProof(stateRoot common.Hash, keys [][]byte) ([][]byte, error) sync.Locker }
StorageState interface for storage state methods
type TransactionState ¶ added in v0.2.0
type TransactionState interface { Push(vt *transaction.ValidTransaction) (common.Hash, error) AddToPool(vt *transaction.ValidTransaction) common.Hash RemoveExtrinsic(ext types.Extrinsic) RemoveExtrinsicFromPool(ext types.Extrinsic) PendingInPool() []*transaction.ValidTransaction Exists(ext types.Extrinsic) bool }
TransactionState is the interface for transaction state methods