diff --git a/http/http.go b/http/http.go index 6d9c2bd..7d5925d 100644 --- a/http/http.go +++ b/http/http.go @@ -77,7 +77,7 @@ func (s *Service) get(ctx context.Context, // req.Header.Set("Accept", "application/octet-stream;q=1,application/json;q=0.9") req.Header.Set("Accept", "application/json") if req.Header.Get("User-Agent") == "" { - req.Header.Set("User-Agent", "go-builder-client/0.4.4") + req.Header.Set("User-Agent", "go-builder-client/0.4.5") } resp, err := s.client.Do(req) @@ -200,7 +200,7 @@ func (s *Service) post(ctx context.Context, req.Header.Set(k, v) } if req.Header.Get("User-Agent") == "" { - req.Header.Set("User-Agent", "go-builder-client/0.4.4") + req.Header.Set("User-Agent", "go-builder-client/0.4.5") } resp, err := s.client.Do(req) diff --git a/http/unblindproposal.go b/http/unblindproposal.go index a95c9f7..1acdd4a 100644 --- a/http/unblindproposal.go +++ b/http/unblindproposal.go @@ -1,4 +1,4 @@ -// Copyright © 2023 Attestant Limited. +// Copyright © 2023, 2024 Attestant Limited. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -35,10 +35,6 @@ import ( "go.opentelemetry.io/otel/trace" ) -type denebBundle struct { - Bundle *apideneb.ExecutionPayloadAndBlobsBundle `json:"data"` -} - // UnblindProposal unblinds a proposal. func (s *Service) UnblindProposal(ctx context.Context, proposal *consensusapi.VersionedSignedBlindedProposal, @@ -264,7 +260,7 @@ func (s *Service) unblindDenebProposal(ctx context.Context, switch httpResponse.contentType { case ContentTypeJSON: - bundle, _, err := decodeJSONResponse(bytes.NewReader(httpResponse.body), &denebBundle{}) + bundle, _, err := decodeJSONResponse(bytes.NewReader(httpResponse.body), &apideneb.ExecutionPayloadAndBlobsBundle{}) if err != nil { return nil, errors.Wrap(err, "failed to parse deneb response") } @@ -273,25 +269,25 @@ func (s *Service) unblindDenebProposal(ctx context.Context, if err != nil { return nil, errors.Wrap(err, "failed to generate hash tree root for our execution payload header") } - receivedExecutionPayloadHash, err := bundle.Bundle.ExecutionPayload.HashTreeRoot() + receivedExecutionPayloadHash, err := bundle.ExecutionPayload.HashTreeRoot() if err != nil { return nil, errors.Wrap(err, "failed to generate hash tree root for the received execution payload") } if !bytes.Equal(ourExecutionPayloadHash[:], receivedExecutionPayloadHash[:]) { return nil, fmt.Errorf("execution payload hash mismatch: %#x != %#x", receivedExecutionPayloadHash[:], ourExecutionPayloadHash[:]) } - res.Deneb.SignedBlock.Message.Body.ExecutionPayload = bundle.Bundle.ExecutionPayload + res.Deneb.SignedBlock.Message.Body.ExecutionPayload = bundle.ExecutionPayload // Reconstruct blobs. - res.Deneb.KZGProofs = make([]deneb.KZGProof, len(bundle.Bundle.BlobsBundle.Proofs)) - res.Deneb.Blobs = make([]deneb.Blob, len(bundle.Bundle.BlobsBundle.Blobs)) - for i := range bundle.Bundle.BlobsBundle.Blobs { - if !bytes.Equal(bundle.Bundle.BlobsBundle.Commitments[i][:], res.Deneb.SignedBlock.Message.Body.BlobKZGCommitments[i][:]) { + res.Deneb.KZGProofs = make([]deneb.KZGProof, len(bundle.BlobsBundle.Proofs)) + res.Deneb.Blobs = make([]deneb.Blob, len(bundle.BlobsBundle.Blobs)) + for i := range bundle.BlobsBundle.Blobs { + if !bytes.Equal(bundle.BlobsBundle.Commitments[i][:], res.Deneb.SignedBlock.Message.Body.BlobKZGCommitments[i][:]) { return nil, fmt.Errorf("blob %d commitment mismatch", i) } - res.Deneb.KZGProofs[i] = bundle.Bundle.BlobsBundle.Proofs[i] - res.Deneb.Blobs[i] = bundle.Bundle.BlobsBundle.Blobs[i] + res.Deneb.KZGProofs[i] = bundle.BlobsBundle.Proofs[i] + res.Deneb.Blobs[i] = bundle.BlobsBundle.Blobs[i] } default: return nil, fmt.Errorf("unsupported content type %v", httpResponse.contentType)