Skip to content

Commit 6cb0d3b

Browse files
committed
docs: fix typos and add documentation comments for some batcher public methods
1 parent d5c1386 commit 6cb0d3b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

op-alt-da/damock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func NewMockDAClient(log log.Logger) *MockDAClient {
4040
}
4141

4242
// NewCountingGenericCommitmentMockDAClient creates a MockDAClient that uses counting commitments.
43-
// It's commitments are big-endian encoded uint16s of 0, 1, 2, etc. instead of actual hash or altda-layer related commitments.
43+
// Its commitments are big-endian encoded uint16s of 0, 1, 2, etc. instead of actual hash or altda-layer related commitments.
4444
// Used for testing to make sure we receive commitments in order following Holocene strict ordering rules.
4545
func NewCountingGenericCommitmentMockDAClient(log log.Logger) *MockDAClient {
4646
return &MockDAClient{

op-batcher/batcher/channel.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type channel struct {
2424
channelBuilder *ChannelBuilder
2525
// Temporary cache for altDACommitments that are received potentially out of order from the da layer.
2626
// Map: first frameNumber in txData -> txData (that contains an altDACommitment)
27-
// Once the txData containing altDANextFrame is received, it will be pulled out of the
27+
// Once the txData containing altDAFrameCursor is received, it will be pulled out of the
2828
// channel on the next driver iteration, and sent to L1.
2929
altDACommitments map[uint16]txData
3030
// Points to the next frame number to send to L1 in order to maintain holocene strict ordering rules.
@@ -56,6 +56,10 @@ func newChannel(log log.Logger, metr metrics.Metricer, cfg ChannelConfig, rollup
5656
}
5757
}
5858

59+
// CacheAltDACommitment caches the commitment received from the DA layer for the given txData.
60+
// We cannot submit it directly to L1 yet, as we need to make sure the commitments are submitted in order,
61+
// according to the holocene rules. Therefore, we cache the commitment and let the channelManager
62+
// decide when to pull them out of the channel and send them to L1.
5963
func (s *channel) CacheAltDACommitment(txData txData, commitment altda.CommitmentData) {
6064
if commitment == nil {
6165
panic("expected non-nil commitment")
@@ -189,7 +193,7 @@ func (c *channel) ID() derive.ChannelID {
189193
return c.channelBuilder.ID()
190194
}
191195

192-
// NextAltDACommitment checks if it has already receives the altDA commitment
196+
// NextAltDACommitment checks if it has already received the altDA commitment
193197
// of the txData whose first frame is altDAFrameCursor. If it has, it returns
194198
// the txData and true. Otherwise, it returns an empty txData and false.
195199
func (c *channel) NextAltDACommitment() (txData, bool) {
@@ -200,7 +204,7 @@ func (c *channel) NextAltDACommitment() (txData, bool) {
200204
if len(txData.frames) == 0 {
201205
panic("expected txData to have frames")
202206
}
203-
// update altDANextFrame to the first frame of the next txData
207+
// update altDAFrameCursor to the first frame of the next txData
204208
lastFrame := txData.frames[len(txData.frames)-1]
205209
c.altDAFrameCursor = lastFrame.id.frameNumber + 1
206210
// We also store it in pendingTransactions so that TxFailed can know

op-batcher/batcher/channel_manager.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ func (s *channelManager) pendingBlocks() int {
9292
return s.blocks.Len() - s.blockCursor
9393
}
9494

95+
// CacheAltDACommitment caches the commitment received from the DA layer for the given txData.
96+
// We cannot submit it directly to L1 yet, as we need to make sure the commitments are submitted in order,
97+
// according to the holocene rules. Therefore, we cache them and let the channelManager decide when to submit them.
9598
func (s *channelManager) CacheAltDACommitment(txData txData, commitment altda.CommitmentData) {
9699
if len(txData.frames) == 0 {
97100
panic("no frames in txData")
@@ -110,6 +113,9 @@ func (s *channelManager) CacheAltDACommitment(txData txData, commitment altda.Co
110113
}
111114
}
112115

116+
// AltDASubmissionFailed marks a DA submission as having failed to be submitted to the DA layer.
117+
// The frames will be pushed back into the corresponding channel such that they can be pulled again by the
118+
// driver main loop and resent to the DA layer.
113119
func (s *channelManager) AltDASubmissionFailed(_id txID) {
114120
id := _id.String()
115121
if channel, ok := s.txChannels[id]; ok {

0 commit comments

Comments
 (0)