Documentation ¶
Overview ¶
Package bor is a generated GoMock package.
Package bor is a generated GoMock package.
Index ¶
- Constants
- Variables
- func AddFeeTransferLog(ibs evmtypes.IntraBlockState, sender libcommon.Address, ...)
- func AppendBytes32(data ...[]byte) []byte
- func BorRLP(header *types.Header, c *borcfg.BorConfig) []byte
- func BorTransfer(db evmtypes.IntraBlockState, sender, recipient libcommon.Address, ...)
- func CalcProducerDelay(number uint64, succession int, c *borcfg.BorConfig) uint64
- func ComputeHeadersRootHash(blockHeaders []*types.Header) ([]byte, error)
- func Convert(input [][32]byte) [][]byte
- func ConvertTo32(input []byte) (output [32]byte, err error)
- func Ecrecover(header *types.Header, ...) (libcommon.Address, error)
- func GetTxDependency(b *types.Block) [][]uint64
- func GetValidatorBytes(h *types.Header, config *borcfg.BorConfig) []byte
- func MinNextBlockTime(parent *types.Header, succession int, config *borcfg.BorConfig) uint64
- func NextPowerOfTwo(n uint64) uint64
- func SealHash(header *types.Header, c *borcfg.BorConfig) (hash libcommon.Hash)
- func ValidateHeaderExtraLength(extraBytes []byte) error
- func ValidateHeaderGas(header *types.Header, parent *types.Header, chainConfig *chain.Config) error
- func ValidateHeaderSprintValidators(header *types.Header, config *borcfg.BorConfig) error
- func ValidateHeaderTime(header *types.Header, now time.Time, parent *types.Header, ...) error
- func ValidateHeaderUnusedFields(header *types.Header) error
- func VerifyUncles(uncles []*types.Header) error
- type ABI
- type BlockExtraData
- type BlockTooSoonError
- type Bor
- func (c *Bor) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (c *Bor) Author(header *types.Header) (libcommon.Address, error)
- func (c *Bor) Authorize(currentSigner libcommon.Address, signFn SignerFn)
- func (c *Bor) CalcDifficulty(chain consensus.ChainHeaderReader, _, _ uint64, _ *big.Int, ...) *big.Int
- func (c *Bor) CalculateRewards(config *chain.Config, header *types.Header, uncles []*types.Header, ...) ([]consensus.Reward, error)
- func (c *Bor) Close() error
- func (c *Bor) CommitStates(state *state.IntraBlockState, header *types.Header, ...) error
- func (c *Bor) Config() *borcfg.BorConfig
- func (c *Bor) Finalize(config *chain.Config, header *types.Header, state *state.IntraBlockState, ...) (types.Transactions, types.Receipts, types.FlatRequests, error)
- func (c *Bor) FinalizeAndAssemble(chainConfig *chain.Config, header *types.Header, state *state.IntraBlockState, ...) (*types.Block, types.Transactions, types.Receipts, types.FlatRequests, error)
- func (c *Bor) GetPostApplyMessageFunc() evmtypes.PostApplyMessageFunc
- func (c *Bor) GetRootHash(ctx context.Context, tx kv.Tx, start, end uint64) (string, error)
- func (c *Bor) GetTransferFunc() evmtypes.TransferFunc
- func (c *Bor) HeaderProgress(p HeaderProgress)
- func (c *Bor) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header, ...)
- func (c *Bor) IsProposer(header *types.Header) (bool, error)
- func (c *Bor) IsServiceTransaction(sender libcommon.Address, syscall consensus.SystemCall) bool
- func (c *Bor) IsValidator(header *types.Header) (bool, error)
- func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header, ...) error
- func (c *Bor) Seal(chain consensus.ChainHeaderReader, blockWithReceipts *types.BlockWithReceipts, ...) error
- func (c *Bor) SealHash(header *types.Header) libcommon.Hash
- func (c *Bor) SetHeimdallClient(h heimdall.HeimdallClient)
- func (c *Bor) Start(chainDB kv.RwDB)
- func (c *Bor) Type() chain.ConsensusName
- func (c *Bor) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
- func (c *Bor) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, _ []bool) (chan<- struct{}, <-chan error)
- func (c *Bor) VerifySeal(chain ChainHeaderReader, header *types.Header) error
- func (c *Bor) VerifyUncles(_ consensus.ChainReader, _ *types.Header, uncles []*types.Header) error
- type ChainHeaderReader
- type ChainSpanner
- func (c *ChainSpanner) CommitSpan(heimdallSpan heimdall.Span, syscall consensus.SystemCall) error
- func (c *ChainSpanner) GetCurrentProducers(spanId uint64, chain ChainHeaderReader) ([]*valset.Validator, error)
- func (c *ChainSpanner) GetCurrentSpan(syscall consensus.SystemCall) (*heimdall.Span, error)
- func (c *ChainSpanner) GetCurrentValidators(spanId uint64, chain ChainHeaderReader) ([]*valset.Validator, error)
- type ChainStateReceiver
- type FakeBor
- type FinalityAPI
- type FinalityAPIFunc
- type HeaderProgress
- type MaxCheckpointLengthExceededError
- type MismatchingValidatorsError
- type MockSpanner
- func (m *MockSpanner) CommitSpan(heimdallSpan heimdall.Span, syscall consensus.SystemCall) error
- func (m *MockSpanner) EXPECT() *MockSpannerMockRecorder
- func (m *MockSpanner) GetCurrentProducers(arg0 uint64, arg1 ChainHeaderReader) ([]*valset.Validator, error)
- func (m *MockSpanner) GetCurrentSpan(syscall consensus.SystemCall) (*heimdall.Span, error)
- func (m *MockSpanner) GetCurrentValidators(arg0 uint64, arg1 ChainHeaderReader) ([]*valset.Validator, error)
- type MockSpannerCommitSpanCall
- func (c *MockSpannerCommitSpanCall) Do(f func(heimdall.Span, consensus.SystemCall) error) *MockSpannerCommitSpanCall
- func (c *MockSpannerCommitSpanCall) DoAndReturn(f func(heimdall.Span, consensus.SystemCall) error) *MockSpannerCommitSpanCall
- func (c *MockSpannerCommitSpanCall) Return(arg0 error) *MockSpannerCommitSpanCall
- type MockSpannerGetCurrentProducersCall
- func (c *MockSpannerGetCurrentProducersCall) Do(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentProducersCall
- func (c *MockSpannerGetCurrentProducersCall) DoAndReturn(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentProducersCall
- func (c *MockSpannerGetCurrentProducersCall) Return(arg0 []*valset.Validator, arg1 error) *MockSpannerGetCurrentProducersCall
- type MockSpannerGetCurrentSpanCall
- func (c *MockSpannerGetCurrentSpanCall) Do(f func(consensus.SystemCall) (*heimdall.Span, error)) *MockSpannerGetCurrentSpanCall
- func (c *MockSpannerGetCurrentSpanCall) DoAndReturn(f func(consensus.SystemCall) (*heimdall.Span, error)) *MockSpannerGetCurrentSpanCall
- func (c *MockSpannerGetCurrentSpanCall) Return(arg0 *heimdall.Span, arg1 error) *MockSpannerGetCurrentSpanCall
- type MockSpannerGetCurrentValidatorsCall
- func (c *MockSpannerGetCurrentValidatorsCall) Do(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentValidatorsCall
- func (c *MockSpannerGetCurrentValidatorsCall) DoAndReturn(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentValidatorsCall
- func (c *MockSpannerGetCurrentValidatorsCall) Return(arg0 []*valset.Validator, arg1 error) *MockSpannerGetCurrentValidatorsCall
- type MockSpannerMockRecorder
- func (mr *MockSpannerMockRecorder) CommitSpan(heimdallSpan, syscall any) *MockSpannerCommitSpanCall
- func (mr *MockSpannerMockRecorder) GetCurrentProducers(spanId, chain any) *MockSpannerGetCurrentProducersCall
- func (mr *MockSpannerMockRecorder) GetCurrentSpan(syscall any) *MockSpannerGetCurrentSpanCall
- func (mr *MockSpannerMockRecorder) GetCurrentValidators(spanId, chain any) *MockSpannerGetCurrentValidatorsCall
- type MockStateReceiver
- type MockStateReceiverCommitStateCall
- func (c *MockStateReceiverCommitStateCall) Do(f func(rlp.RawValue, consensus.SystemCall) error) *MockStateReceiverCommitStateCall
- func (c *MockStateReceiverCommitStateCall) DoAndReturn(f func(rlp.RawValue, consensus.SystemCall) error) *MockStateReceiverCommitStateCall
- func (c *MockStateReceiverCommitStateCall) Return(arg0 error) *MockStateReceiverCommitStateCall
- type MockStateReceiverMockRecorder
- type SignerFn
- type Snapshot
- type Spanner
- type StateReceiver
- type ValidateHeaderTimeSignerSuccessionNumber
- type WrongDifficultyError
Constants ¶
const BorSeparate = "BorSeparate"
Variables ¶
var BorDevnetChainVals = []*valset.Validator{ { ID: 1, Address: common.HexToAddress("0x67b1d87101671b127f5f8714789C7192f7ad340e"), VotingPower: 1000, ProposerPriority: 1, }, }
Validator set for bor devnet-chain with 1 validator configuration
var BorE2ETestChain2Valset = []*valset.Validator{ { ID: 1, Address: common.HexToAddress("71562b71999873DB5b286dF957af199Ec94617F7"), VotingPower: 1000, ProposerPriority: 1, }, { ID: 2, Address: common.HexToAddress("9fB29AAc15b9A4B7F17c3385939b007540f4d791"), VotingPower: 1000, ProposerPriority: 2, }, }
Validator set for bor e2e test chain with 2 validator configuration
var ( // ErrInvalidTimestamp is returned if the timestamp of a block is lower than // the previous block's timestamp + the minimum block period. ErrInvalidTimestamp = errors.New("invalid timestamp") )
Various error messages to mark blocks invalid. These should be private to prevent engine specific errors from being referenced in the remainder of the codebase, inherently breaking if the engine is swapped out. Please put common error types into the consensus package.
var ( // MaxCheckpointLength is the maximum number of blocks that can be requested for constructing a checkpoint root hash MaxCheckpointLength = uint64(math.Pow(2, 15)) )
Bor protocol constants.
var NetworkNameVals = make(map[string][]*valset.Validator)
NetworkNameVals is a map of network name to validator set for tests/devnets
Functions ¶
func AddFeeTransferLog ¶
func AddFeeTransferLog(ibs evmtypes.IntraBlockState, sender libcommon.Address, coinbase libcommon.Address, result *evmtypes.ExecutionResult)
AddFeeTransferLog adds fee transfer log into state Deprecating transfer log and will be removed in future fork. PLEASE DO NOT USE this transfer log going forward. Parameters won't get updated as expected going forward with EIP1559
func AppendBytes32 ¶
func BorRLP ¶
BorRLP returns the rlp bytes which needs to be signed for the bor sealing. The RLP to sign consists of the entire header apart from the 65 byte signature contained at the end of the extra data.
Note, the method requires the extra data to be at least 65 bytes, otherwise it panics. This is done to avoid accidentally using both forms (signature present or not), which could be abused to produce different hashes for the same header.
func BorTransfer ¶
func BorTransfer(db evmtypes.IntraBlockState, sender, recipient libcommon.Address, amount *uint256.Int, bailout bool)
BorTransfer transfer in Bor
func CalcProducerDelay ¶
CalcProducerDelay is the block delay algorithm based on block time, period, producerDelay and turn-ness of a signer
func ComputeHeadersRootHash ¶
func ConvertTo32 ¶
func Ecrecover ¶
func Ecrecover(header *types.Header, sigcache *lru.ARCCache[libcommon.Hash, libcommon.Address], c *borcfg.BorConfig) (libcommon.Address, error)
Ecrecover extracts the Ethereum account address from a signed header.
func GetTxDependency ¶
Returns the Block-STM Transaction Dependency from the block header
func MinNextBlockTime ¶
func NextPowerOfTwo ¶
func ValidateHeaderExtraLength ¶
ValidateHeaderExtraLength validates that the extra-data contains both the vanity and signature. header.Extra = header.Vanity + header.ProducerBytes (optional) + header.Seal
func ValidateHeaderGas ¶
ValidateHeaderGas validates GasUsed, GasLimit and BaseFee.
func ValidateHeaderSprintValidators ¶
ValidateHeaderSprintValidators validates that the extra-data contains a validators list only in the last header of a sprint.
func ValidateHeaderTime ¶
func ValidateHeaderUnusedFields ¶
ValidateHeaderUnusedFields validates that unused fields are empty.
func VerifyUncles ¶
Types ¶
type BlockExtraData ¶
type BlockExtraData struct { // Validator bytes of bor ValidatorBytes []byte // length of TxDependency -> n (n = number of transactions in the block) // length of TxDependency[i] -> k (k = a whole number) // k elements in TxDependency[i] -> transaction indexes on which transaction i is dependent on TxDependency [][]uint64 }
In bor, RLP encoding of BlockExtraData will be stored in the Extra field in the header
type BlockTooSoonError ¶
func (*BlockTooSoonError) Error ¶
func (e *BlockTooSoonError) Error() string
type Bor ¶
type Bor struct { DB kv.RwDB // Database to store and retrieve snapshot checkpoints Recents *lru.ARCCache[libcommon.Hash, *Snapshot] // Snapshots for recent block to speed up reorgs Signatures *lru.ARCCache[libcommon.Hash, libcommon.Address] // Signatures of recent blocks to speed up mining HeimdallClient heimdall.HeimdallClient // contains filtered or unexported fields }
Bor is the matic-bor consensus engine
func New ¶
func New( chainConfig *chain.Config, db kv.RwDB, blockReader services.FullBlockReader, spanner Spanner, heimdallClient heimdall.HeimdallClient, genesisContracts StateReceiver, logger log.Logger, bridgeReader bridgeReader, spanReader spanReader, ) *Bor
New creates a Matic Bor consensus engine.
func NewRo ¶
func NewRo(chainConfig *chain.Config, db kv.RoDB, blockReader services.FullBlockReader, logger log.Logger) *Bor
NewRo is used by the rpcdaemon and tests which need read only access to the provided data services
func (*Bor) APIs ¶
func (c *Bor) APIs(chain consensus.ChainHeaderReader) []rpc.API
Depricated: To get the API use jsonrpc.APIList
func (*Bor) Author ¶
Author implements consensus.Engine, returning the Ethereum address recovered from the signature in the header's extra-data section. This is thread-safe (only access the header and config (which is never updated), as well as signatures, which are lru.ARCCache, which is thread-safe)
func (*Bor) Authorize ¶
Authorize injects a private key into the consensus engine to mint new blocks with.
func (*Bor) CalcDifficulty ¶
func (c *Bor) CalcDifficulty(chain consensus.ChainHeaderReader, _, _ uint64, _ *big.Int, parentNumber uint64, parentHash, _ libcommon.Hash, _ uint64) *big.Int
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have based on the previous blocks in the chain and the current signer.
func (*Bor) CalculateRewards ¶
func (*Bor) CommitStates ¶
func (c *Bor) CommitStates( state *state.IntraBlockState, header *types.Header, chain statefull.ChainContext, syscall consensus.SystemCall, logger log.Logger, ) error
CommitStates commit states
func (*Bor) Finalize ¶
func (c *Bor) Finalize(config *chain.Config, header *types.Header, state *state.IntraBlockState, txs types.Transactions, uncles []*types.Header, r types.Receipts, withdrawals []*types.Withdrawal, chain consensus.ChainReader, syscall consensus.SystemCall, logger log.Logger, ) (types.Transactions, types.Receipts, types.FlatRequests, error)
Finalize implements consensus.Engine, ensuring no uncles are set, nor block rewards given.
func (*Bor) FinalizeAndAssemble ¶
func (c *Bor) FinalizeAndAssemble(chainConfig *chain.Config, header *types.Header, state *state.IntraBlockState, txs types.Transactions, uncles []*types.Header, receipts types.Receipts, withdrawals []*types.Withdrawal, chain consensus.ChainReader, syscall consensus.SystemCall, call consensus.Call, logger log.Logger, ) (*types.Block, types.Transactions, types.Receipts, types.FlatRequests, error)
FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, nor block rewards given, and returns the final block.
func (*Bor) GetPostApplyMessageFunc ¶
func (c *Bor) GetPostApplyMessageFunc() evmtypes.PostApplyMessageFunc
func (*Bor) GetRootHash ¶
func (*Bor) GetTransferFunc ¶
func (c *Bor) GetTransferFunc() evmtypes.TransferFunc
func (*Bor) HeaderProgress ¶
func (c *Bor) HeaderProgress(p HeaderProgress)
func (*Bor) Initialize ¶
func (c *Bor) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header, state *state.IntraBlockState, syscall consensus.SysCallCustom, logger log.Logger, tracer *tracing.Hooks)
func (*Bor) IsProposer ¶
IsProposer returns true if this instance is the proposer for this block
func (*Bor) IsServiceTransaction ¶
func (*Bor) IsValidator ¶
IsValidator returns true if this instance is the validator for this block
func (*Bor) Prepare ¶
func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header, state *state.IntraBlockState) error
Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.
func (*Bor) Seal ¶
func (c *Bor) Seal(chain consensus.ChainHeaderReader, blockWithReceipts *types.BlockWithReceipts, results chan<- *types.BlockWithReceipts, stop <-chan struct{}) error
Seal implements consensus.Engine, attempting to create a sealed block using the local signing credentials.
func (*Bor) SetHeimdallClient ¶
func (c *Bor) SetHeimdallClient(h heimdall.HeimdallClient)
func (*Bor) Type ¶
func (c *Bor) Type() chain.ConsensusName
Type returns underlying consensus engine
func (*Bor) VerifyHeader ¶
func (c *Bor) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
VerifyHeader checks whether a header conforms to the consensus rules.
func (*Bor) VerifyHeaders ¶
func (c *Bor) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, _ []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).
func (*Bor) VerifySeal ¶
func (c *Bor) VerifySeal(chain ChainHeaderReader, header *types.Header) error
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*Bor) VerifyUncles ¶
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.
type ChainHeaderReader ¶
type ChainSpanner ¶
type ChainSpanner struct {
// contains filtered or unexported fields
}
func NewChainSpanner ¶
func NewChainSpanner(validatorSet ABI, chainConfig *chain.Config, withoutHeimdall bool, logger log.Logger) *ChainSpanner
func (*ChainSpanner) CommitSpan ¶
func (c *ChainSpanner) CommitSpan(heimdallSpan heimdall.Span, syscall consensus.SystemCall) error
func (*ChainSpanner) GetCurrentProducers ¶
func (c *ChainSpanner) GetCurrentProducers(spanId uint64, chain ChainHeaderReader) ([]*valset.Validator, error)
func (*ChainSpanner) GetCurrentSpan ¶
func (c *ChainSpanner) GetCurrentSpan(syscall consensus.SystemCall) (*heimdall.Span, error)
GetCurrentSpan get current span from contract
func (*ChainSpanner) GetCurrentValidators ¶
func (c *ChainSpanner) GetCurrentValidators(spanId uint64, chain ChainHeaderReader) ([]*valset.Validator, error)
type ChainStateReceiver ¶
type ChainStateReceiver struct {
// contains filtered or unexported fields
}
func NewStateReceiver ¶
func NewStateReceiver(contractAddress libcommon.Address) *ChainStateReceiver
func (*ChainStateReceiver) CommitState ¶
func (gc *ChainStateReceiver) CommitState(event rlp.RawValue, syscall consensus.SystemCall) error
type FakeBor ¶
type FakeBor struct {
*ethash.FakeEthash
}
func (*FakeBor) Finalize ¶
func (f *FakeBor) Finalize(config *chain.Config, header *types.Header, state *state.IntraBlockState, txs types.Transactions, uncles []*types.Header, r types.Receipts, withdrawals []*types.Withdrawal, chain consensus.ChainReader, syscall consensus.SystemCall, logger log.Logger, ) (types.Transactions, types.Receipts, types.FlatRequests, error)
type FinalityAPI ¶
type FinalityAPIFunc ¶
func (FinalityAPIFunc) GetRootHash ¶
func (f FinalityAPIFunc) GetRootHash(start uint64, end uint64) (string, error)
type HeaderProgress ¶
type HeaderProgress interface {
Progress() uint64
}
type MaxCheckpointLengthExceededError ¶
func (*MaxCheckpointLengthExceededError) Error ¶
func (e *MaxCheckpointLengthExceededError) Error() string
type MismatchingValidatorsError ¶
type MismatchingValidatorsError struct { Number uint64 ValidatorSetSnap []byte ValidatorSetHeader []byte }
MismatchingValidatorsError is returned if a last block in sprint contains a list of validators different from the one that local node calculated
func (*MismatchingValidatorsError) Error ¶
func (e *MismatchingValidatorsError) Error() string
type MockSpanner ¶
type MockSpanner struct {
// contains filtered or unexported fields
}
MockSpanner is a mock of Spanner interface.
func NewMockSpanner ¶
func NewMockSpanner(ctrl *gomock.Controller) *MockSpanner
NewMockSpanner creates a new mock instance.
func (*MockSpanner) CommitSpan ¶
func (m *MockSpanner) CommitSpan(heimdallSpan heimdall.Span, syscall consensus.SystemCall) error
CommitSpan mocks base method.
func (*MockSpanner) EXPECT ¶
func (m *MockSpanner) EXPECT() *MockSpannerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSpanner) GetCurrentProducers ¶
func (m *MockSpanner) GetCurrentProducers(arg0 uint64, arg1 ChainHeaderReader) ([]*valset.Validator, error)
GetCurrentProducers mocks base method.
func (*MockSpanner) GetCurrentSpan ¶
func (m *MockSpanner) GetCurrentSpan(syscall consensus.SystemCall) (*heimdall.Span, error)
GetCurrentSpan mocks base method.
func (*MockSpanner) GetCurrentValidators ¶
func (m *MockSpanner) GetCurrentValidators(arg0 uint64, arg1 ChainHeaderReader) ([]*valset.Validator, error)
GetCurrentValidators mocks base method.
type MockSpannerCommitSpanCall ¶
MockSpannerCommitSpanCall wrap *gomock.Call
func (*MockSpannerCommitSpanCall) Do ¶
func (c *MockSpannerCommitSpanCall) Do(f func(heimdall.Span, consensus.SystemCall) error) *MockSpannerCommitSpanCall
Do rewrite *gomock.Call.Do
func (*MockSpannerCommitSpanCall) DoAndReturn ¶
func (c *MockSpannerCommitSpanCall) DoAndReturn(f func(heimdall.Span, consensus.SystemCall) error) *MockSpannerCommitSpanCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockSpannerCommitSpanCall) Return ¶
func (c *MockSpannerCommitSpanCall) Return(arg0 error) *MockSpannerCommitSpanCall
Return rewrite *gomock.Call.Return
type MockSpannerGetCurrentProducersCall ¶
MockSpannerGetCurrentProducersCall wrap *gomock.Call
func (*MockSpannerGetCurrentProducersCall) Do ¶
func (c *MockSpannerGetCurrentProducersCall) Do(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentProducersCall
Do rewrite *gomock.Call.Do
func (*MockSpannerGetCurrentProducersCall) DoAndReturn ¶
func (c *MockSpannerGetCurrentProducersCall) DoAndReturn(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentProducersCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockSpannerGetCurrentProducersCall) Return ¶
func (c *MockSpannerGetCurrentProducersCall) Return(arg0 []*valset.Validator, arg1 error) *MockSpannerGetCurrentProducersCall
Return rewrite *gomock.Call.Return
type MockSpannerGetCurrentSpanCall ¶
MockSpannerGetCurrentSpanCall wrap *gomock.Call
func (*MockSpannerGetCurrentSpanCall) Do ¶
func (c *MockSpannerGetCurrentSpanCall) Do(f func(consensus.SystemCall) (*heimdall.Span, error)) *MockSpannerGetCurrentSpanCall
Do rewrite *gomock.Call.Do
func (*MockSpannerGetCurrentSpanCall) DoAndReturn ¶
func (c *MockSpannerGetCurrentSpanCall) DoAndReturn(f func(consensus.SystemCall) (*heimdall.Span, error)) *MockSpannerGetCurrentSpanCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockSpannerGetCurrentSpanCall) Return ¶
func (c *MockSpannerGetCurrentSpanCall) Return(arg0 *heimdall.Span, arg1 error) *MockSpannerGetCurrentSpanCall
Return rewrite *gomock.Call.Return
type MockSpannerGetCurrentValidatorsCall ¶
MockSpannerGetCurrentValidatorsCall wrap *gomock.Call
func (*MockSpannerGetCurrentValidatorsCall) Do ¶
func (c *MockSpannerGetCurrentValidatorsCall) Do(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentValidatorsCall
Do rewrite *gomock.Call.Do
func (*MockSpannerGetCurrentValidatorsCall) DoAndReturn ¶
func (c *MockSpannerGetCurrentValidatorsCall) DoAndReturn(f func(uint64, ChainHeaderReader) ([]*valset.Validator, error)) *MockSpannerGetCurrentValidatorsCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockSpannerGetCurrentValidatorsCall) Return ¶
func (c *MockSpannerGetCurrentValidatorsCall) Return(arg0 []*valset.Validator, arg1 error) *MockSpannerGetCurrentValidatorsCall
Return rewrite *gomock.Call.Return
type MockSpannerMockRecorder ¶
type MockSpannerMockRecorder struct {
// contains filtered or unexported fields
}
MockSpannerMockRecorder is the mock recorder for MockSpanner.
func (*MockSpannerMockRecorder) CommitSpan ¶
func (mr *MockSpannerMockRecorder) CommitSpan(heimdallSpan, syscall any) *MockSpannerCommitSpanCall
CommitSpan indicates an expected call of CommitSpan.
func (*MockSpannerMockRecorder) GetCurrentProducers ¶
func (mr *MockSpannerMockRecorder) GetCurrentProducers(spanId, chain any) *MockSpannerGetCurrentProducersCall
GetCurrentProducers indicates an expected call of GetCurrentProducers.
func (*MockSpannerMockRecorder) GetCurrentSpan ¶
func (mr *MockSpannerMockRecorder) GetCurrentSpan(syscall any) *MockSpannerGetCurrentSpanCall
GetCurrentSpan indicates an expected call of GetCurrentSpan.
func (*MockSpannerMockRecorder) GetCurrentValidators ¶
func (mr *MockSpannerMockRecorder) GetCurrentValidators(spanId, chain any) *MockSpannerGetCurrentValidatorsCall
GetCurrentValidators indicates an expected call of GetCurrentValidators.
type MockStateReceiver ¶
type MockStateReceiver struct {
// contains filtered or unexported fields
}
MockStateReceiver is a mock of StateReceiver interface.
func NewMockStateReceiver ¶
func NewMockStateReceiver(ctrl *gomock.Controller) *MockStateReceiver
NewMockStateReceiver creates a new mock instance.
func (*MockStateReceiver) CommitState ¶
func (m *MockStateReceiver) CommitState(event rlp.RawValue, syscall consensus.SystemCall) error
CommitState mocks base method.
func (*MockStateReceiver) EXPECT ¶
func (m *MockStateReceiver) EXPECT() *MockStateReceiverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockStateReceiverCommitStateCall ¶
MockStateReceiverCommitStateCall wrap *gomock.Call
func (*MockStateReceiverCommitStateCall) Do ¶
func (c *MockStateReceiverCommitStateCall) Do(f func(rlp.RawValue, consensus.SystemCall) error) *MockStateReceiverCommitStateCall
Do rewrite *gomock.Call.Do
func (*MockStateReceiverCommitStateCall) DoAndReturn ¶
func (c *MockStateReceiverCommitStateCall) DoAndReturn(f func(rlp.RawValue, consensus.SystemCall) error) *MockStateReceiverCommitStateCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockStateReceiverCommitStateCall) Return ¶
func (c *MockStateReceiverCommitStateCall) Return(arg0 error) *MockStateReceiverCommitStateCall
Return rewrite *gomock.Call.Return
type MockStateReceiverMockRecorder ¶
type MockStateReceiverMockRecorder struct {
// contains filtered or unexported fields
}
MockStateReceiverMockRecorder is the mock recorder for MockStateReceiver.
func (*MockStateReceiverMockRecorder) CommitState ¶
func (mr *MockStateReceiverMockRecorder) CommitState(event, syscall any) *MockStateReceiverCommitStateCall
CommitState indicates an expected call of CommitState.
type SignerFn ¶
SignerFn is a signer callback function to request a header to be signed by a backing account.
type Snapshot ¶
type Snapshot struct { Number uint64 `json:"number"` // Block number where the snapshot was created Hash common.Hash `json:"hash"` // Block hash where the snapshot was created ValidatorSet *valset.ValidatorSet `json:"validatorSet"` // Validator set at this moment // contains filtered or unexported fields }
Snapshot is the state of the authorization voting at a given point in time.
func LoadSnapshot ¶
func LoadSnapshot(config *borcfg.BorConfig, sigcache *lru.ARCCache[common.Hash, common.Address], db kv.RwDB, hash common.Hash) (*Snapshot, error)
loadSnapshot loads an existing snapshot from the database.
func NewSnapshot ¶
func NewSnapshot( config *borcfg.BorConfig, sigcache *lru.ARCCache[common.Hash, common.Address], number uint64, hash common.Hash, validators []*valset.Validator, logger log.Logger, ) *Snapshot
newSnapshot creates a new snapshot with the specified startup parameters. This method does not initialize the set of recent signers, so only ever use if for the genesis block.
func (*Snapshot) GetSignerSuccessionNumber ¶
type Spanner ¶
type Spanner interface { GetCurrentSpan(syscall consensus.SystemCall) (*heimdall.Span, error) GetCurrentValidators(spanId uint64, chain ChainHeaderReader) ([]*valset.Validator, error) GetCurrentProducers(spanId uint64, chain ChainHeaderReader) ([]*valset.Validator, error) CommitSpan(heimdallSpan heimdall.Span, syscall consensus.SystemCall) error }
type StateReceiver ¶
type StateReceiver interface {
CommitState(event rlp.RawValue, syscall consensus.SystemCall) error
}
type ValidateHeaderTimeSignerSuccessionNumber ¶
type ValidateHeaderTimeSignerSuccessionNumber interface {
GetSignerSuccessionNumber(signer libcommon.Address, number uint64) (int, error)
}
ValidateHeaderTimeSignerSuccessionNumber - valset.ValidatorSet abstraction for unit tests
type WrongDifficultyError ¶
WrongDifficultyError is returned if the difficulty of a block doesn't match the turn of the signer.
func (*WrongDifficultyError) Error ¶
func (e *WrongDifficultyError) Error() string