fraud

package
v0.3.1-dirty Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadEncodingProof

type BadEncodingProof struct {
	BlockHeight uint64
	// ShareWithProof contains all shares from row or col.
	// Shares that did not pass verification in rmst2d will be nil.
	// For non-nil shares MerkleProofs are computed.
	Shares []*ipld.ShareWithProof
	// Index represents the row/col index where ErrByzantineRow/ErrByzantineColl occurred
	Index uint8
	// contains filtered or unexported fields
}

func (*BadEncodingProof) Height

func (p *BadEncodingProof) Height() uint64

Height returns block height

func (*BadEncodingProof) MarshalBinary

func (p *BadEncodingProof) MarshalBinary() ([]byte, error)

MarshalBinary converts BadEncodingProof to binary

func (*BadEncodingProof) Type

func (p *BadEncodingProof) Type() ProofType

Type returns type of fraud proof

func (*BadEncodingProof) UnmarshalBinary

func (p *BadEncodingProof) UnmarshalBinary(data []byte) error

UnmarshalBinary converts binary to BadEncodingProof

func (*BadEncodingProof) Validate

func (p *BadEncodingProof) Validate(header *header.ExtendedHeader) error

Validate ensures that fraud proof is correct. Validate checks that provided Merkle Proofs correspond to the shares, rebuilds bad row or col from received shares, computes Merkle Root and compares it with block's Merkle Root.

type Proof

type Proof interface {
	// Type returns the exact type of fraud proof
	Type() ProofType
	// Height returns the block height corresponding to the Proof
	Height() uint64
	// Validate check the validity of fraud proof.
	// Validate throws an error if some conditions don't pass and thus fraud proof is not valid
	// NOTE: header.ExtendedHeader should pass basic validation otherwise it will panic if it's malformed
	Validate(*header.ExtendedHeader) error

	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

Proof is a generic interface that will be used for all types of fraud proofs in the network.

func CreateBadEncodingProof

func CreateBadEncodingProof(
	height uint64,
	errByzantine *ipld.ErrByzantine,
) Proof

CreateBadEncodingProof creates a new Bad Encoding Fraud Proof that should be propagated through network The fraud proof will contain shares that did not pass verification and their relevant Merkle proofs.

type ProofType

type ProofType int
const (
	BadEncoding ProofType = iota
)

func (ProofType) String added in v0.7.0

func (p ProofType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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