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(ctx context.Context, aggregator gethcommon.Address) (*ecdsa.PublicKey, error) // StoreAttestedKey - store the public key of an attested aggregator StoreAttestedKey(ctx context.Context, aggregator gethcommon.Address, key *ecdsa.PublicKey) error }
type BatchResolver ¶
type BatchResolver interface { // FetchBatch returns the batch with the given hash. FetchBatch(ctx context.Context, hash common.L2BatchHash) (*core.Batch, error) // FetchBatchHeader returns the batch header with the given hash. FetchBatchHeader(ctx context.Context, hash common.L2BatchHash) (*common.BatchHeader, error) // FetchBatchByHeight returns the batch on the canonical chain with the given height. FetchBatchByHeight(ctx context.Context, height uint64) (*core.Batch, error) // FetchBatchBySeqNo returns the batch with the given seq number. FetchBatchBySeqNo(ctx context.Context, seqNum uint64) (*core.Batch, error) // FetchHeadBatch returns the current head batch of the canonical chain. FetchHeadBatch(ctx context.Context) (*core.Batch, error) // FetchCurrentSequencerNo returns the sequencer number FetchCurrentSequencerNo(ctx context.Context) (*big.Int, error) // FetchBatchesByBlock returns all batches with the block hash as the L1 proof FetchBatchesByBlock(ctx context.Context, hash common.L1BlockHash) ([]*core.Batch, error) // FetchNonCanonicalBatchesBetween - returns all reorged batches between the sequences FetchNonCanonicalBatchesBetween(ctx context.Context, startSeq uint64, endSeq uint64) ([]*core.Batch, error) // FetchCanonicalBatchesBetween - returns all canon batches between the sequences FetchCanonicalBatchesBetween(ctx context.Context, startSeq uint64, endSeq uint64) ([]*core.Batch, error) // FetchCanonicalUnexecutedBatches - return the list of the unexecuted batches that are canonical FetchCanonicalUnexecutedBatches(context.Context, *big.Int) ([]*core.Batch, error) FetchConvertedHash(ctx context.Context, hash common.L2BatchHash) (gethcommon.Hash, error) // BatchWasExecuted - return true if the batch was executed BatchWasExecuted(ctx context.Context, hash common.L2BatchHash) (bool, error) // StoreBatch stores an un-executed batch. StoreBatch(ctx context.Context, batch *core.Batch, convertedHash gethcommon.Hash) error // StoreExecutedBatch - store the batch after it was executed StoreExecutedBatch(ctx context.Context, batch *core.Batch, receipts []*types.Receipt) error // StoreRollup StoreRollup(ctx context.Context, rollup *common.ExtRollup, header *common.CalldataRollupHeader) error FetchRollupMetadata(ctx context.Context, hash common.L2RollupHash) (*common.PublicRollupMetadata, error) FetchReorgedRollup(ctx context.Context, reorgedBlocks []common.L1BlockHash) (*common.L2BatchHash, error) }
type BlockResolver ¶
type BlockResolver interface { // FetchBlock returns the L1 Block with the given hash. FetchBlock(ctx context.Context, blockHash common.L1BlockHash) (*types.Block, error) // FetchCanonicaBlockByHeight - self explanatory FetchCanonicaBlockByHeight(ctx context.Context, height *big.Int) (*types.Block, error) // FetchHeadBlock - returns the head of the current chain. FetchHeadBlock(ctx context.Context) (*types.Block, error) // StoreBlock persists the L1 Block and updates the canonical ancestors if there was a fork StoreBlock(ctx context.Context, block *types.Block, fork *common.ChainFork) error // IsAncestor returns true if maybeAncestor is an ancestor of the L1 Block, and false otherwise IsAncestor(ctx context.Context, 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(ctx context.Context, block *types.Block, maybeAncestor common.L1BlockHash) bool }
BlockResolver stores new blocks and returns information on existing blocks
type CrossChainMessagesStorage ¶
type CrossChainMessagesStorage interface { StoreL1Messages(ctx context.Context, blockHash common.L1BlockHash, messages common.CrossChainMessages) error GetL1Messages(ctx context.Context, blockHash common.L1BlockHash) (common.CrossChainMessages, error) StoreValueTransfers(ctx context.Context, blockHash common.L1BlockHash, transfers common.ValueTransferEvents) error GetL1Transfers(ctx context.Context, blockHash common.L1BlockHash) (common.ValueTransferEvents, error) }
type EnclaveKeyStorage ¶
type EnclaveKeyStorage interface { StoreEnclaveKey(ctx context.Context, enclaveKey *crypto.EnclaveKey) error GetEnclaveKey(ctx context.Context) (*crypto.EnclaveKey, error) }
type GethStateDB ¶
type ScanStorage ¶
type ScanStorage interface { GetContractCount(ctx context.Context) (*big.Int, error) GetTransactionsPerAddress(ctx context.Context, address *gethcommon.Address, pagination *common.QueryPagination) (types.Receipts, error) CountTransactionsPerAddress(ctx context.Context, addr *gethcommon.Address) (uint64, error) }
type SharedSecretStorage ¶
type SharedSecretStorage interface { context.Context) (*crypto.SharedEnclaveSecret, error) StoreSecret(ctx context.Context, secret crypto.SharedEnclaveSecret) error }FetchSecret(ctx
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(ctx context.Context) (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(ctx context.Context, 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(ctx context.Context, txHash common.TxHash) ([]*tracers.DebugLogs, error) // TrieDB - return the underlying trie database TrieDB() *triedb.Database // StateDB - return the underlying state database StateDB() state.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(ctx context.Context, txHash common.L2TxHash) (*types.Transaction, common.L2BatchHash, uint64, uint64, error) // GetTransactionReceipt - returns the receipt of a tx by tx hash GetTransactionReceipt(ctx context.Context, txHash common.L2TxHash) (*types.Receipt, error) // GetReceiptsByBatchHash retrieves the receipts for all transactions in a given rollup. GetReceiptsByBatchHash(ctx context.Context, hash common.L2BatchHash) (types.Receipts, error) // GetContractCreationTx returns the hash of the tx that created a contract GetContractCreationTx(ctx context.Context, address gethcommon.Address) (*gethcommon.Hash, error) }
Click to show internal directories.
Click to hide internal directories.