abci

package
v0.5.0-dev.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

README

ABCI

The ABCI package of the SEDA Chain implements the CometBFT ABCI++ interface to support batch signing. Once a new batch is created at block height H, the following sequence begins:

  1. ExtendVote at H+1 - Batch Signing
    • Validators sign the batch using the secp256k1 signature scheme and include their signatures in their pre-commit votes.
  2. VerifyVoteExtension at H+1 - Batch Signature Verification
    • Upon receiving a pre-commit vote with a batch signature, the validator checks the signature against the batch in the store and the corresponding public key registered in the pubkey module. The vote is only accepted if the signature verification succeeds.
  3. PrepareProposal at H+2 - Injecting Vote Extensions in Proposal
    • When the proposer at block H+1 proposes a canonical set of votes for the block H, it also injects the votes’ extended data in the proposal so that a canonical set of batch signatures also become available to all validators.
  4. ProcessProposal at H+2 - Batch Signatures Validation
    • The proposed canonical set of batch signatures is checked to ensure that more than 2/3 of voting power according to the previous block’s validator set has signed the batch.
  5. PreBlock at H+2 - Batch Signatures Persistence
    • It is run at the beginning of FinalizeBlock ABCI call to store the fully-populated batch in the batching module store.

Documentation

Index

Constants

View Source
const (
	// BlockOffsetSign is the block height difference between the batch
	// signing phase and the corresponding batch's creation height.
	// The signing phase consists of ExtendVote and VerifyVoteExtension.
	BlockOffsetSignPhase = -1

	// BlockOffsetCollectPhase is the block height difference between the
	// batch signature collection phase and the corresponding batch's
	// creation height. The collection phase spans PrepareProposal,
	// ProcessProposal, and PreBlock to store a canonical set of batch
	// signatures.
	BlockOffsetCollectPhase = -2

	// MaxVoteExtensionLength is the maximum size of vote extension in
	// bytes.
	MaxVoteExtensionLength = 65 * 5
)
View Source
const ModuleName = "vote_extension"

Variables

View Source
var (
	ErrNoBatchForCurrentHeight      = errors.Register(ModuleName, 2, "no batch found for current height")
	ErrInvalidVoteExtensionLength   = errors.Register(ModuleName, 3, "invalid vote extension length")
	ErrVoteExtensionInjectionTooBig = errors.Register(ModuleName, 4, "injected vote extensions are too big")
	ErrInvalidBatchSignature        = errors.Register(ModuleName, 5, "batch signature is invalid")
	ErrUnexpectedBatchSignature     = errors.Register(ModuleName, 6, "batch signature should be empty")
)

Functions

This section is empty.

Types

type BatchingKeeper

type BatchingKeeper interface {
	GetBatchForHeight(ctx context.Context, height int64) (batchingtypes.Batch, error)
	SetBatchSigSecp256k1(ctx context.Context, batchNum uint64, valAddr sdk.ValAddress, signature []byte) error
	GetValidatorTreeEntry(ctx context.Context, batchNum uint64, valAddr sdk.ValAddress) (batchingtypes.ValidatorTreeEntry, error)
}

type Handlers

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

func (*Handlers) ExtendVoteHandler

func (h *Handlers) ExtendVoteHandler() sdk.ExtendVoteHandler

ExtendVoteHandler handles the ExtendVote ABCI to sign a batch created from the previous block.

func (*Handlers) PreBlocker

func (h *Handlers) PreBlocker() sdk.PreBlocker

PreBlocker runs before BeginBlocker to extract the batch signatures from the canonical set of vote extensions injected by the proposer and store them.

func (*Handlers) PrepareProposalHandler

func (h *Handlers) PrepareProposalHandler() sdk.PrepareProposalHandler

PrepareProposalHandler handles the PrepareProposal ABCI to inject a canonical set of vote extensions in the proposal.

func (*Handlers) ProcessProposalHandler

func (h *Handlers) ProcessProposalHandler() sdk.ProcessProposalHandler

ProcessProposalHandler handles the ProcessProposal ABCI to validate the canonical set of vote extensions injected by the proposer.

func (*Handlers) VerifyVoteExtensionHandler

func (h *Handlers) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler

VerifyVoteExtensionHandler handles the VerifyVoteExtension ABCI to verify the batch signature included in the pre-commit vote against the public key registered in the pubkey module.

type PubKeyKeeper

type PubKeyKeeper interface {
	GetValidatorKeys(ctx context.Context, validatorAddr string) (result pubkeytypes.ValidatorPubKeys, err error)
	GetValidatorKeyAtIndex(ctx context.Context, validatorAddr sdk.ValAddress, index utils.SEDAKeyIndex) ([]byte, error)
}

type StakingKeeper

type StakingKeeper interface {
	baseapp.ValidatorStore
	GetValidator(ctx context.Context, addr sdk.ValAddress) (stakingtypes.Validator, error)
	GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (stakingtypes.Validator, error)
}

Directories

Path Synopsis
Package testutil is a generated GoMock package.
Package testutil is a generated GoMock package.

Jump to

Keyboard shortcuts

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