Documentation ¶
Index ¶
- type ExecQuerier
- type PostgresStorage
- func (p *PostgresStorage) AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error
- func (p *PostgresStorage) AddSequence(ctx context.Context, sequence state.Sequence, dbTx pgx.Tx) error
- func (p *PostgresStorage) CheckProofContainsCompleteSequences(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) (bool, error)
- func (p *PostgresStorage) CheckProofExistsForBatch(ctx context.Context, batchNumber uint64, 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) 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) GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error)
- func (p *PostgresStorage) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error)
- func (p *PostgresStorage) UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecQuerier ¶
type PostgresStorage ¶
PostgresStorage implements the Storage interface
func NewPostgresStorage ¶
func NewPostgresStorage(cfg state.Config, db *pgxpool.Pool) *PostgresStorage
NewPostgresStorage creates a new StateDB
func (*PostgresStorage) AddGeneratedProof ¶
func (p *PostgresStorage) AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error
AddGeneratedProof adds a generated proof to the storage
func (*PostgresStorage) AddSequence ¶
func (p *PostgresStorage) AddSequence(ctx context.Context, sequence state.Sequence, dbTx pgx.Tx) error
AddSequence stores the sequence information to allow the aggregator verify sequences.
func (*PostgresStorage) CheckProofContainsCompleteSequences ¶
func (p *PostgresStorage) CheckProofContainsCompleteSequences( ctx context.Context, proof *state.Proof, dbTx pgx.Tx, ) (bool, error)
CheckProofContainsCompleteSequences checks if a recursive proof contains complete sequences
func (*PostgresStorage) CheckProofExistsForBatch ¶
func (p *PostgresStorage) CheckProofExistsForBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error)
CheckProofExistsForBatch checks if the batch is already included in any proof
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) 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) GetProofReadyToVerify ¶
func (p *PostgresStorage) GetProofReadyToVerify( ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx, ) (*state.Proof, error)
GetProofReadyToVerify return the proof that is ready to verify
func (*PostgresStorage) GetProofsToAggregate ¶
func (p *PostgresStorage) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error)
GetProofsToAggregate return the next to proof that it is possible to aggregate
func (*PostgresStorage) UpdateGeneratedProof ¶
func (p *PostgresStorage) UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error
UpdateGeneratedProof updates a generated proof in the storage