Skip to content

Commit

Permalink
remove computing deneb hash
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed Sep 22, 2023
1 parent 544b7b5 commit cd5267f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 48 deletions.
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo=
github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE=
github.com/flashbots/go-boost-utils v1.7.2-0.20230921233330-ac6e2dbf669d h1:pUfm1NLi3v2rUSnUYyHXDAwucgGq6giPbC4EntVmYVw=
github.com/flashbots/go-boost-utils v1.7.2-0.20230921233330-ac6e2dbf669d/go.mod h1:gj0BOhAoMTTI/VVkAht+o2kMmSW7WqshyL9wY+lKKj4=
github.com/flashbots/go-boost-utils v1.7.2-0.20230922193448-757aa4804cd5 h1:3OWpIpHHDd4bdOe+ZPGDuWefCkKctD6mVtgDkSHLkiA=
github.com/flashbots/go-boost-utils v1.7.2-0.20230922193448-757aa4804cd5/go.mod h1:gj0BOhAoMTTI/VVkAht+o2kMmSW7WqshyL9wY+lKKj4=
github.com/flashbots/go-utils v0.4.8 h1:WDJXryrqShGq4HFe+p1kGjObXSqzT7Sy/+9YvFpr5tM=
Expand Down
19 changes: 0 additions & 19 deletions server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,25 +744,6 @@ func (m *BoostService) processDenebPayload(w http.ResponseWriter, req *http.Requ
return
}

// Ensure the response blockhash matches the response block
blockRoot, err := getDenebBlockRoot(blindedBlock.Message, responsePayload.Deneb)
if err != nil {
log.WithError(err).Error("could not calculate deneb beacon block root")
return
}
calculatedBlockHash, err := utils.ComputeBlockHash(&builderApi.VersionedExecutionPayload{
Version: responsePayload.Version,
Deneb: payload,
}, &blockRoot)
if err != nil {
log.WithError(err).Error("could not calculate block hash")
} else if payload.BlockHash != calculatedBlockHash {
log.WithFields(logrus.Fields{
"calculatedBlockHash": calculatedBlockHash.String(),
"responseBlockHash": payload.BlockHash.String(),
}).Error("responseBlockHash does not equal hash calculated from response block")
}

// Ensure that blobs are valid and matches the request
if len(blindedBlobs) != len(blobs.Blobs) || len(blindedBlobs) != len(blobs.Commitments) || len(blindedBlobs) != len(blobs.Proofs) {
log.WithFields(logrus.Fields{
Expand Down
27 changes: 0 additions & 27 deletions server/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ import (
"strings"
"time"

builderApiDeneb "github.com/attestantio/go-builder-client/api/deneb"
builderApi "github.com/attestantio/go-builder-client/api"
builderSpec "github.com/attestantio/go-builder-client/spec"
eth2ApiV1Deneb "github.com/attestantio/go-eth2-client/api/v1/deneb"
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/attestantio/go-eth2-client/spec/deneb"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand Down Expand Up @@ -335,27 +332,3 @@ func getPayloadResponseIsEmpty(payload *builderApi.VersionedSubmitBlindedBlockRe
}
return false
}

func getDenebBlockRoot(blindedBlock *eth2ApiV1Deneb.BlindedBeaconBlock, blockPayload *builderApiDeneb.ExecutionPayloadAndBlobsBundle) (phase0.Root, error) {
block := deneb.BeaconBlock{
Slot: blindedBlock.Slot,
ProposerIndex: blindedBlock.ProposerIndex,
ParentRoot: blindedBlock.ParentRoot,
StateRoot: blindedBlock.StateRoot,
Body: &deneb.BeaconBlockBody{
BLSToExecutionChanges: blindedBlock.Body.BLSToExecutionChanges,
RANDAOReveal: blindedBlock.Body.RANDAOReveal,
ETH1Data: blindedBlock.Body.ETH1Data,
Graffiti: blindedBlock.Body.Graffiti,
ProposerSlashings: blindedBlock.Body.ProposerSlashings,
AttesterSlashings: blindedBlock.Body.AttesterSlashings,
Attestations: blindedBlock.Body.Attestations,
Deposits: blindedBlock.Body.Deposits,
VoluntaryExits: blindedBlock.Body.VoluntaryExits,
SyncAggregate: blindedBlock.Body.SyncAggregate,
ExecutionPayload: blockPayload.ExecutionPayload,
BlobKzgCommitments: blockPayload.BlobsBundle.Commitments,
},
}
return block.HashTreeRoot()
}

0 comments on commit cd5267f

Please sign in to comment.