blobsubmission

package
v0.0.0-...-50d4516 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalStream

func EvalStream(stream []byte, x_ []byte) (fr381.Element, error)

Cast the list of the field into a vector of field elements and performs a polynomial evaluation in the scalar field of BLS12-381. The bytes are split in chunks of 31 bytes representing each a field element in bigendian order. The last chunk is padded to the right with zeroes. The input x is taken as an array of 32 bytes because the smart-contract generating it will be using the result of the keccak directly. The modular reduction is implicitly done during the evaluation of the compressed data polynomial representation.

Types

type ConflationOrder

type ConflationOrder struct {
	StartingBlockNumber int   `json:"startingBlockNumber"`
	UpperBoundaries     []int `json:"upperBoundaries"`
}

func (*ConflationOrder) Range

func (order *ConflationOrder) Range() (start, end int)

type Request

type Request struct {

	// If true, eip4844. If false or not defined, legacy calldata
	Eip4844Enabled bool `json:"eip4844Enabled"`

	// The compressed data in base64 string
	CompressedData string `json:"compressedData"`

	// Parent data hash: the hash of the compressed data that were last
	// submitted and following which we are submitted CompressedData.
	DataParentHash string `json:"dataParentHash"`

	// Conflation order
	ConflationOrder ConflationOrder `json:"conflationOrder"`
	// The parent zkRootHash for the sucession of blocks. In hexstring.
	ParentStateRootHash string `json:"parentStateRootHash"`
	// The new state root hash
	FinalStateRootHash string `json:"finalStateRootHash"`

	// The previous shnarf
	PrevShnarf string `json:"prevShnarf"`
}

Output of the compression prover

type Response

type Response struct {

	// If true, eip4844. If false or not defined, legacy calldata
	Eip4844Enabled bool `json:"eip4844Enabled"`

	// BlobHash (VersionedHash): Hash of the compressed data
	DataHash string `json:"dataHash"`
	// Blob: compressed data in base64 string
	CompressedData string `json:"compressedData"` // kzg4844.Blob [131072]byte

	// The KZG commitment of the blob-data
	Commitment string `json:"commitment"` // kzg4844.Commitment [48]byte
	// The KZG proof for the blob data consistency check
	KzgProofContract string `json:"kzgProofContract"` // kzg4844.Proof [48]byte
	// The KZG proof for the blob sidecar in the blob tx
	KzgProofSidecar string `json:"kzgProofSidecar"` // kzg4844.Proof [48]byte

	// The expected value of X and Y from the prover's perspective. In hexstring
	// as a field element on the BLS12 field.
	ExpectedX string `json:"expectedX"` //ExpectedX kzg4844.Point [32]byte
	ExpectedY string `json:"expectedY"` //ExpectedY kzg4844.Claim [32]byte

	// The Snark friendly hash of the inputs
	SnarkHash string `json:"snarkHash"`

	// Conflation order
	ConflationOrder ConflationOrder `json:"conflationOrder"`
	// (parentZkRootHash) The parent zkRootHash for the sucession of blocks. In hexstring.
	ParentStateRootHash string `json:"parentStateRootHash"`
	// (newStateRootHash) The last root hash after executing all the blocks in the blob.
	FinalStateRootHash string `json:"finalStateRootHash"`
	// Parent data hash. Namely, the hash of the blob of compressed data that
	// were last submitted.
	DataParentHash string `json:"parentDataHash"`
	// The expected value of the shnarf (or super-hash) that we expect the
	// contract to recover. In hexstring.
	ExpectedShnarf string `json:"expectedShnarf"`
	// The shnarf upon which we are towering the current blob.
	PrevShnarf string `json:"prevShnarf"`
}

func CraftResponse

func CraftResponse(req *Request) (*Response, error)

Prepare a response object by computing all the fields except for the proof.

func CraftResponseCalldata

func CraftResponseCalldata(req *Request) (*Response, error)

Prepare a response object by computing all the fields except for the proof.

type Shnarf

type Shnarf struct {
	OldShnarf, SnarkHash, NewStateRootHash []byte
	X                                      []byte
	Y                                      fr381.Element
	Hash                                   hash.Hash
}

schnarfParts wrap the arguments needed to create a new Shnarf by calling the NewSchnarf() function.

func (*Shnarf) Compute

func (s *Shnarf) Compute() []byte

Compute returns the new shnarf given, the old shnarf, the snark hash, the new state root hash, the x and the y in that order. All over 32 bytes.

Jump to

Keyboard shortcuts

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