agglayer

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidSignerErrorType                = "InvalidSigner"
	InvalidPreviousLERErrorType           = "InvalidPreviousLocalExitRoot"
	InvalidPreviousBalanceRootErrorType   = "InvalidPreviousBalanceRoot"
	InvalidPreviousNullifierRootErrorType = "InvalidPreviousNullifierRoot"
	InvalidNewLocalExitRootErrorType      = "InvalidNewLocalExitRoot"
	InvalidNewBalanceRootErrorType        = "InvalidNewBalanceRoot"
	InvalidNewNullifierRootErrorType      = "InvalidNewNullifierRoot"
	InvalidImportedExitsRootErrorType     = "InvalidImportedExitsRoot"
	MismatchImportedExitsRootErrorType    = "MismatchImportedExitsRoot"
	InvalidNullifierPathErrorType         = "InvalidNullifierPath"
	InvalidBalancePathErrorType           = "InvalidBalancePath"
	BalanceOverflowInBridgeExitErrorType  = "BalanceOverflowInBridgeExit"
	BalanceUnderflowInBridgeExitErrorType = "BalanceUnderflowInBridgeExit"
	CannotExitToSameNetworkErrorType      = "CannotExitToSameNetwork"
	InvalidMessageOriginNetworkErrorType  = "InvalidMessageOriginNetwork"
	InvalidL1TokenInfoErrorType           = "InvalidL1TokenInfo"
	MissingTokenBalanceProofErrorType     = "MissingTokenBalanceProof"
	DuplicateTokenBalanceProofErrorType   = "DuplicateTokenBalanceProof"
	InvalidSignatureErrorType             = "InvalidSignature"
	InvalidImportedBridgeExitErrorType    = "InvalidImportedBridgeExit"
	UnknownErrorType                      = "UnknownError"
)
View Source
const (
	VersionMismatchErrorType     = "VersionMismatch"
	CoreErrorType                = "Core"
	RecursionErrorType           = "Recursion"
	PlankErrorType               = "Plank"
	Groth16ErrorType             = "Groth16"
	InvalidPublicValuesErrorType = "InvalidPublicValues"
)
View Source
const (
	MultipleL1InfoRootErrorType            = "MultipleL1InfoRoot"
	MismatchNewLocalExitRootErrorType      = "MismatchNewLocalExitRoot"
	BalanceOverflowErrorType               = "BalanceOverflow"
	BalanceUnderflowErrorType              = "BalanceUnderflow"
	BalanceProofGenerationFailedErrorType  = "BalanceProofGenerationFailed"
	NullifierPathGenerationFailedErrorType = "NullifierPathGenerationFailed"
	L1InfoRootIncorrectErrorType           = "L1InfoRootIncorrect"
)

Variables

View Source
var (
	NonSettledStatuses = []CertificateStatus{Pending, Candidate, Proven}
	ClosedStatuses     = []CertificateStatus{Settled, InError}
)
View Source
var (
	ErrAgglayerRateLimitExceeded = fmt.Errorf("agglayer rate limit exceeded")
)

Functions

This section is empty.

Types

type AggLayerClient

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

AggLayerClient is the client that will be used to interact with the AggLayer

func NewAggLayerClient

func NewAggLayerClient(url string) *AggLayerClient

NewAggLayerClient returns a client ready to be used

func (*AggLayerClient) GetCertificateHeader

func (c *AggLayerClient) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)

GetCertificateHeader returns the certificate header associated to the hash

func (*AggLayerClient) GetEpochConfiguration

func (c *AggLayerClient) GetEpochConfiguration() (*ClockConfiguration, error)

GetEpochConfiguration returns the clock configuration of AggLayer

func (*AggLayerClient) GetLatestKnownCertificateHeader

func (c *AggLayerClient) GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error)

GetLatestKnownCertificateHeader returns the last certificate header submitted by networkID

func (*AggLayerClient) SendCertificate

func (c *AggLayerClient) SendCertificate(certificate *SignedCertificate) (common.Hash, error)

SendCertificate sends a certificate to the AggLayer

func (*AggLayerClient) SendTx

func (c *AggLayerClient) SendTx(signedTx SignedTx) (common.Hash, error)

SendTx sends a signed transaction to the AggLayer

func (*AggLayerClient) WaitTxToBeMined

func (c *AggLayerClient) WaitTxToBeMined(hash common.Hash, ctx context.Context) error

WaitTxToBeMined waits for a transaction to be mined

type AggLayerClientGetEpochConfiguration

type AggLayerClientGetEpochConfiguration interface {
	GetEpochConfiguration() (*ClockConfiguration, error)
}

type AgglayerClientInterface

type AgglayerClientInterface interface {
	SendTx(signedTx SignedTx) (common.Hash, error)
	WaitTxToBeMined(hash common.Hash, ctx context.Context) error
	SendCertificate(certificate *SignedCertificate) (common.Hash, error)
	GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)
	GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error)
	AggLayerClientGetEpochConfiguration
}

AgglayerClientInterface is the interface that defines the methods that the AggLayerClient will implement

type AgglayerClientMock

type AgglayerClientMock struct {
	mock.Mock
}

AgglayerClientMock is an autogenerated mock type for the AgglayerClientInterface type

func NewAgglayerClientMock

func NewAgglayerClientMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *AgglayerClientMock

NewAgglayerClientMock creates a new instance of AgglayerClientMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*AgglayerClientMock) EXPECT

func (*AgglayerClientMock) GetCertificateHeader

func (_m *AgglayerClientMock) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)

GetCertificateHeader provides a mock function with given fields: certificateHash

func (*AgglayerClientMock) GetEpochConfiguration

func (_m *AgglayerClientMock) GetEpochConfiguration() (*ClockConfiguration, error)

GetEpochConfiguration provides a mock function with given fields:

func (*AgglayerClientMock) GetLatestKnownCertificateHeader

func (_m *AgglayerClientMock) GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error)

GetLatestKnownCertificateHeader provides a mock function with given fields: networkID

func (*AgglayerClientMock) SendCertificate

func (_m *AgglayerClientMock) SendCertificate(certificate *SignedCertificate) (common.Hash, error)

SendCertificate provides a mock function with given fields: certificate

func (*AgglayerClientMock) SendTx

func (_m *AgglayerClientMock) SendTx(signedTx SignedTx) (common.Hash, error)

SendTx provides a mock function with given fields: signedTx

func (*AgglayerClientMock) WaitTxToBeMined

func (_m *AgglayerClientMock) WaitTxToBeMined(hash common.Hash, ctx context.Context) error

WaitTxToBeMined provides a mock function with given fields: hash, ctx

type AgglayerClientMock_Expecter

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

func (*AgglayerClientMock_Expecter) GetCertificateHeader

func (_e *AgglayerClientMock_Expecter) GetCertificateHeader(certificateHash interface{}) *AgglayerClientMock_GetCertificateHeader_Call

GetCertificateHeader is a helper method to define mock.On call

  • certificateHash common.Hash

func (*AgglayerClientMock_Expecter) GetEpochConfiguration

GetEpochConfiguration is a helper method to define mock.On call

func (*AgglayerClientMock_Expecter) GetLatestKnownCertificateHeader

func (_e *AgglayerClientMock_Expecter) GetLatestKnownCertificateHeader(networkID interface{}) *AgglayerClientMock_GetLatestKnownCertificateHeader_Call

GetLatestKnownCertificateHeader is a helper method to define mock.On call

  • networkID uint32

func (*AgglayerClientMock_Expecter) SendCertificate

func (_e *AgglayerClientMock_Expecter) SendCertificate(certificate interface{}) *AgglayerClientMock_SendCertificate_Call

SendCertificate is a helper method to define mock.On call

  • certificate *SignedCertificate

func (*AgglayerClientMock_Expecter) SendTx

func (_e *AgglayerClientMock_Expecter) SendTx(signedTx interface{}) *AgglayerClientMock_SendTx_Call

SendTx is a helper method to define mock.On call

  • signedTx SignedTx

func (*AgglayerClientMock_Expecter) WaitTxToBeMined

func (_e *AgglayerClientMock_Expecter) WaitTxToBeMined(hash interface{}, ctx interface{}) *AgglayerClientMock_WaitTxToBeMined_Call

WaitTxToBeMined is a helper method to define mock.On call

  • hash common.Hash
  • ctx context.Context

type AgglayerClientMock_GetCertificateHeader_Call

type AgglayerClientMock_GetCertificateHeader_Call struct {
	*mock.Call
}

AgglayerClientMock_GetCertificateHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCertificateHeader'

func (*AgglayerClientMock_GetCertificateHeader_Call) Return

func (*AgglayerClientMock_GetCertificateHeader_Call) Run

func (*AgglayerClientMock_GetCertificateHeader_Call) RunAndReturn

type AgglayerClientMock_GetEpochConfiguration_Call

type AgglayerClientMock_GetEpochConfiguration_Call struct {
	*mock.Call
}

AgglayerClientMock_GetEpochConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEpochConfiguration'

func (*AgglayerClientMock_GetEpochConfiguration_Call) Return

func (*AgglayerClientMock_GetEpochConfiguration_Call) Run

func (*AgglayerClientMock_GetEpochConfiguration_Call) RunAndReturn

type AgglayerClientMock_GetLatestKnownCertificateHeader_Call

type AgglayerClientMock_GetLatestKnownCertificateHeader_Call struct {
	*mock.Call
}

AgglayerClientMock_GetLatestKnownCertificateHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestKnownCertificateHeader'

func (*AgglayerClientMock_GetLatestKnownCertificateHeader_Call) Return

func (*AgglayerClientMock_GetLatestKnownCertificateHeader_Call) Run

func (*AgglayerClientMock_GetLatestKnownCertificateHeader_Call) RunAndReturn

type AgglayerClientMock_SendCertificate_Call

type AgglayerClientMock_SendCertificate_Call struct {
	*mock.Call
}

AgglayerClientMock_SendCertificate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendCertificate'

func (*AgglayerClientMock_SendCertificate_Call) Return

func (*AgglayerClientMock_SendCertificate_Call) Run

func (*AgglayerClientMock_SendCertificate_Call) RunAndReturn

type AgglayerClientMock_SendTx_Call

type AgglayerClientMock_SendTx_Call struct {
	*mock.Call
}

AgglayerClientMock_SendTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendTx'

func (*AgglayerClientMock_SendTx_Call) Return

func (*AgglayerClientMock_SendTx_Call) Run

func (*AgglayerClientMock_SendTx_Call) RunAndReturn

type AgglayerClientMock_WaitTxToBeMined_Call

type AgglayerClientMock_WaitTxToBeMined_Call struct {
	*mock.Call
}

AgglayerClientMock_WaitTxToBeMined_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WaitTxToBeMined'

func (*AgglayerClientMock_WaitTxToBeMined_Call) Return

func (*AgglayerClientMock_WaitTxToBeMined_Call) Run

func (*AgglayerClientMock_WaitTxToBeMined_Call) RunAndReturn

type BalanceOverflow

type BalanceOverflow struct {
	*TokenInfoError
}

BalanceOverflow is an error that is returned when the given token balance cannot overflow.

func NewBalanceOverflow

func NewBalanceOverflow() *BalanceOverflow

NewBalanceOverflow returns a new BalanceOverflow error.

func (*BalanceOverflow) String

func (e *BalanceOverflow) String() string

String is the implementation of the Error interface

type BalanceOverflowInBridgeExit

type BalanceOverflowInBridgeExit struct{}

BalanceOverflowInBridgeExit is a struct that represents an error that occurs when bridge exit led to balance overflow.

func (*BalanceOverflowInBridgeExit) String

func (e *BalanceOverflowInBridgeExit) String() string

String is the implementation of the Error interface

type BalanceProofGenerationFailed

type BalanceProofGenerationFailed struct {
	*TokenInfoError
	*SmtError
}

BalanceProofGenerationFailed is a struct that represents an error that occurs when the balance proof for the given token cannot be generated.

func NewBalanceProofGenerationFailed

func NewBalanceProofGenerationFailed() *BalanceProofGenerationFailed

func (*BalanceProofGenerationFailed) String

String is the implementation of the Error interface

func (*BalanceProofGenerationFailed) UnmarshalFromMap

func (e *BalanceProofGenerationFailed) UnmarshalFromMap(data interface{}) error

type BalanceUnderflow

type BalanceUnderflow struct {
	*TokenInfoError
}

BalanceUnderflow is an error that is returned when the given token balance cannot be negative.

func NewBalanceUnderflow

func NewBalanceUnderflow() *BalanceUnderflow

NewBalanceOverflow returns a new BalanceOverflow error.

func (*BalanceUnderflow) String

func (e *BalanceUnderflow) String() string

String is the implementation of the Error interface

type BalanceUnderflowInBridgeExit

type BalanceUnderflowInBridgeExit struct{}

BalanceUnderflowInBridgeExit is a struct that represents an error that occurs when bridge exit led to balance underflow.

func (*BalanceUnderflowInBridgeExit) String

String is the implementation of the Error interface

type BridgeExit

type BridgeExit struct {
	LeafType           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

type CannotExitToSameNetwork

type CannotExitToSameNetwork struct{}

CannotExitToSameNetwork is a struct that represents an error that occurs when the user tries to exit to the same network.

func (*CannotExitToSameNetwork) String

func (e *CannotExitToSameNetwork) String() string

String is the implementation of the Error interface

type Certificate

type Certificate struct {
	NetworkID           uint32                `json:"network_id"`
	Height              uint64                `json:"height"`
	PrevLocalExitRoot   [32]byte              `json:"prev_local_exit_root"`
	NewLocalExitRoot    [32]byte              `json:"new_local_exit_root"`
	BridgeExits         []*BridgeExit         `json:"bridge_exits"`
	ImportedBridgeExits []*ImportedBridgeExit `json:"imported_bridge_exits"`
	Metadata            common.Hash           `json:"metadata"`
}

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

func (*Certificate) Hash

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

Hash returns a hash that uniquely identifies the certificate

func (*Certificate) HashToSign

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

HashToSign is the actual hash that needs to be signed by the aggsender as expected by the agglayer

func (*Certificate) String

func (c *Certificate) String() string

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"`
	NewLocalExitRoot common.Hash       `json:"new_local_exit_root"`
	Status           CertificateStatus `json:"status"`
	Metadata         common.Hash       `json:"metadata"`
	Error            PPError           `json:"-"`
}

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) String

func (c *CertificateHeader) String() string

func (*CertificateHeader) UnmarshalJSON

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

type CertificateStatus

type CertificateStatus int
const (
	Pending CertificateStatus = iota
	Proven
	Candidate
	InError
	Settled
)

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(data []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
}

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

type ClaimFromMainnnet

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

ClaimFromMainnnet represents a claim originating from the mainnet

func (*ClaimFromMainnnet) Hash

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

Hash is the implementation of Claim interface

func (*ClaimFromMainnnet) MarshalJSON

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

MarshalJSON is the implementation of Claim interface

func (*ClaimFromMainnnet) String

func (c *ClaimFromMainnnet) String() string

func (ClaimFromMainnnet) Type

func (c ClaimFromMainnnet) Type() string

Type is the implementation of Claim interface

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

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 Core

type Core struct {
	StringError
}

Core is an error that is returned when the core machine verification fails.

func (*Core) String

func (e *Core) String() string

String is the implementation of the Error interface

type DeclaredComputedError

type DeclaredComputedError struct {
	Declared common.Hash `json:"declared"`
	Computed common.Hash `json:"computed"`
	ErrType  string
}

DeclaredComputedError is a base struct for errors that have both declared and computed values.

func (*DeclaredComputedError) String

func (e *DeclaredComputedError) String() string

String is the implementation of the Error interface

func (*DeclaredComputedError) UnmarshalFromMap

func (e *DeclaredComputedError) UnmarshalFromMap(data interface{}) error

UnmarshalFromMap is the implementation of the Error interface

type DuplicateTokenBalanceProof

type DuplicateTokenBalanceProof struct {
	*TokenInfoError
}

DuplicateTokenBalanceProof is a struct that represents an error that occurs when the token balance proof is duplicated.

func NewDuplicateTokenBalanceProof

func NewDuplicateTokenBalanceProof() *DuplicateTokenBalanceProof

NewDuplicateTokenBalanceProof returns a new instance of DuplicateTokenBalanceProof.

func (*DuplicateTokenBalanceProof) String

func (e *DuplicateTokenBalanceProof) String() string

String is the implementation of the Error interface

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) UnmarshalFromMap

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

type Groth16

type Groth16 struct {
	StringError
}

Groth16 is an error that is returned when the Groth16 verification fails.

func (*Groth16) String

func (e *Groth16) String() string

String is the implementation of the Error interface

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) 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

type InvalidBalancePath

type InvalidBalancePath struct{}

InvalidBalancePath is a struct that represents an error that occurs when the provided balance path is invalid.

func (*InvalidBalancePath) String

func (e *InvalidBalancePath) String() string

String is the implementation of the Error interface

type InvalidImportedBridgeExit

type InvalidImportedBridgeExit struct {
	GlobalIndex *GlobalIndex `json:"global_index"`
	ErrorType   string       `json:"error_type"`
}

InvalidImportedBridgeExit is a struct that represents an error that occurs when the imported bridge exit is invalid.

func (*InvalidImportedBridgeExit) String

func (e *InvalidImportedBridgeExit) String() string

String is the implementation of the Error interface

func (*InvalidImportedBridgeExit) UnmarshalFromMap

func (e *InvalidImportedBridgeExit) UnmarshalFromMap(data interface{}) error

type InvalidImportedExitsRoot

type InvalidImportedExitsRoot struct {
	*DeclaredComputedError
}

InvalidImportedExitsRoot is a struct that represents an error that occurs when the imported exits root is invalid.

func NewInvalidImportedExitsRoot

func NewInvalidImportedExitsRoot() *InvalidImportedExitsRoot

type InvalidL1TokenInfo

type InvalidL1TokenInfo struct {
	*TokenInfoError
}

InvalidL1TokenInfo is a struct that represents an error that occurs when the L1 token info is invalid.

func NewInvalidL1TokenInfo

func NewInvalidL1TokenInfo() *InvalidL1TokenInfo

NewInvalidL1TokenInfo returns a new instance of InvalidL1TokenInfo.

func (*InvalidL1TokenInfo) String

func (e *InvalidL1TokenInfo) String() string

String is the implementation of the Error interface

type InvalidMessageOriginNetwork

type InvalidMessageOriginNetwork struct{}

InvalidMessageOriginNetwork is a struct that represents an error that occurs when the origin network of the message is invalid.

func (*InvalidMessageOriginNetwork) String

func (e *InvalidMessageOriginNetwork) String() string

String is the implementation of the Error interface

type InvalidNewBalanceRoot

type InvalidNewBalanceRoot struct {
	*DeclaredComputedError
}

InvalidNewBalanceRoot is a struct that represents an error that occurs when the new balance root is invalid.

func NewInvalidNewBalanceRoot

func NewInvalidNewBalanceRoot() *InvalidNewBalanceRoot

type InvalidNewLocalExitRoot

type InvalidNewLocalExitRoot struct {
	*DeclaredComputedError
}

InvalidNewLocalExitRoot is a struct that represents an error that occurs when the new local exit root is invalid.

func NewInvalidNewLocalExitRoot

func NewInvalidNewLocalExitRoot() *InvalidNewLocalExitRoot

type InvalidNewNullifierRoot

type InvalidNewNullifierRoot struct {
	*DeclaredComputedError
}

InvalidNewNullifierRoot is a struct that represents an error that occurs when the new nullifier root is invalid.

func NewInvalidNewNullifierRoot

func NewInvalidNewNullifierRoot() *InvalidNewNullifierRoot

type InvalidNullifierPath

type InvalidNullifierPath struct{}

InvalidNullifierPath is a struct that represents an error that occurs when the provided nullifier path is invalid.

func (*InvalidNullifierPath) String

func (e *InvalidNullifierPath) String() string

String is the implementation of the Error interface

type InvalidPreviousBalanceRoot

type InvalidPreviousBalanceRoot struct {
	*DeclaredComputedError
}

InvalidPreviousBalanceRoot is a struct that represents an error that occurs when the previous balance root is invalid.

func NewInvalidPreviousBalanceRoot

func NewInvalidPreviousBalanceRoot() *InvalidPreviousBalanceRoot

type InvalidPreviousLocalExitRoot

type InvalidPreviousLocalExitRoot struct {
	*DeclaredComputedError
}

InvalidPreviousLocalExitRoot is a struct that represents an error that occurs when the previous local exit root is invalid.

func NewInvalidPreviousLocalExitRoot

func NewInvalidPreviousLocalExitRoot() *InvalidPreviousLocalExitRoot

type InvalidPreviousNullifierRoot

type InvalidPreviousNullifierRoot struct {
	*DeclaredComputedError
}

InvalidPreviousNullifierRoot is a struct that represents an error that occurs when the previous nullifier root is invalid.

func NewInvalidPreviousNullifierRoot

func NewInvalidPreviousNullifierRoot() *InvalidPreviousNullifierRoot

type InvalidPublicValues

type InvalidPublicValues struct{}

InvalidPublicValues is an error that is returned when the public values are invalid.

func (*InvalidPublicValues) String

func (e *InvalidPublicValues) String() string

String is the implementation of the Error interface

type InvalidSignature

type InvalidSignature struct{}

InvalidSignature is a struct that represents an error that occurs when the signature is invalid.

func (*InvalidSignature) String

func (e *InvalidSignature) String() string

String is the implementation of the Error interface

type InvalidSignerError

type InvalidSignerError struct {
	Declared  common.Address `json:"declared"`
	Recovered common.Address `json:"recovered"`
}

InvalidSignerError is a struct that represents an error that occurs when the signer of the certificate is invalid, or the hash that was signed was not valid.

func (*InvalidSignerError) String

func (e *InvalidSignerError) String() string

String is the implementation of the Error interface

func (*InvalidSignerError) UnmarshalFromMap

func (e *InvalidSignerError) UnmarshalFromMap(data interface{}) error

type L1InfoRootIncorrect

type L1InfoRootIncorrect struct {
	Declared  common.Hash `json:"declared"`
	Retrieved common.Hash `json:"retrieved"`
	LeafCount uint32      `json:"leaf_count"`
}

L1InfoRootIncorrect is an error that is returned when the L1 Info Root is invalid or unsettled

func (*L1InfoRootIncorrect) String

func (e *L1InfoRootIncorrect) String() string

String is the implementation of the Error interface

func (*L1InfoRootIncorrect) Unmarshal

func (e *L1InfoRootIncorrect) Unmarshal(data interface{}) error

Unmarshal unmarshals the data from a map into a L1InfoRootIncorrect struct.

type L1InfoTreeLeaf

type L1InfoTreeLeaf struct {
	L1InfoTreeIndex uint32               `json:"l1_info_tree_index"`
	RollupExitRoot  [32]byte             `json:"rer"`
	MainnetExitRoot [32]byte             `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

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) MarshalJSON

func (l *L1InfoTreeLeafInner) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*L1InfoTreeLeafInner) String

func (l *L1InfoTreeLeafInner) String() string

type LeafType

type LeafType uint8
const (
	LeafTypeAsset LeafType = iota
	LeafTypeMessage
)

func (LeafType) String

func (l LeafType) String() string

func (LeafType) Uint8

func (l LeafType) Uint8() uint8

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

type MismatchImportedExitsRoot

type MismatchImportedExitsRoot struct{}

MismatchImportedExitsRoot is a struct that represents an error that occurs when the commitment to the list of imported bridge exits but the list of imported bridge exits is empty.

func (*MismatchImportedExitsRoot) String

func (e *MismatchImportedExitsRoot) String() string

String is the implementation of the Error interface

type MismatchNewLocalExitRoot

type MismatchNewLocalExitRoot struct {
	*DeclaredComputedError
}

MissingNewLocalExitRoot is an error that is returned when the certificate refers to a new local exit root which differ from the one computed by the agglayer.

func NewMismatchNewLocalExitRoot

func NewMismatchNewLocalExitRoot() *MismatchNewLocalExitRoot

type MissingTokenBalanceProof

type MissingTokenBalanceProof struct {
	*TokenInfoError
}

MissingTokenBalanceProof is a struct that represents an error that occurs when the token balance proof is missing.

func NewMissingTokenBalanceProof

func NewMissingTokenBalanceProof() *MissingTokenBalanceProof

NewMissingTokenBalanceProof returns a new instance of MissingTokenBalanceProof.

func (*MissingTokenBalanceProof) String

func (e *MissingTokenBalanceProof) String() string

String is the implementation of the Error interface

type MultipleL1InfoRoot

type MultipleL1InfoRoot struct{}

MultipleL1InfoRoot is an error that is returned when the imported bridge exits refer to different L1 info roots.

func (*MultipleL1InfoRoot) String

func (e *MultipleL1InfoRoot) String() string

String is the implementation of the Error interface

type NullifierPathGenerationFailed

type NullifierPathGenerationFailed struct {
	GlobalIndex *GlobalIndex `json:"global_index"`
	*SmtError
}

NullifierPathGenerationFailed is a struct that represents an error that occurs when the nullifier path for the given imported bridge exit cannot be generated..

func NewNullifierPathGenerationFailed

func NewNullifierPathGenerationFailed() *NullifierPathGenerationFailed

func (*NullifierPathGenerationFailed) String

String is the implementation of the Error interface

func (*NullifierPathGenerationFailed) UnmarshalFromMap

func (e *NullifierPathGenerationFailed) UnmarshalFromMap(data interface{}) error

type PPError

type PPError interface {
	String() string
}

type Plank

type Plank struct {
	StringError
}

Plank is an error that is returned when the plank verification fails.

func (*Plank) String

func (e *Plank) String() string

String is the implementation of the Error interface

type ProofGenerationError

type ProofGenerationError struct {
	GenerationType string
	InnerErrors    []PPError
}

ProofGenerationError is a struct that represents an error that occurs when generating a proof.

func (*ProofGenerationError) String

func (p *ProofGenerationError) String() string

String is the implementation of the Error interface

func (*ProofGenerationError) Unmarshal

func (p *ProofGenerationError) Unmarshal(data interface{}) error

Unmarshal unmarshals the data from a map into a ProofGenerationError struct.

type ProofVerificationError

type ProofVerificationError struct {
	InnerErrors []PPError
}

ProofVerificationError is an error that is returned when verifying a proof

func (*ProofVerificationError) String

func (p *ProofVerificationError) String() string

String is the implementation of the Error interface

func (*ProofVerificationError) Unmarshal

func (p *ProofVerificationError) Unmarshal(data interface{}) error

Unmarshal unmarshals the data from a map into a ProofVerificationError struct.

type Recursion

type Recursion struct {
	StringError
}

Recursion is an error that is returned when the recursion verification fails.

func (*Recursion) String

func (e *Recursion) String() string

String is the implementation of the Error interface

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

func (*SignedCertificate) CopyWithDefaulting

func (s *SignedCertificate) CopyWithDefaulting() *SignedCertificate

CopyWithDefaulting returns a shallow copy of the signed certificate

func (*SignedCertificate) String

func (s *SignedCertificate) String() string

type SignedTx

type SignedTx struct {
	Tx        Tx             `json:"tx"`
	Signature types.ArgBytes `json:"signature"`
}

SignedTx is the struct that contains the signed batch transaction

func (*SignedTx) Signer

func (s *SignedTx) Signer() (common.Address, error)

Signer returns the address of the signer

type SmtError

type SmtError struct {
	ErrorCode string
	Error     string
}

SmtError is a type that is inherited by all errors that occur during SMT operations.

func (*SmtError) Unmarshal

func (e *SmtError) Unmarshal(data interface{}) error

type StringError

type StringError string

StringError is an error that is inherited by other errors that expect a string field in the data.

func (*StringError) Unmarshal

func (e *StringError) Unmarshal(data interface{}) error

Unmarshal unmarshals the data from an interface{} into a StringError.

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

type TokenInfoError

type TokenInfoError struct {
	TokenInfo *TokenInfo `json:"token_info"`
	// contains filtered or unexported fields
}

TokenInfoError is a struct inherited by other errors that have a TokenInfo field.

func (*TokenInfoError) UnmarshalFromMap

func (e *TokenInfoError) UnmarshalFromMap(data interface{}) error

type Tx

type Tx struct {
	RollupID          uint32
	LastVerifiedBatch types.ArgUint64 `json:"lastVerifiedBatch"`
	NewVerifiedBatch  types.ArgUint64 `json:"newVerifiedBatch"`
	ZKP               ZKP             `json:"ZKP"`
}

Tx is the struct that contains the verified batch transaction

func (*Tx) Hash

func (t *Tx) Hash() common.Hash

Hash returns a hash that uniquely identifies the tx

func (*Tx) Sign

func (t *Tx) Sign(privateKey *ecdsa.PrivateKey) (*SignedTx, error)

Sign returns a signed batch by the private key

type TypeConversionError

type TypeConversionError struct {
	InnerErrors []PPError
}

TypeConversionError is an error that is returned when verifying a certficate before generating its proof.

func (*TypeConversionError) String

func (p *TypeConversionError) String() string

String is the implementation of the Error interface

func (*TypeConversionError) Unmarshal

func (p *TypeConversionError) Unmarshal(data interface{}) error

Unmarshal unmarshals the data from a map into a ProofGenerationError struct.

type UnknownError

type UnknownError struct{}

UnknownError is a struct that represents an error that occurs when an unknown error is encountered.

func (*UnknownError) String

func (e *UnknownError) String() string

String is the implementation of the Error interface

type VersionMismatch

type VersionMismatch struct {
	StringError
}

VersionMismatch is an error that is returned when the version of the proof is different from the version of the core.

func (*VersionMismatch) String

func (e *VersionMismatch) String() string

String is the implementation of the Error interface

type ZKP

type ZKP struct {
	NewStateRoot     common.Hash    `json:"newStateRoot"`
	NewLocalExitRoot common.Hash    `json:"newLocalExitRoot"`
	Proof            types.ArgBytes `json:"proof"`
}

ZKP is the struct that contains the zero-knowledge proof

Jump to

Keyboard shortcuts

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