Commit 4de760d3 authored by clabby's avatar clabby

Follow Go doc comment conventions

parent 4c255a29
......@@ -19,7 +19,7 @@ import (
var ErrNotDepositTx = errors.New("first transaction in block is not a deposit tx")
var ErrTooManyRLPBytes = errors.New("batch would cause RLP bytes to go over limit")
// Interface shared between `zlib.Writer` and `gzip.Writer`
// WriterApi is the interface shared between `zlib.Writer` and `gzip.Writer`
type WriterApi interface {
Close() error
Flush() error
......@@ -27,7 +27,8 @@ type WriterApi interface {
Write([]byte) (int, error)
}
// Modified `derive.ChannelOut` that can be configured to behave differently than the original
// GarbageChannelOut is a modified `derive.ChannelOut` that can be configured to behave differently
// than the original
type GarbageChannelOut struct {
id derive.ChannelID
// Frame ID of the next frame to emit. Increment after emitting
......@@ -50,6 +51,7 @@ func (co *GarbageChannelOut) ID() derive.ChannelID {
return co.id
}
// NewGarbageChannelOut creates a new `GarbageChannelOut` with the given configuration.
func NewGarbageChannelOut(cfg *GarbageChannelCfg) (*GarbageChannelOut, error) {
c := &GarbageChannelOut{
id: derive.ChannelID{}, // TODO: use GUID here instead of fully random data
......
......@@ -254,9 +254,9 @@ type GarbageChannelCfg struct {
malformRLP bool
}
// ActL2BatchSubmit constructs a malformed channel frame and submits it to the
// ActL2BatchSubmitGarbage constructs a malformed channel frame and submits it to the
// batch inbox. This *should* cause the batch inbox to reject the blocks
// encoded within the frame, even if they are valid.
// encoded within the frame, even if the blocks themselves are valid.
func (s *L2Batcher) ActL2BatchSubmitGarbage(t Testing, kind GarbageKind) {
// Don't run this action if there's no data to submit
if s.l2ChannelOut == nil {
......
......@@ -196,8 +196,9 @@ func TestL2Finalization(gt *testing.T) {
require.Equal(t, heightToSubmit, sequencer.SyncStatus().FinalizedL2.Number, "unknown/bad finalized L1 blocks are ignored")
}
// Tests the behavior of an invalid/malformed output channel frame containing
// valid batches being submitted to the batch inbox.
// TestGarbageBatch tests the behavior of an invalid/malformed output channel frame containing
// valid batches being submitted to the batch inbox. These batches should always be rejected
// and the safe L2 head should remain unaltered.
func TestGarbageBatch(gt *testing.T) {
t := NewDefaultTesting(gt)
p := defaultRollupTestParams
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment