misanu

package
v0.0.0-...-4ac1123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2024 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TABLE_WIDTH  uint64 = 1 << 2
	TABLE_HEIGHT uint64 = 1 << 2
)
View Source
const FILL_MASK uint64 = 0x00FFFFFFFFFFFFFF
View Source
const OUTER_DIGEST = false

digest se cita sa spoljnog izvora + timestamp

View Source
const (
	//number of seconds that passed since block's creation and reading outer data
	OUTER_TIME_DELTA int64 = 3
)

Variables

View Source
var (
	FrontierBlockReward  *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
	ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium

)

TODO: PROVERITI OVO Ethash proof-of-work protocol constants.

View Source
var POW_MASKS = [...]byte{0x0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}

Functions

func ChooseTableDimension_Set

func ChooseTableDimension_Set() (height uint64, width uint64)

func Convert56to64Des

func Convert56to64Des(x56 uint64) uint64

func Convert64to56Des

func Convert64to56Des(x64 uint64) uint64

func HashHeaderWithDigest

func HashHeaderWithDigest(headerNoNonce common.Hash, mixDigest common.Hash) common.Hash

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API exposes ethash related methods for the RPC interface.

func (*API) GetHashrate

func (api *API) GetHashrate() uint64

GetHashrate returns the current hashrate for local CPU miner and remote miner.

func (*API) GetWork

func (api *API) GetWork() ([3]string, error)

GetWork returns a work package for external miner.

The work package consists of 3 strings:

result[0] - 32 bytes hex encoded current block header pow-hash
result[1] - 32 bytes hex encoded seed hash used for DAG
result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty

func (*API) SubmitHashRate

func (api *API) SubmitHashRate(rate hexutil.Uint64, id common.Hash) bool

SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node.

It accepts the miner hash rate and an identifier which must be unique between nodes.

func (*API) SubmitWork

func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) bool

SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note either an invalid solution, a stale work a non-existent work will return false.

type PoIC

type PoIC struct {
	// contains filtered or unexported fields
}

func New

func New(config *params.PoICConfig, db ethdb.Database) *PoIC

New creates a PoIC

func (*PoIC) APIs

func (p *PoIC) APIs(chain consensus.ChainHeaderReader) []rpc.API

APIs implements consensus.Engine, returning the user facing RPC APIs.

func (*PoIC) Author

func (p *PoIC) Author(header *types.Header) (common.Address, error)

Author retrieves the Ethereum address of the account that minted the given block, which may be different from the header's coinbase if a consensus engine is based on signatures.

func (*PoIC) CalcDifficulty

func (p *PoIC) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have. TODO Treba staviti neko vreme

func (*PoIC) ClearTable

func (p *PoIC) ClearTable() error

func (*PoIC) Close

func (p *PoIC) Close() error

Close terminates any background threads maintained by the consensus engine.

func (*PoIC) CreateTableBinary

func (p *PoIC) CreateTableBinary(tableSize uint64) error

func (*PoIC) CreateTableBinarySuffix

func (p *PoIC) CreateTableBinarySuffix(tableSize uint64) error

KORISTIM OVU VERZIJU! creates table that only compares suffixes (the numbers in table are only suffixes not whole 64 bit numbers)

func (*PoIC) CreateTableSet

func (p *PoIC) CreateTableSet(tableSize uint64, numberOfTables uint64) error

creates a set of smaller tables with forks that are kept in tmp dir and mmaped the name of each table is tabela_{redBr}_{fork}_{widh}x{height}.csv if fork is 0, no fork is used

func (*PoIC) Finalize

func (p *PoIC) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body)

Finalize implements consensus.Engine, accumulating the block and uncle rewards. func (p *PoIC) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) {

func (*PoIC) FinalizeAndAssemble

func (p *PoIC) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, error)

FinalizeAndAssemble implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block. func (p *PoIC) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) {

func (*PoIC) FindKeyForHashMultiThread

func (p *PoIC) FindKeyForHashMultiThread(hashOfHeader *common.Hash, numOfBits uint64, stop <-chan struct{}) (*types.BlockNonce, error)

func (*PoIC) FindKeyForHashMultiThreadSuffix

func (p *PoIC) FindKeyForHashMultiThreadSuffix(hashOfHeader *common.Hash, numOfBits uint64, stop <-chan struct{}, foundExternal chan *types.Block) (*types.BlockNonce, error, *types.Block, uint64)

func (*PoIC) FindKeyForHashMultiThreadWholeTable

func (p *PoIC) FindKeyForHashMultiThreadWholeTable(hashOfHeader *common.Hash, numOfBits uint64, stop <-chan struct{}) (*types.BlockNonce, error)

func (*PoIC) GetCurrentRowBinary

func (p *PoIC) GetCurrentRowBinary(startPosition uint64, endPosition uint64) (key uint64, val uint64, newPosition uint64, err error)

func (*PoIC) GetTable

func (p *PoIC) GetTable() *TradeoffTable

func (*PoIC) Prepare

func (p *PoIC) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error

Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline. Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the ethash protocol. The changes are done inline.

func (*PoIC) Seal

func (p *PoIC) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

Seal generates a new block for the given input block with the local miner's seal place on top. samo rudarenje se desava Ovde

func (*PoIC) SealHash

func (ethash *PoIC) SealHash(header *types.Header) (hash common.Hash)

func (*PoIC) SearchRow

func (p *PoIC) SearchRow(value uint64, rows []uint64, numOfBits uint64) *uint64

func (*PoIC) SearchTableFoRows

func (p *PoIC) SearchTableFoRows(value uint64, numOfBits uint64, abort chan struct{}) ([]uint64, error)

func (*PoIC) VerifyEntrySuffix

func (p *PoIC) VerifyEntrySuffix(hashOfHeader *common.Hash, key uint64, numOfBits uint64) error

func (*PoIC) VerifyHeader

func (p *PoIC) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header) error

VerifyHeader checks whether a header conforms to the consensus rules of a given engine.

func (*PoIC) VerifyHeaders

func (p *PoIC) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header) (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 (the order is that of the input slice).

func (*PoIC) VerifySeal

func (p *PoIC) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error

VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.

func (*PoIC) VerifyUncles

func (p *PoIC) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.

type TradeoffTable

type TradeoffTable struct {
	// contains filtered or unexported fields
}

type TradeoffTablePartial

type TradeoffTablePartial struct {
	// contains filtered or unexported fields
}

type TradeoffTableSet

type TradeoffTableSet struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL