Skip to content
Merged
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/chuckpreslar/emission v0.0.0-20170206194824-a7ddd980baf9
github.com/ethereum/go-ethereum v1.16.4
github.com/ethpandaops/ethwallclock v0.2.0
github.com/ethpandaops/go-eth2-client v0.1.2
github.com/ethpandaops/go-eth2-client v0.1.3-0.20260513062559-5fb497ba414f
github.com/go-co-op/gocron v1.16.2
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/client_model v0.6.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ github.com/ethpandaops/ethwallclock v0.2.0 h1:EeFKtZ7v6TAdn/oAh0xaPujD7N4amjBxrW
github.com/ethpandaops/ethwallclock v0.2.0/go.mod h1:y0Cu+mhGLlem19vnAV2x0hpFS5KZ7oOi2SWYayv9l24=
github.com/ethpandaops/go-eth2-client v0.1.2 h1:nJr0YBmqHtbVeLeWEDyXwjCEO0AFt1Z0lIciMYlowfU=
github.com/ethpandaops/go-eth2-client v0.1.2/go.mod h1:U3KdR8QSq8vqs9LWSGAF4ETHJpcB62E1DFf0gVMgWv0=
github.com/ethpandaops/go-eth2-client v0.1.3-0.20260513062559-5fb497ba414f h1:9k0z0tEayikToEqZn71xKIRtCNzH6mwUkIJk70kbSSk=
github.com/ethpandaops/go-eth2-client v0.1.3-0.20260513062559-5fb497ba414f/go.mod h1:U3KdR8QSq8vqs9LWSGAF4ETHJpcB62E1DFf0gVMgWv0=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down
2 changes: 2 additions & 0 deletions pkg/beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ type Node interface {
OnBlobSidecar(ctx context.Context, handler func(ctx context.Context, ev *v1.BlobSidecarEvent) error)
// OnDataColumnSidecar is called when a data column sidecar is received.
OnDataColumnSidecar(ctx context.Context, handler func(ctx context.Context, ev *v1.DataColumnSidecarEvent) error)
// OnFastConfirmation is called when a fast confirmation is received.
OnFastConfirmation(ctx context.Context, handler func(ctx context.Context, ev *v1.FastConfirmationEvent) error)

// - Custom events
// OnReady is called when the node is ready.
Expand Down
1 change: 1 addition & 0 deletions pkg/beacon/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const (
topicContributionAndProof = "contribution_and_proof"
topicBlobSidecar = "blob_sidecar"
topicDataColumnSidecar = "data_column_sidecar"
topicFastConfirmation = "fast_confirmation"
topicEvent = "raw_event"
)

Expand Down
4 changes: 4 additions & 0 deletions pkg/beacon/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func (n *node) publishBlockGossip(ctx context.Context, event *v1.BlockGossipEven
n.broker.Emit(topicBlockGossip, event)
}

func (n *node) publishFastConfirmation(ctx context.Context, event *v1.FastConfirmationEvent) {
n.broker.Emit(topicFastConfirmation, event)
}

func (n *node) publishAttestation(ctx context.Context, event *spec.VersionedAttestation) {
n.broker.Emit(topicAttestation, event)
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/beacon/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func (n *node) OnBlockGossip(ctx context.Context, handler func(ctx context.Conte
})
}

func (n *node) OnFastConfirmation(ctx context.Context, handler func(ctx context.Context, event *v1.FastConfirmationEvent) error) {
n.broker.On(topicFastConfirmation, func(event *v1.FastConfirmationEvent) {
n.handleSubscriberError(handler(ctx, event), topicFastConfirmation)
})
}

func (n *node) OnAttestation(ctx context.Context, handler func(ctx context.Context, event *spec.VersionedAttestation) error) {
n.broker.On(topicAttestation, func(event *spec.VersionedAttestation) {
n.handleSubscriberError(handler(ctx, event), topicAttestation)
Expand Down
13 changes: 13 additions & 0 deletions pkg/beacon/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ func (n *node) handleEvent(ctx context.Context, event *v1.Event) error {
return n.handleBlobSidecar(ctx, event)
case topicDataColumnSidecar:
return n.handleDataColumnSidecar(ctx, event)
case topicFastConfirmation:
return n.handleFastConfirmation(ctx, event)

default:
return fmt.Errorf("unknown event topic %s", event.Topic)
Expand Down Expand Up @@ -152,6 +154,17 @@ func (n *node) handleBlockGossip(ctx context.Context, event *v1.Event) error {
return nil
}

func (n *node) handleFastConfirmation(ctx context.Context, event *v1.Event) error {
fastConfirmation, valid := event.Data.(*v1.FastConfirmationEvent)
if !valid {
return errors.New("invalid fast confirmation event")
}

n.publishFastConfirmation(ctx, fastConfirmation)

return nil
}

func (n *node) handleChainReorg(ctx context.Context, event *v1.Event) error {
chainReorg, valid := event.Data.(*v1.ChainReorgEvent)
if !valid {
Expand Down
Loading