Documentation ¶
Index ¶
- Variables
- type AggLayerClient
- func (c *AggLayerClient) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)
- func (c *AggLayerClient) SendCertificate(certificate *SignedCertificate) (common.Hash, error)
- func (c *AggLayerClient) SendTx(signedTx SignedTx) (common.Hash, error)
- func (c *AggLayerClient) WaitTxToBeMined(hash common.Hash, ctx context.Context) error
- type AgglayerClientInterface
- type AgglayerClientMock
- func (_m *AgglayerClientMock) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)
- func (_m *AgglayerClientMock) SendCertificate(certificate *SignedCertificate) (common.Hash, error)
- func (_m *AgglayerClientMock) SendTx(signedTx SignedTx) (common.Hash, error)
- func (_m *AgglayerClientMock) WaitTxToBeMined(hash common.Hash, ctx context.Context) error
- type BridgeExit
- type Certificate
- type CertificateHeader
- type CertificateStatus
- type Claim
- type ClaimFromMainnnet
- type ClaimFromRollup
- type GlobalIndex
- type ImportedBridgeExit
- type L1InfoTreeLeaf
- type L1InfoTreeLeafInner
- type LeafType
- type MerkleProof
- type Signature
- type SignedCertificate
- type SignedTx
- type TokenInfo
- type Tx
- type ZKP
Constants ¶
This section is empty.
Variables ¶
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) 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 ¶
WaitTxToBeMined waits for a transaction to be mined
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) }
AgglayerClientInterface is the interface that defines the methods that the AggLayerClient will implement
type AgglayerClientMock ¶
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) GetCertificateHeader ¶
func (_m *AgglayerClientMock) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)
GetCertificateHeader provides a mock function with given fields: certificateHash
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 ¶
WaitTxToBeMined provides a mock function with given fields: hash, ctx
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
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"` }
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
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"` }
CertificateHeader is the structure returned by the interop_getCertificateHeader RPC call
func (CertificateHeader) String ¶
func (c CertificateHeader) String() string
type CertificateStatus ¶
type CertificateStatus int
const ( Pending CertificateStatus = iota Proven Candidate InError 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 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) 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) Type ¶
func (c ClaimFromRollup) Type() string
Type is the implementation of Claim 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
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
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
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
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
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
type SignedCertificate ¶
type SignedCertificate struct { *Certificate Signature *Signature `json:"signature"` }
SignedCertificate is the struct that contains the certificate and the signature of the signer
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.
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