hemi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderVersion1       = 1
	HeaderSize           = 73 // XXX rename
	KeystoneHeaderPeriod = 25 // XXX debate and set

	OldHeaderSize = 65

	HEMIBase = 1000000000000000000
)
View Source
const (
	L2KeystoneAbrevVersion uint8 = 1
	L2KeystoneAbrevSize          = 76
)

L2KeystoneVersion designates hwta version of the L2 keystone we are using.

Variables

This section is empty.

Functions

func HashSerializedL2KeystoneAbrev

func HashSerializedL2KeystoneAbrev(s []byte) []byte

Types

type Header struct {
	Version            uint8    // 0:1
	BlockNumber        uint32   // 1:5
	ParentEPHash       [12]byte // 5:17
	PrevKeystoneEPHash [12]byte // 17:29
	StateRoot          [32]byte // 29:61
	EPHash             [12]byte // 61:73
}

XXX Header should be renamed to L2KeystoneAbrev

func Genesis

func Genesis() *Header

func NewHeaderFromBytes

func NewHeaderFromBytes(b []byte) (*Header, error)

func (*Header) Dump

func (h *Header) Dump(w io.Writer)

func (*Header) Hash

func (h *Header) Hash() []byte

func (*Header) Serialize

func (h *Header) Serialize() RawHeader

type L2BTCFinality

type L2BTCFinality struct {
	L2Keystone       L2Keystone    `json:"l2_keystone"`
	BTCPubHeight     int64         `json:"btc_pub_height"`
	BTCPubHeaderHash api.ByteSlice `json:"btc_pub_header_hash"`
	BTCFinality      int32         `json:"btc_finality"`
}

func L2BTCFinalityFromBfgd

func L2BTCFinalityFromBfgd(l2BtcFinality *bfgd.L2BTCFinality, currentBTCHeight uint32, effectiveHeight uint32) (*L2BTCFinality, error)

type L2Keystone

type L2Keystone struct {
	Version            uint8         `json:"version"`
	L1BlockNumber      uint32        `json:"l1_block_number"`
	L2BlockNumber      uint32        `json:"l2_block_number"`
	ParentEPHash       api.ByteSlice `json:"parent_ep_hash"`
	PrevKeystoneEPHash api.ByteSlice `json:"prev_ep_keystone_hash"`
	StateRoot          api.ByteSlice `json:"state_root"`
	EPHash             api.ByteSlice `json:"ep_hash"`
}

L2Keystone is the wire format of a keystone that is shared among several daemons.

type L2KeystoneAbrev

type L2KeystoneAbrev struct {
	Version            uint8    // [0:1]
	L1BlockNumber      uint32   // [1:5]
	L2BlockNumber      uint32   // [5:9]
	ParentEPHash       [11]byte // [9:20]
	PrevKeystoneEPHash [12]byte // [20:32]
	StateRoot          [32]byte // [32:64]
	EPHash             [12]byte // [64:76]
}

L2KeystoneAbrev is the abbreviated format of an L2Keystone. It simply clips various hashes to a shorter version.

func L2KeystoneAbbreviate

func L2KeystoneAbbreviate(l2ks L2Keystone) *L2KeystoneAbrev

func L2KeystoneAbrevDeserialize

func L2KeystoneAbrevDeserialize(r RawAbreviatedL2Keystone) *L2KeystoneAbrev

func NewL2KeystoneAbrevFromBytes

func NewL2KeystoneAbrevFromBytes(b []byte) (*L2KeystoneAbrev, error)

func (*L2KeystoneAbrev) Dump

func (a *L2KeystoneAbrev) Dump(w io.Writer)

func (*L2KeystoneAbrev) Hash

func (a *L2KeystoneAbrev) Hash() []byte

func (*L2KeystoneAbrev) Serialize

type RawAbreviatedL2Keystone

type RawAbreviatedL2Keystone [L2KeystoneAbrevSize]byte

type RawHeader

type RawHeader [HeaderSize]byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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