types

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pending CertificateStatus = iota
	Proven
	Candidate
	InError
	Settled

	EstimatedAggchainProofSize      = 10 * aggkitcommon.KB
	EstimatedAggchainSignatureSize  = 0.07 * aggkitcommon.KB
	EstimatedBridgeExitSize         = 0.09 * aggkitcommon.KB
	EstimatedImportedBridgeExitSize = 2.8 * aggkitcommon.KB

	// GlobalIndexBytesSize denotes the size in bytes when global index gets encoded
	GlobalIndexBytesSize = 9
)

Variables

View Source
var (
	NonSettledStatuses = []CertificateStatus{Pending, Candidate, Proven}
	ClosedStatuses     = []CertificateStatus{Settled, InError}
)

Functions

This section is empty.

Types

type AggchainData

type AggchainData interface {
	json.Marshaler
	json.Unmarshaler
}

type AggchainDataMultisig added in v0.7.0

type AggchainDataMultisig struct {
	Multisig *Multisig `json:"multisig"`
}

AggchainDataMultisig is the data structure that will hold the multisig information for PP networks

func (*AggchainDataMultisig) MarshalJSON added in v0.7.0

func (a *AggchainDataMultisig) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*AggchainDataMultisig) UnmarshalJSON added in v0.7.0

func (a *AggchainDataMultisig) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type AggchainDataMultisigWithProof added in v0.7.0

type AggchainDataMultisigWithProof struct {
	Multisig      *Multisig          `json:"multisig"`
	AggchainProof *AggchainDataProof `json:"aggchain_proof"`
}

AggchainDataMultisigWithProof is the data structure that will hold the multisig and aggchain proof information for FEP networks

func (*AggchainDataMultisigWithProof) MarshalJSON added in v0.7.0

func (a *AggchainDataMultisigWithProof) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*AggchainDataMultisigWithProof) UnmarshalJSON added in v0.7.0

func (a *AggchainDataMultisigWithProof) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type AggchainDataProof

type AggchainDataProof struct {
	Proof          []byte            `json:"proof"`
	Version        string            `json:"version"`
	Vkey           []byte            `json:"vkey"`
	AggchainParams common.Hash       `json:"aggchain_params"`
	Context        map[string][]byte `json:"context"`
	Signature      []byte            `json:"signature"`
}

AggchainDataProof is the data structure that will hold the proof of the certificate This is used in the aggchain prover path

func (*AggchainDataProof) MarshalJSON

func (a *AggchainDataProof) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*AggchainDataProof) UnmarshalJSON

func (a *AggchainDataProof) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type AggchainDataSelector

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

AggchainDataSelector is a helper struct that allow to decice which type of aggchain data to unmarshal

func (*AggchainDataSelector) GetObject

func (a *AggchainDataSelector) GetObject() AggchainData

func (*AggchainDataSelector) UnmarshalJSON

func (a *AggchainDataSelector) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type AggchainDataSignature

type AggchainDataSignature struct {
	Signature []byte `json:"signature"`
}

AggchainDataSignature is the data structure that will hold the signature of the aggsender key that signed the certificate This is used in the regular PP path

func (*AggchainDataSignature) MarshalJSON

func (a *AggchainDataSignature) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*AggchainDataSignature) UnmarshalJSON

func (a *AggchainDataSignature) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type BridgeExit

type BridgeExit struct {
	LeafType           bridgetypes.LeafType `json:"leaf_type"`
	TokenInfo          *TokenInfo           `json:"token_info"`
	DestinationNetwork uint32               `json:"dest_network"`
	DestinationAddress common.Address       `json:"dest_address"`
	Amount             *big.Int             `json:"amount"`
	Metadata           []byte               `json:"metadata"`
}

BridgeExit represents a token bridge exit

func (*BridgeExit) Hash

func (b *BridgeExit) Hash() common.Hash

Hash returns a hash that uniquely identifies the bridge exit

func (*BridgeExit) MarshalJSON

func (b *BridgeExit) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*BridgeExit) String

func (b *BridgeExit) String() string

func (*BridgeExit) UnmarshalJSON

func (b *BridgeExit) UnmarshalJSON(data []byte) error

func (*BridgeExit) Validate added in v0.7.0

func (b *BridgeExit) Validate() error

type Certificate

type Certificate struct {
	NetworkID           uint32                `json:"network_id"`
	Height              uint64                `json:"height"`
	PrevLocalExitRoot   common.Hash           `json:"prev_local_exit_root"`
	NewLocalExitRoot    common.Hash           `json:"new_local_exit_root"`
	BridgeExits         []*BridgeExit         `json:"bridge_exits"`
	ImportedBridgeExits []*ImportedBridgeExit `json:"imported_bridge_exits"`
	CustomChainData     []byte                `json:"custom_chain_data,omitempty"`
	AggchainData        AggchainData          `json:"aggchain_data,omitempty"`
	L1InfoTreeLeafCount uint32                `json:"l1_info_tree_leaf_count,omitempty"`
}

Certificate is the data structure that will be sent to the agglayer

func (*Certificate) Brief

func (c *Certificate) Brief() string

Brief returns a string with a brief cert

func (*Certificate) CertificateID added in v0.7.0

func (c *Certificate) CertificateID() common.Hash

CertificateID returns a certificateID that identifies the certificate next fields are not included: CustomChainData, AggchainData, L1InfoTreeLeafCount

func (*Certificate) ExtractAggchainParams added in v0.7.0

func (c *Certificate) ExtractAggchainParams() []byte

ExtractAggchainParams extracts the aggchain params field from the certificate with handling different types of aggchain data.

func (*Certificate) ID

func (c *Certificate) ID() string

ID returns a string with the ident of this cert (height/certID)

func (*Certificate) UnmarshalJSON

func (c *Certificate) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

func (*Certificate) Validate added in v0.7.0

func (c *Certificate) Validate() error

Validate certificate

type CertificateHeader

type CertificateHeader struct {
	NetworkID             uint32            `json:"network_id"`
	Height                uint64            `json:"height"`
	EpochNumber           *uint64           `json:"epoch_number"`
	CertificateIndex      *uint64           `json:"certificate_index"`
	CertificateID         common.Hash       `json:"certificate_id"`
	PreviousLocalExitRoot *common.Hash      `json:"prev_local_exit_root,omitempty"`
	NewLocalExitRoot      common.Hash       `json:"new_local_exit_root"`
	Status                CertificateStatus `json:"status"`
	Metadata              common.Hash       `json:"metadata"`
	Error                 error             `json:"-"`
	SettlementTxHash      *common.Hash      `json:"settlement_tx_hash,omitempty"`
}

CertificateHeader is the structure returned by the interop_getCertificateHeader RPC call

func (*CertificateHeader) ID

func (c *CertificateHeader) ID() string

ID returns a string with the ident of this cert (height/certID)

func (*CertificateHeader) StatusString

func (c *CertificateHeader) StatusString() string

StatusString returns the string representation of the status

func (*CertificateHeader) String

func (c *CertificateHeader) String() string

func (*CertificateHeader) UnmarshalJSON

func (c *CertificateHeader) UnmarshalJSON(data []byte) error

type CertificateStatus

type CertificateStatus int

func (CertificateStatus) IsClosed

func (c CertificateStatus) IsClosed() bool

IsClosed returns true if the certificate is closed (settled or inError)

func (CertificateStatus) IsInError

func (c CertificateStatus) IsInError() bool

IsInError returns true if the certificate is in error

func (CertificateStatus) IsOpen

func (c CertificateStatus) IsOpen() bool

IsOpen returns true if the certificate is open (pending, candidate or proven)

func (CertificateStatus) IsSettled

func (c CertificateStatus) IsSettled() bool

IsSettled returns true if the certificate is settled

func (CertificateStatus) String

func (c CertificateStatus) String() string

String representation of the enum

func (*CertificateStatus) UnmarshalJSON

func (c *CertificateStatus) UnmarshalJSON(rawStatus []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type Claim

type Claim interface {
	Type() string
	Hash() common.Hash
	MarshalJSON() ([]byte, error)
	String() string
	Validate() error
}

Claim is the interface that will be implemented by the different types of claims

type ClaimFromMainnet added in v0.7.0

type ClaimFromMainnet struct {
	ProofLeafMER     *MerkleProof    `json:"proof_leaf_mer"`
	ProofGERToL1Root *MerkleProof    `json:"proof_ger_l1root"`
	L1Leaf           *L1InfoTreeLeaf `json:"l1_leaf"`
}

ClaimFromMainnet represents a claim originating from the mainnet

func (*ClaimFromMainnet) Hash added in v0.7.0

func (c *ClaimFromMainnet) Hash() common.Hash

Hash is the implementation of Claim interface

func (*ClaimFromMainnet) MarshalJSON added in v0.7.0

func (c *ClaimFromMainnet) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of Claim interface

func (*ClaimFromMainnet) String added in v0.7.0

func (c *ClaimFromMainnet) String() string

func (ClaimFromMainnet) Type added in v0.7.0

func (c ClaimFromMainnet) Type() string

Type is the implementation of Claim interface

func (*ClaimFromMainnet) UnmarshalJSON added in v0.7.0

func (c *ClaimFromMainnet) UnmarshalJSON(data []byte) error

func (*ClaimFromMainnet) Validate added in v0.7.0

func (c *ClaimFromMainnet) Validate() error

func (*ClaimFromMainnet) VerifyProofs added in v0.7.0

func (c *ClaimFromMainnet) VerifyProofs(l1RootFromWhichToProof, leafHash common.Hash, leafIndex uint32) error

VerifyProofs verifies the inclusion proofs for the given mainnet claim

type ClaimFromRollup

type ClaimFromRollup struct {
	ProofLeafLER     *MerkleProof    `json:"proof_leaf_ler"`
	ProofLERToRER    *MerkleProof    `json:"proof_ler_rer"`
	ProofGERToL1Root *MerkleProof    `json:"proof_ger_l1root"`
	L1Leaf           *L1InfoTreeLeaf `json:"l1_leaf"`
}

ClaimFromRollup represents a claim originating from a rollup

func (*ClaimFromRollup) Hash

func (c *ClaimFromRollup) Hash() common.Hash

Hash is the implementation of Claim interface

func (*ClaimFromRollup) MarshalJSON

func (c *ClaimFromRollup) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of Claim interface

func (*ClaimFromRollup) String

func (c *ClaimFromRollup) String() string

func (ClaimFromRollup) Type

func (c ClaimFromRollup) Type() string

Type is the implementation of Claim interface

func (*ClaimFromRollup) UnmarshalJSON

func (c *ClaimFromRollup) UnmarshalJSON(data []byte) error

func (*ClaimFromRollup) Validate added in v0.7.0

func (c *ClaimFromRollup) Validate() error

func (*ClaimFromRollup) VerifyProofs added in v0.7.0

func (c *ClaimFromRollup) VerifyProofs(
	l1RootFromWhichToProof, leafHash common.Hash, rollupIndex, leafIndex uint32) error

type ClaimSelector

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

ClaimSelector is a helper struct that allow to decice which type of claim to unmarshal

func (*ClaimSelector) GetObject

func (c *ClaimSelector) GetObject() Claim

func (*ClaimSelector) UnmarshalJSON

func (c *ClaimSelector) UnmarshalJSON(data []byte) error

type ClockConfiguration

type ClockConfiguration struct {
	EpochDuration uint64 `json:"epoch_duration"`
	GenesisBlock  uint64 `json:"genesis_block"`
}

ClockConfiguration represents the configuration of the epoch clock returned by the interop_GetEpochConfiguration RPC call

func (ClockConfiguration) String

func (c ClockConfiguration) String() string

type ECDSAMultisigEntry added in v0.7.0

type ECDSAMultisigEntry struct {
	Index     uint32 `json:"index"`
	Signature []byte `json:"signature"`
}

ECDSAMultisigEntry is the data structure that will hold the information about a single signature in the multisig

func (*ECDSAMultisigEntry) MarshalJSON added in v0.7.0

func (e *ECDSAMultisigEntry) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*ECDSAMultisigEntry) UnmarshalJSON added in v0.7.0

func (e *ECDSAMultisigEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type GenericError

type GenericError struct {
	Key   string
	Value string
}

func (*GenericError) Error

func (p *GenericError) Error() string

type GlobalIndex

type GlobalIndex struct {
	MainnetFlag bool   `json:"mainnet_flag"`
	RollupIndex uint32 `json:"rollup_index"`
	LeafIndex   uint32 `json:"leaf_index"`
}

GlobalIndex represents the global index of an imported bridge exit

func (*GlobalIndex) Hash

func (g *GlobalIndex) Hash() common.Hash

func (*GlobalIndex) String

func (g *GlobalIndex) String() string

String returns a string representation of the GlobalIndex struct

func (*GlobalIndex) ToBigInt added in v0.7.0

func (g *GlobalIndex) ToBigInt() *big.Int

ToBigInt converts the GlobalIndex to a big.Int representation

func (*GlobalIndex) UnmarshalFromMap

func (g *GlobalIndex) UnmarshalFromMap(data map[string]interface{}) error

func (*GlobalIndex) Validate added in v0.7.0

func (g *GlobalIndex) Validate() error

type ImportedBridgeExit

type ImportedBridgeExit struct {
	BridgeExit  *BridgeExit  `json:"bridge_exit"`
	ClaimData   Claim        `json:"claim_data"`
	GlobalIndex *GlobalIndex `json:"global_index"`
}

ImportedBridgeExit represents a token bridge exit originating on another network but claimed on the current network.

func (*ImportedBridgeExit) GlobalIndexToLittleEndianBytes added in v0.4.0

func (c *ImportedBridgeExit) GlobalIndexToLittleEndianBytes() []byte

GlobalIndexToLittleEndianBytes converts the global index to a byte slice in little-endian format

func (*ImportedBridgeExit) Hash

func (c *ImportedBridgeExit) Hash() common.Hash

Hash returns a hash that uniquely identifies the imported bridge exit

func (*ImportedBridgeExit) String

func (c *ImportedBridgeExit) String() string

func (*ImportedBridgeExit) UnmarshalJSON

func (c *ImportedBridgeExit) UnmarshalJSON(data []byte) error

func (*ImportedBridgeExit) Validate added in v0.7.0

func (c *ImportedBridgeExit) Validate() error

func (*ImportedBridgeExit) VerifyProofs added in v0.7.0

func (c *ImportedBridgeExit) VerifyProofs(l1RootFromWhichToProve common.Hash) error

VerifyProofs verifies the inclusion proofs for the imported bridge exit

type ImportedBridgeExitWithBlockNumber

type ImportedBridgeExitWithBlockNumber struct {
	BlockNumber        uint64              `json:"block_number"`
	LogIndex           uint64              `json:"log_index"`
	ImportedBridgeExit *ImportedBridgeExit `json:"imported_bridge_exit"`
}

func (*ImportedBridgeExitWithBlockNumber) String added in v0.4.0

String returns a string representation of the ImportedBridgeExitWithBlockNumber struct

type L1InfoTreeLeaf

type L1InfoTreeLeaf struct {
	L1InfoTreeIndex uint32               `json:"l1_info_tree_index"`
	RollupExitRoot  common.Hash          `json:"rer"`
	MainnetExitRoot common.Hash          `json:"mer"`
	Inner           *L1InfoTreeLeafInner `json:"inner"`
}

L1InfoTreeLeaf represents the leaf of the L1 info tree

func (*L1InfoTreeLeaf) Hash

func (l *L1InfoTreeLeaf) Hash() common.Hash

Hash returns the hash of the L1InfoTreeLeaf struct

func (*L1InfoTreeLeaf) String

func (l *L1InfoTreeLeaf) String() string

func (*L1InfoTreeLeaf) Validate added in v0.7.0

func (l *L1InfoTreeLeaf) Validate() error

type L1InfoTreeLeafInner

type L1InfoTreeLeafInner struct {
	GlobalExitRoot common.Hash `json:"global_exit_root"`
	BlockHash      common.Hash `json:"block_hash"`
	Timestamp      uint64      `json:"timestamp"`
}

L1InfoTreeLeafInner represents the inner part of the L1 info tree leaf

func (*L1InfoTreeLeafInner) Hash

func (l *L1InfoTreeLeafInner) Hash() common.Hash

Hash returns the hash of the L1InfoTreeLeafInner struct

func (*L1InfoTreeLeafInner) String

func (l *L1InfoTreeLeafInner) String() string

type MerkleProof

type MerkleProof struct {
	Root  common.Hash                      `json:"root"`
	Proof [types.DefaultHeight]common.Hash `json:"proof"`
}

MerkleProof represents an inclusion proof of a leaf in a Merkle tree

func (*MerkleProof) Hash

func (m *MerkleProof) Hash() common.Hash

Hash returns the hash of the Merkle proof struct

func (*MerkleProof) MarshalJSON

func (m *MerkleProof) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*MerkleProof) String

func (m *MerkleProof) String() string

func (*MerkleProof) UnmarshalJSON

func (m *MerkleProof) UnmarshalJSON(data []byte) error

type Multisig added in v0.7.0

type Multisig struct {
	Signatures []ECDSAMultisigEntry `json:"signatures"`
}

Multisig is the data structure that will hold the multisig information

type NetworkInfo added in v0.7.0

type NetworkInfo struct {
	// Status is the current status of the network (e.g., "active", "syncing", "error")
	Status string `json:"network_status"`
	// NetworkType is the aggchain type of network
	NetworkType string `json:"network_type"`
	// NetworkID is the unique identifier of the network
	NetworkID uint32 `json:"network_id"`
	// SettledHeight is the height of the latest settled certificate
	SettledHeight *uint64 `json:"settled_height"`
	// SettledCertificateID is the ID of the latest settled certificate
	SettledCertificateID *common.Hash `json:"settled_certificate_id"`
	// SettledPPRoot pessimistic proof root of the latest settled certificate
	SettledPPRoot *common.Hash `json:"settled_pp_root"`
	// SettledLER is the local exit root of the latest settled certificate
	SettledLER *common.Hash `json:"settled_ler"`
	// SettledLETLeafCount is the leaf count of the latest settled local exit tree
	SettledLETLeafCount *uint64 `json:"settled_let_leaf_count"`
	// SettledImportedBridgeExit is the information about the latest settled claim
	SettledImportedBridgeExit *SettledImportedBridgeExit `json:"settled_claim,omitempty"`
	// LatestPendingHeight is the height of the latest pending certificate
	LatestPendingHeight *uint64 `json:"latest_pending_height"`
	// LatestPendingCertificateID is the status of the latest pending certificate (e.g., "Proven", "Pending", "InError")
	LatestPendingStatus *CertificateStatus `json:"latest_pending_status"`
	// LatestPendingError is the error message of the latest pending certificate, if any
	LatestPendingError string `json:"latest_pending_error"`
	// LatestEpochWithSettlement is the epoch number of the latest settlement
	LatestEpochWithSettlement *uint64 `json:"latest_epoch_with_settlement"`
}

NetworkInfo represents the state of the network returned by the interop_getNetworkInfo RPC call

type ProvenInsertedGER

type ProvenInsertedGER struct {
	ProofGERToL1Root *MerkleProof    `json:"proof_ger_l1root"`
	L1Leaf           *L1InfoTreeLeaf `json:"l1_leaf"`
}

type ProvenInsertedGERWithBlockNumber

type ProvenInsertedGERWithBlockNumber struct {
	BlockNumber           uint64            `json:"block_number"`
	ProvenInsertedGERLeaf ProvenInsertedGER `json:"inserted_ger_leaf"`
	LogIndex              uint64            `json:"log_index"`
}

type RemovedGER added in v0.8.0

type RemovedGER struct {
	GlobalExitRoot common.Hash `json:"global_exit_root"`
	BlockNumber    uint64      `json:"block_number"`
	LogIndex       uint64      `json:"log_index"`
}

type SettledImportedBridgeExit added in v0.7.0

type SettledImportedBridgeExit struct {
	GlobalIndex    *big.Int    `json:"global_index"`
	BridgeExitHash common.Hash `json:"bridge_exit_hash"`
}

SettledImportedBridgeExit represents the information about a settled claim

type Signature

type Signature struct {
	R         common.Hash `json:"r"`
	S         common.Hash `json:"s"`
	OddParity bool        `json:"odd_y_parity"`
}

Signature is the data structure that will hold the signature of the given certificate

func (*Signature) String

func (s *Signature) String() string

type SignedCertificate

type SignedCertificate struct {
	*Certificate
	Signature *Signature `json:"signature"`
}

SignedCertificate is the struct that contains the certificate and the signature of the signer NOTE: this is an old and deprecated struct, only to be used for backward compatibility

func (*SignedCertificate) Brief

func (s *SignedCertificate) Brief() string

func (*SignedCertificate) CopyWithDefaulting

func (s *SignedCertificate) CopyWithDefaulting() *SignedCertificate

CopyWithDefaulting returns a shallow copy of the signed certificate

type TokenInfo

type TokenInfo struct {
	OriginNetwork      uint32         `json:"origin_network"`
	OriginTokenAddress common.Address `json:"origin_token_address"`
}

TokenInfo encapsulates the information to uniquely identify a token on the origin network.

func (*TokenInfo) String

func (t *TokenInfo) String() string

String returns a string representation of the TokenInfo struct

func (*TokenInfo) Validate added in v0.7.0

func (t *TokenInfo) Validate() error

Validate checks if the TokenInfo is valid

type Unclaim added in v0.8.0

type Unclaim struct {
	GlobalIndex *GlobalIndex `json:"global_index"`
	BlockNumber uint64       `json:"block_number"`
	LogIndex    uint64       `json:"log_index"`
}

Jump to

Keyboard shortcuts

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