matrix

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidMaxLen            = errors.New("invalid max length to absorb")
	ErrIncorrectCommitmentCount = errors.New("incorrect number of commitments for input length")
	ErrValid                    = errors.New("state commitments are valid")
)

Functions

func Challenge

func Challenge(data io.Reader, commitments []common.Hash) (types.Challenge, error)

Challenge creates a types.Challenge to invalidate the provided preimage data if possible. ErrValid is returned if the provided inputs are valid and no challenge can be created.

Types

type StateMatrix

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

StateMatrix implements a stateful keccak sponge with the ability to create state commitments after each permutation

func NewStateMatrix

func NewStateMatrix() *StateMatrix

NewStateMatrix creates a new state matrix initialized with the initial, zero keccak block.

func (*StateMatrix) AbsorbUpTo

func (d *StateMatrix) AbsorbUpTo(in io.Reader, maxLen int) (types.InputData, error)

func (*StateMatrix) Hash

func (d *StateMatrix) Hash() (h common.Hash)

Hash finalizes the keccak permutation and returns the final hash. No further leaves can be absorbed after this is called

func (*StateMatrix) PoststateWithProof

func (d *StateMatrix) PoststateWithProof() (types.Leaf, merkle.Proof)

PoststateWithProof returns the poststate leaf with its merkle proof.

func (*StateMatrix) PrestateMatrix added in v1.5.1

func (d *StateMatrix) PrestateMatrix() types.StateSnapshot

func (*StateMatrix) PrestateWithProof

func (d *StateMatrix) PrestateWithProof() (types.Leaf, merkle.Proof)

PrestateWithProof returns the prestate leaf with its merkle proof.

func (*StateMatrix) StateCommitment

func (d *StateMatrix) StateCommitment() common.Hash

StateCommitment returns the state commitment for the current state matrix. Additional data may be absorbed after calling this method.

func (*StateMatrix) StateSnapshot

func (d *StateMatrix) StateSnapshot() types.StateSnapshot

Jump to

Keyboard shortcuts

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