Documentation ¶
Index ¶
- func GetMagicBytes() [32]byte
- type BlockMerkleRoot
- type Bytes
- type Commitment
- type FeeInfo
- type Header
- type HotShotBlockMerkleProof
- type L1BlockInfo
- type NamespaceProof
- type NsTable
- type RawCommitmentBuilder
- func (b *RawCommitmentBuilder) ConstantString(s string) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) Field(f string, c Commitment) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) Finalize() Commitment
- func (b *RawCommitmentBuilder) FixedSizeBytes(bytes Bytes) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) FixedSizeField(f string, bytes Bytes) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) OptionalField(f string, c *Commitment) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) Uint256(n *U256) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) Uint256Field(f string, n *U256) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) Uint64(n uint64) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) Uint64Field(f string, n uint64) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) VarSizeBytes(bytes Bytes) *RawCommitmentBuilder
- func (b *RawCommitmentBuilder) VarSizeField(f string, bytes Bytes) *RawCommitmentBuilder
- type TaggedBase64
- type Transaction
- type U256
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMagicBytes ¶ added in v0.0.9
func GetMagicBytes() [32]byte
Types ¶
type BlockMerkleRoot ¶ added in v0.0.10
type BlockMerkleRoot = Commitment
type Bytes ¶
type Bytes []byte
A bytes type which serializes to JSON as an array, rather than a base64 string. This ensures compatibility with the Espresso APIs.
func (Bytes) MarshalJSON ¶
func (*Bytes) UnmarshalJSON ¶
type Commitment ¶
type Commitment [32]byte
func CommitmentFromUint256 ¶
func CommitmentFromUint256(n *U256) (Commitment, error)
func (Commitment) Equals ¶
func (c Commitment) Equals(other Commitment) bool
func (Commitment) Uint256 ¶
func (c Commitment) Uint256() *U256
type FeeInfo ¶ added in v0.0.7
func (*FeeInfo) Commit ¶ added in v0.0.7
func (self *FeeInfo) Commit() Commitment
type Header ¶
type Header struct { Height uint64 `json:"height"` Timestamp uint64 `json:"timestamp"` L1Head uint64 `json:"l1_head"` L1Finalized *L1BlockInfo `json:"l1_finalized" rlp:"nil"` NsTable *NsTable `json:"ns_table"` PayloadCommitment *TaggedBase64 `json:"payload_commitment"` BlockMerkleTreeRoot *TaggedBase64 `json:"block_merkle_tree_root"` FeeMerkleTreeRoot *TaggedBase64 `json:"fee_merkle_tree_root"` FeeInfo *FeeInfo `json:"fee_info"` }
func (*Header) Commit ¶
func (self *Header) Commit() Commitment
func (*Header) UnmarshalJSON ¶
type HotShotBlockMerkleProof ¶ added in v0.0.10
type HotShotBlockMerkleProof json.RawMessage
func (*HotShotBlockMerkleProof) Verify ¶ added in v0.0.10
func (p *HotShotBlockMerkleProof) Verify(root BlockMerkleRoot) (uint64, error)
Validates a block merkle proof, returning the validated HotShot block height. This is mocked until we have real merkle tree snapshot support.
type L1BlockInfo ¶
type L1BlockInfo struct { Number uint64 `json:"number"` Timestamp U256 `json:"timestamp"` Hash common.Hash `json:"hash"` }
func (*L1BlockInfo) Commit ¶
func (self *L1BlockInfo) Commit() Commitment
func (*L1BlockInfo) UnmarshalJSON ¶
func (i *L1BlockInfo) UnmarshalJSON(b []byte) error
type NamespaceProof ¶ added in v0.0.6
type NamespaceProof = json.RawMessage
type NsTable ¶ added in v0.0.6
type NsTable struct {
Bytes Bytes `json:"bytes"`
}
func (*NsTable) Commit ¶ added in v0.0.6
func (self *NsTable) Commit() Commitment
func (*NsTable) UnmarshalJSON ¶ added in v0.0.6
type RawCommitmentBuilder ¶
type RawCommitmentBuilder struct {
// contains filtered or unexported fields
}
func NewRawCommitmentBuilder ¶
func NewRawCommitmentBuilder(name string) *RawCommitmentBuilder
func (*RawCommitmentBuilder) ConstantString ¶
func (b *RawCommitmentBuilder) ConstantString(s string) *RawCommitmentBuilder
Append a constant string to the running hash.
WARNING: The string `s` must be a constant. This function does not encode the length of `s` in the hash, which can lead to domain collisions when different strings with different lengths are used depending on the input object.
func (*RawCommitmentBuilder) Field ¶
func (b *RawCommitmentBuilder) Field(f string, c Commitment) *RawCommitmentBuilder
Include a named field of another committable type.
func (*RawCommitmentBuilder) Finalize ¶
func (b *RawCommitmentBuilder) Finalize() Commitment
func (*RawCommitmentBuilder) FixedSizeBytes ¶
func (b *RawCommitmentBuilder) FixedSizeBytes(bytes Bytes) *RawCommitmentBuilder
Append a fixed size byte array to the running hash.
WARNING: Go's type system cannot express the requirement that `bytes` is a fixed size array of any size. The best we can do is take a dynamically sized slice. However, this function uses a fixed-size encoding; namely, it does not encode the length of `bytes` in the hash, which can lead to domain collisions when this function is called with a slice which can have different lengths depending on the input object.
The caller must ensure that this function is only used with slices whose length is statically determined by the type being committed to.
func (*RawCommitmentBuilder) FixedSizeField ¶
func (b *RawCommitmentBuilder) FixedSizeField(f string, bytes Bytes) *RawCommitmentBuilder
Include a named field of fixed length in the hash.
WARNING: Go's type system cannot express the requirement that `bytes` is a fixed size array of any size. The best we can do is take a dynamically sized slice. However, this function uses a fixed-size encoding; namely, it does not encode the length of `bytes` in the hash, which can lead to domain collisions when this function is called with a slice which can have different lengths depending on the input object.
The caller must ensure that this function is only used with slices whose length is statically determined by the type being committed to.
func (*RawCommitmentBuilder) OptionalField ¶
func (b *RawCommitmentBuilder) OptionalField(f string, c *Commitment) *RawCommitmentBuilder
func (*RawCommitmentBuilder) Uint256 ¶
func (b *RawCommitmentBuilder) Uint256(n *U256) *RawCommitmentBuilder
Include a value of type `uint256` in the hash.
func (*RawCommitmentBuilder) Uint256Field ¶
func (b *RawCommitmentBuilder) Uint256Field(f string, n *U256) *RawCommitmentBuilder
Include a named field of type `uint256` in the hash.
func (*RawCommitmentBuilder) Uint64 ¶
func (b *RawCommitmentBuilder) Uint64(n uint64) *RawCommitmentBuilder
Include a value of type `uint64` in the hash.
func (*RawCommitmentBuilder) Uint64Field ¶
func (b *RawCommitmentBuilder) Uint64Field(f string, n uint64) *RawCommitmentBuilder
Include a named field of type `uint64` in the hash.
func (*RawCommitmentBuilder) VarSizeBytes ¶
func (b *RawCommitmentBuilder) VarSizeBytes(bytes Bytes) *RawCommitmentBuilder
Include a byte array whose length can be dynamic to the running hash.
func (*RawCommitmentBuilder) VarSizeField ¶
func (b *RawCommitmentBuilder) VarSizeField(f string, bytes Bytes) *RawCommitmentBuilder
Include a named field of dynamic length in the hash.
type TaggedBase64 ¶ added in v0.0.4
type TaggedBase64 = tagged_base64.TaggedBase64
type Transaction ¶
func (*Transaction) Commit ¶ added in v0.0.10
func (self *Transaction) Commit() Commitment
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(b []byte) error
type U256 ¶
A BigInt type which serializes to JSON a a hex string. This ensures compatibility with the Espresso APIs.