Documentation ¶
Index ¶
- func CreateBadEncodingProof(hash []byte, height uint64, errByzantine *ErrByzantine) fraud.Proof
- func ProtoToProof(protoProof *pb.MerkleProof) nmt.Proof
- type BadEncodingProof
- func (p *BadEncodingProof) HeaderHash() []byte
- func (p *BadEncodingProof) Height() uint64
- func (p *BadEncodingProof) MarshalBinary() ([]byte, error)
- func (p *BadEncodingProof) Type() fraud.ProofType
- func (p *BadEncodingProof) UnmarshalBinary(data []byte) error
- func (p *BadEncodingProof) Validate(header *header.ExtendedHeader) error
- type ErrByzantine
- type ShareWithProof
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBadEncodingProof ¶
func CreateBadEncodingProof( hash []byte, height uint64, errByzantine *ErrByzantine, ) fraud.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.
func ProtoToProof ¶
func ProtoToProof(protoProof *pb.MerkleProof) nmt.Proof
Types ¶
type BadEncodingProof ¶
type BadEncodingProof struct { BlockHeight uint64 // Shares that did not pass verification in rsmt2d will be nil. // For non-nil shares MerkleProofs are computed. Shares []*ShareWithProof // Index represents the row/col index where ErrByzantineRow/ErrByzantineColl occurred. Index uint32 // Axis represents the axis that verification failed on. Axis rsmt2d.Axis // contains filtered or unexported fields }
func (*BadEncodingProof) HeaderHash ¶
func (p *BadEncodingProof) HeaderHash() []byte
HeaderHash returns block hash.
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() fraud.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 ErrByzantine ¶
ErrByzantine is a thrown when recovered data square is not correct (merkle proofs do not match parity erasure-coding data).
It is converted from rsmt2d.ByzantineRow/Col + Merkle Proof for each share.
func NewErrByzantine ¶
func NewErrByzantine( ctx context.Context, bGetter blockservice.BlockGetter, dah *da.DataAvailabilityHeader, errByz *rsmt2d.ErrByzantineData, ) *ErrByzantine
NewErrByzantine creates new ErrByzantine from rsmt2d error. If error happens during proof collection, it terminates the process with os.Exit(1).
func (*ErrByzantine) Error ¶
func (e *ErrByzantine) Error() string
type ShareWithProof ¶
ShareWithProof contains data with corresponding Merkle Proof
func GetProofsForShares ¶
func GetProofsForShares( ctx context.Context, bGetter blockservice.BlockGetter, root cid.Cid, shares [][]byte, ) ([]*ShareWithProof, error)
GetProofsForShares fetches Merkle proofs for the given shares and returns the result as an array of ShareWithProof.
func NewShareWithProof ¶
func NewShareWithProof(index int, share share.Share, pathToLeaf []cid.Cid) *ShareWithProof
NewShareWithProof takes the given leaf and its path, starting from the tree root, and computes the nmt.Proof for it.
func ProtoToShare ¶
func ProtoToShare(protoShares []*pb.Share) []*ShareWithProof
func (*ShareWithProof) ShareWithProofToProto ¶
func (s *ShareWithProof) ShareWithProofToProto() *pb.Share
func (*ShareWithProof) Validate ¶
func (s *ShareWithProof) Validate(root cid.Cid) bool
Validate validates inclusion of the share under the given root CID.