Documentation ¶
Overview ¶
Package minerva implements the taiyuechain hybrid consensus engine.
Index ¶
- Constants
- Variables
- func LogPrint(info string, addr common.Address, amount *big.Int)
- func MatMuliple(input []uint64, output []uint64, pmat []uint64) int
- func NewDataset(epoch uint64) interface{}
- func SeedHash(block uint64) []byte
- func TruehashLight(dataset []uint64, hash []byte, nonce uint64) ([]byte, []byte)
- type Config
- type ConstSqrt
- type Dataset
- type Minerva
- func New(config Config, cimList *cim.CimList) *Minerva
- func NewFakeDelayer(delay time.Duration) *Minerva
- func NewFakeFailer(fail uint64) *Minerva
- func NewFaker(cimList *cim.CimList) *Minerva
- func NewFullFaker() *Minerva
- func NewShared(cimList *cim.CimList) *Minerva
- func NewTester(cimList *cim.CimList) *Minerva
- func (m *Minerva) APIs(chain consensus.ChainReader) []rpc.API
- func (m *Minerva) Author(header *types.Header) (common.Address, error)
- func (m *Minerva) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (m *Minerva) GetElection() consensus.CommitteeElection
- func (m *Minerva) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (m *Minerva) SetElection(e consensus.CommitteeElection)
- func (m *Minerva) VerifyHeader(chain consensus.ChainReader, header *types.Header) error
- func (m *Minerva) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (m *Minerva) VerifySigns(fastnumber *big.Int, fastHash common.Hash, signs []*types.PbftSign) error
- func (m *Minerva) VerifySwitchInfo(fastnumber *big.Int, info []*types.CommitteeMember) error
- type Mode
Constants ¶
const DATALENGTH = 2048 //2048 520
const DGSTSIZE = 32
const HEADSIZE = 32
const OFF_CYCLE_LEN = 8192 //8192 2080
const OFF_SKIP_LEN = 32768 //32768 8230
const OFF_STATR = 12 //in advance updata the algorithm
const PMTSIZE = 4
const SKIP_CYCLE_LEN = 2048 //2048 520
const STARTUPDATENUM = 10240 //10240 2600
const TBLSIZE = 16
const UPDATABLOCKLENGTH = 12000 //12000 3000
Variables ¶
var ( //SnailBlockRewardsBase Snail block rewards base value is 115.555555555555 * 10^12 SnailBlockRewardsBase = 115555555555555 // Big1e6 up to wei SnailBlockRewardsBase * this is wei Big1e6 = big.NewInt(1e6) // SnailBlockRewardsChangeInterval Snail block rewards change interval 4500 blocks SnailBlockRewardsChangeInterval = 4500 // SnailBlockRewardsChangePercentage snall block rewards change interval decrease %2 SnailBlockRewardsChangePercentage = 2 //BaseBig ... BaseBig = big.NewInt(1e18) //NetworkFragmentsNuber The number of main network fragments is currently fixed at 1 NetworkFragmentsNuber = 1 //MiningConstant Mining constant is 20 MiningConstant = 20 //SqrtMin pbft and miner allocation constant //Generating formula :TestOutSqrt SqrtMin = 25 //SqrtMax ... SqrtMax = 6400 )
var ErrInvalidDumpMagic = errors.New("invalid dump magic")
ErrInvalidDumpMagic errorinfo
Functions ¶
func NewDataset ¶
func NewDataset(epoch uint64) interface{}
newDataset creates a new truehash mining dataset
Types ¶
type Config ¶
type Config struct {
PowMode Mode
}
Config are the configuration parameters of the minerva.
type Dataset ¶
type Dataset struct {
// contains filtered or unexported fields
}
dataset wraps an truehash dataset with some metadata to allow easier concurrent use.
type Minerva ¶
type Minerva struct {
// contains filtered or unexported fields
}
Minerva consensus
func NewFakeDelayer ¶
NewFakeDelayer creates a minerva consensus engine with a fake PoW scheme that accepts all blocks as valid, but delays verifications by some time, though they still have to conform to the Ethereum consensus rules.
func NewFakeFailer ¶
NewFakeFailer creates a minerva consensus engine with a fake PoW scheme that accepts all blocks as valid apart from the single one specified, though they still have to conform to the Ethereum consensus rules.
func NewFaker ¶
NewFaker creates a minerva consensus engine with a fake PoW scheme that accepts all blocks' seal as valid, though they still have to conform to the Ethereum consensus rules.
func NewFullFaker ¶
func NewFullFaker() *Minerva
NewFullFaker creates an minerva consensus engine with a full fake scheme that accepts all blocks as valid, without checking any consensus rules whatsoever.
func NewShared ¶
NewShared creates a full sized minerva shared between all requesters running in the same process.
func (*Minerva) APIs ¶
func (m *Minerva) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC APIs. Currently that is empty.
func (*Minerva) Author ¶
Author implements consensus.Engine, returning the header's coinbase as the proof-of-work verified author of the block.
func (*Minerva) Finalize ¶
func (m *Minerva) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, receipts []*types.Receipt, feeAmount *big.Int) (*types.Block, error)
Finalize implements consensus.Engine, accumulating the block gas rewards, setting the final state and assembling the block.
func (*Minerva) GetElection ¶
func (m *Minerva) GetElection() consensus.CommitteeElection
GetElection return election
func (*Minerva) Prepare ¶
Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the minerva protocol. The changes are done inline.
func (*Minerva) SetElection ¶
func (m *Minerva) SetElection(e consensus.CommitteeElection)
SetElection Append interface CommitteeElection after instantiation
func (*Minerva) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules of the stock Taiyuechain m engine.
func (*Minerva) VerifyHeaders ¶
func (m *Minerva) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications.
func (*Minerva) VerifySigns ¶
func (m *Minerva) VerifySigns(fastnumber *big.Int, fastHash common.Hash, signs []*types.PbftSign) error
VerifySigns check the sings included in fast block or fruit