keyshare

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LaneName defines the name of the free lane.
	LaneName = "keyshare"
)

Variables

This section is empty.

Functions

func GetAggregateKeyshareMsgFromTx

func GetAggregateKeyshareMsgFromTx(tx sdk.Tx) (*types.MsgCreateAggregatedKeyShare, error)

func TxPriority

func TxPriority(config Factory) blockbuster.TxPriority[string]

TxPriority returns a TxPriority over AggregatedKeyShare transactions only. It is to be used in the AggregatedKeyShare index only.

Types

type DefaultKeyshareFactory

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

DefaultKeyshareFactory defines a default implmentation for the keyshare factory interface for processing aggregate keyshare transactions.

func (*DefaultKeyshareFactory) GetKeyShareInfo

func (config *DefaultKeyshareFactory) GetKeyShareInfo(tx sdk.Tx) (*types.AggregatedKeyShare, error)

func (*DefaultKeyshareFactory) IsKeyshareTx

func (config *DefaultKeyshareFactory) IsKeyshareTx(tx sdk.Tx) bool

type Factory

type Factory interface {
	// IsKeyshareTx defines a function that checks if a transaction qualifies as AggregateKeyshare Tx.
	IsKeyshareTx(tx sdk.Tx) bool

	// GetKeyShareInfo defines a function that returns the Aggregated KeyShare info from the Tx
	GetKeyShareInfo(tx sdk.Tx) (*types.AggregatedKeyShare, error)
}

Factory defines the interface for processing AggregateKeyShare transactions. It is a wrapper around all of the functionality that each application chain must implement in order for Aggregated keyshare processing to work.

func NewDefaultKeyshareFactory

func NewDefaultKeyshareFactory(txDecoder sdk.TxDecoder) Factory

NewDefaultKeyshareFactory returns a default keyshare factory interface implementation.

type KeyShareLane

type KeyShareLane struct {
	// Mempool defines the mempool for the lane.
	Mempool

	// LaneConfig defines the base lane configuration.
	*base.DefaultLane

	// Factory defines the API/functionality which is responsible for determining
	// if a transaction is a aggregateKeyshare transaction and how to extract relevant
	// information from the transaction (creator Address).
	Factory
}

KeyShareLane defines the lane that is responsible for processing AggregateKeyShare transactions.

func NewKeyShareLane

func NewKeyShareLane(
	cfg blockbuster.BaseLaneConfig,
	maxTx int,
	af Factory,
) *KeyShareLane

NewKeyShareLane returns a new KeyShare lane.

func (*KeyShareLane) Match

func (l *KeyShareLane) Match(tx sdk.Tx) bool

Match returns true if the transaction is a aated keyshareggreg transaction. This is determined by the KeyShareFactory.

func (*KeyShareLane) Name

func (l *KeyShareLane) Name() string

Name returns the name of the lane.

func (*KeyShareLane) PrepareLane

PrepareLane will attempt to select the keyshare transactions that are valid and include them in the proposal. It will return an empty partial proposal if no valid keyshare transactions are found.

func (*KeyShareLane) ProcessLane

func (l *KeyShareLane) ProcessLane(ctx sdk.Context, txs []sdk.Tx, next blockbuster.ProcessLanesHandler) (sdk.Context, error)

ProcessLane will ensure that block proposals that include transactions from the keyshare lane are valid.

func (*KeyShareLane) ProcessLaneBasic

func (l *KeyShareLane) ProcessLaneBasic(txs []sdk.Tx) error

ProcessLaneBasic ensures that if keyshare transactions are present in a proposal,

  • they are the first transaction in the partial proposal
  • there are no other aggregate keyshare transactions in the proposal

func (*KeyShareLane) VerifyTx

func (l *KeyShareLane) VerifyTx(ctx sdk.Context, keyshareTx sdk.Tx) error

VerifyTx will verify that the keyshare transaction is valid. It will return an error if the transaction is invalid.

type KeyShareMempool

type KeyShareMempool struct {

	// Factory implements the functionality required to process AggregateKeyshare transactions.
	Factory
	// contains filtered or unexported fields
}

KeyShareMempool defines an KeyShare mempool. It can be seen as an extension of an SDK PriorityNonceMempool, i.e. a mempool that supports <sender, nonce> two-dimensional priority ordering, with the additional support of prioritizing and indexing submitted aggregated keyshares.

func NewMempool

func NewMempool(txEncoder sdk.TxEncoder, maxTx int, config Factory) *KeyShareMempool

NewMempool returns a new AggregateKeyShare mempool.

func (*KeyShareMempool) Contains

func (am *KeyShareMempool) Contains(tx sdk.Tx) (bool, error)

Contains returns true if the transaction is contained in the mempool.

func (*KeyShareMempool) CountTx

func (am *KeyShareMempool) CountTx() int

func (*KeyShareMempool) Insert

func (am *KeyShareMempool) Insert(ctx context.Context, tx sdk.Tx) error

Insert inserts a transaction into the KeyShare mempool.

func (*KeyShareMempool) Remove

func (am *KeyShareMempool) Remove(tx sdk.Tx) error

Remove removes a transaction from the mempool based.

func (*KeyShareMempool) Select

func (am *KeyShareMempool) Select(ctx context.Context, txs [][]byte) sdkmempool.Iterator

type Mempool

type Mempool interface {
	sdkmempool.Mempool

	// Contains returns true if the transaction is contained in the mempool.
	Contains(tx sdk.Tx) (bool, error)
}

Mempool defines the interface of the keyshare mempool.

type TxWithTimeoutHeight

type TxWithTimeoutHeight interface {
	sdk.Tx

	GetTimeoutHeight() uint64
}

TxWithTimeoutHeight is used to extract timeouts from sdk.Tx transactions. In the case where, timeouts are explicitly set on the sdk.Tx, we can use this interface to extract the timeout.

Jump to

Keyboard shortcuts

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