Skip to content

builder beacon apis for gloas - #17392

Open
james-prysm wants to merge 15 commits into
developfrom
builder-rest-endpoints
Open

builder beacon apis for gloas#17392
james-prysm wants to merge 15 commits into
developfrom
builder-rest-endpoints

Conversation

@james-prysm

@james-prysm james-prysm commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

Feature

What does this PR do? Why is it needed?

adds

  • Support POST on /eth/v4/validator/blocks/{slot} with a BuilderConfig body and return the winning builder in the Eth-Builder-Url response header, per beacon-APIs #630.
  • Add POST /eth/v1/validator/builder_preferences to forward per-builder preference entries to their builders.

The core logic is already there in grpc and this simply utilizes it, but needs to update protobuf for ssz.

there's also a few smaller issues on validation fixed

note: this pr does not hook up validator client to beacon node

Which issue(s) does this PR fix?

addresses ethereum/beacon-APIs#630

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have included a uniquely named changelog fragment file.
  • I have added a description with sufficient context for reviewers to understand this PR.
  • I have tested that my changes work as expected and I added a testing plan to the PR description (if applicable).

@james-prysm
james-prysm force-pushed the builder-rest-endpoints branch from c223af1 to fd8a063 Compare August 20, 2026 21:46
Comment thread proto/prysm/v1alpha1/gloas_builder_api.ssz.go Fixed
Comment thread proto/prysm/v1alpha1/gloas_builder_api.ssz.go Fixed
Base automatically changed from builder-bid-enforcement to develop August 21, 2026 00:43
@terencechain
terencechain force-pushed the builder-rest-endpoints branch from 1166034 to 471bbd4 Compare August 21, 2026 00:43
@james-prysm
james-prysm force-pushed the builder-rest-endpoints branch from 82b3ffd to 9018adc Compare August 21, 2026 14:57
@james-prysm
james-prysm marked this pull request as ready for review August 21, 2026 14:57
@james-prysm james-prysm changed the title adding changes to add the rest endpoints based on 630 builder beacon apis for gloas Aug 21, 2026
@github-project-automation github-project-automation Bot moved this to Unassigned in Gloas Aug 21, 2026
Comment thread beacon-chain/rpc/endpoints.go
Comment thread beacon-chain/rpc/eth/validator/handlers_builder.go Outdated
@james-prysm
james-prysm force-pushed the builder-rest-endpoints branch from f8ca32f to 606349a Compare August 24, 2026 16:49
Comment thread proto/prysm/v1alpha1/gloas.ssz.go Dismissed
Comment thread proto/prysm/v1alpha1/gloas.ssz.go Dismissed
@james-prysm
james-prysm force-pushed the builder-rest-endpoints branch 3 times, most recently from 4e9f1df to cd0827a Compare August 25, 2026 18:33
@syjn99
syjn99 self-requested a review August 26, 2026 05:16
Comment thread beacon-chain/rpc/eth/validator/handlers_block_gloas.go Outdated
Comment thread beacon-chain/rpc/eth/validator/handlers_block_gloas.go
Comment thread api/server/structs/conversions_gloas.go
Comment thread beacon-chain/builder/service.go Outdated
Comment thread beacon-chain/rpc/eth/validator/handlers_builder.go Outdated
Comment thread beacon-chain/rpc/eth/validator/handlers_block_gloas_test.go
Comment thread beacon-chain/builder/service.go Outdated
@james-prysm
james-prysm force-pushed the builder-rest-endpoints branch 3 times, most recently from 6548fa4 to cc476da Compare August 26, 2026 18:48
@syjn99
syjn99 self-requested a review August 27, 2026 02:30
func (s *Service) SubmitBuilderPreferences(ctx context.Context, proposerPubkey [48]byte, url string, req *ethpb.BuilderPreferencesRequest) error {
// SubmitBuilderPreferences forwards each entry to its own builder url concurrently, returning
// failure messages keyed by entry position. Nil entries are skipped; auth is forwarded unchanged.
func (s *Service) SubmitBuilderPreferences(ctx context.Context, entries []*ethpb.BuilderPreferencesEntry) map[int]string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func (s *Service) SubmitBuilderPreferences(ctx context.Context, entries []*ethpb.BuilderPreferencesEntry) []string {
	ctx, span := trace.StartSpan(ctx, "builder.SubmitBuilderPreferences")
	defer span.End()

	var (
		wg       sync.WaitGroup
		failures = make([]string, len(entries))
	)

	for i, e := range entries {
		if e == nil {
			continue
		}
		if len(e.GetUrl()) == 0 {
			log.Warn("Skipping builder preferences entry with no builder url")
			failures[i] = "builder url is required"
			continue
		}
		wg.Add(1)
		wg.Go(func() {
			url := string(e.Url)
			c, err := s.clientFor(url)
			if err == nil {
				req := &ethpb.BuilderPreferencesRequest{
					Preferences: &ethpb.BuilderPreferences{MaxExecutionPayment: e.MaxExecutionPayment},
					Auth:        e.Auth,
				}
				err = c.SubmitBuilderPreferences(ctx, bytesutil.ToBytes48(e.ProposerPubkey), req)
			}
			if err != nil {
				tracing.AnnotateError(span, err)
				log.WithError(err).WithField("builder", logs.MaskCredentialsLogging(url)).Warn("Could not submit builder preferences")
				failures[i] = "could not submit builder preferences: " + logs.MaskCredentialsLogging(err.Error())
			}
		})
	}
	wg.Wait()
	return failures
}

I don't think we need mutex here, as each entry owns its index so there's no concurrency issue. This looks much better to me, although it requires some changes at the caller side.

Also note that i and e can be safely used in goroutine as they are scoped in each iteration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in here but i think the failures still need a map
5504a1e

@james-prysm
james-prysm force-pushed the builder-rest-endpoints branch from 5504a1e to 217c971 Compare August 27, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Unassigned

Development

Successfully merging this pull request may close these issues.

2 participants