Documentation ¶
Index ¶
- Variables
- func VerifyIdentity(data []byte, att *common.AttestationReport) error
- type AttestationProvider
- type BatchExecutionContext
- type BatchExecutor
- type BatchRegistry
- type BlockIngestionType
- type ComputedBatch
- type DummyAttestationProvider
- type EgoAttestationProvider
- type IDData
- type L1BlockProcessor
- type RollupCompression
- type RollupConsumer
- type RollupProducer
- type SharedSecretProcessor
- type SignatureValidator
- type ValueTransfers
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicateRollup = errors.New("duplicate rollup received")
var ErrNoTransactionsToProcess = fmt.Errorf("no transactions to process")
Functions ¶
func VerifyIdentity ¶
func VerifyIdentity(data []byte, att *common.AttestationReport) error
Types ¶
type AttestationProvider ¶
type AttestationProvider interface { // GetReport returns the verifiable attestation report GetReport(pubKey []byte, owner gethcommon.Address, hostAddress string) (*common.AttestationReport, error) // VerifyReport returns the embedded report data VerifyReport(att *common.AttestationReport) ([]byte, error) }
type BatchExecutionContext ¶
type BatchExecutionContext struct { BlockPtr common.L1BlockHash // Block is needed for the cross chain messages ParentPtr common.L2BatchHash Transactions common.L2Transactions AtTime uint64 Creator gethcommon.Address ChainConfig *params.ChainConfig SequencerNo *big.Int BaseFee *big.Int }
BatchExecutionContext - Contains all of the data that each batch depends on
type BatchExecutor ¶
type BatchExecutor interface { // ComputeBatch - a more primitive ExecuteBatch // Call with same BatchContext should always produce identical extBatch - idempotent // Should be safe to call in parallel // failForEmptyBatch bool is used to skip batch production ComputeBatch(batchContext *BatchExecutionContext, failForEmptyBatch bool) (*ComputedBatch, error) // ExecuteBatch - executes the transactions and xchain messages, returns the receipts, and updates the stateDB ExecuteBatch(*core.Batch) (types.Receipts, error) // CreateGenesisState - will create and commit the genesis state in the stateDB for the given block hash, // and uint64 timestamp representing the time now. In this genesis state is where one can // find preallocated funds for faucet. TODO - make this an option CreateGenesisState(common.L1BlockHash, uint64, gethcommon.Address, *big.Int) (*core.Batch, *types.Transaction, error) }
func NewBatchExecutor ¶
func NewBatchExecutor( storage storage.Storage, gethEncodingService gethencoding.EncodingService, cc *crosschain.Processors, genesis *genesis.Genesis, gasOracle gas.Oracle, chainConfig *params.ChainConfig, batchGasLimit uint64, logger gethlog.Logger, ) BatchExecutor
type BatchRegistry ¶
type BatchRegistry interface { // BatchesAfter - Given a hash, will return batches following it until the head batch and the l1 blocks referenced by those batches BatchesAfter(batchSeqNo uint64, upToL1Height uint64, rollupLimiter limiters.RollupLimiter) ([]*core.Batch, []*types.Block, error) // GetBatchStateAtHeight - creates a stateDB that represents the state committed when // the batch with height matching the blockNumber was created and stored. GetBatchStateAtHeight(blockNumber *gethrpc.BlockNumber) (*state.StateDB, error) // GetBatchAtHeight - same as `GetBatchStateAtHeight`, but instead returns the full batch // rather than its stateDB only. GetBatchAtHeight(height gethrpc.BlockNumber) (*core.Batch, error) // SubscribeForExecutedBatches - register a callback for new batches SubscribeForExecutedBatches(func(*core.Batch, types.Receipts)) UnsubscribeFromBatches() OnBatchExecuted(batch *core.Batch, receipts types.Receipts) // HasGenesisBatch - returns if genesis batch is available yet or not, or error in case // the function is unable to determine. HasGenesisBatch() (bool, error) HeadBatchSeq() *big.Int HealthCheck() (bool, error) }
func NewBatchRegistry ¶
func NewBatchRegistry(storage storage.Storage, logger gethlog.Logger) BatchRegistry
type BlockIngestionType ¶
type BlockIngestionType struct { // PreGenesis is true if there is no stored L1 head block. // (L1 head is only stored when there is an L2 state to associate it with. Soon we will start consuming from the // genesis block and then, we should only see one block ingested in a 'PreGenesis' state) PreGenesis bool // ChainFork contains information about the status of the new block in the chain ChainFork *common.ChainFork }
func (*BlockIngestionType) IsFork ¶
func (bit *BlockIngestionType) IsFork() bool
type ComputedBatch ¶
type ComputedBatch struct { Batch *core.Batch Receipts types.Receipts Commit func(bool) (gethcommon.Hash, error) }
ComputedBatch - a structure representing the result of a batch computation where `Batch` is the newly computed batch and `Receipts` are the receipts for the executed transactions inside this batch. The `Commit` function allows for committing the stateDB resulting from the computation of the batch. One might not want to commit in case the resulting batch differs than what is being validated for example.
type DummyAttestationProvider ¶
type DummyAttestationProvider struct{}
func (*DummyAttestationProvider) GetReport ¶
func (e *DummyAttestationProvider) GetReport(pubKey []byte, owner gethcommon.Address, hostAddress string) (*common.AttestationReport, error)
func (*DummyAttestationProvider) VerifyReport ¶
func (e *DummyAttestationProvider) VerifyReport(att *common.AttestationReport) ([]byte, error)
type EgoAttestationProvider ¶
type EgoAttestationProvider struct{}
func (*EgoAttestationProvider) GetReport ¶
func (e *EgoAttestationProvider) GetReport(pubKey []byte, owner gethcommon.Address, hostAddress string) (*common.AttestationReport, error)
func (*EgoAttestationProvider) VerifyReport ¶
func (e *EgoAttestationProvider) VerifyReport(att *common.AttestationReport) ([]byte, error)
todo (#1059) - we need to verify the hash is a recognized enclave - figure out how we solve for upgradability
type L1BlockProcessor ¶
type L1BlockProcessor interface { Process(br *common.BlockAndReceipts) (*BlockIngestionType, error) GetHead() (*common.L1Block, error) GetCrossChainContractAddress() *gethcommon.Address HealthCheck() (bool, error) }
func NewBlockProcessor ¶
func NewBlockProcessor(storage storage.Storage, cc *crosschain.Processors, gasOracle gas.Oracle, logger gethlog.Logger) L1BlockProcessor
type RollupCompression ¶
type RollupCompression struct {
// contains filtered or unexported fields
}
RollupCompression - responsible for the compression logic
## Problem The main overhead (after the tx payloads), are the batch headers.
## Requirements: 1. recreate the exact batch headers as the live ones 2. security - make sure it all chains up cryptographically, so it can't be gamed
## Solution elements: 1. Add another compressed and encrypted metadata blob to the ExtRollup. This is the "CalldataRollupHeader". It will also be published as calldata, together with the transactions. The role of this header is to contain the bare minimum information required to recreate the batches. 2. Use implicit position information, deltas, and exceptions to minimise size. Eg. If the time between 2 batches is always 1second, there is no need to store any extra information. 3. To avoid storing hashes, which don't compress at all, we execute each batch to be able to populate the parent hash. 4. The Signatures over the batches are not stored, since the rollup is itself signed. 5. The cross chain messages are calculated.
func NewRollupCompression ¶
func NewRollupCompression( batchRegistry BatchRegistry, batchExecutor BatchExecutor, dataEncryptionService crypto.DataEncryptionService, dataCompressionService compression.DataCompressionService, storage storage.Storage, gethEncodingService gethencoding.EncodingService, chainConfig *params.ChainConfig, logger gethlog.Logger, ) *RollupCompression
func (*RollupCompression) CreateExtRollup ¶
CreateExtRollup - creates a compressed and encrypted External rollup from the internal data structure
func (*RollupCompression) ProcessExtRollup ¶
func (rc *RollupCompression) ProcessExtRollup(rollup *common.ExtRollup) (*common.CalldataRollupHeader, error)
ProcessExtRollup - given an External rollup, responsible with checking and saving all batches found inside
type RollupConsumer ¶
type RollupConsumer interface { // ProcessRollupsInBlock - extracts the rollup from the block's transactions // and verifies its integrity, saving and processing any batches that have // not been seen previously. ProcessRollupsInBlock(b *common.BlockAndReceipts) error }
func NewRollupConsumer ¶
func NewRollupConsumer( mgmtContractLib mgmtcontractlib.MgmtContractLib, batchRegistry BatchRegistry, rollupCompression *RollupCompression, storage storage.Storage, logger gethlog.Logger, verifier *SignatureValidator, ) RollupConsumer
type RollupProducer ¶
type RollupProducer interface { // CreateInternalRollup - creates a rollup starting from the end of the last rollup that has been stored on the L1 CreateInternalRollup(fromBatchNo uint64, upToL1Height uint64, limiter limiters.RollupLimiter) (*core.Rollup, error) }
func NewRollupProducer ¶
func NewRollupProducer(sequencerID gethcommon.Address, storage storage.Storage, batchRegistry BatchRegistry, logger gethlog.Logger) RollupProducer
type SharedSecretProcessor ¶
type SharedSecretProcessor struct {
// contains filtered or unexported fields
}
func NewSharedSecretProcessor ¶
func NewSharedSecretProcessor(mgmtcontractlib mgmtcontractlib.MgmtContractLib, attestationProvider AttestationProvider, storage storage.Storage, logger gethlog.Logger) *SharedSecretProcessor
func (*SharedSecretProcessor) ProcessNetworkSecretMsgs ¶
func (ssp *SharedSecretProcessor) ProcessNetworkSecretMsgs(br *common.BlockAndReceipts) []*common.ProducedSecretResponse
ProcessNetworkSecretMsgs we watch for all messages that are requesting or receiving the secret and we store the nodes attested keys
type SignatureValidator ¶
type SignatureValidator struct { SequencerID gethcommon.Address // contains filtered or unexported fields }
func NewSignatureValidator ¶
func NewSignatureValidator(seqID gethcommon.Address, storage storage.Storage) (*SignatureValidator, error)
func (*SignatureValidator) CheckSequencerSignature ¶
func (sigChecker *SignatureValidator) CheckSequencerSignature(headerHash gethcommon.Hash, sigR *big.Int, sigS *big.Int) error
CheckSequencerSignature - verifies the signature against the registered sequencer
type ValueTransfers ¶
type ValueTransfers []common.ValueTransferEvent
func (ValueTransfers) EncodeIndex ¶
func (vt ValueTransfers) EncodeIndex(index int, w *bytes.Buffer)
func (ValueTransfers) Len ¶
func (vt ValueTransfers) Len() int