dexcon

package
v1.0.0-tan Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dexcon

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

Dexcon is a delegated proof-of-stake consensus engine.

func New

func New() *Dexcon

New creates a Clique proof-of-authority consensus engine with the initial signers set to the ones provided by the user.

func (*Dexcon) APIs

func (d *Dexcon) APIs(chain consensus.ChainReader) []rpc.API

APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.

func (*Dexcon) Author

func (d *Dexcon) Author(header *types.Header) (common.Address, error)

Author implements consensus.Engine, returning the Ethereum address recovered from the signature in the header's extra-data section.

func (*Dexcon) CalcDifficulty

func (d *Dexcon) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *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 (*Dexcon) Close

func (d *Dexcon) Close() error

Close implements consensus.Engine. It's a noop for clique as there is are no background threads.

func (*Dexcon) Finalize

func (d *Dexcon) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

Finalize implements consensus.Engine, ensuring no uncles are set, nor block rewards given, and returns the final block.

func (*Dexcon) Prepare

func (d *Dexcon) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.

func (*Dexcon) Seal

func (d *Dexcon) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

Seal implements consensus.Engine, attempting to create a sealed block using the local signing credentials.

func (*Dexcon) SealHash

func (d *Dexcon) SealHash(header *types.Header) (hash common.Hash)

SealHash returns the hash of a block prior to it being sealed.

func (*Dexcon) SetGovStateFetcher

func (d *Dexcon) SetGovStateFetcher(fetcher GovernanceStateFetcher)

SetGovStateFetcher sets the config fetcher for Dexcon. The reason this is not passed in the New() method is to bypass cycle dependencies when initializing dex backend.

func (*Dexcon) VerifyHeader

func (d *Dexcon) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

VerifyHeader checks whether a header conforms to the consensus rules.

func (*Dexcon) VerifyHeaders

func (d *Dexcon) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []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 (*Dexcon) VerifySeal

func (d *Dexcon) VerifySeal(chain consensus.ChainReader, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.

func (*Dexcon) VerifyUncles

func (d *Dexcon) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.

type FakeDexcon

type FakeDexcon struct {
	*Dexcon
	// contains filtered or unexported fields
}

func NewFaker

func NewFaker(nodes *NodeSet) *FakeDexcon

func (*FakeDexcon) Prepare

func (f *FakeDexcon) Prepare(chain consensus.ChainReader, header *types.Header) error

type GovernanceStateFetcher

type GovernanceStateFetcher interface {
	GetConfigState(round uint64) (*vm.GovernanceState, error)
	DKGSetNodeKeyAddresses(round uint64) (map[common.Address]struct{}, error)
}

type Node

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

func (*Node) Address

func (n *Node) Address() common.Address

func (*Node) CreateGovTx

func (n *Node) CreateGovTx(nonce uint64, data []byte) *types.Transaction

func (*Node) DKGFinalize

func (n *Node) DKGFinalize(round uint64) *coreTypesDKG.Finalize

func (*Node) DKGID

func (n *Node) DKGID() coreDKG.ID

func (*Node) DKGMPKReady

func (n *Node) DKGMPKReady(round uint64) *coreTypesDKG.MPKReady

func (*Node) ID

func (n *Node) ID() coreTypes.NodeID

func (*Node) MasterPublicKey

func (n *Node) MasterPublicKey(round uint64) *coreTypesDKG.MasterPublicKey

type NodeSet

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

func NewNodeSet

func NewNodeSet(round uint64, signedCRS []byte, signer types.Signer,
	privkeys []*ecdsa.PrivateKey) *NodeSet

func (*NodeSet) CRS

func (n *NodeSet) CRS(round uint64) common.Hash

func (*NodeSet) Nodes

func (n *NodeSet) Nodes(round uint64) []*Node

func (*NodeSet) Randomness

func (n *NodeSet) Randomness(round uint64, hash common.Hash) []byte

func (*NodeSet) RunDKG

func (n *NodeSet) RunDKG(round uint64, threshold int)

Assume All nodes in NodeSet are in DKG Set too.

func (*NodeSet) SignCRS

func (n *NodeSet) SignCRS(round uint64)

func (*NodeSet) SignedCRS

func (n *NodeSet) SignedCRS(round uint64) []byte

func (*NodeSet) TSig

func (n *NodeSet) TSig(round uint64, hash common.Hash) []byte

Jump to

Keyboard shortcuts

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