diff --git a/.gitignore b/.gitignore index c495903..1397179 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ coverage.html # Local TODO TODO.md + +# Intellij +.idea/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 04b59b7..ef43428 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +0.10.0: + - support fulu + - use updated event handlers from go-eth2-client + 0.9.2: - add provider functions for consolidation and deposit requests diff --git a/go.mod b/go.mod index b054fcf..747f2d8 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.7 toolchain go1.23.2 require ( - github.com/attestantio/go-eth2-client v0.24.0 + github.com/attestantio/go-eth2-client v0.27.1 github.com/aws/aws-sdk-go v1.55.6 github.com/jackc/pgx-shopspring-decimal v0.0.0-20220624020537-1d36b5a1853e github.com/jackc/pgx-zerolog v0.0.0-20230315001418-f978528409eb @@ -90,7 +90,7 @@ require ( go.opentelemetry.io/otel/metric v1.34.0 // indirect go.opentelemetry.io/proto/otlp v1.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.32.0 // indirect + golang.org/x/crypto v0.33.0 // indirect golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect golang.org/x/net v0.34.0 // indirect golang.org/x/oauth2 v0.26.0 // indirect diff --git a/go.sum b/go.sum index 26b0fa9..8336c0c 100644 --- a/go.sum +++ b/go.sum @@ -74,8 +74,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/attestantio/go-eth2-client v0.24.0 h1:lGVbcnhlBwRglt1Zs56JOCgXVyLWKFZOmZN8jKhE7Ws= -github.com/attestantio/go-eth2-client v0.24.0/go.mod h1:/KTLN3WuH1xrJL7ZZrpBoWM1xCCihnFbzequD5L+83o= +github.com/attestantio/go-eth2-client v0.27.1 h1:g7bm+gG/p+gfzYdEuxuAepVWYb8EO+2KojV5/Lo2BxM= +github.com/attestantio/go-eth2-client v0.27.1/go.mod h1:fvULSL9WtNskkOB4i+Yyr6BKpNHXvmpGZj9969fCrfY= github.com/aws/aws-sdk-go v1.44.81/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk= github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= @@ -433,8 +433,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= diff --git a/main.go b/main.go index 3d086ef..7232f5e 100644 --- a/main.go +++ b/main.go @@ -64,7 +64,7 @@ import ( ) // ReleaseVersion is the release version for the code. -var ReleaseVersion = "0.9.2" +var ReleaseVersion = "0.10.0" func main() { os.Exit(main2()) diff --git a/services/beaconcommittees/standard/service.go b/services/beaconcommittees/standard/service.go index bb933e0..ff62111 100644 --- a/services/beaconcommittees/standard/service.go +++ b/services/beaconcommittees/standard/service.go @@ -17,7 +17,8 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/pkg/errors" "github.com/rs/zerolog" zerologger "github.com/rs/zerolog/log" @@ -92,9 +93,11 @@ func (s *Service) updateAfterRestart(ctx context.Context, startEpoch int64) { s.activitySem.Release(1) // Set up the handler for new chain head updates. - if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, []string{"head"}, func(event *api.Event) { - eventData := event.Data.(*api.HeadEvent) - s.OnBeaconChainHeadUpdated(ctx, eventData.Slot, eventData.Block, eventData.State, eventData.EpochTransition) + if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, &api.EventsOpts{ + Topics: []string{"head"}, + HeadHandler: func(ctx context.Context, event *apiv1.HeadEvent) { + s.OnBeaconChainHeadUpdated(ctx, event.Slot, event.Block, event.State, event.EpochTransition) + }, }); err != nil { log.Fatal().Err(err).Msg("Failed to add beacon chain head updated handler") } diff --git a/services/blocks/standard/service.go b/services/blocks/standard/service.go index b625810..9a4e46c 100644 --- a/services/blocks/standard/service.go +++ b/services/blocks/standard/service.go @@ -17,7 +17,8 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -194,13 +195,11 @@ func (s *Service) updateAfterRestart(ctx context.Context, startSlot int64) { log.Info().Msg("Caught up") // Set up the handler for new chain head updates. - if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, []string{"head"}, func(event *api.Event) { - if event.Data == nil { - // Happens when the channel shuts down, nothing to worry about. - return - } - eventData := event.Data.(*api.HeadEvent) - s.OnBeaconChainHeadUpdated(ctx, eventData.Slot, eventData.Block, eventData.State, eventData.EpochTransition) + if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, &api.EventsOpts{ + Topics: []string{"head"}, + HeadHandler: func(ctx context.Context, event *apiv1.HeadEvent) { + s.OnBeaconChainHeadUpdated(ctx, event.Slot, event.Block, event.State, event.EpochTransition) + }, }); err != nil { log.Fatal().Err(err).Msg("Failed to add beacon chain head updated handler") } diff --git a/services/proposerduties/standard/service.go b/services/proposerduties/standard/service.go index d2209e3..73e8d27 100644 --- a/services/proposerduties/standard/service.go +++ b/services/proposerduties/standard/service.go @@ -17,7 +17,8 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -103,9 +104,11 @@ func (s *Service) updateAfterRestart(ctx context.Context, startEpoch int64) { log.Info().Msg("Caught up") // Set up the handler for new chain head updates. - if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, []string{"head"}, func(event *api.Event) { - eventData := event.Data.(*api.HeadEvent) - s.OnBeaconChainHeadUpdated(ctx, eventData.Slot, eventData.Block, eventData.State, eventData.EpochTransition) + if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, &api.EventsOpts{ + Topics: []string{"head"}, + HeadHandler: func(ctx context.Context, event *apiv1.HeadEvent) { + s.OnBeaconChainHeadUpdated(ctx, event.Slot, event.Block, event.State, event.EpochTransition) + }, }); err != nil { log.Fatal().Err(err).Msg("Failed to add beacon chain head updated handler") } diff --git a/services/synccommittees/standard/service.go b/services/synccommittees/standard/service.go index d7d14e7..bf28377 100644 --- a/services/synccommittees/standard/service.go +++ b/services/synccommittees/standard/service.go @@ -17,6 +17,7 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -114,9 +115,11 @@ func (s *Service) updateAfterRestart(ctx context.Context, startPeriod int64) { log.Info().Msg("Caught up") // Set up the handler for new chain head updates. - if err := s.eventsProvider.Events(ctx, []string{"head"}, func(event *apiv1.Event) { - eventData := event.Data.(*apiv1.HeadEvent) - s.OnBeaconChainHeadUpdated(ctx, eventData.Slot) + if err := s.eventsProvider.Events(ctx, &api.EventsOpts{ + Topics: []string{"head"}, + HeadHandler: func(ctx context.Context, event *apiv1.HeadEvent) { + s.OnBeaconChainHeadUpdated(ctx, event.Slot) + }, }); err != nil { log.Fatal().Err(err).Msg("Failed to add sync chain head updated handler") } diff --git a/services/validators/standard/service.go b/services/validators/standard/service.go index b065d49..6396a06 100644 --- a/services/validators/standard/service.go +++ b/services/validators/standard/service.go @@ -17,7 +17,8 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/pkg/errors" "github.com/rs/zerolog" zerologger "github.com/rs/zerolog/log" @@ -125,9 +126,11 @@ func (s *Service) updateAfterRestart(ctx context.Context, startEpoch int64) { log.Info().Uint64("epoch", uint64(md.LatestEpoch)).Msg("Caught up") // Set up the handler for new chain head updates. - if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, []string{"head"}, func(event *api.Event) { - eventData := event.Data.(*api.HeadEvent) - s.OnBeaconChainHeadUpdated(ctx, eventData.Slot, eventData.Block, eventData.State, eventData.EpochTransition) + if err := s.eth2Client.(eth2client.EventsProvider).Events(ctx, &api.EventsOpts{ + Topics: []string{"head"}, + HeadHandler: func(ctx context.Context, event *apiv1.HeadEvent) { + s.OnBeaconChainHeadUpdated(ctx, event.Slot, event.Block, event.State, event.EpochTransition) + }, }); err != nil { log.Fatal().Err(err).Msg("Failed to add beacon chain head updated handler") }