Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/evm/server/force_inclusion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (m *mockDA) Get(ctx context.Context, ids []da.ID, namespace []byte) ([]da.B
return nil, nil
}

func (m *mockDA) Subscribe(_ context.Context, _ []byte) (<-chan da.SubscriptionEvent, error) {
func (m *mockDA) Subscribe(_ context.Context, _ []byte, _ bool) (<-chan da.SubscriptionEvent, error) {
// Not needed in these tests; return a closed channel.
ch := make(chan da.SubscriptionEvent)
close(ch)
Expand Down
21 changes: 20 additions & 1 deletion block/internal/common/event.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package common

import "github.com/evstack/ev-node/types"
import (
"context"

"github.com/evstack/ev-node/types"
)

// EventSource represents the origin of a block event
type EventSource string
Expand All @@ -24,3 +28,18 @@ type DAHeightEvent struct {
// Optional DA height hints from P2P. first is the DA height hint for the header, second is the DA height hint for the data
DaHeightHints [2]uint64
}

// EventSink receives parsed DA events with backpressure support.
type EventSink interface {
PipeEvent(ctx context.Context, event DAHeightEvent) error
}

// EventSinkFunc adapts a plain function to the EventSink interface.
// Useful in tests:
//
// sink := common.EventSinkFunc(func(ctx context.Context, ev common.DAHeightEvent) error { return nil })
type EventSinkFunc func(ctx context.Context, event DAHeightEvent) error

func (f EventSinkFunc) PipeEvent(ctx context.Context, event DAHeightEvent) error {
return f(ctx, event)
}
Loading
Loading