Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Commit 4d3debf

Browse files
add more comments
1 parent e94c7f4 commit 4d3debf

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

adr-11-centralized-sequencer.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,44 @@ The centralized sequencer uses the following key data structures:
6363
1. **BatchQueue**: A queue to store batches of transactions waiting to be processed
6464
```go
6565
type BatchQueue struct {
66-
queue []sequencing.Batch
67-
mu sync.Mutex
66+
queue []sequencing.Batch // In-memory queue of batches waiting to be processed
67+
mu sync.Mutex // Mutex to ensure thread-safe access to the queue
6868
}
6969
```
7070

7171
2. **Sequencer**: The main sequencer structure that implements the Generic Sequencer interface
72-
```go:centralized-sequencer/adr-11-centralized-sequencer.md
72+
```go
7373
type Sequencer struct {
74-
da goda.DA
75-
namespace []byte
76-
rollupId []byte
77-
batchTime time.Duration
78-
bq *BatchQueue
79-
lastBatchHash []byte
80-
seenBatches map[string]struct{}
81-
seenBatchesMutex sync.RWMutex
82-
metrics *Metrics
83-
db *badger.DB
84-
closed atomic.Bool
74+
dalc *da.DAClient // Client for interacting with the Data Availability layer
75+
batchTime time.Duration // Time interval between batch submissions
76+
ctx context.Context // Context for controlling the sequencer's lifecycle
77+
maxSize uint64 // Maximum size of a batch in bytes
78+
79+
rollupId sequencing.RollupId // Identifier for the rollup this sequencer serves
80+
81+
tq *TransactionQueue // Queue for storing pending transactions
82+
lastBatchHash []byte // Hash of the last processed batch
83+
lastBatchHashMutex sync.RWMutex // Mutex for thread-safe access to lastBatchHash
84+
85+
seenBatches map[string]struct{} // Map to track batches that have been processed
86+
seenBatchesMutex sync.Mutex // Mutex for thread-safe access to seenBatches
87+
bq *BatchQueue // Queue for storing batches ready for processing
88+
89+
db *badger.DB // BadgerDB instance for persistent storage
90+
dbMux sync.Mutex // Mutex for safe concurrent DB access
91+
92+
metrics *Metrics // Structure to hold metrics for monitoring
8593
}
8694
```
8795

8896
3. **Metrics**: Structure to hold metrics for monitoring
8997
```go
9098
type Metrics struct {
91-
GasPrice metrics.Gauge
92-
LastBlobSize metrics.Gauge
93-
TransactionStatus metrics.Counter
94-
NumPendingBlocks metrics.Gauge
95-
IncludedBlockHeight metrics.Gauge
99+
GasPrice metrics.Gauge // Tracks the gas price used for DA submissions
100+
LastBlobSize metrics.Gauge // Tracks the size of the last submitted blob
101+
TransactionStatus metrics.Counter // Counts transaction status outcomes
102+
NumPendingBlocks metrics.Gauge // Tracks the number of blocks waiting to be submitted
103+
IncludedBlockHeight metrics.Gauge // Tracks the height of the last included block in the DA layer
96104
}
97105
```
98106

0 commit comments

Comments
 (0)