-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow users to publish blobs (#14442)
* allow users to publish blobs Allowing users to publish blobs before publishing blocks, gives the blobs a head start. They can begin to propagate around the network while the block is being validated. * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go * Update beacon-chain/rpc/prysm/beacon/handlers.go --------- Co-authored-by: Radosław Kapka <[email protected]>
- Loading branch information
Showing
13 changed files
with
533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package structs | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/prysmaticlabs/prysm/v5/api/server" | ||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" | ||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" | ||
) | ||
|
||
func (sc *Sidecar) ToConsensus() (*eth.BlobSidecar, error) { | ||
if sc == nil { | ||
return nil, errNilValue | ||
} | ||
|
||
index, err := strconv.ParseUint(sc.Index, 10, 64) | ||
if err != nil { | ||
return nil, server.NewDecodeError(err, "Index") | ||
} | ||
|
||
blob, err := bytesutil.DecodeHexWithLength(sc.Blob, 131072) | ||
if err != nil { | ||
return nil, server.NewDecodeError(err, "Blob") | ||
} | ||
|
||
kzgCommitment, err := bytesutil.DecodeHexWithLength(sc.KzgCommitment, 48) | ||
if err != nil { | ||
return nil, server.NewDecodeError(err, "KzgCommitment") | ||
} | ||
|
||
kzgProof, err := bytesutil.DecodeHexWithLength(sc.KzgProof, 48) | ||
if err != nil { | ||
return nil, server.NewDecodeError(err, "KzgProof") | ||
} | ||
|
||
header, err := sc.SignedBeaconBlockHeader.ToConsensus() | ||
if err != nil { | ||
return nil, server.NewDecodeError(err, "SignedBeaconBlockHeader") | ||
} | ||
|
||
// decode the commitment inclusion proof | ||
var commitmentInclusionProof [][]byte | ||
for _, proof := range sc.CommitmentInclusionProof { | ||
proofBytes, err := bytesutil.DecodeHexWithLength(proof, 32) | ||
if err != nil { | ||
return nil, server.NewDecodeError(err, "CommitmentInclusionProof") | ||
} | ||
commitmentInclusionProof = append(commitmentInclusionProof, proofBytes) | ||
} | ||
|
||
bsc := ð.BlobSidecar{ | ||
Index: index, | ||
Blob: blob, | ||
KzgCommitment: kzgCommitment, | ||
KzgProof: kzgProof, | ||
SignedBlockHeader: header, | ||
CommitmentInclusionProof: commitmentInclusionProof, | ||
} | ||
|
||
return bsc, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.