diff --git a/CHANGELOG.md b/CHANGELOG.md index ef677ebd..81516a37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ dev: - add proposer_slashing and attester_slashing events + - add bls_to_execution_change event 0.19.8 - more efficient fetching for large numbers of validators diff --git a/http/events.go b/http/events.go index 67e89c0c..1994e93c 100644 --- a/http/events.go +++ b/http/events.go @@ -27,6 +27,7 @@ import ( client "github.com/attestantio/go-eth2-client" api "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/altair" + "github.com/attestantio/go-eth2-client/spec/capella" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/r3labs/sse/v2" @@ -196,6 +197,15 @@ func (s *Service) handleEvent(ctx context.Context, msg *sse.Event, handler clien return } event.Data = attesterSlashingEvent + case "bls_to_execution_change": + blsToExecutionChangeEvent := &capella.BLSToExecutionChange{} + err := json.Unmarshal(msg.Data, blsToExecutionChangeEvent) + if err != nil { + log.Error().Err(err).RawJSON("data", msg.Data).Msg("Failed to parse bls to execution change event") + + return + } + event.Data = blsToExecutionChangeEvent case "blob_sidecar": blobSidecar := &api.BlobSidecarEvent{} err := json.Unmarshal(msg.Data, blobSidecar) diff --git a/http/events_internal_test.go b/http/events_internal_test.go index 03eaf3ce..683460ba 100644 --- a/http/events_internal_test.go +++ b/http/events_internal_test.go @@ -143,6 +143,15 @@ func TestEventHandler(t *testing.T) { handler: handler, handled: true, }, + { + name: "BLSToExecutionChangeGood", + message: &sse.Event{ + Event: []byte("bls_to_execution_change"), + Data: []byte(`{"validator_index":"63401","from_bls_pubkey":"0xa46ed2574770ec1942d577ef89e0bf7b0d601349dab791740dead3fb5a6e2624cf62b9e58de1074c49f44b986eb39002","to_execution_address":"0xd641D2Cc74C7b6A641861260d07D67eB67bc7403"}`), + }, + handler: handler, + handled: true, + }, { name: "ContributionAndProofGood", message: &sse.Event{