Skip to content

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Aug 24, 2025

What type of PR is this?

Feature

What does this PR do? Why is it needed?

adding relevent changes for handling fulu changes in grpc and rest submit block endpoints.

  • refactors broadcasting to its own functions
  • updates consensus check for rest api endpoint.

tested via kurtosis with disable get blob cdd44dd
image

Which issues(s) does this PR fix?

Fixes #

part of #14129

Other notes for review

Acknowledgements

@james-prysm james-prysm force-pushed the block-proposal-fulu branch 2 times, most recently from fac3a33 to cea9503 Compare August 25, 2025 03:18
@james-prysm james-prysm force-pushed the block-proposal-fulu branch 5 times, most recently from 93695ee to 65876ce Compare August 25, 2025 16:35
…ast for rest api to properly send datasidecars
@james-prysm james-prysm requested a review from nalepae August 26, 2025 19:34
@james-prysm james-prysm marked this pull request as ready for review August 26, 2025 19:38
@james-prysm james-prysm requested a review from rkapka August 26, 2025 19:38
Copy link
Contributor

@nalepae nalepae left a comment

Choose a reason for hiding this comment

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

General comments about errors wrapping: https://github.com/uber-go/guide/blob/master/style.md#error-wrapping

To avoid the failed to xxx: failed to yyy: failed to zzz

}

// BroadcastDataColumnSidecars broadcasts data column sidecars concurrently and optionally receives them.
func BroadcastDataColumnSidecars(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a warning should be added in the godoc of this function because it transforms sidecars into verified sidecars.
Like:
"WARNING: This function should be called only with trusted sidecars, since it will upgrade them as verified without any further check."

Same for the BroadcastBlobSidecars.
Maybe Kasey could have a better idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about it i'm going to refactor this and have the helper as part of the broadcaster it makes more sense

return s.broadcastSeenBlockSidecars(ctx, b, gb.GetDeneb().Blobs, gb.GetDeneb().KzgProofs)
default:
// other forks before Deneb do not support blob sidecars
// forks after fulu do not support blob sidecars, instead support data columns, no need to rebroadcast
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need to broadcast datacolumns when the block is equivocated anymore right

Copy link
Contributor

Choose a reason for hiding this comment

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

But in that case should we broadcast data columns of the equivocated block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so but I guess I can ask around, it's not required by the beacon api as far as I can tell

"github.com/pkg/errors"
)

func bytesToBlob(blob []byte) *GoKZG.Blob {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Why do the other functions use a named return value and this one uses a variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that one is a pointer the other ones are not

for blobIndex, blobData := range blobs {
// Convert blob to kzg.Blob type
var blob Blob
copy(blob[:], blobData)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we avoid a copy here?

allIndices = append(allIndices, columnIndex)

var proof Bytes48
copy(proof[:], cellProofs[cellProofIndex])
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we avoid a copy here?

Comment on lines 74 to 76
copy(ckzgBlobs[i][:], blobs[i])
copy(ckzgCommitments[i][:], commitments[i])
copy(ckzgProofs[i][:], proofs[i])
Copy link
Contributor

Choose a reason for hiding this comment

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

We never modify any of these objects - is copying necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me try

return s.broadcastSeenBlockSidecars(ctx, b, gb.GetDeneb().Blobs, gb.GetDeneb().KzgProofs)
default:
// other forks before Deneb do not support blob sidecars
// forks after fulu do not support blob sidecars, instead support data columns, no need to rebroadcast
Copy link
Contributor

Choose a reason for hiding this comment

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

But in that case should we broadcast data columns of the equivocated block?

// For Fulu blocks, proofs are cell proofs (blobs * numberOfColumns)
expectedProofsCount := uint64(len(blobs)) * numberOfColumns
if uint64(len(proofs)) != expectedProofsCount || len(blobs) != len(commitments) {
return fmt.Errorf("number of blobs (%d), cell proofs (%d), and commitments (%d) do not match (expected %d cell proofs)", len(blobs), len(proofs), len(commitments), expectedProofsCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

This error is a little misleading because number of blobs (%d), cell proofs (%d), and commitments (%d) do not match sounds like they should all be equal, while in reality there should be more cell proofs than blobs/commitments.

Maybe this should be split into two separate errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually I think this error is probably fine with what you posted , i think people knowing this context will know

func (vs *Server) ProposeBeaconBlock(ctx context.Context, req *ethpb.GenericSignedBeaconBlock) (*ethpb.ProposeResponse, error) {
var (
blobSidecars []*ethpb.BlobSidecar
dataColumnSideCars []*ethpb.DataColumnSidecar
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: SideCars --> Sidecars

@james-prysm james-prysm added this pull request to the merge queue Aug 28, 2025
Merged via the queue into develop with commit d339e09 Aug 28, 2025
17 checks passed
@james-prysm james-prysm deleted the block-proposal-fulu branch August 28, 2025 16:37
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
* propose block changes from peerdas branch

* breaking out broadcast code into its own helper, changing fulu broadcast for rest api to properly send datasidecars

* renamed validate blobsidecars to validate blobs, and added check for max blobs

* gofmt

* adding in batch verification for blobs"

* changelog

* adding kzg tests, moving new kzg functions to validation.go

* linting and other small fixes

* fixing linting issues and adding some proposer tests

* missing dependencies

* fixing test

* fixing more tests

* gaz

* removed return on broadcast data columns

* more cleanup and unit test adjustments

* missed removal of unneeded field

* adding data column receiver initialization

* Update beacon-chain/rpc/eth/beacon/handlers.go

Co-authored-by: Manu NALEPA <[email protected]>

* partial review feedback from manu

* gaz

* reverting some code to peerdas as I don't believe the broadcast code needs to be reused

* missed removal of build dependency

* fixing tests and adding another test based on manu's suggestion

* fixing linting

* Update beacon-chain/rpc/eth/beacon/handlers.go

Co-authored-by: Radosław Kapka <[email protected]>

* Update beacon-chain/blockchain/kzg/validation.go

Co-authored-by: Radosław Kapka <[email protected]>

* radek's review changes

* adding missed test

---------

Co-authored-by: Manu NALEPA <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
* propose block changes from peerdas branch

* breaking out broadcast code into its own helper, changing fulu broadcast for rest api to properly send datasidecars

* renamed validate blobsidecars to validate blobs, and added check for max blobs

* gofmt

* adding in batch verification for blobs"

* changelog

* adding kzg tests, moving new kzg functions to validation.go

* linting and other small fixes

* fixing linting issues and adding some proposer tests

* missing dependencies

* fixing test

* fixing more tests

* gaz

* removed return on broadcast data columns

* more cleanup and unit test adjustments

* missed removal of unneeded field

* adding data column receiver initialization

* Update beacon-chain/rpc/eth/beacon/handlers.go

Co-authored-by: Manu NALEPA <[email protected]>

* partial review feedback from manu

* gaz

* reverting some code to peerdas as I don't believe the broadcast code needs to be reused

* missed removal of build dependency

* fixing tests and adding another test based on manu's suggestion

* fixing linting

* Update beacon-chain/rpc/eth/beacon/handlers.go

Co-authored-by: Radosław Kapka <[email protected]>

* Update beacon-chain/blockchain/kzg/validation.go

Co-authored-by: Radosław Kapka <[email protected]>

* radek's review changes

* adding missed test

---------

Co-authored-by: Manu NALEPA <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants