Documentation ¶
Overview ¶
Package aura implements the proof-of-authority consensus engine.
Index ¶
- Constants
- Variables
- func EmptyStepFullRlp(signature []byte, emptyStepRlp []byte) ([]byte, error)
- func EmptyStepRlp(step uint64, parentHash libcommon.Hash) ([]byte, error)
- func GetFromValidatorSet(set ValidatorSet, parent libcommon.Hash, nonce uint, call consensus.Call) (libcommon.Address, error)
- type AuRa
- func (c *AuRa) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (c *AuRa) Author(header *types.Header) (libcommon.Address, error)
- func (c *AuRa) Authorize(signer libcommon.Address, signFn clique.SignerFn)
- func (c *AuRa) CalcDifficulty(chain consensus.ChainHeaderReader, time, parentTime uint64, ...) *big.Int
- func (c *AuRa) CalculateRewards(_ *chain.Config, header *types.Header, _ []*types.Header, ...) ([]consensus.Reward, error)
- func (c *AuRa) Close() error
- func (c *AuRa) ExecuteSystemWithdrawals(withdrawals []*types.Withdrawal, syscall consensus.SystemCall) error
- func (c *AuRa) Finalize(config *chain.Config, header *types.Header, state *state.IntraBlockState, ...) (types.Transactions, types.Receipts, error)
- func (c *AuRa) FinalizeAndAssemble(config *chain.Config, header *types.Header, state *state.IntraBlockState, ...) (*types.Block, types.Transactions, types.Receipts, error)
- func (c *AuRa) GenerateSeal(chain consensus.ChainHeaderReader, current, parent *types.Header, ...) []byte
- func (c *AuRa) GenesisEpochData(header *types.Header, caller consensus.SystemCall) ([]byte, error)
- func (c *AuRa) GetBlockGasLimitFromContract(_ *chain.Config, syscall consensus.SystemCall) uint64
- func (c *AuRa) HasGasLimitContract() bool
- func (c *AuRa) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header, ...)
- func (c *AuRa) IsServiceTransaction(sender libcommon.Address, syscall consensus.SystemCall) bool
- func (c *AuRa) Prepare(chain consensus.ChainHeaderReader, header *types.Header, ...) error
- func (c *AuRa) Seal(chain consensus.ChainHeaderReader, block *types.Block, ...) error
- func (c *AuRa) SealHash(header *types.Header) libcommon.Hash
- func (c *AuRa) Type() chain.ConsensusName
- func (c *AuRa) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, _ bool) error
- func (c *AuRa) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error
- func (c *AuRa) VerifyUncles(chain consensus.ChainReader, header *types.Header, uncles []*types.Header) error
- type AuthorityRoundParams
- type BlockReward
- type BlockRewardContract
- type BlockRewardContractList
- type BlockRewardList
- type Call
- type CallResults
- type Code
- type EmptyStep
- type EmptyStepSet
- type EpochManager
- type EpochTransition
- type EpochTransitionProof
- type FirstValidatorSetProof
- type GasLimitOverride
- type Multi
- type MultiItem
- type NonTransactionalEpochReader
- func (cr *NonTransactionalEpochReader) FindBeforeOrEqualNumber(number uint64) (blockNum uint64, blockHash libcommon.Hash, transitionProof []byte, err error)
- func (cr *NonTransactionalEpochReader) GetEpoch(hash libcommon.Hash, number uint64) (v []byte, err error)
- func (cr *NonTransactionalEpochReader) GetPendingEpoch(hash libcommon.Hash, number uint64) (v []byte, err error)
- func (cr *NonTransactionalEpochReader) PutEpoch(hash libcommon.Hash, number uint64, proof []byte) error
- func (cr *NonTransactionalEpochReader) PutPendingEpoch(hash libcommon.Hash, number uint64, proof []byte) error
- type PermissionedStep
- type ReceivedStepHashes
- type ReportQueue
- type ReportQueueItem
- type RollingFinality
- type SealedEmptyStep
- type SimpleList
- type Step
- type StepDurationInfo
- type SystemCall
- type ValidatorContract
- type ValidatorSafeContract
- type ValidatorSet
- type ValidatorSetProof
Constants ¶
const DEBUG_LOG_FROM = 999_999_999
const EVENT_NAME = "InitiateChange(bytes32,address[])"
Variables ¶
var EVENT_NAME_HASH = crypto.Keccak256Hash([]byte(EVENT_NAME))
Functions ¶
func EmptyStepFullRlp ¶
Types ¶
type AuRa ¶
type AuRa struct { EmptyStepsSet *EmptyStepSet EpochManager *EpochManager // Mutex<EpochManager>, // contains filtered or unexported fields }
AuRa nolint
func (*AuRa) APIs ¶
func (c *AuRa) APIs(chain consensus.ChainHeaderReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.
func (*AuRa) 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 Coinbase of the header)
func (*AuRa) Authorize ¶
Authorize injects a private key into the consensus engine to mint new blocks with.
func (*AuRa) CalcDifficulty ¶
func (*AuRa) CalculateRewards ¶
func (*AuRa) Close ¶
Close implements consensus.Engine. It's a noop for clique as there are no background threads.
func (*AuRa) ExecuteSystemWithdrawals ¶
func (c *AuRa) ExecuteSystemWithdrawals(withdrawals []*types.Withdrawal, syscall consensus.SystemCall) error
See https://github.com/gnosischain/specs/blob/master/execution/withdrawals.md
func (*AuRa) Finalize ¶
func (c *AuRa) Finalize(config *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, logger log.Logger, ) (types.Transactions, types.Receipts, error)
word `signal epoch` == word `pending epoch`
func (*AuRa) FinalizeAndAssemble ¶
func (c *AuRa) FinalizeAndAssemble(config *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, error)
FinalizeAndAssemble implements consensus.Engine
func (*AuRa) GenerateSeal ¶
func (c *AuRa) GenerateSeal(chain consensus.ChainHeaderReader, current, parent *types.Header, call consensus.Call) []byte
GenerateSeal - Attempt to seal the block internally.
This operation is synchronous and may (quite reasonably) not be available, in which case `Seal::None` will be returned.
func (*AuRa) GenesisEpochData ¶
func (*AuRa) GetBlockGasLimitFromContract ¶
func (*AuRa) HasGasLimitContract ¶
func (*AuRa) Initialize ¶
func (c *AuRa) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header, state *state.IntraBlockState, syscallCustom consensus.SysCallCustom, logger log.Logger, )
func (*AuRa) IsServiceTransaction ¶
See https://openethereum.github.io/Permissioning.html#gas-price This is thread-safe: it only accesses the `certifier` which is used behind a RWLock
func (*AuRa) Prepare ¶
func (c *AuRa) 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 (*AuRa) Type ¶
func (c *AuRa) Type() chain.ConsensusName
Type returns underlying consensus engine
func (*AuRa) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules.
func (*AuRa) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*AuRa) VerifyUncles ¶
func (c *AuRa) VerifyUncles(chain consensus.ChainReader, header *types.Header, uncles []*types.Header) error
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.
type AuthorityRoundParams ¶
type AuthorityRoundParams struct { // A map defining intervals of blocks with the given times (in seconds) to wait before next // block or authority switching. The keys in the map are steps of starting blocks of those // periods. The entry at `0` should be defined. // // Wait times (durations) are additionally required to be less than 65535 since larger values // lead to slow block issuance. StepDurations map[uint64]uint64 // Starting step, StartStep *uint64 // Valid validators. Validators ValidatorSet // Chain score validation transition block. ValidateScoreTransition uint64 // Monotonic step validation transition block. ValidateStepTransition uint64 // Immediate transitions. ImmediateTransitions bool // Block reward in base units. BlockReward BlockRewardList // Block reward contract addresses with their associated starting block numbers. BlockRewardContractTransitions BlockRewardContractList // Number of accepted uncles transition block. MaximumUncleCountTransition uint64 // Number of accepted uncles. MaximumUncleCount uint // Transition block to strict empty steps validation. StrictEmptyStepsTransition uint64 // If set, enables random number contract integration. It maps the transition block to the contract address. RandomnessContractAddress map[uint64]libcommon.Address // The addresses of contracts that determine the block gas limit with their associated block // numbers. BlockGasLimitContractTransitions map[uint64]libcommon.Address // If set, this is the block number at which the consensus engine switches from AuRa to AuRa // with POSDAO modifications. PosdaoTransition *uint64 // Stores human-readable keys associated with addresses, like DNS information. // This contract is primarily required to store the address of the Certifier contract. Registrar *libcommon.Address // See https://github.com/gnosischain/specs/blob/master/execution/withdrawals.md WithdrawalContractAddress *libcommon.Address RewriteBytecode map[uint64]map[libcommon.Address][]byte }
func FromJson ¶
func FromJson(jsonParams *chain.AuRaConfig) (AuthorityRoundParams, error)
type BlockReward ¶
type BlockReward struct {
// contains filtered or unexported fields
}
type BlockRewardContract ¶
type BlockRewardContract struct {
// contains filtered or unexported fields
}
func NewBlockRewardContract ¶
func NewBlockRewardContract(address libcommon.Address) *BlockRewardContract
type BlockRewardContractList ¶
type BlockRewardContractList []BlockRewardContract
func (BlockRewardContractList) Len ¶
func (r BlockRewardContractList) Len() int
func (BlockRewardContractList) Less ¶
func (r BlockRewardContractList) Less(i, j int) bool
func (BlockRewardContractList) Swap ¶
func (r BlockRewardContractList) Swap(i, j int)
type BlockRewardList ¶
type BlockRewardList []BlockReward
func (BlockRewardList) Len ¶
func (r BlockRewardList) Len() int
func (BlockRewardList) Less ¶
func (r BlockRewardList) Less(i, j int) bool
func (BlockRewardList) Swap ¶
func (r BlockRewardList) Swap(i, j int)
type Call ¶
type Call func(libcommon.Address, []byte) (CallResults, error)
Type alias for a function we can make calls through synchronously. Returns the call result and state proof for each call.
type EmptyStep ¶
type EmptyStep struct {
// contains filtered or unexported fields
}
A message broadcast by authorities when it's their turn to seal a block but there are no transactions. Other authorities accumulate these messages and later include them in the seal as proof.
An empty step message is created _instead of_ a block if there are no pending transactions. It cannot itself be a parent, and `parent_hash` always points to the most recent block. E.g.:
- Validator A creates block `bA`.
- Validator B has no pending transactions, so it signs an empty step message `mB` instead whose hash points to block `bA`.
- Validator C also has no pending transactions, so it also signs an empty step message `mC` instead whose hash points to block `bA`.
- Validator D creates block `bD`. The parent is block `bA`, and the header includes `mB` and `mC`.
func (*EmptyStep) LessOrEqual ¶
type EmptyStepSet ¶
type EmptyStepSet struct {
// contains filtered or unexported fields
}
func (*EmptyStepSet) ForEach ¶
func (s *EmptyStepSet) ForEach(f func(int, *EmptyStep))
func (*EmptyStepSet) Len ¶
func (s *EmptyStepSet) Len() int
func (*EmptyStepSet) Less ¶
func (s *EmptyStepSet) Less(i, j int) bool
func (*EmptyStepSet) Sort ¶
func (s *EmptyStepSet) Sort()
func (*EmptyStepSet) Swap ¶
func (s *EmptyStepSet) Swap(i, j int)
type EpochManager ¶
type EpochManager struct {
// contains filtered or unexported fields
}
nolint
func NewEpochManager ¶
func NewEpochManager() *EpochManager
type EpochTransition ¶
type EpochTransitionProof ¶
EpochTransitionProof - Holds 2 proofs inside: ValidatorSetProof and FinalityProof
type FirstValidatorSetProof ¶
FirstValidatorSetProof state-dependent proofs for the safe contract: only "first" proofs are such.
type GasLimitOverride ¶
type GasLimitOverride struct {
// contains filtered or unexported fields
}
func NewGasLimitOverride ¶
func NewGasLimitOverride() *GasLimitOverride
type Multi ¶
type Multi struct {
// contains filtered or unexported fields
}
func NewMulti ¶
func NewMulti(m map[uint64]ValidatorSet) *Multi
type NonTransactionalEpochReader ¶
type NonTransactionalEpochReader struct {
// contains filtered or unexported fields
}
func (*NonTransactionalEpochReader) FindBeforeOrEqualNumber ¶
func (*NonTransactionalEpochReader) GetPendingEpoch ¶
func (*NonTransactionalEpochReader) PutPendingEpoch ¶
type PermissionedStep ¶
type PermissionedStep struct {
// contains filtered or unexported fields
}
type ReceivedStepHashes ¶
type ReportQueueItem ¶
type ReportQueueItem struct {
// contains filtered or unexported fields
}
nolint
type RollingFinality ¶
type RollingFinality struct {
// contains filtered or unexported fields
}
RollingFinality checker for authority round consensus. Stores a chain of unfinalized hashes that can be pushed onto. nolint
func NewRollingFinality ¶
func NewRollingFinality(signers []libcommon.Address) *RollingFinality
NewRollingFinality creates a blank finality checker under the given validator set.
type SealedEmptyStep ¶
type SealedEmptyStep struct {
// contains filtered or unexported fields
}
An empty step message that is included in a seal, the only difference is that it doesn't include the `parent_hash` in order to save space. The included signature is of the original empty step message, which can be reconstructed by using the parent hash of the block in which this sealed empty message is included. nolint
type SimpleList ¶
type SimpleList struct {
// contains filtered or unexported fields
}
func NewSimpleList ¶
func NewSimpleList(validators []libcommon.Address) *SimpleList
type StepDurationInfo ¶
type SystemCall ¶
type SystemCall func(libcommon.Address, []byte) (CallResults, error)
A system-calling closure. Enacts calls on a block's state from the system address.
type ValidatorContract ¶
type ValidatorContract struct {
// contains filtered or unexported fields
}
ValidatorContract a validator contract with reporting.
type ValidatorSafeContract ¶
type ValidatorSafeContract struct {
// contains filtered or unexported fields
}
The validator contract should have the following interface: nolint
func NewValidatorSafeContract ¶
func NewValidatorSafeContract(contractAddress libcommon.Address, posdaoTransition *uint64, client client) *ValidatorSafeContract
type ValidatorSet ¶
type ValidatorSet interface {
// contains filtered or unexported methods
}