-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fulu block proposals with datacolumn broadcast #15628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fac3a33
to
cea9503
Compare
93695ee
to
65876ce
Compare
2936798
to
99cf1ef
Compare
…ast for rest api to properly send datasidecars
826da72
to
63c3fb1
Compare
2594828
to
0fd759a
Compare
There was a problem hiding this 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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Co-authored-by: Manu NALEPA <[email protected]>
…needs to be reused
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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?
copy(ckzgBlobs[i][:], blobs[i]) | ||
copy(ckzgCommitments[i][:], commitments[i]) | ||
copy(ckzgProofs[i][:], proofs[i]) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: SideCars
--> Sidecars
Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
* 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]>
* 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]>
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.
tested via kurtosis with disable get blob cdd44dd

Which issues(s) does this PR fix?
Fixes #
part of #14129
Other notes for review
Acknowledgements