Documentation ¶
Index ¶
- func CreateDBFromConfig(cfg *config.EnclaveConfig, logger gethlog.Logger) (enclavedb.EnclaveDB, error)
- type AttestationStorage
- type BatchResolver
- type BlockResolver
- type CrossChainMessagesStorage
- type EnclaveKeyStorage
- type GethStateDB
- type ScanStorage
- type SharedSecretStorage
- type Storage
- type TransactionStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDBFromConfig ¶
func CreateDBFromConfig(cfg *config.EnclaveConfig, logger gethlog.Logger) (enclavedb.EnclaveDB, error)
CreateDBFromConfig creates an appropriate ethdb.Database instance based on your config
Types ¶
type AttestationStorage ¶
type AttestationStorage interface { // FetchAttestedKey returns the public key of an attested aggregator FetchAttestedKey(aggregator gethcommon.Address) (*ecdsa.PublicKey, error) // StoreAttestedKey - store the public key of an attested aggregator StoreAttestedKey(aggregator gethcommon.Address, key *ecdsa.PublicKey) error }
type BatchResolver ¶
type BatchResolver interface { // FetchBatch returns the batch with the given hash. FetchBatch(hash common.L2BatchHash) (*core.Batch, error) // FetchBatchHeader returns the batch header with the given hash. FetchBatchHeader(hash common.L2BatchHash) (*common.BatchHeader, error) // FetchBatchByHeight returns the batch on the canonical chain with the given height. FetchBatchByHeight(height uint64) (*core.Batch, error) // FetchBatchBySeqNo returns the batch with the given seq number. FetchBatchBySeqNo(seqNum uint64) (*core.Batch, error) // FetchHeadBatch returns the current head batch of the canonical chain. FetchHeadBatch() (*core.Batch, error) // FetchCurrentSequencerNo returns the sequencer number FetchCurrentSequencerNo() (*big.Int, error) // FetchBatchesByBlock returns all batches with the block hash as the L1 proof FetchBatchesByBlock(common.L1BlockHash) ([]*core.Batch, error) // FetchUnexecutedBatches - return a list of the unexecuted batches that were not permanently marked as non-canonical FetchUnexecutedBatches() ([]*core.Batch, error) // BatchWasExecuted - return true if the batch was executed BatchWasExecuted(hash common.L2BatchHash) (bool, error) // FetchHeadBatchForBlock returns the hash of the head batch at a given L1 block. FetchHeadBatchForBlock(blockHash common.L1BlockHash) (*core.Batch, error) // StoreBatch stores an un-executed batch. StoreBatch(batch *core.Batch) error // StoreExecutedBatch - store the batch after it was executed StoreExecutedBatch(batch *core.Batch, receipts []*types.Receipt) error }
type BlockResolver ¶
type BlockResolver interface { // FetchBlock returns the L1 Block with the given hash. FetchBlock(blockHash common.L1BlockHash) (*types.Block, error) // FetchHeadBlock - returns the head of the current chain. FetchHeadBlock() (*types.Block, error) // StoreBlock persists the L1 Block and updates the canonical ancestors if there was a fork StoreBlock(block *types.Block, fork *common.ChainFork) error // IsAncestor returns true if maybeAncestor is an ancestor of the L1 Block, and false otherwise IsAncestor(block *types.Block, maybeAncestor *types.Block) bool // IsBlockAncestor returns true if maybeAncestor is an ancestor of the L1 Block, and false otherwise // Takes into consideration that the Block to verify might be on a branch we haven't received yet // todo (low priority) - this is super confusing, analyze the usage IsBlockAncestor(block *types.Block, maybeAncestor common.L1BlockHash) bool }
BlockResolver stores new blocks and returns information on existing blocks
type CrossChainMessagesStorage ¶
type CrossChainMessagesStorage interface { StoreL1Messages(blockHash common.L1BlockHash, messages common.CrossChainMessages) error GetL1Messages(blockHash common.L1BlockHash) (common.CrossChainMessages, error) }
type EnclaveKeyStorage ¶
type EnclaveKeyStorage interface { StoreEnclaveKey(enclaveKey *ecdsa.PrivateKey) error GetEnclaveKey() (*ecdsa.PrivateKey, error) }
type GethStateDB ¶
type ScanStorage ¶
type ScanStorage interface { GetContractCount() (*big.Int, error) GetReceiptsPerAddress(address *gethcommon.Address, pagination *common.QueryPagination) (types.Receipts, error) GetPublicTransactionData(pagination *common.QueryPagination) ([]common.PublicTxData, error) GetPublicTransactionCount() (uint64, error) GetReceiptsPerAddressCount(addr *gethcommon.Address) (uint64, error) }
type SharedSecretStorage ¶
type SharedSecretStorage interface { crypto.SharedEnclaveSecret, error) StoreSecret(secret crypto.SharedEnclaveSecret) error }FetchSecret() (*
type Storage ¶
type Storage interface { BlockResolver BatchResolver GethStateDB SharedSecretStorage TransactionStorage AttestationStorage CrossChainMessagesStorage EnclaveKeyStorage ScanStorage io.Closer // HealthCheck returns whether the storage is deemed healthy or not HealthCheck() (bool, error) // FilterLogs - applies the properties the relevancy checks for the requestingAccount to all the stored log events // nil values will be ignored. Make sure to set all fields to the right values before calling this function // the blockHash should always be nil. FilterLogs(requestingAccount *gethcommon.Address, fromBlock, toBlock *big.Int, blockHash *common.L2BatchHash, addresses []gethcommon.Address, topics [][]gethcommon.Hash) ([]*types.Log, error) // DebugGetLogs returns logs for a given tx hash without any constraints - should only be used for debug purposes DebugGetLogs(txHash common.TxHash) ([]*tracers.DebugLogs, error) // TrieDB - return the underlying trie database TrieDB() *trie.Database }
Storage is the enclave's interface for interacting with the enclave's datastore
func NewStorage ¶
func NewStorageFromConfig ¶
func NewStorageFromConfig(config *config.EnclaveConfig, chainConfig *params.ChainConfig, logger gethlog.Logger) Storage
type TransactionStorage ¶
type TransactionStorage interface { // GetTransaction - returns the positional metadata of the tx by hash GetTransaction(txHash common.L2TxHash) (*types.Transaction, gethcommon.Hash, uint64, uint64, error) // GetTransactionReceipt - returns the receipt of a tx by tx hash GetTransactionReceipt(txHash common.L2TxHash) (*types.Receipt, error) // GetReceiptsByBatchHash retrieves the receipts for all transactions in a given rollup. GetReceiptsByBatchHash(hash common.L2BatchHash) (types.Receipts, error) // GetSender returns the sender of the tx by hash GetSender(txHash common.L2TxHash) (gethcommon.Address, error) // GetContractCreationTx returns the hash of the tx that created a contract GetContractCreationTx(address gethcommon.Address) (*gethcommon.Hash, error) }
Click to show internal directories.
Click to hide internal directories.