Documentation ¶
Index ¶
- Constants
- Variables
- func BuildTx(appState *appstate.AppState, from common.Address, to *common.Address, ...) *types.Transaction
- func BuildTxWithFeeEstimating(state *appstate.AppState, from common.Address, to *common.Address, ...) *types.Transaction
- func ConvertToFloat(amount *big.Int) decimal.Decimal
- func ConvertToInt(amount decimal.Decimal) *big.Int
- func GetDefaultConsensusConfig() *config.ConsensusConf
- func NewTiming(conf *config.ValidationConfig) *timing
- type Blockchain
- func (chain *Blockchain) AddBlock(block *types.Block, checkState *appstate.AppState, ...) error
- func (chain *Blockchain) AddHeaderUnsafe(header *types.Header) error
- func (chain *Blockchain) ApplyHotfixToState()
- func (chain *Blockchain) AtomicSwitchToPreliminary(manifest *snapshot.Manifest) error
- func (chain *Blockchain) CoinbaseShard() (common.ShardId, error)
- func (chain *Blockchain) Config() *config.Config
- func (chain *Blockchain) EnsureIntegrity() error
- func (chain *Blockchain) GenerateEmptyBlock() *types.Block
- func (chain *Blockchain) GenerateGenesis(network types.Network) (*types.Block, error)
- func (chain *Blockchain) GenesisInfo() *types.GenesisInfo
- func (chain *Blockchain) GetBlock(hash common.Hash) *types.Block
- func (chain *Blockchain) GetBlockByHeight(height uint64) *types.Block
- func (chain *Blockchain) GetBlockHeaderByHeight(height uint64) *types.Header
- func (chain *Blockchain) GetBlockWithRetry(hash common.Hash) *types.Block
- func (chain *Blockchain) GetCertificate(hash common.Hash) *types.BlockCert
- func (chain *Blockchain) GetCommitteeSize(vc *validators.ValidatorsCache, final bool) int
- func (chain *Blockchain) GetCommitteeVotesThreshold(vc *validators.ValidatorsCache, final bool) int
- func (chain *Blockchain) GetGasCost(appState *appstate.AppState, gasUsed uint64) *big.Int
- func (chain *Blockchain) GetHead() *types.Header
- func (chain *Blockchain) GetIdentityDiff(height uint64) *state.IdentityStateDiff
- func (chain *Blockchain) GetProposerSortition() (bool, []byte)
- func (chain *Blockchain) GetReceipt(hash common.Hash) *types.TxReceipt
- func (chain *Blockchain) GetTopBlockHashes(count int) []common.Hash
- func (chain *Blockchain) GetTx(hash common.Hash) (*types.Transaction, *types.TransactionIndex)
- func (chain *Blockchain) GetTxIndex(hash common.Hash) *types.TransactionIndex
- func (chain *Blockchain) Indexer() *indexer
- func (chain *Blockchain) InitializeChain() error
- func (chain *Blockchain) IsPermanentCert(header *types.Header) bool
- func (chain *Blockchain) MinimalShard(appState *appstate.AppState) common.ShardId
- func (chain *Blockchain) ModifiedCoinbaseShard() (common.ShardId, error)
- func (chain *Blockchain) Network() types.Network
- func (chain *Blockchain) ProposeBlock(proof []byte) *types.BlockProposal
- func (chain *Blockchain) ProvideApplyNewEpochFunc(...)
- func (chain *Blockchain) ReadBlockForForkedPeer(blocks []common.Hash) []types.BlockBundle
- func (chain *Blockchain) ReadEvents(contract common.Address) []*types.SavedEvent
- func (chain *Blockchain) ReadPreliminaryConsensusVersion() uint32
- func (chain *Blockchain) ReadPreliminaryHead() *types.Header
- func (chain *Blockchain) ReadSnapshotManifest() *snapshot.Manifest
- func (chain *Blockchain) ReadTotalBurntCoins() []*types.BurntCoins
- func (chain *Blockchain) ReadTxs(address common.Address, count int, token []byte) ([]*types.SavedTransaction, []byte)
- func (chain *Blockchain) RemovePreliminaryConsensusVersion()
- func (chain *Blockchain) RemovePreliminaryHead(batch dbm.Batch)
- func (chain *Blockchain) RemovePreliminaryIntermediateGenesis()
- func (chain *Blockchain) ResetTo(height uint64) (revertedTxs []*types.Transaction, err error)
- func (chain *Blockchain) Round() uint64
- func (chain *Blockchain) ShardsNum() uint32
- func (chain *Blockchain) StartSync()
- func (chain *Blockchain) StopSync()
- func (chain *Blockchain) UseMiddleware(middleWare Middleware)
- func (chain *Blockchain) ValidateBlock(block *types.Block, checkState *appstate.AppState, ...) (*blockInsertionResult, error)
- func (chain *Blockchain) ValidateBlockCert(prevBlock *types.Header, block *types.Header, cert *types.BlockCert, ...) (err error)
- func (chain *Blockchain) ValidateBlockCertOnHead(block *types.Header, cert *types.BlockCert) error
- func (chain *Blockchain) ValidateHeader(header, prevBlock *types.Header) error
- func (chain *Blockchain) ValidateProposerProof(proof []byte, pubKeyData []byte) error
- func (chain *Blockchain) ValidateSubChain(startHeight uint64, blocks []types.BlockBundle) error
- func (chain *Blockchain) WriteCertificate(hash common.Hash, cert *types.BlockCert, persistent bool)
- func (chain *Blockchain) WriteFinalConsensus(hash common.Hash)
- func (chain *Blockchain) WriteIdentityStateDiff(height uint64, diff *state.IdentityStateDiff)
- func (chain *Blockchain) WritePreliminaryConsensusVersion(ver uint32)
- func (chain *Blockchain) WritePreliminaryIntermediateGenesis(height uint64)
- func (chain *Blockchain) WriteTxIndex(hash common.Hash, txs types.Transactions)
- func (chain *Blockchain) WriteTxReceipts(cid []byte, receipts types.TxReceipts)
- type Middleware
- type OfflineDetector
- func (dt *OfflineDetector) GetActivityMap() map[common.Address]time.Time
- func (dt *OfflineDetector) ProcessVote(vote *types.Vote)
- func (dt *OfflineDetector) ProposeOffline(head *types.Header) (*common.Address, types.BlockFlag)
- func (dt *OfflineDetector) PushValidators(round uint64, step uint8, stepValidators *validators.StepValidators)
- func (dt *OfflineDetector) Start(head *types.Header)
- func (dt *OfflineDetector) ValidateBlock(head *types.Header, block *types.Block) error
- func (dt *OfflineDetector) VoteForOffline(block *types.Block) bool
- type TestBlockchain
- func NewCustomTestBlockchain(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey) (*TestBlockchain, *appstate.AppState)
- func NewCustomTestBlockchainWithConfig(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey, ...) (*TestBlockchain, *appstate.AppState)
- func NewTestBlockchain(withIdentity bool, alloc map[common.Address]config.GenesisAllocation) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
- func NewTestBlockchainWithBlocks(blocksCount int, emptyBlocksCount int) (*TestBlockchain, *appstate.AppState)
- func NewTestBlockchainWithConfig(withIdentity bool, conf *config.ConsensusConf, ...) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
- func (chain *TestBlockchain) AddTx(tx *types.Transaction) error
- func (chain *TestBlockchain) Bus() eventbus.Bus
- func (chain *TestBlockchain) CommitState() *TestBlockchain
- func (chain *TestBlockchain) Copy() (*TestBlockchain, *appstate.AppState)
- func (chain *TestBlockchain) GenerateBlocks(count int, txsInBlock int) *TestBlockchain
- func (chain *TestBlockchain) GenerateEmptyBlocks(count int) *TestBlockchain
- func (chain *TestBlockchain) SecStore() *secstore.SecStore
Constants ¶
View Source
const ( ProposerRole uint8 = 0x1 EmptyBlockTimeIncrement = time.Second * 20 MaxFutureBlockOffset = time.Minute * 2 MinBlockDelay = time.Second * 10 StoreToIpfsThreshold = 1 - fee.StoreToIpfsFeeCoef )
View Source
const (
Mainnet types.Network = 0x1
)
View Source
const (
OfflineVotesCacheLength = 10
)
Variables ¶
View Source
var ( ParentHashIsInvalid = errors.New("parentHash is invalid") BlockInsertionErr = errors.New("can't insert block") )
Functions ¶
func BuildTxWithFeeEstimating ¶ added in v0.28.4
func GetDefaultConsensusConfig ¶ added in v0.30.0
func GetDefaultConsensusConfig() *config.ConsensusConf
func NewTiming ¶
func NewTiming(conf *config.ValidationConfig) *timing
Types ¶
type Blockchain ¶
type Blockchain struct { Head *types.Header PreliminaryHead *types.Header // contains filtered or unexported fields }
func NewBlockchain ¶
func NewBlockchain(config *config.Config, db dbm.DB, txpool *mempool.TxPool, appState *appstate.AppState, ipfs ipfs.Proxy, secStore *secstore.SecStore, bus eventbus.Bus, offlineDetector *OfflineDetector, keyStore *keystore.KeyStore, subManager *subscriptions.Manager, upgrader *upgrade.Upgrader) *Blockchain
func (*Blockchain) AddBlock ¶
func (chain *Blockchain) AddBlock(block *types.Block, checkState *appstate.AppState, statsCollector collector.StatsCollector) error
func (*Blockchain) AddHeaderUnsafe ¶ added in v0.27.3
func (chain *Blockchain) AddHeaderUnsafe(header *types.Header) error
func (*Blockchain) ApplyHotfixToState ¶ added in v0.30.2
func (chain *Blockchain) ApplyHotfixToState()
func (*Blockchain) AtomicSwitchToPreliminary ¶
func (chain *Blockchain) AtomicSwitchToPreliminary(manifest *snapshot.Manifest) error
func (*Blockchain) CoinbaseShard ¶ added in v0.27.3
func (chain *Blockchain) CoinbaseShard() (common.ShardId, error)
func (*Blockchain) Config ¶
func (chain *Blockchain) Config() *config.Config
func (*Blockchain) EnsureIntegrity ¶
func (chain *Blockchain) EnsureIntegrity() error
func (*Blockchain) GenerateEmptyBlock ¶
func (chain *Blockchain) GenerateEmptyBlock() *types.Block
func (*Blockchain) GenerateGenesis ¶
func (*Blockchain) GenesisInfo ¶ added in v0.23.0
func (chain *Blockchain) GenesisInfo() *types.GenesisInfo
func (*Blockchain) GetBlockByHeight ¶
func (chain *Blockchain) GetBlockByHeight(height uint64) *types.Block
func (*Blockchain) GetBlockHeaderByHeight ¶
func (chain *Blockchain) GetBlockHeaderByHeight(height uint64) *types.Header
func (*Blockchain) GetBlockWithRetry ¶
func (chain *Blockchain) GetBlockWithRetry(hash common.Hash) *types.Block
func (*Blockchain) GetCertificate ¶
func (chain *Blockchain) GetCertificate(hash common.Hash) *types.BlockCert
func (*Blockchain) GetCommitteeSize ¶
func (chain *Blockchain) GetCommitteeSize(vc *validators.ValidatorsCache, final bool) int
func (*Blockchain) GetCommitteeVotesThreshold ¶
func (chain *Blockchain) GetCommitteeVotesThreshold(vc *validators.ValidatorsCache, final bool) int
func (*Blockchain) GetGasCost ¶ added in v0.22.0
func (*Blockchain) GetHead ¶
func (chain *Blockchain) GetHead() *types.Header
func (*Blockchain) GetIdentityDiff ¶
func (chain *Blockchain) GetIdentityDiff(height uint64) *state.IdentityStateDiff
func (*Blockchain) GetProposerSortition ¶
func (chain *Blockchain) GetProposerSortition() (bool, []byte)
func (*Blockchain) GetReceipt ¶ added in v0.22.0
func (chain *Blockchain) GetReceipt(hash common.Hash) *types.TxReceipt
func (*Blockchain) GetTopBlockHashes ¶
func (chain *Blockchain) GetTopBlockHashes(count int) []common.Hash
func (*Blockchain) GetTx ¶
func (chain *Blockchain) GetTx(hash common.Hash) (*types.Transaction, *types.TransactionIndex)
func (*Blockchain) GetTxIndex ¶
func (chain *Blockchain) GetTxIndex(hash common.Hash) *types.TransactionIndex
func (*Blockchain) Indexer ¶ added in v0.19.5
func (chain *Blockchain) Indexer() *indexer
func (*Blockchain) InitializeChain ¶
func (chain *Blockchain) InitializeChain() error
func (*Blockchain) IsPermanentCert ¶
func (chain *Blockchain) IsPermanentCert(header *types.Header) bool
func (*Blockchain) MinimalShard ¶ added in v0.27.3
func (chain *Blockchain) MinimalShard(appState *appstate.AppState) common.ShardId
func (*Blockchain) ModifiedCoinbaseShard ¶ added in v0.27.3
func (chain *Blockchain) ModifiedCoinbaseShard() (common.ShardId, error)
func (*Blockchain) Network ¶
func (chain *Blockchain) Network() types.Network
func (*Blockchain) ProposeBlock ¶
func (chain *Blockchain) ProposeBlock(proof []byte) *types.BlockProposal
func (*Blockchain) ProvideApplyNewEpochFunc ¶
func (chain *Blockchain) ProvideApplyNewEpochFunc(fn func(height uint64, appState *appstate.AppState, collector collector.StatsCollector) types.TotalValidationResult)
func (*Blockchain) ReadBlockForForkedPeer ¶
func (chain *Blockchain) ReadBlockForForkedPeer(blocks []common.Hash) []types.BlockBundle
func (*Blockchain) ReadEvents ¶ added in v0.22.0
func (chain *Blockchain) ReadEvents(contract common.Address) []*types.SavedEvent
func (*Blockchain) ReadPreliminaryConsensusVersion ¶ added in v0.23.0
func (chain *Blockchain) ReadPreliminaryConsensusVersion() uint32
func (*Blockchain) ReadPreliminaryHead ¶
func (chain *Blockchain) ReadPreliminaryHead() *types.Header
func (*Blockchain) ReadSnapshotManifest ¶
func (chain *Blockchain) ReadSnapshotManifest() *snapshot.Manifest
func (*Blockchain) ReadTotalBurntCoins ¶
func (chain *Blockchain) ReadTotalBurntCoins() []*types.BurntCoins
func (*Blockchain) ReadTxs ¶
func (chain *Blockchain) ReadTxs(address common.Address, count int, token []byte) ([]*types.SavedTransaction, []byte)
func (*Blockchain) RemovePreliminaryConsensusVersion ¶ added in v0.23.0
func (chain *Blockchain) RemovePreliminaryConsensusVersion()
func (*Blockchain) RemovePreliminaryHead ¶
func (chain *Blockchain) RemovePreliminaryHead(batch dbm.Batch)
func (*Blockchain) RemovePreliminaryIntermediateGenesis ¶ added in v0.23.0
func (chain *Blockchain) RemovePreliminaryIntermediateGenesis()
func (*Blockchain) ResetTo ¶
func (chain *Blockchain) ResetTo(height uint64) (revertedTxs []*types.Transaction, err error)
func (*Blockchain) Round ¶
func (chain *Blockchain) Round() uint64
func (*Blockchain) ShardsNum ¶ added in v0.27.3
func (chain *Blockchain) ShardsNum() uint32
func (*Blockchain) StartSync ¶
func (chain *Blockchain) StartSync()
func (*Blockchain) StopSync ¶
func (chain *Blockchain) StopSync()
func (*Blockchain) UseMiddleware ¶ added in v1.0.0
func (chain *Blockchain) UseMiddleware(middleWare Middleware)
func (*Blockchain) ValidateBlock ¶
func (chain *Blockchain) ValidateBlock(block *types.Block, checkState *appstate.AppState, statsCollector collector.StatsCollector) (*blockInsertionResult, error)
func (*Blockchain) ValidateBlockCert ¶
func (chain *Blockchain) ValidateBlockCert(prevBlock *types.Header, block *types.Header, cert *types.BlockCert, validatorsCache *validators.ValidatorsCache, pubKeyToAddrCache map[string]common.Address) (err error)
func (*Blockchain) ValidateBlockCertOnHead ¶
func (*Blockchain) ValidateHeader ¶
func (chain *Blockchain) ValidateHeader(header, prevBlock *types.Header) error
func (*Blockchain) ValidateProposerProof ¶
func (chain *Blockchain) ValidateProposerProof(proof []byte, pubKeyData []byte) error
func (*Blockchain) ValidateSubChain ¶
func (chain *Blockchain) ValidateSubChain(startHeight uint64, blocks []types.BlockBundle) error
func (*Blockchain) WriteCertificate ¶
func (*Blockchain) WriteFinalConsensus ¶
func (chain *Blockchain) WriteFinalConsensus(hash common.Hash)
func (*Blockchain) WriteIdentityStateDiff ¶
func (chain *Blockchain) WriteIdentityStateDiff(height uint64, diff *state.IdentityStateDiff)
func (*Blockchain) WritePreliminaryConsensusVersion ¶ added in v0.23.0
func (chain *Blockchain) WritePreliminaryConsensusVersion(ver uint32)
func (*Blockchain) WritePreliminaryIntermediateGenesis ¶ added in v0.23.0
func (chain *Blockchain) WritePreliminaryIntermediateGenesis(height uint64)
func (*Blockchain) WriteTxIndex ¶
func (chain *Blockchain) WriteTxIndex(hash common.Hash, txs types.Transactions)
func (*Blockchain) WriteTxReceipts ¶ added in v0.22.0
func (chain *Blockchain) WriteTxReceipts(cid []byte, receipts types.TxReceipts)
type Middleware ¶ added in v1.0.0
type OfflineDetector ¶
type OfflineDetector struct {
// contains filtered or unexported fields
}
func NewOfflineDetector ¶
func (*OfflineDetector) GetActivityMap ¶
func (dt *OfflineDetector) GetActivityMap() map[common.Address]time.Time
func (*OfflineDetector) ProcessVote ¶
func (dt *OfflineDetector) ProcessVote(vote *types.Vote)
func (*OfflineDetector) ProposeOffline ¶
func (*OfflineDetector) PushValidators ¶ added in v0.28.1
func (dt *OfflineDetector) PushValidators(round uint64, step uint8, stepValidators *validators.StepValidators)
func (*OfflineDetector) Start ¶
func (dt *OfflineDetector) Start(head *types.Header)
func (*OfflineDetector) ValidateBlock ¶
func (*OfflineDetector) VoteForOffline ¶
func (dt *OfflineDetector) VoteForOffline(block *types.Block) bool
type TestBlockchain ¶
type TestBlockchain struct { *Blockchain // contains filtered or unexported fields }
func NewCustomTestBlockchain ¶
func NewCustomTestBlockchain(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey) (*TestBlockchain, *appstate.AppState)
func NewCustomTestBlockchainWithConfig ¶
func NewCustomTestBlockchainWithConfig(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey, cfg *config.Config) (*TestBlockchain, *appstate.AppState)
func NewTestBlockchain ¶
func NewTestBlockchain(withIdentity bool, alloc map[common.Address]config.GenesisAllocation) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
func NewTestBlockchainWithBlocks ¶
func NewTestBlockchainWithBlocks(blocksCount int, emptyBlocksCount int) (*TestBlockchain, *appstate.AppState)
func NewTestBlockchainWithConfig ¶
func NewTestBlockchainWithConfig(withIdentity bool, conf *config.ConsensusConf, valConf *config.ValidationConfig, alloc map[common.Address]config.GenesisAllocation, queueSlots int, executableSlots int, executableLimit int, queueLimit int) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
func (*TestBlockchain) AddTx ¶ added in v0.27.3
func (chain *TestBlockchain) AddTx(tx *types.Transaction) error
func (*TestBlockchain) Bus ¶ added in v0.27.3
func (chain *TestBlockchain) Bus() eventbus.Bus
func (*TestBlockchain) CommitState ¶ added in v0.27.3
func (chain *TestBlockchain) CommitState() *TestBlockchain
func (*TestBlockchain) Copy ¶
func (chain *TestBlockchain) Copy() (*TestBlockchain, *appstate.AppState)
func (*TestBlockchain) GenerateBlocks ¶
func (chain *TestBlockchain) GenerateBlocks(count int, txsInBlock int) *TestBlockchain
func (*TestBlockchain) GenerateEmptyBlocks ¶
func (chain *TestBlockchain) GenerateEmptyBlocks(count int) *TestBlockchain
func (*TestBlockchain) SecStore ¶ added in v0.27.3
func (chain *TestBlockchain) SecStore() *secstore.SecStore
Source Files ¶
Click to show internal directories.
Click to hide internal directories.