Documentation ¶
Index ¶
- Constants
- Variables
- func AddressPtr(i common.Address) *common.Address
- func CheckLogOrder(logs []*types.Log) bool
- func CheckSignature(tx types.Transaction) error
- func CheckSupersetBatchTransactions(existingTxHashes []common.Hash, processedTxs []*ProcessTransactionResponse) error
- func DecodeTx(encodedTx string) (*types.Transaction, error)
- func DecodeTxs(txsData []byte, forkID uint64) ([]types.Transaction, []byte, []uint8, error)
- func EncodeTransaction(tx types.Transaction, effectivePercentage uint8, forkID uint64) ([]byte, error)
- func EncodeTransactionWithoutEffectivePercentage(tx types.Transaction) ([]byte, error)
- func EncodeTransactions(txs []types.Transaction, effectivePercentages []uint8, forkID uint64) ([]byte, error)
- func EncodeTransactionsWithoutEffectivePercentage(txs []types.Transaction) ([]byte, error)
- func EncodeUnsignedTransaction(tx types.Transaction, chainID uint64, forcedNonce *uint64, forkID uint64) ([]byte, error)
- func GetSender(tx types.Transaction) (common.Address, error)
- func GetZKCounterError(name string) error
- func HashPtr(h common.Hash) *common.Hash
- func HexToAddressPtr(hex string) *common.Address
- func HexToHashPtr(hex string) *common.Hash
- func IsStateRootChanged(err executor.RomError) bool
- func NewBatchRemainingResourcesUnderflowError(err error, resourceName string) error
- func RlpFieldsToLegacyTx(fields [][]byte, v, r, s []byte) (tx *types.LegacyTx, err error)
- type Batch
- type BatchRemainingResourcesUnderflowError
- type BatchResources
- type Block
- type ClosingReason
- type Config
- type FakeDB
- func (f *FakeDB) AddAddressToAccessList(addr common.Address)
- func (f *FakeDB) AddBalance(common.Address, *big.Int)
- func (f *FakeDB) AddLog(*types.Log)
- func (f *FakeDB) AddPreimage(common.Hash, []byte)
- func (f *FakeDB) AddRefund(uint64)
- func (f *FakeDB) AddSlotToAccessList(addr common.Address, slot common.Hash)
- func (f *FakeDB) AddressInAccessList(addr common.Address) bool
- func (f *FakeDB) CreateAccount(common.Address)
- func (f *FakeDB) Empty(address common.Address) bool
- func (f *FakeDB) Exist(address common.Address) bool
- func (f *FakeDB) GetBalance(address common.Address) *big.Int
- func (f *FakeDB) GetCode(address common.Address) []byte
- func (f *FakeDB) GetCodeHash(address common.Address) common.Hash
- func (f *FakeDB) GetCodeSize(address common.Address) int
- func (f *FakeDB) GetCommittedState(common.Address, common.Hash) common.Hash
- func (f *FakeDB) GetNonce(address common.Address) uint64
- func (f *FakeDB) GetRefund() uint64
- func (f *FakeDB) GetState(address common.Address, hash common.Hash) common.Hash
- func (f *FakeDB) GetTransientState(addr common.Address, key common.Hash) common.Hash
- func (f *FakeDB) HasSuicided(common.Address) bool
- func (f *FakeDB) Prepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, ...)
- func (f *FakeDB) RevertToSnapshot(int)
- func (f *FakeDB) SetCode(common.Address, []byte)
- func (f *FakeDB) SetNonce(common.Address, uint64)
- func (f *FakeDB) SetState(common.Address, common.Hash, common.Hash)
- func (f *FakeDB) SetStateRoot(stateRoot []byte)
- func (f *FakeDB) SetTransientState(addr common.Address, key, value common.Hash)
- func (f *FakeDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool)
- func (f *FakeDB) Snapshot() int
- func (f *FakeDB) SubBalance(common.Address, *big.Int)
- func (f *FakeDB) SubRefund(uint64)
- func (f *FakeDB) Suicide(common.Address) bool
- type ForcedBatch
- type ForkIDInterval
- type Genesis
- type GenesisAction
- type GlobalExitRoot
- type InfoReadWrite
- type NewL2BlockEvent
- type NewL2BlockEventHandler
- type PostgresStorage
- func (p *PostgresStorage) AddAccumulatedInputHash(ctx context.Context, batchNum uint64, accInputHash common.Hash, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddBlock(ctx context.Context, block *Block, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddForcedBatch(ctx context.Context, forcedBatch *ForcedBatch, tx pgx.Tx) error
- func (p *PostgresStorage) AddForkID(ctx context.Context, forkID ForkIDInterval, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddGeneratedProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddGlobalExitRoot(ctx context.Context, exitRoot *GlobalExitRoot, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddL2Block(ctx context.Context, batchNumber uint64, l2Block *types.Block, ...) error
- func (p *PostgresStorage) AddLog(ctx context.Context, l *types.Log, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddReceipt(ctx context.Context, receipt *types.Receipt, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddSequence(ctx context.Context, sequence Sequence, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddTrustedReorg(ctx context.Context, reorg *TrustedReorg, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddVerifiedBatch(ctx context.Context, verifiedBatch *VerifiedBatch, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddVirtualBatch(ctx context.Context, virtualBatch *VirtualBatch, dbTx pgx.Tx) error
- func (p *PostgresStorage) BatchNumberByL2BlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) CheckProofContainsCompleteSequences(ctx context.Context, proof *Proof, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
- func (p *PostgresStorage) CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error)
- func (p *PostgresStorage) CountReorgs(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error
- func (p *PostgresStorage) DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error
- func (p *PostgresStorage) GetBatchByForcedBatchNum(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) GetBatchByL2BlockNumber(ctx context.Context, l2BlockNumber uint64, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) GetBatchByTxHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) GetBatchNumberOfL2Block(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetBlockNumAndMainnetExitRootByGER(ctx context.Context, ger common.Hash, dbTx pgx.Tx) (uint64, common.Hash, error)
- func (p *PostgresStorage) GetBlockNumVirtualBatchByBatchNum(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetEncodedTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (encodedTxs []string, effectivePercentages []uint8, err error)
- func (p *PostgresStorage) GetExitRootByGlobalExitRoot(ctx context.Context, ger common.Hash, dbTx pgx.Tx) (*GlobalExitRoot, error)
- func (p *PostgresStorage) GetFinalizedL2BlockNumber(ctx context.Context, l1FinalizedBlockNumber uint64, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*ForcedBatch, error)
- func (p *PostgresStorage) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber, maxBlockNumber uint64, dbTx pgx.Tx) ([]*ForcedBatch, error)
- func (p *PostgresStorage) GetForkIDTrustedReorgCount(ctx context.Context, forkID uint64, version string, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetForkIDs(ctx context.Context, dbTx pgx.Tx) ([]ForkIDInterval, error)
- func (p *PostgresStorage) GetL2BlockByHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*types.Block, error)
- func (p *PostgresStorage) GetL2BlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*types.Block, error)
- func (p *PostgresStorage) GetL2BlockHashesSince(ctx context.Context, since time.Time, dbTx pgx.Tx) ([]common.Hash, error)
- func (p *PostgresStorage) GetL2BlockHeaderByHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*types.Header, error)
- func (p *PostgresStorage) GetL2BlockHeaderByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*types.Header, error)
- func (p *PostgresStorage) GetL2BlockTransactionCountByHash(ctx context.Context, blockHash common.Hash, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetL2BlockTransactionCountByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetL2BlocksByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]types.Block, error)
- func (p *PostgresStorage) GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetLastBatchTime(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
- func (p *PostgresStorage) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*Block, error)
- func (p *PostgresStorage) GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) GetLastConsolidatedL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetLastL2Block(ctx context.Context, dbTx pgx.Tx) (*types.Block, error)
- func (p *PostgresStorage) GetLastL2BlockCreatedAt(ctx context.Context, dbTx pgx.Tx) (*time.Time, error)
- func (p *PostgresStorage) GetLastL2BlockHeader(ctx context.Context, dbTx pgx.Tx) (*types.Header, error)
- func (p *PostgresStorage) GetLastL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetLastNBatches(ctx context.Context, numBatches uint, dbTx pgx.Tx) ([]*Batch, error)
- func (p *PostgresStorage) GetLastNBatchesByL2BlockNumber(ctx context.Context, l2BlockNumber *uint64, numBatches uint, dbTx pgx.Tx) ([]*Batch, common.Hash, error)
- func (p *PostgresStorage) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*VerifiedBatch, error)
- func (p *PostgresStorage) GetLastVirtualBatchNum(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetLastVirtualizedL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetLatestGer(ctx context.Context, maxBlockNumber uint64) (GlobalExitRoot, time.Time, error)
- func (p *PostgresStorage) GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (GlobalExitRoot, time.Time, error)
- func (p *PostgresStorage) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
- func (p *PostgresStorage) GetLocalExitRootByBatchNumber(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (common.Hash, error)
- func (p *PostgresStorage) GetLogs(ctx context.Context, fromBlock uint64, toBlock uint64, ...) ([]*types.Log, error)
- func (p *PostgresStorage) GetNextForcedBatches(ctx context.Context, nextForcedBatches int, dbTx pgx.Tx) ([]ForcedBatch, error)
- func (p *PostgresStorage) GetNumberOfBlocksSinceLastGERUpdate(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*Block, error)
- func (p *PostgresStorage) GetProcessingContext(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*ProcessingContext, error)
- func (p *PostgresStorage) GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*Proof, error)
- func (p *PostgresStorage) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*Proof, *Proof, error)
- func (p *PostgresStorage) GetReorgedTransactions(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error)
- func (p *PostgresStorage) GetSafeL2BlockNumber(ctx context.Context, l1SafeBlockNumber uint64, dbTx pgx.Tx) (uint64, error)
- func (p *PostgresStorage) GetSequences(ctx context.Context, lastVerifiedBatchNumber uint64, dbTx pgx.Tx) ([]Sequence, error)
- func (p *PostgresStorage) GetStateRootByBatchNumber(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (common.Hash, error)
- func (p *PostgresStorage) GetSyncingInfo(ctx context.Context, dbTx pgx.Tx) (SyncingInfo, error)
- func (p *PostgresStorage) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
- func (p *PostgresStorage) GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error)
- func (p *PostgresStorage) GetTransactionByL2BlockHashAndIndex(ctx context.Context, blockHash common.Hash, index uint64, dbTx pgx.Tx) (*types.Transaction, error)
- func (p *PostgresStorage) GetTransactionByL2BlockNumberAndIndex(ctx context.Context, blockNumber uint64, index uint64, dbTx pgx.Tx) (*types.Transaction, error)
- func (p *PostgresStorage) GetTransactionReceipt(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Receipt, error)
- func (p *PostgresStorage) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error)
- func (p *PostgresStorage) GetTxsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error)
- func (p *PostgresStorage) GetTxsByBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error)
- func (p *PostgresStorage) GetTxsHashesByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (encoded []common.Hash, err error)
- func (p *PostgresStorage) GetTxsOlderThanNL1Blocks(ctx context.Context, nL1Blocks uint64, dbTx pgx.Tx) ([]common.Hash, error)
- func (p *PostgresStorage) GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*VerifiedBatch, error)
- func (p *PostgresStorage) GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*VirtualBatch, error)
- func (p *PostgresStorage) GetVirtualBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) GetVirtualBatchToProve(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*Batch, error)
- func (p *PostgresStorage) IsBatchClosed(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) IsBatchConsolidated(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) IsBatchVirtualized(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) IsL2BlockConsolidated(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) IsL2BlockVirtualized(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) IsSequencingTXSynced(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) Reset(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error
- func (p *PostgresStorage) ResetForkID(ctx context.Context, batchNumber, forkID uint64, version string, dbTx pgx.Tx) error
- func (p *PostgresStorage) ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
- func (p *PostgresStorage) SetInitSyncBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
- func (p *PostgresStorage) SetLastBatchInfoSeenOnEthereum(ctx context.Context, lastBatchNumberSeen, lastBatchNumberVerified uint64, ...) error
- func (p *PostgresStorage) UpdateBatchL2Data(ctx context.Context, batchNumber uint64, batchL2Data []byte, dbTx pgx.Tx) error
- func (p *PostgresStorage) UpdateForkID(ctx context.Context, forkID ForkIDInterval, dbTx pgx.Tx) error
- func (p *PostgresStorage) UpdateGERInOpenBatch(ctx context.Context, ger common.Hash, dbTx pgx.Tx) error
- func (p *PostgresStorage) UpdateGeneratedProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error
- type ProcessBatchResponse
- type ProcessRequest
- type ProcessTransactionResponse
- type ProcessingContext
- type ProcessingReceipt
- type Proof
- type Sequence
- type Stack
- type State
- func (s *State) AddForkIDInterval(ctx context.Context, newForkID ForkIDInterval, dbTx pgx.Tx) error
- func (s *State) BeginStateTransaction(ctx context.Context) (pgx.Tx, error)
- func (s *State) CloseBatch(ctx context.Context, receipt ProcessingReceipt, dbTx pgx.Tx) error
- func (s *State) DebugTransaction(ctx context.Context, transactionHash common.Hash, traceConfig TraceConfig, ...) (*runtime.ExecutionResult, error)
- func (s *State) EstimateGas(transaction *types.Transaction, senderAddress common.Address, ...) (uint64, []byte, error)
- func (s *State) ExecuteBatch(ctx context.Context, batch Batch, updateMerkleTree bool, dbTx pgx.Tx) (*executor.ProcessBatchResponse, error)
- func (s *State) FlushMerkleTree(ctx context.Context) error
- func (s *State) GetBalance(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
- func (s *State) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
- func (s *State) GetCode(ctx context.Context, address common.Address, root common.Hash) ([]byte, error)
- func (s *State) GetForkIDByBatchNumber(batchNumber uint64) uint64
- func (s *State) GetLastBatch(ctx context.Context, dbTx pgx.Tx) (*Batch, error)
- func (s *State) GetLastStateRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
- func (s *State) GetNonce(ctx context.Context, address common.Address, root common.Hash) (uint64, error)
- func (s *State) GetNonceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
- func (s *State) GetStorageAt(ctx context.Context, address common.Address, position *big.Int, ...) (*big.Int, error)
- func (s *State) GetStoredFlushID(ctx context.Context) (uint64, string, error)
- func (s *State) GetTree() *merkletree.StateTree
- func (s *State) OpenBatch(ctx context.Context, processingContext ProcessingContext, dbTx pgx.Tx) error
- func (s *State) PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*ProcessBatchResponse, error)
- func (s *State) PrepareWebSocket()
- func (s *State) ProcessAndStoreClosedBatch(ctx context.Context, processingCtx ProcessingContext, encodedTxs []byte, ...) (common.Hash, uint64, string, error)
- func (s *State) ProcessBatch(ctx context.Context, request ProcessRequest, updateMerkleTree bool) (*ProcessBatchResponse, error)
- func (s *State) ProcessSequencerBatch(ctx context.Context, batchNumber uint64, batchL2Data []byte, ...) (*ProcessBatchResponse, error)
- func (s *State) ProcessUnsignedTransaction(ctx context.Context, tx *types.Transaction, senderAddress common.Address, ...) (*runtime.ExecutionResult, error)
- func (s *State) RegisterNewL2BlockEventHandler(h NewL2BlockEventHandler)
- func (s *State) SetGenesis(ctx context.Context, block Block, genesis Genesis, dbTx pgx.Tx) ([]byte, error)
- func (s *State) StoreTransaction(ctx context.Context, batchNumber uint64, ...) error
- func (s *State) StoreTransactions(ctx context.Context, batchNumber uint64, ...) error
- func (s *State) TestConvertToProcessBatchResponse(response *executor.ProcessBatchResponse) (*ProcessBatchResponse, error)
- func (s *State) UpdateForkIDIntervalsInMemory(intervals []ForkIDInterval)
- type SyncingInfo
- type TraceConfig
- type TrustedReorg
- type VerifiedBatch
- type VirtualBatch
- type ZKCounters
Constants ¶
const ( // MaxEffectivePercentage is the maximum value that can be used as effective percentage MaxEffectivePercentage = uint8(255) )
Variables ¶
var ( // ErrInvalidBatchHeader indicates the batch header is invalid ErrInvalidBatchHeader = errors.New("invalid batch header") // ErrUnexpectedBatch indicates that the batch is unexpected ErrUnexpectedBatch = errors.New("unexpected batch") // ErrStateNotSynchronized indicates the state database may be empty ErrStateNotSynchronized = errors.New("state not synchronized") // ErrNotFound indicates an object has not been found for the search criteria used ErrNotFound = errors.New("object not found") // ErrNilDBTransaction indicates the db transaction has not been properly initialized ErrNilDBTransaction = errors.New("database transaction not properly initialized") // ErrAlreadyInitializedDBTransaction indicates the db transaction was already initialized ErrAlreadyInitializedDBTransaction = errors.New("database transaction already initialized") // ErrNotEnoughIntrinsicGas indicates the gas is not enough to cover the intrinsic gas cost ErrNotEnoughIntrinsicGas = fmt.Errorf("not enough gas supplied for intrinsic gas costs") // ErrParsingExecutorTrace indicates an error occurred while parsing the executor trace ErrParsingExecutorTrace = fmt.Errorf("error while parsing executor trace") // ErrInvalidBatchNumber indicates the provided batch number is not the latest in db ErrInvalidBatchNumber = errors.New("provided batch number is not latest") // ErrLastBatchShouldBeClosed indicates that last batch needs to be closed before adding a new one ErrLastBatchShouldBeClosed = errors.New("last batch needs to be closed before adding a new one") // ErrBatchAlreadyClosed indicates that batch is already closed ErrBatchAlreadyClosed = errors.New("batch is already closed") // ErrClosingBatchWithoutTxs indicates that the batch attempted to close does not have txs. ErrClosingBatchWithoutTxs = errors.New("can not close a batch without transactions") // ErrTimestampGE indicates that timestamp needs to be greater or equal ErrTimestampGE = errors.New("timestamp needs to be greater or equal") // ErrDBTxNil indicates that the method requires a dbTx that is not nil ErrDBTxNil = errors.New("the method requires a dbTx that is not nil") // ErrExistingTxGreaterThanProcessedTx indicates that we have more txs stored // in db than the txs we want to process. ErrExistingTxGreaterThanProcessedTx = errors.New("there are more transactions in the database than in the processed transaction set") // ErrOutOfOrderProcessedTx indicates the the processed transactions of an // ongoing batch are not in the same order as the transactions stored in the // database for the same batch. ErrOutOfOrderProcessedTx = errors.New("the processed transactions are not in the same order as the stored transactions") // ErrInsufficientFunds is returned if the total cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value") // ErrExecutorNil indicates that the method requires an executor that is not nil ErrExecutorNil = errors.New("the method requires an executor that is not nil") // ErrStateTreeNil indicates that the method requires a state tree that is not nil ErrStateTreeNil = errors.New("the method requires a state tree that is not nil") // ErrUnsupportedDuration is returned if the provided unit for a time // interval is not supported by our conversion mechanism. ErrUnsupportedDuration = errors.New("unsupported time duration") // ErrInvalidData is the error when the raw txs is unexpected ErrInvalidData = errors.New("invalid data") // ErrBatchResourceBytesUnderflow happens when the batch runs out of Bytes ErrBatchResourceBytesUnderflow = NewBatchRemainingResourcesUnderflowError(nil, "Bytes") )
var ( // ZeroHash is the hash 0x0000000000000000000000000000000000000000000000000000000000000000 ZeroHash = common.Hash{} // ZeroAddress is the address 0x0000000000000000000000000000000000000000 ZeroAddress = common.Address{} )
var ( // ErrInvalidSig indicates the signature of the transaction is not valid ErrInvalidSig = errors.New("invalid transaction v, r, s values") )
var ErrStackEmpty = errors.New("Empty Stack")
ErrStackEmpty returned when Pop is called and the stack is empty
Functions ¶
func AddressPtr ¶
AddressPtr returns a pointer to the provided address
func CheckLogOrder ¶ added in v0.0.990
CheckLogOrder checks the order of the logs. The order should be incremental
func CheckSignature ¶
func CheckSignature(tx types.Transaction) error
CheckSignature checks a transaction signature
func CheckSupersetBatchTransactions ¶
func CheckSupersetBatchTransactions(existingTxHashes []common.Hash, processedTxs []*ProcessTransactionResponse) error
CheckSupersetBatchTransactions verifies that processedTransactions is a superset of existingTxs and that the existing txs have the same order, returns a non-nil error if that is not the case.
func DecodeTx ¶
func DecodeTx(encodedTx string) (*types.Transaction, error)
DecodeTx decodes a string rlp tx representation into a types.Transaction instance
func EncodeTransaction ¶
func EncodeTransaction(tx types.Transaction, effectivePercentage uint8, forkID uint64) ([]byte, error)
EncodeTransaction RLP encodes the given transaction
func EncodeTransactionWithoutEffectivePercentage ¶ added in v0.0.990
func EncodeTransactionWithoutEffectivePercentage(tx types.Transaction) ([]byte, error)
EncodeTransactionWithoutEffectivePercentage RLP encodes the given transaction without the effective percentage
func EncodeTransactions ¶
func EncodeTransactions(txs []types.Transaction, effectivePercentages []uint8, forkID uint64) ([]byte, error)
EncodeTransactions RLP encodes the given transactions
func EncodeTransactionsWithoutEffectivePercentage ¶ added in v0.0.990
func EncodeTransactionsWithoutEffectivePercentage(txs []types.Transaction) ([]byte, error)
EncodeTransactionsWithoutEffectivePercentage RLP encodes the given transactions without the effective percentage
func EncodeUnsignedTransaction ¶
func EncodeUnsignedTransaction(tx types.Transaction, chainID uint64, forcedNonce *uint64, forkID uint64) ([]byte, error)
EncodeUnsignedTransaction RLP encodes the given unsigned transaction
func GetSender ¶
func GetSender(tx types.Transaction) (common.Address, error)
GetSender gets the sender from the transaction's signature
func GetZKCounterError ¶
GetZKCounterError returns the error associated with the zkCounter
func HexToAddressPtr ¶
HexToAddressPtr create an address from a hex and returns its pointer
func HexToHashPtr ¶
HexToHashPtr create a hash from a hex and returns its pointer
func IsStateRootChanged ¶ added in v0.0.990
IsStateRootChanged returns true if the transaction changes the state root
func NewBatchRemainingResourcesUnderflowError ¶ added in v0.0.990
NewBatchRemainingResourcesUnderflowError creates a new BatchRemainingResourcesUnderflowError
func RlpFieldsToLegacyTx ¶
RlpFieldsToLegacyTx parses the rlp fields slice into a type.LegacyTx in this specific order:
required fields: [0] Nonce uint64 [1] GasPrice *big.Int [2] Gas uint64 [3] To *common.Address [4] Value *big.Int [5] Data []byte
optional fields: [6] V *big.Int [7] R *big.Int [8] S *big.Int
Types ¶
type Batch ¶
type Batch struct { BatchNumber uint64 Coinbase common.Address BatchL2Data []byte StateRoot common.Hash LocalExitRoot common.Hash AccInputHash common.Hash Timestamp time.Time Transactions []types.Transaction GlobalExitRoot common.Hash ForcedBatchNum *uint64 }
Batch struct
type BatchRemainingResourcesUnderflowError ¶ added in v0.0.990
type BatchRemainingResourcesUnderflowError struct { Message string Code int Err error ResourceName string }
BatchRemainingResourcesUnderflowError happens when the execution of a batch runs out of counters
func (BatchRemainingResourcesUnderflowError) Error ¶ added in v0.0.990
func (b BatchRemainingResourcesUnderflowError) Error() string
Error returns the error message
type BatchResources ¶ added in v0.0.990
type BatchResources struct { ZKCounters ZKCounters Bytes uint64 }
BatchResources is a struct that contains the ZKEVM resources used by a batch/tx
func (*BatchResources) Sub ¶ added in v0.0.990
func (r *BatchResources) Sub(other BatchResources) error
Sub subtracts the batch resources from other
type Block ¶
type Block struct { BlockNumber uint64 BlockHash common.Hash ParentHash common.Hash ReceivedAt time.Time }
Block struct
type ClosingReason ¶ added in v0.0.990
type ClosingReason string
ClosingReason represents the reason why a batch is closed.
const ( // EmptyClosingReason is the closing reason used when a batch is not closed EmptyClosingReason ClosingReason = "" // BatchFullClosingReason is the closing reason used when a batch is closed when it is full BatchFullClosingReason ClosingReason = "Batch is full" // ForcedBatchClosingReason is the closing reason used when a batch is closed because it is forced ForcedBatchClosingReason ClosingReason = "Forced Batch" // BatchAlmostFullClosingReason is the closing reason used when the batch it is almost full BatchAlmostFullClosingReason ClosingReason = "Batch is almost full" // ForcedBatchDeadlineClosingReason is the closing reason used when forced batch deadline is reached ForcedBatchDeadlineClosingReason ClosingReason = "Forced Batch deadline" // TimeoutResolutionDeadlineClosingReason is the closing reason used when timeout resolution deadline is reached TimeoutResolutionDeadlineClosingReason ClosingReason = "timeout resolution deadline" // GlobalExitRootDeadlineClosingReason is the closing reason used when Global Exit Root deadline is reached GlobalExitRootDeadlineClosingReason ClosingReason = "Global Exit Root deadline" )
type Config ¶
type Config struct { // MaxCumulativeGasUsed is the max gas allowed per batch MaxCumulativeGasUsed uint64 // ChainID is the L2 ChainID provided by the Network Config ChainID uint64 // ForkIdIntervals is the list of fork id intervals ForkIDIntervals []ForkIDInterval // MaxResourceExhaustedAttempts is the max number of attempts to make a transaction succeed because of resource exhaustion MaxResourceExhaustedAttempts int // WaitOnResourceExhaustion is the time to wait before retrying a transaction because of resource exhaustion WaitOnResourceExhaustion types.Duration // Batch number from which there is a forkid change (fork upgrade) ForkUpgradeBatchNumber uint64 // New fork id to be used for batches greaters than ForkUpgradeBatchNumber (fork upgrade) ForkUpgradeNewForkId uint64 }
Config is state config
type FakeDB ¶
type FakeDB struct { State *State // contains filtered or unexported fields }
FakeDB is the implementation of the fakeevm.FakeDB interface
func (*FakeDB) AddAddressToAccessList ¶
AddAddressToAccessList not implemented// even if the feature/fork is not active yet
func (*FakeDB) AddBalance ¶
AddBalance not implemented
func (*FakeDB) AddPreimage ¶
AddPreimage not implemented
func (*FakeDB) AddSlotToAccessList ¶
AddSlotToAccessList not implemented// even if the feature/fork is not active yet
func (*FakeDB) AddressInAccessList ¶
AddressInAccessList not implemented
func (*FakeDB) CreateAccount ¶
CreateAccount not implemented
func (*FakeDB) Empty ¶
Empty returns whether the given account is empty. Empty is defined according to EIP161 (balance = nonce = code = 0).
func (*FakeDB) Exist ¶
Exist reports whether the given account exists in state. Notably this should also return true for suicided accounts.
func (*FakeDB) GetBalance ¶
GetBalance returns the balance of the given address.
func (*FakeDB) GetCodeHash ¶
GetCodeHash gets the hash for the code at a given address
func (*FakeDB) GetCodeSize ¶
GetCodeSize get address code size
func (*FakeDB) GetCommittedState ¶
GetCommittedState not implemented
func (*FakeDB) GetTransientState ¶
GetTransientState not implemented
func (*FakeDB) HasSuicided ¶
HasSuicided not implemented
func (*FakeDB) Prepare ¶
func (f *FakeDB) Prepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList)
Prepare not implemented
func (*FakeDB) RevertToSnapshot ¶
RevertToSnapshot not implemented
func (*FakeDB) SetStateRoot ¶
SetStateRoot is the stateRoot setter.
func (*FakeDB) SetTransientState ¶
SetTransientState not implemented
func (*FakeDB) SlotInAccessList ¶
func (f *FakeDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool)
SlotInAccessList not implemented
func (*FakeDB) SubBalance ¶
SubBalance not implemented
type ForcedBatch ¶
type ForcedBatch struct { BlockNumber uint64 ForcedBatchNumber uint64 Sequencer common.Address GlobalExitRoot common.Hash RawTxsData []byte ForcedAt time.Time }
ForcedBatch represents a ForcedBatch
type ForkIDInterval ¶
type ForkIDInterval struct { FromBatchNumber uint64 ToBatchNumber uint64 ForkId uint64 Version string BlockNumber uint64 }
ForkIDInterval is a fork id interval
type Genesis ¶
type Genesis struct { // GenesisBlockNum is the block number where the polygonZKEVM smc was deployed on L1 GenesisBlockNum uint64 // Root hash of the genesis block Root common.Hash // Contracts to be deployed to L2 GenesisActions []*GenesisAction }
Genesis contains the information to populate state on creation
type GenesisAction ¶
type GenesisAction struct { Address string `json:"address"` Type int `json:"type"` StoragePosition string `json:"storagePosition"` Bytecode string `json:"bytecode"` Key string `json:"key"` Value string `json:"value"` Root string `json:"root"` }
GenesisAction represents one of the values set on the SMT during genesis.
type GlobalExitRoot ¶
type GlobalExitRoot struct { BlockNumber uint64 Timestamp time.Time MainnetExitRoot common.Hash RollupExitRoot common.Hash GlobalExitRoot common.Hash }
GlobalExitRoot struct
type InfoReadWrite ¶
InfoReadWrite has information about modified addresses during the execution
type NewL2BlockEvent ¶
NewL2BlockEvent is a struct provided from the state to the NewL2BlockEventHandler when a new l2 block is detected with data related to this new l2 block.
type NewL2BlockEventHandler ¶
type NewL2BlockEventHandler func(e NewL2BlockEvent)
NewL2BlockEventHandler represent a func that will be called by the state when a NewL2BlockEvent is triggered
type PostgresStorage ¶
PostgresStorage implements the Storage interface
func NewPostgresStorage ¶
func NewPostgresStorage(db *pgxpool.Pool) *PostgresStorage
NewPostgresStorage creates a new StateDB
func (*PostgresStorage) AddAccumulatedInputHash ¶
func (p *PostgresStorage) AddAccumulatedInputHash(ctx context.Context, batchNum uint64, accInputHash common.Hash, dbTx pgx.Tx) error
AddAccumulatedInputHash adds the accumulated input hash
func (*PostgresStorage) AddBlock ¶
func (p *PostgresStorage) AddBlock(ctx context.Context, block *Block, dbTx pgx.Tx) error
AddBlock adds a new block to the State Store
func (*PostgresStorage) AddForcedBatch ¶
func (p *PostgresStorage) AddForcedBatch(ctx context.Context, forcedBatch *ForcedBatch, tx pgx.Tx) error
AddForcedBatch adds a new ForcedBatch to the db
func (*PostgresStorage) AddForkID ¶ added in v0.0.990
func (p *PostgresStorage) AddForkID(ctx context.Context, forkID ForkIDInterval, dbTx pgx.Tx) error
AddForkID adds a new forkID to the storage
func (*PostgresStorage) AddGeneratedProof ¶
func (p *PostgresStorage) AddGeneratedProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error
AddGeneratedProof adds a generated proof to the storage
func (*PostgresStorage) AddGlobalExitRoot ¶
func (p *PostgresStorage) AddGlobalExitRoot(ctx context.Context, exitRoot *GlobalExitRoot, dbTx pgx.Tx) error
AddGlobalExitRoot adds a new ExitRoot to the db
func (*PostgresStorage) AddL2Block ¶
func (p *PostgresStorage) AddL2Block(ctx context.Context, batchNumber uint64, l2Block *types.Block, receipts []*types.Receipt, effectivePercentage uint8, dbTx pgx.Tx) error
AddL2Block adds a new L2 block to the State Store
func (*PostgresStorage) AddReceipt ¶
func (p *PostgresStorage) AddReceipt(ctx context.Context, receipt *types.Receipt, dbTx pgx.Tx) error
AddReceipt adds a new receipt to the State Store
func (*PostgresStorage) AddSequence ¶
func (p *PostgresStorage) AddSequence(ctx context.Context, sequence Sequence, dbTx pgx.Tx) error
AddSequence stores the sequence information to allow the aggregator verify sequences.
func (*PostgresStorage) AddTrustedReorg ¶
func (p *PostgresStorage) AddTrustedReorg(ctx context.Context, reorg *TrustedReorg, dbTx pgx.Tx) error
AddTrustedReorg is used to store trusted reorgs
func (*PostgresStorage) AddVerifiedBatch ¶
func (p *PostgresStorage) AddVerifiedBatch(ctx context.Context, verifiedBatch *VerifiedBatch, dbTx pgx.Tx) error
AddVerifiedBatch adds a new VerifiedBatch to the db
func (*PostgresStorage) AddVirtualBatch ¶
func (p *PostgresStorage) AddVirtualBatch(ctx context.Context, virtualBatch *VirtualBatch, dbTx pgx.Tx) error
AddVirtualBatch adds a new virtual batch to the storage.
func (*PostgresStorage) BatchNumberByL2BlockNumber ¶
func (p *PostgresStorage) BatchNumberByL2BlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (uint64, error)
BatchNumberByL2BlockNumber gets a batch number by a l2 block number
func (*PostgresStorage) CheckProofContainsCompleteSequences ¶
func (p *PostgresStorage) CheckProofContainsCompleteSequences(ctx context.Context, proof *Proof, dbTx pgx.Tx) (bool, error)
CheckProofContainsCompleteSequences checks if a recursive proof contains complete sequences
func (*PostgresStorage) CleanupGeneratedProofs ¶
func (p *PostgresStorage) CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
CleanupGeneratedProofs deletes from the storage the generated proofs up to the specified batch number included.
func (*PostgresStorage) CleanupLockedProofs ¶
func (p *PostgresStorage) CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error)
CleanupLockedProofs deletes from the storage the proofs locked in generating state for more than the provided threshold.
func (*PostgresStorage) CountReorgs ¶
func (p *PostgresStorage) CountReorgs(ctx context.Context, dbTx pgx.Tx) (uint64, error)
CountReorgs returns the number of reorgs
func (*PostgresStorage) DeleteGeneratedProofs ¶
func (p *PostgresStorage) DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error
DeleteGeneratedProofs deletes from the storage the generated proofs falling inside the batch numbers range.
func (*PostgresStorage) DeleteUngeneratedProofs ¶
func (p *PostgresStorage) DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error
DeleteUngeneratedProofs deletes ungenerated proofs. This method is meant to be use during aggregator boot-up sequence
func (*PostgresStorage) GetBatchByForcedBatchNum ¶
func (p *PostgresStorage) GetBatchByForcedBatchNum(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*Batch, error)
GetBatchByForcedBatchNum returns the batch with the given forced batch number.
func (*PostgresStorage) GetBatchByL2BlockNumber ¶
func (p *PostgresStorage) GetBatchByL2BlockNumber(ctx context.Context, l2BlockNumber uint64, dbTx pgx.Tx) (*Batch, error)
GetBatchByL2BlockNumber returns the batch related to the l2 block accordingly to the provided l2 block number.
func (*PostgresStorage) GetBatchByNumber ¶
func (p *PostgresStorage) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*Batch, error)
GetBatchByNumber returns the batch with the given number.
func (*PostgresStorage) GetBatchByTxHash ¶
func (p *PostgresStorage) GetBatchByTxHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*Batch, error)
GetBatchByTxHash returns the batch including the given tx
func (*PostgresStorage) GetBatchNumberOfL2Block ¶
func (p *PostgresStorage) GetBatchNumberOfL2Block(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (uint64, error)
GetBatchNumberOfL2Block gets a batch number for l2 block by its number
func (*PostgresStorage) GetBlockNumAndMainnetExitRootByGER ¶
func (p *PostgresStorage) GetBlockNumAndMainnetExitRootByGER(ctx context.Context, ger common.Hash, dbTx pgx.Tx) (uint64, common.Hash, error)
GetBlockNumAndMainnetExitRootByGER gets block number and mainnet exit root by the global exit root
func (*PostgresStorage) GetBlockNumVirtualBatchByBatchNum ¶
func (p *PostgresStorage) GetBlockNumVirtualBatchByBatchNum(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (uint64, error)
GetBlockNumVirtualBatchByBatchNum get block num of virtual batch by block num
func (*PostgresStorage) GetEncodedTransactionsByBatchNumber ¶
func (p *PostgresStorage) GetEncodedTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (encodedTxs []string, effectivePercentages []uint8, err error)
GetEncodedTransactionsByBatchNumber returns the encoded field of all transactions in the given batch.
func (*PostgresStorage) GetExitRootByGlobalExitRoot ¶
func (p *PostgresStorage) GetExitRootByGlobalExitRoot(ctx context.Context, ger common.Hash, dbTx pgx.Tx) (*GlobalExitRoot, error)
GetExitRootByGlobalExitRoot returns the mainnet and rollup exit root given a global exit root number.
func (*PostgresStorage) GetFinalizedL2BlockNumber ¶ added in v0.0.990
func (p *PostgresStorage) GetFinalizedL2BlockNumber(ctx context.Context, l1FinalizedBlockNumber uint64, dbTx pgx.Tx) (uint64, error)
GetFinalizedL2BlockNumber gets the last l2 block verified that was mined on or after the finalized block on L1
func (*PostgresStorage) GetForcedBatch ¶
func (p *PostgresStorage) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*ForcedBatch, error)
GetForcedBatch get an L1 forcedBatch.
func (*PostgresStorage) GetForcedBatchesSince ¶
func (p *PostgresStorage) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber, maxBlockNumber uint64, dbTx pgx.Tx) ([]*ForcedBatch, error)
GetForcedBatchesSince gets L1 forced batches since forcedBatchNumber
func (*PostgresStorage) GetForkIDTrustedReorgCount ¶
func (p *PostgresStorage) GetForkIDTrustedReorgCount(ctx context.Context, forkID uint64, version string, dbTx pgx.Tx) (uint64, error)
GetForkIDTrustedReorgCount returns the forkID
func (*PostgresStorage) GetForkIDs ¶ added in v0.0.990
func (p *PostgresStorage) GetForkIDs(ctx context.Context, dbTx pgx.Tx) ([]ForkIDInterval, error)
GetForkIDs get all the forkIDs stored
func (*PostgresStorage) GetL2BlockByHash ¶
func (p *PostgresStorage) GetL2BlockByHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*types.Block, error)
GetL2BlockByHash gets a l2 block from its hash
func (*PostgresStorage) GetL2BlockByNumber ¶
func (p *PostgresStorage) GetL2BlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*types.Block, error)
GetL2BlockByNumber gets a l2 block by its number
func (*PostgresStorage) GetL2BlockHashesSince ¶
func (p *PostgresStorage) GetL2BlockHashesSince(ctx context.Context, since time.Time, dbTx pgx.Tx) ([]common.Hash, error)
GetL2BlockHashesSince gets the block hashes added since the provided date
func (*PostgresStorage) GetL2BlockHeaderByHash ¶
func (p *PostgresStorage) GetL2BlockHeaderByHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*types.Header, error)
GetL2BlockHeaderByHash gets the block header by block number
func (*PostgresStorage) GetL2BlockHeaderByNumber ¶
func (p *PostgresStorage) GetL2BlockHeaderByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*types.Header, error)
GetL2BlockHeaderByNumber gets the block header by block number
func (*PostgresStorage) GetL2BlockTransactionCountByHash ¶
func (p *PostgresStorage) GetL2BlockTransactionCountByHash(ctx context.Context, blockHash common.Hash, dbTx pgx.Tx) (uint64, error)
GetL2BlockTransactionCountByHash returns the number of transactions related to the provided block hash
func (*PostgresStorage) GetL2BlockTransactionCountByNumber ¶
func (p *PostgresStorage) GetL2BlockTransactionCountByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (uint64, error)
GetL2BlockTransactionCountByNumber returns the number of transactions related to the provided block number
func (*PostgresStorage) GetL2BlocksByBatchNumber ¶ added in v0.0.990
func (p *PostgresStorage) GetL2BlocksByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]types.Block, error)
GetL2BlocksByBatchNumber get all blocks associated to a batch accordingly to the provided batch number
func (*PostgresStorage) GetLastBatchNumber ¶
func (p *PostgresStorage) GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastBatchNumber get last trusted batch number
func (*PostgresStorage) GetLastBatchTime ¶
GetLastBatchTime gets last trusted batch time
func (*PostgresStorage) GetLastBlock ¶
func (p *PostgresStorage) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*Block, error)
GetLastBlock returns the last L1 block.
func (*PostgresStorage) GetLastClosedBatch ¶
func (p *PostgresStorage) GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*Batch, error)
GetLastClosedBatch returns the latest closed batch
func (*PostgresStorage) GetLastConsolidatedL2BlockNumber ¶
func (p *PostgresStorage) GetLastConsolidatedL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastConsolidatedL2BlockNumber gets the last l2 block verified
func (*PostgresStorage) GetLastL2Block ¶
GetLastL2Block retrieves the latest L2 Block from the State data base
func (*PostgresStorage) GetLastL2BlockCreatedAt ¶
func (p *PostgresStorage) GetLastL2BlockCreatedAt(ctx context.Context, dbTx pgx.Tx) (*time.Time, error)
GetLastL2BlockCreatedAt gets the timestamp of the last l2 block
func (*PostgresStorage) GetLastL2BlockHeader ¶
func (p *PostgresStorage) GetLastL2BlockHeader(ctx context.Context, dbTx pgx.Tx) (*types.Header, error)
GetLastL2BlockHeader gets the last l2 block number
func (*PostgresStorage) GetLastL2BlockNumber ¶
func (p *PostgresStorage) GetLastL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastL2BlockNumber gets the last l2 block number
func (*PostgresStorage) GetLastNBatches ¶
func (p *PostgresStorage) GetLastNBatches(ctx context.Context, numBatches uint, dbTx pgx.Tx) ([]*Batch, error)
GetLastNBatches returns the last numBatches batches.
func (*PostgresStorage) GetLastNBatchesByL2BlockNumber ¶
func (p *PostgresStorage) GetLastNBatchesByL2BlockNumber(ctx context.Context, l2BlockNumber *uint64, numBatches uint, dbTx pgx.Tx) ([]*Batch, common.Hash, error)
GetLastNBatchesByL2BlockNumber returns the last numBatches batches along with the l2 block state root by l2BlockNumber if the l2BlockNumber parameter is nil, it means we want to get the most recent last N batches
func (*PostgresStorage) GetLastTrustedForcedBatchNumber ¶
func (p *PostgresStorage) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastTrustedForcedBatchNumber get last trusted forced batch number
func (*PostgresStorage) GetLastVerifiedBatch ¶
func (p *PostgresStorage) GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*VerifiedBatch, error)
GetLastVerifiedBatch gets last verified batch
func (*PostgresStorage) GetLastVirtualBatchNum ¶
func (p *PostgresStorage) GetLastVirtualBatchNum(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastVirtualBatchNum gets last virtual batch num
func (*PostgresStorage) GetLastVirtualizedL2BlockNumber ¶ added in v0.0.990
func (p *PostgresStorage) GetLastVirtualizedL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastVirtualizedL2BlockNumber gets the last l2 block virtualized
func (*PostgresStorage) GetLatestGer ¶
func (p *PostgresStorage) GetLatestGer(ctx context.Context, maxBlockNumber uint64) (GlobalExitRoot, time.Time, error)
GetLatestGer is used to get the latest ger
func (*PostgresStorage) GetLatestGlobalExitRoot ¶
func (p *PostgresStorage) GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (GlobalExitRoot, time.Time, error)
GetLatestGlobalExitRoot get the latest global ExitRoot synced.
func (*PostgresStorage) GetLatestVirtualBatchTimestamp ¶
func (p *PostgresStorage) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
GetLatestVirtualBatchTimestamp gets last virtual batch timestamp
func (*PostgresStorage) GetLocalExitRootByBatchNumber ¶
func (p *PostgresStorage) GetLocalExitRootByBatchNumber(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (common.Hash, error)
GetLocalExitRootByBatchNumber get local exit root by batch number
func (*PostgresStorage) GetLogs ¶
func (p *PostgresStorage) GetLogs(ctx context.Context, fromBlock uint64, toBlock uint64, addresses []common.Address, topics [][]common.Hash, blockHash *common.Hash, since *time.Time, dbTx pgx.Tx) ([]*types.Log, error)
GetLogs returns the logs that match the filter
func (*PostgresStorage) GetNextForcedBatches ¶
func (p *PostgresStorage) GetNextForcedBatches(ctx context.Context, nextForcedBatches int, dbTx pgx.Tx) ([]ForcedBatch, error)
GetNextForcedBatches gets the next forced batches from the queue.
func (*PostgresStorage) GetNumberOfBlocksSinceLastGERUpdate ¶
func (p *PostgresStorage) GetNumberOfBlocksSinceLastGERUpdate(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetNumberOfBlocksSinceLastGERUpdate gets number of blocks since last global exit root update
func (*PostgresStorage) GetPreviousBlock ¶
func (p *PostgresStorage) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*Block, error)
GetPreviousBlock gets the offset previous L1 block respect to latest.
func (*PostgresStorage) GetProcessingContext ¶
func (p *PostgresStorage) GetProcessingContext(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*ProcessingContext, error)
GetProcessingContext returns the processing context for the given batch.
func (*PostgresStorage) GetProofReadyToVerify ¶
func (p *PostgresStorage) GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*Proof, error)
GetProofReadyToVerify return the proof that is ready to verify
func (*PostgresStorage) GetProofsToAggregate ¶
func (p *PostgresStorage) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*Proof, *Proof, error)
GetProofsToAggregate return the next to proof that it is possible to aggregate
func (*PostgresStorage) GetReorgedTransactions ¶
func (p *PostgresStorage) GetReorgedTransactions(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error)
GetReorgedTransactions returns the transactions that were reorged
func (*PostgresStorage) GetSafeL2BlockNumber ¶ added in v0.0.990
func (p *PostgresStorage) GetSafeL2BlockNumber(ctx context.Context, l1SafeBlockNumber uint64, dbTx pgx.Tx) (uint64, error)
GetSafeL2BlockNumber gets the last l2 block virtualized that was mined on or after the safe block on L1
func (*PostgresStorage) GetSequences ¶
func (p *PostgresStorage) GetSequences(ctx context.Context, lastVerifiedBatchNumber uint64, dbTx pgx.Tx) ([]Sequence, error)
GetSequences get the next sequences higher than an specify batch number
func (*PostgresStorage) GetStateRootByBatchNumber ¶
func (p *PostgresStorage) GetStateRootByBatchNumber(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (common.Hash, error)
GetStateRootByBatchNumber get state root by batch number
func (*PostgresStorage) GetSyncingInfo ¶
func (p *PostgresStorage) GetSyncingInfo(ctx context.Context, dbTx pgx.Tx) (SyncingInfo, error)
GetSyncingInfo returns information regarding the syncing status of the node
func (*PostgresStorage) GetTimeForLatestBatchVirtualization ¶
func (p *PostgresStorage) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
GetTimeForLatestBatchVirtualization returns the timestamp of the latest virtual batch.
func (*PostgresStorage) GetTransactionByHash ¶
func (p *PostgresStorage) GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error)
GetTransactionByHash gets a transaction accordingly to the provided transaction hash
func (*PostgresStorage) GetTransactionByL2BlockHashAndIndex ¶
func (p *PostgresStorage) GetTransactionByL2BlockHashAndIndex(ctx context.Context, blockHash common.Hash, index uint64, dbTx pgx.Tx) (*types.Transaction, error)
GetTransactionByL2BlockHashAndIndex gets a transaction accordingly to the block hash and transaction index provided. since we only have a single transaction per l2 block, any index different from 0 will return a not found result
func (*PostgresStorage) GetTransactionByL2BlockNumberAndIndex ¶
func (p *PostgresStorage) GetTransactionByL2BlockNumberAndIndex(ctx context.Context, blockNumber uint64, index uint64, dbTx pgx.Tx) (*types.Transaction, error)
GetTransactionByL2BlockNumberAndIndex gets a transaction accordingly to the block number and transaction index provided. since we only have a single transaction per l2 block, any index different from 0 will return a not found result
func (*PostgresStorage) GetTransactionReceipt ¶
func (p *PostgresStorage) GetTransactionReceipt(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Receipt, error)
GetTransactionReceipt gets a transaction receipt accordingly to the provided transaction hash
func (*PostgresStorage) GetTransactionsByBatchNumber ¶
func (p *PostgresStorage) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error)
GetTransactionsByBatchNumber returns the transactions in the given batch.
func (*PostgresStorage) GetTxsByBatchNumber ¶
func (p *PostgresStorage) GetTxsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error)
GetTxsByBatchNumber returns all the txs in a given batch
func (*PostgresStorage) GetTxsByBlockNumber ¶
func (p *PostgresStorage) GetTxsByBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error)
GetTxsByBlockNumber returns all the txs in a given block
func (*PostgresStorage) GetTxsHashesByBatchNumber ¶
func (p *PostgresStorage) GetTxsHashesByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (encoded []common.Hash, err error)
GetTxsHashesByBatchNumber returns the hashes of the transactions in the given batch.
func (*PostgresStorage) GetTxsOlderThanNL1Blocks ¶
func (p *PostgresStorage) GetTxsOlderThanNL1Blocks(ctx context.Context, nL1Blocks uint64, dbTx pgx.Tx) ([]common.Hash, error)
GetTxsOlderThanNL1Blocks get txs hashes to delete from tx pool
func (*PostgresStorage) GetVerifiedBatch ¶
func (p *PostgresStorage) GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*VerifiedBatch, error)
GetVerifiedBatch get an L1 verifiedBatch.
func (*PostgresStorage) GetVirtualBatch ¶
func (p *PostgresStorage) GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*VirtualBatch, error)
GetVirtualBatch get an L1 virtualBatch.
func (*PostgresStorage) GetVirtualBatchByNumber ¶
func (p *PostgresStorage) GetVirtualBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*Batch, error)
GetVirtualBatchByNumber gets batch from batch table that exists on virtual batch
func (*PostgresStorage) GetVirtualBatchToProve ¶
func (p *PostgresStorage) GetVirtualBatchToProve(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*Batch, error)
GetVirtualBatchToProve return the next batch that is not proved, neither in proved process.
func (*PostgresStorage) IsBatchClosed ¶
func (p *PostgresStorage) IsBatchClosed(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error)
IsBatchClosed indicates if the batch referenced by batchNum is closed or not
func (*PostgresStorage) IsBatchConsolidated ¶
func (p *PostgresStorage) IsBatchConsolidated(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error)
IsBatchConsolidated checks if batch is consolidated/verified.
func (*PostgresStorage) IsBatchVirtualized ¶
func (p *PostgresStorage) IsBatchVirtualized(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error)
IsBatchVirtualized checks if batch is virtualized
func (*PostgresStorage) IsL2BlockConsolidated ¶
func (p *PostgresStorage) IsL2BlockConsolidated(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (bool, error)
IsL2BlockConsolidated checks if the block ID is consolidated
func (*PostgresStorage) IsL2BlockVirtualized ¶
func (p *PostgresStorage) IsL2BlockVirtualized(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (bool, error)
IsL2BlockVirtualized checks if the block ID is virtualized
func (*PostgresStorage) IsSequencingTXSynced ¶
func (p *PostgresStorage) IsSequencingTXSynced(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (bool, error)
IsSequencingTXSynced checks if sequencing tx has been synced into the state
func (*PostgresStorage) Reset ¶
func (p *PostgresStorage) Reset(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error
Reset resets the state to a block for the given DB tx
func (*PostgresStorage) ResetForkID ¶
func (p *PostgresStorage) ResetForkID(ctx context.Context, batchNumber, forkID uint64, version string, dbTx pgx.Tx) error
ResetForkID resets the state to reprocess the newer batches with the correct forkID
func (*PostgresStorage) ResetTrustedState ¶
func (p *PostgresStorage) ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
ResetTrustedState removes the batches with number greater than the given one from the database.
func (*PostgresStorage) SetInitSyncBatch ¶ added in v0.0.990
func (p *PostgresStorage) SetInitSyncBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
SetInitSyncBatch sets the initial batch number where the synchronization started
func (*PostgresStorage) SetLastBatchInfoSeenOnEthereum ¶ added in v0.0.990
func (p *PostgresStorage) SetLastBatchInfoSeenOnEthereum(ctx context.Context, lastBatchNumberSeen, lastBatchNumberVerified uint64, dbTx pgx.Tx) error
SetLastBatchInfoSeenOnEthereum sets the last batch number that affected the roll-up and the last batch number that was consolidated on ethereum in order to allow the components to know if the state is synchronized or not
func (*PostgresStorage) UpdateBatchL2Data ¶
func (p *PostgresStorage) UpdateBatchL2Data(ctx context.Context, batchNumber uint64, batchL2Data []byte, dbTx pgx.Tx) error
UpdateBatchL2Data updates data tx data in a batch
func (*PostgresStorage) UpdateForkID ¶ added in v0.0.990
func (p *PostgresStorage) UpdateForkID(ctx context.Context, forkID ForkIDInterval, dbTx pgx.Tx) error
UpdateForkID updates the forkID stored in db
func (*PostgresStorage) UpdateGERInOpenBatch ¶
func (p *PostgresStorage) UpdateGERInOpenBatch(ctx context.Context, ger common.Hash, dbTx pgx.Tx) error
UpdateGERInOpenBatch update ger in open batch
func (*PostgresStorage) UpdateGeneratedProof ¶
func (p *PostgresStorage) UpdateGeneratedProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error
UpdateGeneratedProof updates a generated proof in the storage
type ProcessBatchResponse ¶
type ProcessBatchResponse struct { NewStateRoot common.Hash NewAccInputHash common.Hash NewLocalExitRoot common.Hash NewBatchNumber uint64 UsedZkCounters ZKCounters Responses []*ProcessTransactionResponse ExecutorError error IsBatchProcessed bool ReadWriteAddresses map[common.Address]*InfoReadWrite IsRomLevelError bool IsExecutorLevelError bool IsRomOOCError bool FlushID uint64 StoredFlushID uint64 ProverID string }
ProcessBatchResponse represents the response of a batch process.
type ProcessRequest ¶
type ProcessRequest struct { BatchNumber uint64 GlobalExitRoot common.Hash OldStateRoot common.Hash OldAccInputHash common.Hash Transactions []byte Coinbase common.Address Timestamp time.Time Caller metrics.CallerLabel }
ProcessRequest represents the request of a batch process.
type ProcessTransactionResponse ¶
type ProcessTransactionResponse struct { // TxHash is the hash of the transaction TxHash common.Hash // Type indicates legacy transaction // It will be always 0 (legacy) in the executor Type uint32 // ReturnValue is the returned data from the runtime (function result or data supplied with revert opcode) ReturnValue []byte // GasLeft is the total gas left as result of execution GasLeft uint64 // GasUsed is the total gas used as result of execution or gas estimation GasUsed uint64 // GasRefunded is the total gas refunded as result of execution GasRefunded uint64 // RomError represents any error encountered during the execution RomError error // CreateAddress is the new SC Address in case of SC creation CreateAddress common.Address // StateRoot is the State Root StateRoot common.Hash // Logs emitted by LOG opcode Logs []*types.Log // ChangesStateRoot indicates if this tx affects the state ChangesStateRoot bool // Tx is the whole transaction object Tx types.Transaction // ExecutionTrace contains the traces produced in the execution ExecutionTrace []instrumentation.StructLog // CallTrace contains the call trace. CallTrace instrumentation.ExecutorTrace // EffectiveGasPrice effective gas price used for the tx EffectiveGasPrice string //EffectivePercentage effective percentage used for the tx EffectivePercentage uint32 }
ProcessTransactionResponse represents the response of a tx process.
type ProcessingContext ¶
type ProcessingContext struct { BatchNumber uint64 Coinbase common.Address Timestamp time.Time GlobalExitRoot common.Hash ForcedBatchNum *uint64 BatchL2Data *[]byte }
ProcessingContext is the necessary data that a batch needs to provide to the runtime, without the historical state data (processing receipt from previous batch)
type ProcessingReceipt ¶
type ProcessingReceipt struct { BatchNumber uint64 StateRoot common.Hash LocalExitRoot common.Hash AccInputHash common.Hash // Txs []types.Transaction BatchL2Data []byte ClosingReason ClosingReason BatchResources BatchResources }
ProcessingReceipt indicates the outcome (StateRoot, AccInputHash) of processing a batch
type Proof ¶
type Proof struct { BatchNumber uint64 BatchNumberFinal uint64 Proof string InputProver string ProofID *string // Prover name, unique identifier across prover reboots. Prover *string // ProverID prover process identifier. ProverID *string // GeneratingSince holds the timestamp for the moment in which the // proof generation has started by a prover. Nil if the proof is not // currently generating. GeneratingSince *time.Time CreatedAt time.Time UpdatedAt time.Time }
Proof struct
type Stack ¶ added in v0.0.990
type Stack[T any] struct { // contains filtered or unexported fields }
Stack is a thread safe stack data structure implementation implementing generics
type State ¶
type State struct { *PostgresStorage // contains filtered or unexported fields }
State is an implementation of the state
func NewState ¶
func NewState(cfg Config, storage *PostgresStorage, executorClient executor.ExecutorServiceClient, stateTree *merkletree.StateTree, eventLog *event.EventLog) *State
NewState creates a new State
func (*State) AddForkIDInterval ¶ added in v0.0.990
func (s *State) AddForkIDInterval(ctx context.Context, newForkID ForkIDInterval, dbTx pgx.Tx) error
AddForkIDInterval updates the forkID intervals
func (*State) BeginStateTransaction ¶
BeginStateTransaction starts a state transaction
func (*State) CloseBatch ¶
func (s *State) CloseBatch(ctx context.Context, receipt ProcessingReceipt, dbTx pgx.Tx) error
CloseBatch is used by sequencer to close the current batch
func (*State) DebugTransaction ¶
func (s *State) DebugTransaction(ctx context.Context, transactionHash common.Hash, traceConfig TraceConfig, dbTx pgx.Tx) (*runtime.ExecutionResult, error)
DebugTransaction re-executes a tx to generate its trace
func (*State) EstimateGas ¶
func (s *State) EstimateGas(transaction *types.Transaction, senderAddress common.Address, l2BlockNumber *uint64, dbTx pgx.Tx) (uint64, []byte, error)
EstimateGas for a transaction
func (*State) ExecuteBatch ¶
func (s *State) ExecuteBatch(ctx context.Context, batch Batch, updateMerkleTree bool, dbTx pgx.Tx) (*executor.ProcessBatchResponse, error)
ExecuteBatch is used by the synchronizer to reprocess batches to compare generated state root vs stored one It is also used by the sequencer in order to calculate used zkCounter of a WIPBatch
func (*State) FlushMerkleTree ¶
FlushMerkleTree persists updates in the Merkle tree
func (*State) GetBalance ¶
func (s *State) GetBalance(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
GetBalance from a given address
func (*State) GetBalanceByStateRoot ¶
func (s *State) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
GetBalanceByStateRoot gets balance from the MT Service using the provided state root
func (*State) GetCode ¶
func (s *State) GetCode(ctx context.Context, address common.Address, root common.Hash) ([]byte, error)
GetCode from a given address
func (*State) GetForkIDByBatchNumber ¶ added in v0.0.990
GetForkIDByBatchNumber returns the fork id for a given batch number
func (*State) GetLastBatch ¶
GetLastBatch gets latest batch (closed or not) on the data base
func (*State) GetLastStateRoot ¶
GetLastStateRoot returns the latest state root
func (*State) GetNonce ¶
func (s *State) GetNonce(ctx context.Context, address common.Address, root common.Hash) (uint64, error)
GetNonce returns the nonce of the given account at the given block number
func (*State) GetNonceByStateRoot ¶
func (s *State) GetNonceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
GetNonceByStateRoot gets nonce from the MT Service using the provided state root
func (*State) GetStorageAt ¶
func (s *State) GetStorageAt(ctx context.Context, address common.Address, position *big.Int, root common.Hash) (*big.Int, error)
GetStorageAt from a given address
func (*State) GetStoredFlushID ¶ added in v0.0.990
GetStoredFlushID returns the stored flush ID and Prover ID
func (*State) GetTree ¶
func (s *State) GetTree() *merkletree.StateTree
GetTree returns State inner tree
func (*State) OpenBatch ¶
func (s *State) OpenBatch(ctx context.Context, processingContext ProcessingContext, dbTx pgx.Tx) error
OpenBatch adds a new batch into the state, with the necessary data to start processing transactions within it. It's meant to be used by sequencers, since they don't necessarily know what transactions are going to be added in this batch yet. In other words it's the creation of a WIP batch. Note that this will add a batch with batch number N + 1, where N it's the greatest batch number on the state.
func (*State) PreProcessTransaction ¶
func (s *State) PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*ProcessBatchResponse, error)
PreProcessTransaction processes the transaction in order to calculate its zkCounters before adding it to the pool
func (*State) PrepareWebSocket ¶
func (s *State) PrepareWebSocket()
PrepareWebSocket allows the RPC to prepare ws
func (*State) ProcessAndStoreClosedBatch ¶
func (s *State) ProcessAndStoreClosedBatch(ctx context.Context, processingCtx ProcessingContext, encodedTxs []byte, dbTx pgx.Tx, caller metrics.CallerLabel) (common.Hash, uint64, string, error)
ProcessAndStoreClosedBatch is used by the Synchronizer to add a closed batch into the data base. Values returned are the new stateRoot, the flushID (incremental value returned by executor), the ProverID (executor running ID) the result of closing the batch.
func (*State) ProcessBatch ¶
func (s *State) ProcessBatch(ctx context.Context, request ProcessRequest, updateMerkleTree bool) (*ProcessBatchResponse, error)
ProcessBatch processes a batch
func (*State) ProcessSequencerBatch ¶
func (s *State) ProcessSequencerBatch(ctx context.Context, batchNumber uint64, batchL2Data []byte, caller metrics.CallerLabel, dbTx pgx.Tx) (*ProcessBatchResponse, error)
ProcessSequencerBatch is used by the sequencers to process transactions into an open batch
func (*State) ProcessUnsignedTransaction ¶
func (s *State) ProcessUnsignedTransaction(ctx context.Context, tx *types.Transaction, senderAddress common.Address, l2BlockNumber *uint64, noZKEVMCounters bool, dbTx pgx.Tx) (*runtime.ExecutionResult, error)
ProcessUnsignedTransaction processes the given unsigned transaction.
func (*State) RegisterNewL2BlockEventHandler ¶
func (s *State) RegisterNewL2BlockEventHandler(h NewL2BlockEventHandler)
RegisterNewL2BlockEventHandler add the provided handler to the list of handlers that will be triggered when a new l2 block event is triggered
func (*State) SetGenesis ¶
func (s *State) SetGenesis(ctx context.Context, block Block, genesis Genesis, dbTx pgx.Tx) ([]byte, error)
SetGenesis populates state with genesis information
func (*State) StoreTransaction ¶
func (s *State) StoreTransaction(ctx context.Context, batchNumber uint64, processedTx *ProcessTransactionResponse, coinbase common.Address, timestamp uint64, dbTx pgx.Tx) error
StoreTransaction is used by the sequencer and trusted state synchronizer to add process a transaction.
func (*State) StoreTransactions ¶
func (s *State) StoreTransactions(ctx context.Context, batchNumber uint64, processedTxs []*ProcessTransactionResponse, dbTx pgx.Tx) error
StoreTransactions is used by the sequencer to add processed transactions into an open batch. If the batch already has txs, the processedTxs must be a super set of the existing ones, preserving order.
func (*State) TestConvertToProcessBatchResponse ¶
func (s *State) TestConvertToProcessBatchResponse(response *executor.ProcessBatchResponse) (*ProcessBatchResponse, error)
TestConvertToProcessBatchResponse for test purposes
func (*State) UpdateForkIDIntervalsInMemory ¶ added in v0.0.990
func (s *State) UpdateForkIDIntervalsInMemory(intervals []ForkIDInterval)
UpdateForkIDIntervalsInMemory updates the forkID intervals in memory
type SyncingInfo ¶
type SyncingInfo struct { InitialSyncingBlock uint64 LastBlockNumberSeen uint64 LastBlockNumberConsolidated uint64 CurrentBlockNumber uint64 InitialSyncingBatch uint64 LastBatchNumberSeen uint64 LastBatchNumberConsolidated uint64 CurrentBatchNumber uint64 }
SyncingInfo stores information regarding the syncing status of the node
type TraceConfig ¶
type TraceConfig struct { DisableStorage bool DisableStack bool EnableMemory bool EnableReturnData bool Tracer *string TracerConfig json.RawMessage }
TraceConfig sets the debug configuration for the executor
func (*TraceConfig) Is4ByteTracer ¶
func (t *TraceConfig) Is4ByteTracer() bool
Is4ByteTracer returns true when should use 4byteTracer
func (*TraceConfig) IsCallTracer ¶
func (t *TraceConfig) IsCallTracer() bool
IsCallTracer returns true when should use callTracer
func (*TraceConfig) IsDefaultTracer ¶
func (t *TraceConfig) IsDefaultTracer() bool
IsDefaultTracer returns true when no custom tracer is set
func (*TraceConfig) IsJSCustomTracer ¶
func (t *TraceConfig) IsJSCustomTracer() bool
IsJSCustomTracer returns true when should use js custom tracer
func (*TraceConfig) IsNoopTracer ¶
func (t *TraceConfig) IsNoopTracer() bool
IsNoopTracer returns true when should use noopTracer
func (*TraceConfig) IsPrestateTracer ¶
func (t *TraceConfig) IsPrestateTracer() bool
IsPrestateTracer returns true when should use prestateTracer
type TrustedReorg ¶
TrustedReorg represents a trusted reorg
type VerifiedBatch ¶
type VerifiedBatch struct { BlockNumber uint64 BatchNumber uint64 Aggregator common.Address TxHash common.Hash StateRoot common.Hash IsTrusted bool }
VerifiedBatch represents a VerifiedBatch
type VirtualBatch ¶
type VirtualBatch struct { BatchNumber uint64 TxHash common.Hash Coinbase common.Address SequencerAddr common.Address BlockNumber uint64 }
VirtualBatch represents a VirtualBatch
type ZKCounters ¶
type ZKCounters struct { CumulativeGasUsed uint64 UsedKeccakHashes uint32 UsedPoseidonHashes uint32 UsedPoseidonPaddings uint32 UsedMemAligns uint32 UsedArithmetics uint32 UsedBinaries uint32 UsedSteps uint32 }
ZKCounters counters for the tx
func ConvertToCounters ¶
func ConvertToCounters(resp *executor.ProcessBatchResponse) ZKCounters
ConvertToCounters extracts ZKCounters from a ProcessBatchResponse
func (*ZKCounters) Sub ¶
func (z *ZKCounters) Sub(other ZKCounters) error
Sub subtract zk counters with passed zk counters (not safe)
func (*ZKCounters) SumUp ¶
func (z *ZKCounters) SumUp(other ZKCounters)
SumUp sum ups zk counters with passed tx zk counters
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
instrumentation/js/internal/tracers
Package tracers contains the actual JavaScript tracer assets.
|
Package tracers contains the actual JavaScript tracer assets. |
instrumentation/tracers
Package tracers is a manager for transaction tracing engines.
|
Package tracers is a manager for transaction tracing engines. |