mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
Remove NUMBER_OF_COLUMNS and MAX_CELLS_IN_EXTENDED_MATRIX configuration. (#16073)
**What type of PR is this?** Other **What does this PR do? Why is it needed?** This pull request removes `NUMBER_OF_COLUMNS` and `MAX_CELLS_IN_EXTENDED_MATRIX` configuration. **Other notes for review** Please read commit by commit, with commit messages. **Acknowledgements** - [x] I have read [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md). - [x] I have included a uniquely named [changelog fragment file](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md#maintaining-changelogmd). - [x] I have added a description to this PR with sufficient context for reviewers to understand this PR.
This commit is contained in:
@@ -634,9 +634,7 @@ func missingDataColumnIndices(store *filesystem.DataColumnStorage, root [fieldpa
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
if len(expected) > fieldparams.NumberOfColumns {
|
||||||
|
|
||||||
if uint64(len(expected)) > numberOfColumns {
|
|
||||||
return nil, errMaxDataColumnsExceeded
|
return nil, errMaxDataColumnsExceeded
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,10 +816,9 @@ func (s *Service) areDataColumnsAvailable(
|
|||||||
|
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
var missingIndices any = "all"
|
var missingIndices any = "all"
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
missingIndicesCount := len(missing)
|
||||||
missingIndicesCount := uint64(len(missing))
|
|
||||||
|
|
||||||
if missingIndicesCount < numberOfColumns {
|
if missingIndicesCount < fieldparams.NumberOfColumns {
|
||||||
missingIndices = helpers.SortedPrettySliceFromMap(missing)
|
missingIndices = helpers.SortedPrettySliceFromMap(missing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2495,7 +2495,8 @@ func TestMissingBlobIndices(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMissingDataColumnIndices(t *testing.T) {
|
func TestMissingDataColumnIndices(t *testing.T) {
|
||||||
countPlusOne := params.BeaconConfig().NumberOfColumns + 1
|
const countPlusOne = fieldparams.NumberOfColumns + 1
|
||||||
|
|
||||||
tooManyColumns := make(map[uint64]bool, countPlusOne)
|
tooManyColumns := make(map[uint64]bool, countPlusOne)
|
||||||
for i := range countPlusOne {
|
for i := range countPlusOne {
|
||||||
tooManyColumns[uint64(i)] = true
|
tooManyColumns[uint64(i)] = true
|
||||||
|
|||||||
@@ -603,7 +603,6 @@ func TestUpdateCustodyInfoInDB(t *testing.T) {
|
|||||||
custodyRequirement = uint64(4)
|
custodyRequirement = uint64(4)
|
||||||
earliestStoredSlot = primitives.Slot(12)
|
earliestStoredSlot = primitives.Slot(12)
|
||||||
numberOfCustodyGroups = uint64(64)
|
numberOfCustodyGroups = uint64(64)
|
||||||
numberOfColumns = uint64(128)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
params.SetupTestConfigCleanup(t)
|
params.SetupTestConfigCleanup(t)
|
||||||
@@ -611,7 +610,6 @@ func TestUpdateCustodyInfoInDB(t *testing.T) {
|
|||||||
cfg.FuluForkEpoch = fuluForkEpoch
|
cfg.FuluForkEpoch = fuluForkEpoch
|
||||||
cfg.CustodyRequirement = custodyRequirement
|
cfg.CustodyRequirement = custodyRequirement
|
||||||
cfg.NumberOfCustodyGroups = numberOfCustodyGroups
|
cfg.NumberOfCustodyGroups = numberOfCustodyGroups
|
||||||
cfg.NumberOfColumns = numberOfColumns
|
|
||||||
params.OverrideBeaconConfig(cfg)
|
params.OverrideBeaconConfig(cfg)
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
"github.com/OffchainLabs/prysm/v7/config/params"
|
||||||
"github.com/OffchainLabs/prysm/v7/crypto/hash"
|
"github.com/OffchainLabs/prysm/v7/crypto/hash"
|
||||||
"github.com/OffchainLabs/prysm/v7/encoding/bytesutil"
|
"github.com/OffchainLabs/prysm/v7/encoding/bytesutil"
|
||||||
@@ -96,8 +97,7 @@ func ComputeColumnsForCustodyGroup(custodyGroup uint64) ([]uint64, error) {
|
|||||||
return nil, ErrCustodyGroupTooLarge
|
return nil, ErrCustodyGroupTooLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
numberOfColumns := cfg.NumberOfColumns
|
numberOfColumns := uint64(fieldparams.NumberOfColumns)
|
||||||
|
|
||||||
columnsPerGroup := numberOfColumns / numberOfCustodyGroups
|
columnsPerGroup := numberOfColumns / numberOfCustodyGroups
|
||||||
|
|
||||||
columns := make([]uint64, 0, columnsPerGroup)
|
columns := make([]uint64, 0, columnsPerGroup)
|
||||||
@@ -112,8 +112,9 @@ func ComputeColumnsForCustodyGroup(custodyGroup uint64) ([]uint64, error) {
|
|||||||
// ComputeCustodyGroupForColumn computes the custody group for a given column.
|
// ComputeCustodyGroupForColumn computes the custody group for a given column.
|
||||||
// It is the reciprocal function of ComputeColumnsForCustodyGroup.
|
// It is the reciprocal function of ComputeColumnsForCustodyGroup.
|
||||||
func ComputeCustodyGroupForColumn(columnIndex uint64) (uint64, error) {
|
func ComputeCustodyGroupForColumn(columnIndex uint64) (uint64, error) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
numberOfColumns := cfg.NumberOfColumns
|
|
||||||
numberOfCustodyGroups := cfg.NumberOfCustodyGroups
|
numberOfCustodyGroups := cfg.NumberOfCustodyGroups
|
||||||
|
|
||||||
if columnIndex >= numberOfColumns {
|
if columnIndex >= numberOfColumns {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ func TestComputeColumnsForCustodyGroup(t *testing.T) {
|
|||||||
func TestComputeCustodyGroupForColumn(t *testing.T) {
|
func TestComputeCustodyGroupForColumn(t *testing.T) {
|
||||||
params.SetupTestConfigCleanup(t)
|
params.SetupTestConfigCleanup(t)
|
||||||
config := params.BeaconConfig()
|
config := params.BeaconConfig()
|
||||||
config.NumberOfColumns = 128
|
|
||||||
config.NumberOfCustodyGroups = 64
|
config.NumberOfCustodyGroups = 64
|
||||||
params.OverrideBeaconConfig(config)
|
params.OverrideBeaconConfig(config)
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ func (Cgc) ENRKey() string { return params.BeaconNetworkConfig().CustodyGroupCou
|
|||||||
// https://github.com/ethereum/consensus-specs/blob/master/specs/fulu/p2p-interface.md#verify_data_column_sidecar
|
// https://github.com/ethereum/consensus-specs/blob/master/specs/fulu/p2p-interface.md#verify_data_column_sidecar
|
||||||
func VerifyDataColumnSidecar(sidecar blocks.RODataColumn) error {
|
func VerifyDataColumnSidecar(sidecar blocks.RODataColumn) error {
|
||||||
// The sidecar index must be within the valid range.
|
// The sidecar index must be within the valid range.
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
if sidecar.Index >= fieldparams.NumberOfColumns {
|
||||||
if sidecar.Index >= numberOfColumns {
|
|
||||||
return ErrIndexTooLarge
|
return ErrIndexTooLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,8 +281,11 @@ func BenchmarkVerifyDataColumnSidecarKZGProofs_SameCommitments_NoBatch(b *testin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkVerifyDataColumnSidecarKZGProofs_DiffCommitments_Batch(b *testing.B) {
|
func BenchmarkVerifyDataColumnSidecarKZGProofs_DiffCommitments_Batch(b *testing.B) {
|
||||||
const blobCount = 12
|
const (
|
||||||
numberOfColumns := int64(params.BeaconConfig().NumberOfColumns)
|
blobCount = 12
|
||||||
|
numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
)
|
||||||
|
|
||||||
err := kzg.Start()
|
err := kzg.Start()
|
||||||
require.NoError(b, err)
|
require.NoError(b, err)
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ var (
|
|||||||
func MinimumColumnCountToReconstruct() uint64 {
|
func MinimumColumnCountToReconstruct() uint64 {
|
||||||
// If the number of columns is odd, then we need total / 2 + 1 columns to reconstruct.
|
// If the number of columns is odd, then we need total / 2 + 1 columns to reconstruct.
|
||||||
// If the number of columns is even, then we need total / 2 columns to reconstruct.
|
// If the number of columns is even, then we need total / 2 columns to reconstruct.
|
||||||
return (params.BeaconConfig().NumberOfColumns + 1) / 2
|
return (fieldparams.NumberOfColumns + 1) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// MinimumCustodyGroupCountToReconstruct returns the minimum number of custody groups needed to
|
// MinimumCustodyGroupCountToReconstruct returns the minimum number of custody groups needed to
|
||||||
@@ -34,10 +34,11 @@ func MinimumColumnCountToReconstruct() uint64 {
|
|||||||
// custody groups and columns, making it future-proof if these values change.
|
// custody groups and columns, making it future-proof if these values change.
|
||||||
// Returns an error if the configuration values are invalid (zero or would cause division by zero).
|
// Returns an error if the configuration values are invalid (zero or would cause division by zero).
|
||||||
func MinimumCustodyGroupCountToReconstruct() (uint64, error) {
|
func MinimumCustodyGroupCountToReconstruct() (uint64, error) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
|
|
||||||
// Validate configuration values
|
// Validate configuration values
|
||||||
if cfg.NumberOfColumns == 0 {
|
if numberOfColumns == 0 {
|
||||||
return 0, errors.New("NumberOfColumns cannot be zero")
|
return 0, errors.New("NumberOfColumns cannot be zero")
|
||||||
}
|
}
|
||||||
if cfg.NumberOfCustodyGroups == 0 {
|
if cfg.NumberOfCustodyGroups == 0 {
|
||||||
@@ -47,13 +48,13 @@ func MinimumCustodyGroupCountToReconstruct() (uint64, error) {
|
|||||||
minimumColumnCount := MinimumColumnCountToReconstruct()
|
minimumColumnCount := MinimumColumnCountToReconstruct()
|
||||||
|
|
||||||
// Calculate how many columns each custody group represents
|
// Calculate how many columns each custody group represents
|
||||||
columnsPerGroup := cfg.NumberOfColumns / cfg.NumberOfCustodyGroups
|
columnsPerGroup := numberOfColumns / cfg.NumberOfCustodyGroups
|
||||||
|
|
||||||
// If there are more groups than columns (columnsPerGroup = 0), this is an invalid configuration
|
// If there are more groups than columns (columnsPerGroup = 0), this is an invalid configuration
|
||||||
// for reconstruction purposes as we cannot determine a meaningful custody group count
|
// for reconstruction purposes as we cannot determine a meaningful custody group count
|
||||||
if columnsPerGroup == 0 {
|
if columnsPerGroup == 0 {
|
||||||
return 0, errors.Errorf("invalid configuration: NumberOfCustodyGroups (%d) exceeds NumberOfColumns (%d)",
|
return 0, errors.Errorf("invalid configuration: NumberOfCustodyGroups (%d) exceeds NumberOfColumns (%d)",
|
||||||
cfg.NumberOfCustodyGroups, cfg.NumberOfColumns)
|
cfg.NumberOfCustodyGroups, numberOfColumns)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use ceiling division to ensure we have enough groups to cover the minimum columns
|
// Use ceiling division to ensure we have enough groups to cover the minimum columns
|
||||||
@@ -285,7 +286,8 @@ func ReconstructBlobSidecars(block blocks.ROBlock, verifiedDataColumnSidecars []
|
|||||||
|
|
||||||
// ComputeCellsAndProofsFromFlat computes the cells and proofs from blobs and cell flat proofs.
|
// ComputeCellsAndProofsFromFlat computes the cells and proofs from blobs and cell flat proofs.
|
||||||
func ComputeCellsAndProofsFromFlat(blobs [][]byte, cellProofs [][]byte) ([][]kzg.Cell, [][]kzg.Proof, error) {
|
func ComputeCellsAndProofsFromFlat(blobs [][]byte, cellProofs [][]byte) ([][]kzg.Cell, [][]kzg.Proof, error) {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
|
||||||
blobCount := uint64(len(blobs))
|
blobCount := uint64(len(blobs))
|
||||||
cellProofsCount := uint64(len(cellProofs))
|
cellProofsCount := uint64(len(cellProofs))
|
||||||
|
|
||||||
@@ -327,8 +329,6 @@ func ComputeCellsAndProofsFromFlat(blobs [][]byte, cellProofs [][]byte) ([][]kzg
|
|||||||
|
|
||||||
// ComputeCellsAndProofsFromStructured computes the cells and proofs from blobs and cell proofs.
|
// ComputeCellsAndProofsFromStructured computes the cells and proofs from blobs and cell proofs.
|
||||||
func ComputeCellsAndProofsFromStructured(blobsAndProofs []*pb.BlobAndProofV2) ([][]kzg.Cell, [][]kzg.Proof, error) {
|
func ComputeCellsAndProofsFromStructured(blobsAndProofs []*pb.BlobAndProofV2) ([][]kzg.Cell, [][]kzg.Proof, error) {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
cellsPerBlob := make([][]kzg.Cell, 0, len(blobsAndProofs))
|
cellsPerBlob := make([][]kzg.Cell, 0, len(blobsAndProofs))
|
||||||
proofsPerBlob := make([][]kzg.Proof, 0, len(blobsAndProofs))
|
proofsPerBlob := make([][]kzg.Proof, 0, len(blobsAndProofs))
|
||||||
for _, blobAndProof := range blobsAndProofs {
|
for _, blobAndProof := range blobsAndProofs {
|
||||||
@@ -347,7 +347,7 @@ func ComputeCellsAndProofsFromStructured(blobsAndProofs []*pb.BlobAndProofV2) ([
|
|||||||
return nil, nil, errors.Wrap(err, "compute cells")
|
return nil, nil, errors.Wrap(err, "compute cells")
|
||||||
}
|
}
|
||||||
|
|
||||||
kzgProofs := make([]kzg.Proof, 0, numberOfColumns)
|
kzgProofs := make([]kzg.Proof, 0, fieldparams.NumberOfColumns)
|
||||||
for _, kzgProofBytes := range blobAndProof.KzgProofs {
|
for _, kzgProofBytes := range blobAndProof.KzgProofs {
|
||||||
if len(kzgProofBytes) != kzg.BytesPerProof {
|
if len(kzgProofBytes) != kzg.BytesPerProof {
|
||||||
return nil, nil, errors.New("wrong KZG proof size - should never happen")
|
return nil, nil, errors.New("wrong KZG proof size - should never happen")
|
||||||
|
|||||||
@@ -17,41 +17,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMinimumColumnsCountToReconstruct(t *testing.T) {
|
func TestMinimumColumnsCountToReconstruct(t *testing.T) {
|
||||||
testCases := []struct {
|
const expected = uint64(64)
|
||||||
name string
|
actual := peerdas.MinimumColumnCountToReconstruct()
|
||||||
numberOfColumns uint64
|
require.Equal(t, expected, actual)
|
||||||
expected uint64
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "numberOfColumns=128",
|
|
||||||
numberOfColumns: 128,
|
|
||||||
expected: 64,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "numberOfColumns=129",
|
|
||||||
numberOfColumns: 129,
|
|
||||||
expected: 65,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "numberOfColumns=130",
|
|
||||||
numberOfColumns: 130,
|
|
||||||
expected: 65,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range testCases {
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
|
||||||
// Set the total number of columns.
|
|
||||||
params.SetupTestConfigCleanup(t)
|
|
||||||
cfg := params.BeaconConfig().Copy()
|
|
||||||
cfg.NumberOfColumns = tc.numberOfColumns
|
|
||||||
params.OverrideBeaconConfig(cfg)
|
|
||||||
|
|
||||||
// Compute the minimum number of columns needed to reconstruct.
|
|
||||||
actual := peerdas.MinimumColumnCountToReconstruct()
|
|
||||||
require.Equal(t, tc.expected, actual)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReconstructDataColumnSidecars(t *testing.T) {
|
func TestReconstructDataColumnSidecars(t *testing.T) {
|
||||||
@@ -200,7 +168,6 @@ func TestReconstructBlobSidecars(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("nominal", func(t *testing.T) {
|
t.Run("nominal", func(t *testing.T) {
|
||||||
const blobCount = 3
|
const blobCount = 3
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
roBlock, roBlobSidecars := util.GenerateTestElectraBlockWithSidecar(t, [fieldparams.RootLength]byte{}, 42, blobCount)
|
roBlock, roBlobSidecars := util.GenerateTestElectraBlockWithSidecar(t, [fieldparams.RootLength]byte{}, 42, blobCount)
|
||||||
|
|
||||||
@@ -236,7 +203,7 @@ func TestReconstructBlobSidecars(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Flatten proofs.
|
// Flatten proofs.
|
||||||
cellProofs := make([][]byte, 0, blobCount*numberOfColumns)
|
cellProofs := make([][]byte, 0, blobCount*fieldparams.NumberOfColumns)
|
||||||
for _, proofs := range inputProofsPerBlob {
|
for _, proofs := range inputProofsPerBlob {
|
||||||
for _, proof := range proofs {
|
for _, proof := range proofs {
|
||||||
cellProofs = append(cellProofs, proof[:])
|
cellProofs = append(cellProofs, proof[:])
|
||||||
@@ -428,13 +395,12 @@ func TestReconstructBlobs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestComputeCellsAndProofsFromFlat(t *testing.T) {
|
func TestComputeCellsAndProofsFromFlat(t *testing.T) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
// Start the trusted setup.
|
// Start the trusted setup.
|
||||||
err := kzg.Start()
|
err := kzg.Start()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
t.Run("mismatched blob and proof counts", func(t *testing.T) {
|
t.Run("mismatched blob and proof counts", func(t *testing.T) {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
// Create one blob but proofs for two blobs
|
// Create one blob but proofs for two blobs
|
||||||
blobs := [][]byte{{}}
|
blobs := [][]byte{{}}
|
||||||
|
|
||||||
@@ -447,7 +413,6 @@ func TestComputeCellsAndProofsFromFlat(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("nominal", func(t *testing.T) {
|
t.Run("nominal", func(t *testing.T) {
|
||||||
const blobCount = 2
|
const blobCount = 2
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
// Generate test blobs
|
// Generate test blobs
|
||||||
_, roBlobSidecars := util.GenerateTestElectraBlockWithSidecar(t, [fieldparams.RootLength]byte{}, 42, blobCount)
|
_, roBlobSidecars := util.GenerateTestElectraBlockWithSidecar(t, [fieldparams.RootLength]byte{}, 42, blobCount)
|
||||||
|
|||||||
@@ -3,16 +3,18 @@ package peerdas
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
"github.com/OffchainLabs/prysm/v7/config/params"
|
||||||
"github.com/OffchainLabs/prysm/v7/testing/require"
|
"github.com/OffchainLabs/prysm/v7/testing/require"
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSemiSupernodeCustody(t *testing.T) {
|
func TestSemiSupernodeCustody(t *testing.T) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
|
||||||
params.SetupTestConfigCleanup(t)
|
params.SetupTestConfigCleanup(t)
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
cfg.NumberOfCustodyGroups = 128
|
cfg.NumberOfCustodyGroups = 128
|
||||||
cfg.NumberOfColumns = 128
|
|
||||||
params.OverrideBeaconConfig(cfg)
|
params.OverrideBeaconConfig(cfg)
|
||||||
|
|
||||||
// Create a test node ID
|
// Create a test node ID
|
||||||
@@ -34,8 +36,8 @@ func TestSemiSupernodeCustody(t *testing.T) {
|
|||||||
|
|
||||||
// Verify the columns are valid (within 0-127 range)
|
// Verify the columns are valid (within 0-127 range)
|
||||||
for columnIndex := range custodyColumns {
|
for columnIndex := range custodyColumns {
|
||||||
if columnIndex >= cfg.NumberOfColumns {
|
if columnIndex >= numberOfColumns {
|
||||||
t.Fatalf("Invalid column index %d, should be less than %d", columnIndex, cfg.NumberOfColumns)
|
t.Fatalf("Invalid column index %d, should be less than %d", columnIndex, numberOfColumns)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -75,33 +77,23 @@ func TestSemiSupernodeCustody(t *testing.T) {
|
|||||||
func TestMinimumCustodyGroupCountToReconstruct(t *testing.T) {
|
func TestMinimumCustodyGroupCountToReconstruct(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
numberOfColumns uint64
|
numberOfGroups uint64
|
||||||
numberOfGroups uint64
|
expectedResult uint64
|
||||||
expectedResult uint64
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Standard 1:1 ratio (128 columns, 128 groups)",
|
name: "Standard 1:1 ratio (128 columns, 128 groups)",
|
||||||
numberOfColumns: 128,
|
numberOfGroups: 128,
|
||||||
numberOfGroups: 128,
|
expectedResult: 64, // Need half of 128 groups
|
||||||
expectedResult: 64, // Need half of 128 groups
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "2 columns per group (128 columns, 64 groups)",
|
name: "2 columns per group (128 columns, 64 groups)",
|
||||||
numberOfColumns: 128,
|
numberOfGroups: 64,
|
||||||
numberOfGroups: 64,
|
expectedResult: 32, // Need 64 columns, which is 32 groups (64/2)
|
||||||
expectedResult: 32, // Need 64 columns, which is 32 groups (64/2)
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "4 columns per group (128 columns, 32 groups)",
|
name: "4 columns per group (128 columns, 32 groups)",
|
||||||
numberOfColumns: 128,
|
numberOfGroups: 32,
|
||||||
numberOfGroups: 32,
|
expectedResult: 16, // Need 64 columns, which is 16 groups (64/4)
|
||||||
expectedResult: 16, // Need 64 columns, which is 16 groups (64/4)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Odd number requiring ceiling division (100 columns, 30 groups)",
|
|
||||||
numberOfColumns: 100,
|
|
||||||
numberOfGroups: 30,
|
|
||||||
expectedResult: 17, // Need 50 columns, 3 columns per group (100/30), ceiling(50/3) = 17
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +101,6 @@ func TestMinimumCustodyGroupCountToReconstruct(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
params.SetupTestConfigCleanup(t)
|
params.SetupTestConfigCleanup(t)
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
cfg.NumberOfColumns = tt.numberOfColumns
|
|
||||||
cfg.NumberOfCustodyGroups = tt.numberOfGroups
|
cfg.NumberOfCustodyGroups = tt.numberOfGroups
|
||||||
params.OverrideBeaconConfig(cfg)
|
params.OverrideBeaconConfig(cfg)
|
||||||
|
|
||||||
@@ -121,22 +112,9 @@ func TestMinimumCustodyGroupCountToReconstruct(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMinimumCustodyGroupCountToReconstruct_ErrorCases(t *testing.T) {
|
func TestMinimumCustodyGroupCountToReconstruct_ErrorCases(t *testing.T) {
|
||||||
t.Run("Returns error when NumberOfColumns is zero", func(t *testing.T) {
|
|
||||||
params.SetupTestConfigCleanup(t)
|
|
||||||
cfg := params.BeaconConfig()
|
|
||||||
cfg.NumberOfColumns = 0
|
|
||||||
cfg.NumberOfCustodyGroups = 128
|
|
||||||
params.OverrideBeaconConfig(cfg)
|
|
||||||
|
|
||||||
_, err := MinimumCustodyGroupCountToReconstruct()
|
|
||||||
require.NotNil(t, err)
|
|
||||||
require.Equal(t, true, err.Error() == "NumberOfColumns cannot be zero")
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("Returns error when NumberOfCustodyGroups is zero", func(t *testing.T) {
|
t.Run("Returns error when NumberOfCustodyGroups is zero", func(t *testing.T) {
|
||||||
params.SetupTestConfigCleanup(t)
|
params.SetupTestConfigCleanup(t)
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
cfg.NumberOfColumns = 128
|
|
||||||
cfg.NumberOfCustodyGroups = 0
|
cfg.NumberOfCustodyGroups = 0
|
||||||
params.OverrideBeaconConfig(cfg)
|
params.OverrideBeaconConfig(cfg)
|
||||||
|
|
||||||
@@ -148,7 +126,6 @@ func TestMinimumCustodyGroupCountToReconstruct_ErrorCases(t *testing.T) {
|
|||||||
t.Run("Returns error when NumberOfCustodyGroups exceeds NumberOfColumns", func(t *testing.T) {
|
t.Run("Returns error when NumberOfCustodyGroups exceeds NumberOfColumns", func(t *testing.T) {
|
||||||
params.SetupTestConfigCleanup(t)
|
params.SetupTestConfigCleanup(t)
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
cfg.NumberOfColumns = 128
|
|
||||||
cfg.NumberOfCustodyGroups = 256
|
cfg.NumberOfCustodyGroups = 256
|
||||||
params.OverrideBeaconConfig(cfg)
|
params.OverrideBeaconConfig(cfg)
|
||||||
|
|
||||||
|
|||||||
@@ -102,11 +102,13 @@ func ValidatorsCustodyRequirement(state beaconState.ReadOnlyBeaconState, validat
|
|||||||
// https://github.com/ethereum/consensus-specs/blob/master/specs/fulu/validator.md#get_data_column_sidecars_from_block and
|
// https://github.com/ethereum/consensus-specs/blob/master/specs/fulu/validator.md#get_data_column_sidecars_from_block and
|
||||||
// https://github.com/ethereum/consensus-specs/blob/master/specs/fulu/validator.md#get_data_column_sidecars_from_column_sidecar
|
// https://github.com/ethereum/consensus-specs/blob/master/specs/fulu/validator.md#get_data_column_sidecars_from_column_sidecar
|
||||||
func DataColumnSidecars(cellsPerBlob [][]kzg.Cell, proofsPerBlob [][]kzg.Proof, src ConstructionPopulator) ([]blocks.RODataColumn, error) {
|
func DataColumnSidecars(cellsPerBlob [][]kzg.Cell, proofsPerBlob [][]kzg.Proof, src ConstructionPopulator) ([]blocks.RODataColumn, error) {
|
||||||
|
const numberOfColumns = uint64(fieldparams.NumberOfColumns)
|
||||||
|
|
||||||
if len(cellsPerBlob) == 0 {
|
if len(cellsPerBlob) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
cells, proofs, err := rotateRowsToCols(cellsPerBlob, proofsPerBlob, params.BeaconConfig().NumberOfColumns)
|
cells, proofs, err := rotateRowsToCols(cellsPerBlob, proofsPerBlob, numberOfColumns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "rotate cells and proofs")
|
return nil, errors.Wrap(err, "rotate cells and proofs")
|
||||||
}
|
}
|
||||||
@@ -115,9 +117,8 @@ func DataColumnSidecars(cellsPerBlob [][]kzg.Cell, proofsPerBlob [][]kzg.Proof,
|
|||||||
return nil, errors.Wrap(err, "extract block info")
|
return nil, errors.Wrap(err, "extract block info")
|
||||||
}
|
}
|
||||||
|
|
||||||
maxIdx := params.BeaconConfig().NumberOfColumns
|
roSidecars := make([]blocks.RODataColumn, 0, numberOfColumns)
|
||||||
roSidecars := make([]blocks.RODataColumn, 0, maxIdx)
|
for idx := range numberOfColumns {
|
||||||
for idx := range maxIdx {
|
|
||||||
sidecar := ðpb.DataColumnSidecar{
|
sidecar := ðpb.DataColumnSidecar{
|
||||||
Index: idx,
|
Index: idx,
|
||||||
Column: cells[idx],
|
Column: cells[idx],
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/blockchain/kzg"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/blockchain/kzg"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
||||||
state_native "github.com/OffchainLabs/prysm/v7/beacon-chain/state/state-native"
|
state_native "github.com/OffchainLabs/prysm/v7/beacon-chain/state/state-native"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
||||||
ethpb "github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1"
|
ethpb "github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1"
|
||||||
@@ -59,6 +59,8 @@ func TestValidatorsCustodyRequirement(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDataColumnSidecars(t *testing.T) {
|
func TestDataColumnSidecars(t *testing.T) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
|
||||||
t.Run("sizes mismatch", func(t *testing.T) {
|
t.Run("sizes mismatch", func(t *testing.T) {
|
||||||
// Create a protobuf signed beacon block.
|
// Create a protobuf signed beacon block.
|
||||||
signedBeaconBlockPb := util.NewBeaconBlockDeneb()
|
signedBeaconBlockPb := util.NewBeaconBlockDeneb()
|
||||||
@@ -69,10 +71,10 @@ func TestDataColumnSidecars(t *testing.T) {
|
|||||||
|
|
||||||
// Create cells and proofs.
|
// Create cells and proofs.
|
||||||
cellsPerBlob := [][]kzg.Cell{
|
cellsPerBlob := [][]kzg.Cell{
|
||||||
make([]kzg.Cell, params.BeaconConfig().NumberOfColumns),
|
make([]kzg.Cell, numberOfColumns),
|
||||||
}
|
}
|
||||||
proofsPerBlob := [][]kzg.Proof{
|
proofsPerBlob := [][]kzg.Proof{
|
||||||
make([]kzg.Proof, params.BeaconConfig().NumberOfColumns),
|
make([]kzg.Proof, numberOfColumns),
|
||||||
}
|
}
|
||||||
|
|
||||||
rob, err := blocks.NewROBlock(signedBeaconBlock)
|
rob, err := blocks.NewROBlock(signedBeaconBlock)
|
||||||
@@ -117,7 +119,6 @@ func TestDataColumnSidecars(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Create cells and proofs with sufficient cells but insufficient proofs.
|
// Create cells and proofs with sufficient cells but insufficient proofs.
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
cellsPerBlob := [][]kzg.Cell{
|
cellsPerBlob := [][]kzg.Cell{
|
||||||
make([]kzg.Cell, numberOfColumns),
|
make([]kzg.Cell, numberOfColumns),
|
||||||
}
|
}
|
||||||
@@ -149,7 +150,6 @@ func TestDataColumnSidecars(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Create cells and proofs with correct dimensions.
|
// Create cells and proofs with correct dimensions.
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
cellsPerBlob := [][]kzg.Cell{
|
cellsPerBlob := [][]kzg.Cell{
|
||||||
make([]kzg.Cell, numberOfColumns),
|
make([]kzg.Cell, numberOfColumns),
|
||||||
make([]kzg.Cell, numberOfColumns),
|
make([]kzg.Cell, numberOfColumns),
|
||||||
@@ -197,6 +197,7 @@ func TestDataColumnSidecars(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReconstructionSource(t *testing.T) {
|
func TestReconstructionSource(t *testing.T) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
// Create a Fulu block with blob commitments.
|
// Create a Fulu block with blob commitments.
|
||||||
signedBeaconBlockPb := util.NewBeaconBlockFulu()
|
signedBeaconBlockPb := util.NewBeaconBlockFulu()
|
||||||
commitment1 := make([]byte, 48)
|
commitment1 := make([]byte, 48)
|
||||||
@@ -212,7 +213,6 @@ func TestReconstructionSource(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Create cells and proofs with correct dimensions.
|
// Create cells and proofs with correct dimensions.
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
cellsPerBlob := [][]kzg.Cell{
|
cellsPerBlob := [][]kzg.Cell{
|
||||||
make([]kzg.Cell, numberOfColumns),
|
make([]kzg.Cell, numberOfColumns),
|
||||||
make([]kzg.Cell, numberOfColumns),
|
make([]kzg.Cell, numberOfColumns),
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ func (dcs *DataColumnStorage) Save(dataColumnSidecars []blocks.VerifiedRODataCol
|
|||||||
// Check the number of columns is the one expected.
|
// Check the number of columns is the one expected.
|
||||||
// While implementing this, we expect the number of columns won't change.
|
// While implementing this, we expect the number of columns won't change.
|
||||||
// If it does, we will need to create a new version of the data column sidecar file.
|
// If it does, we will need to create a new version of the data column sidecar file.
|
||||||
if params.BeaconConfig().NumberOfColumns != mandatoryNumberOfColumns {
|
if fieldparams.NumberOfColumns != mandatoryNumberOfColumns {
|
||||||
return errWrongNumberOfColumns
|
return errWrongNumberOfColumns
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,8 +964,7 @@ func (si *storageIndices) set(dataColumnIndex uint64, position uint8) error {
|
|||||||
|
|
||||||
// pullChan pulls data column sidecars from the input channel until it is empty.
|
// pullChan pulls data column sidecars from the input channel until it is empty.
|
||||||
func pullChan(inputRoDataColumns chan []blocks.VerifiedRODataColumn) []blocks.VerifiedRODataColumn {
|
func pullChan(inputRoDataColumns chan []blocks.VerifiedRODataColumn) []blocks.VerifiedRODataColumn {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
dataColumnSidecars := make([]blocks.VerifiedRODataColumn, 0, fieldparams.NumberOfColumns)
|
||||||
dataColumnSidecars := make([]blocks.VerifiedRODataColumn, 0, numberOfColumns)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -117,8 +117,6 @@ func (sc *dataColumnStorageSummaryCache) HighestEpoch() primitives.Epoch {
|
|||||||
|
|
||||||
// set updates the cache.
|
// set updates the cache.
|
||||||
func (sc *dataColumnStorageSummaryCache) set(dataColumnsIdent DataColumnsIdent) error {
|
func (sc *dataColumnStorageSummaryCache) set(dataColumnsIdent DataColumnsIdent) error {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
sc.mu.Lock()
|
sc.mu.Lock()
|
||||||
defer sc.mu.Unlock()
|
defer sc.mu.Unlock()
|
||||||
|
|
||||||
@@ -127,7 +125,7 @@ func (sc *dataColumnStorageSummaryCache) set(dataColumnsIdent DataColumnsIdent)
|
|||||||
|
|
||||||
count := uint64(0)
|
count := uint64(0)
|
||||||
for _, index := range dataColumnsIdent.Indices {
|
for _, index := range dataColumnsIdent.Indices {
|
||||||
if index >= numberOfColumns {
|
if index >= fieldparams.NumberOfColumns {
|
||||||
return errDataColumnIndexOutOfBounds
|
return errDataColumnIndexOutOfBounds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
||||||
"github.com/OffchainLabs/prysm/v7/testing/require"
|
"github.com/OffchainLabs/prysm/v7/testing/require"
|
||||||
@@ -88,22 +87,6 @@ func TestWarmCache(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSaveDataColumnsSidecars(t *testing.T) {
|
func TestSaveDataColumnsSidecars(t *testing.T) {
|
||||||
t.Run("wrong numbers of columns", func(t *testing.T) {
|
|
||||||
cfg := params.BeaconConfig().Copy()
|
|
||||||
cfg.NumberOfColumns = 0
|
|
||||||
params.OverrideBeaconConfig(cfg)
|
|
||||||
params.SetupTestConfigCleanup(t)
|
|
||||||
|
|
||||||
_, verifiedRoDataColumnSidecars := util.CreateTestVerifiedRoDataColumnSidecars(
|
|
||||||
t,
|
|
||||||
[]util.DataColumnParam{{Index: 12}, {Index: 1_000_000}, {Index: 48}},
|
|
||||||
)
|
|
||||||
|
|
||||||
_, dataColumnStorage := NewEphemeralDataColumnStorageAndFs(t)
|
|
||||||
err := dataColumnStorage.Save(verifiedRoDataColumnSidecars)
|
|
||||||
require.ErrorIs(t, err, errWrongNumberOfColumns)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("one of the column index is too large", func(t *testing.T) {
|
t.Run("one of the column index is too large", func(t *testing.T) {
|
||||||
_, verifiedRoDataColumnSidecars := util.CreateTestVerifiedRoDataColumnSidecars(
|
_, verifiedRoDataColumnSidecars := util.CreateTestVerifiedRoDataColumnSidecars(
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -2683,7 +2683,7 @@ func createBlobServerV2(t *testing.T, numBlobs int, blobMasks []bool) *httptest.
|
|||||||
Blob: []byte("0xblob"),
|
Blob: []byte("0xblob"),
|
||||||
KzgProofs: []hexutil.Bytes{},
|
KzgProofs: []hexutil.Bytes{},
|
||||||
}
|
}
|
||||||
for j := 0; j < int(params.BeaconConfig().NumberOfColumns); j++ {
|
for range fieldparams.NumberOfColumns {
|
||||||
cellProof := make([]byte, 48)
|
cellProof := make([]byte, 48)
|
||||||
blobAndCellProofs[i].KzgProofs = append(blobAndCellProofs[i].KzgProofs, cellProof)
|
blobAndCellProofs[i].KzgProofs = append(blobAndCellProofs[i].KzgProofs, cellProof)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -993,10 +993,11 @@ func (s *Server) validateEquivocation(blk interfaces.ReadOnlyBeaconBlock) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) validateBlobs(blk interfaces.SignedBeaconBlock, blobs [][]byte, proofs [][]byte) error {
|
func (s *Server) validateBlobs(blk interfaces.SignedBeaconBlock, blobs [][]byte, proofs [][]byte) error {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
|
||||||
if blk.Version() < version.Deneb {
|
if blk.Version() < version.Deneb {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
commitments, err := blk.Block().Body().BlobKzgCommitments()
|
commitments, err := blk.Block().Body().BlobKzgCommitments()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not get blob kzg commitments")
|
return errors.Wrap(err, "could not get blob kzg commitments")
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/testutil"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/testutil"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/state"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/state"
|
||||||
mockSync "github.com/OffchainLabs/prysm/v7/beacon-chain/sync/initial-sync/testing"
|
mockSync "github.com/OffchainLabs/prysm/v7/beacon-chain/sync/initial-sync/testing"
|
||||||
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
"github.com/OffchainLabs/prysm/v7/config/params"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/interfaces"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/interfaces"
|
||||||
@@ -3756,6 +3757,7 @@ func Test_validateBlobs(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Fulu block with valid cell proofs", func(t *testing.T) {
|
t.Run("Fulu block with valid cell proofs", func(t *testing.T) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
blk := util.NewBeaconBlockFulu()
|
blk := util.NewBeaconBlockFulu()
|
||||||
blk.Block.Slot = fs
|
blk.Block.Slot = fs
|
||||||
|
|
||||||
@@ -3783,14 +3785,13 @@ func Test_validateBlobs(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Generate cell proofs for the blobs (flattened format like execution client)
|
// Generate cell proofs for the blobs (flattened format like execution client)
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
cellProofs := make([][]byte, uint64(blobCount)*numberOfColumns)
|
cellProofs := make([][]byte, uint64(blobCount)*numberOfColumns)
|
||||||
for blobIdx := range blobCount {
|
for blobIdx := range blobCount {
|
||||||
_, proofs, err := kzg.ComputeCellsAndKZGProofs(&kzgBlobs[blobIdx])
|
_, proofs, err := kzg.ComputeCellsAndKZGProofs(&kzgBlobs[blobIdx])
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for colIdx := range numberOfColumns {
|
for colIdx := range numberOfColumns {
|
||||||
cellProofIdx := uint64(blobIdx)*numberOfColumns + colIdx
|
cellProofIdx := blobIdx*numberOfColumns + colIdx
|
||||||
cellProofs[cellProofIdx] = proofs[colIdx][:]
|
cellProofs[cellProofIdx] = proofs[colIdx][:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,20 +155,19 @@ func TestGetSpec(t *testing.T) {
|
|||||||
config.MaxAttesterSlashingsElectra = 88
|
config.MaxAttesterSlashingsElectra = 88
|
||||||
config.MaxAttestationsElectra = 89
|
config.MaxAttestationsElectra = 89
|
||||||
config.MaxWithdrawalRequestsPerPayload = 90
|
config.MaxWithdrawalRequestsPerPayload = 90
|
||||||
config.MaxCellsInExtendedMatrix = 91
|
config.UnsetDepositRequestsStartIndex = 91
|
||||||
config.UnsetDepositRequestsStartIndex = 92
|
config.MaxDepositRequestsPerPayload = 92
|
||||||
config.MaxDepositRequestsPerPayload = 93
|
config.MaxPendingDepositsPerEpoch = 93
|
||||||
config.MaxPendingDepositsPerEpoch = 94
|
config.MaxBlobCommitmentsPerBlock = 94
|
||||||
config.MaxBlobCommitmentsPerBlock = 95
|
config.MaxBytesPerTransaction = 95
|
||||||
config.MaxBytesPerTransaction = 96
|
config.MaxExtraDataBytes = 96
|
||||||
config.MaxExtraDataBytes = 97
|
config.BytesPerLogsBloom = 97
|
||||||
config.BytesPerLogsBloom = 98
|
config.MaxTransactionsPerPayload = 98
|
||||||
config.MaxTransactionsPerPayload = 99
|
config.FieldElementsPerBlob = 99
|
||||||
config.FieldElementsPerBlob = 100
|
config.KzgCommitmentInclusionProofDepth = 100
|
||||||
config.KzgCommitmentInclusionProofDepth = 101
|
config.BlobsidecarSubnetCount = 101
|
||||||
config.BlobsidecarSubnetCount = 102
|
config.BlobsidecarSubnetCountElectra = 102
|
||||||
config.BlobsidecarSubnetCountElectra = 103
|
config.SyncMessageDueBPS = 103
|
||||||
config.SyncMessageDueBPS = 104
|
|
||||||
|
|
||||||
var dbp [4]byte
|
var dbp [4]byte
|
||||||
copy(dbp[:], []byte{'0', '0', '0', '1'})
|
copy(dbp[:], []byte{'0', '0', '0', '1'})
|
||||||
@@ -206,7 +205,7 @@ func TestGetSpec(t *testing.T) {
|
|||||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), &resp))
|
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), &resp))
|
||||||
data, ok := resp.Data.(map[string]any)
|
data, ok := resp.Data.(map[string]any)
|
||||||
require.Equal(t, true, ok)
|
require.Equal(t, true, ok)
|
||||||
assert.Equal(t, 176, len(data))
|
assert.Equal(t, 175, len(data))
|
||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
t.Run(k, func(t *testing.T) {
|
t.Run(k, func(t *testing.T) {
|
||||||
switch k {
|
switch k {
|
||||||
@@ -500,8 +499,6 @@ func TestGetSpec(t *testing.T) {
|
|||||||
assert.Equal(t, "1024", v)
|
assert.Equal(t, "1024", v)
|
||||||
case "MAX_REQUEST_BLOCKS_DENEB":
|
case "MAX_REQUEST_BLOCKS_DENEB":
|
||||||
assert.Equal(t, "128", v)
|
assert.Equal(t, "128", v)
|
||||||
case "NUMBER_OF_COLUMNS":
|
|
||||||
assert.Equal(t, "128", v)
|
|
||||||
case "MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA":
|
case "MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA":
|
||||||
assert.Equal(t, "128000000000", v)
|
assert.Equal(t, "128000000000", v)
|
||||||
case "MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT":
|
case "MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT":
|
||||||
@@ -538,14 +535,12 @@ func TestGetSpec(t *testing.T) {
|
|||||||
assert.Equal(t, "89", v)
|
assert.Equal(t, "89", v)
|
||||||
case "MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD":
|
case "MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD":
|
||||||
assert.Equal(t, "90", v)
|
assert.Equal(t, "90", v)
|
||||||
case "MAX_CELLS_IN_EXTENDED_MATRIX":
|
|
||||||
assert.Equal(t, "91", v)
|
|
||||||
case "UNSET_DEPOSIT_REQUESTS_START_INDEX":
|
case "UNSET_DEPOSIT_REQUESTS_START_INDEX":
|
||||||
assert.Equal(t, "92", v)
|
assert.Equal(t, "91", v)
|
||||||
case "MAX_DEPOSIT_REQUESTS_PER_PAYLOAD":
|
case "MAX_DEPOSIT_REQUESTS_PER_PAYLOAD":
|
||||||
assert.Equal(t, "93", v)
|
assert.Equal(t, "92", v)
|
||||||
case "MAX_PENDING_DEPOSITS_PER_EPOCH":
|
case "MAX_PENDING_DEPOSITS_PER_EPOCH":
|
||||||
assert.Equal(t, "94", v)
|
assert.Equal(t, "93", v)
|
||||||
case "MAX_BLOBS_PER_BLOCK_ELECTRA":
|
case "MAX_BLOBS_PER_BLOCK_ELECTRA":
|
||||||
assert.Equal(t, "9", v)
|
assert.Equal(t, "9", v)
|
||||||
case "MAX_REQUEST_BLOB_SIDECARS_ELECTRA":
|
case "MAX_REQUEST_BLOB_SIDECARS_ELECTRA":
|
||||||
@@ -563,25 +558,25 @@ func TestGetSpec(t *testing.T) {
|
|||||||
case "MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS":
|
case "MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS":
|
||||||
assert.Equal(t, "4096", v)
|
assert.Equal(t, "4096", v)
|
||||||
case "MAX_BLOB_COMMITMENTS_PER_BLOCK":
|
case "MAX_BLOB_COMMITMENTS_PER_BLOCK":
|
||||||
assert.Equal(t, "95", v)
|
assert.Equal(t, "94", v)
|
||||||
case "MAX_BYTES_PER_TRANSACTION":
|
case "MAX_BYTES_PER_TRANSACTION":
|
||||||
assert.Equal(t, "96", v)
|
assert.Equal(t, "95", v)
|
||||||
case "MAX_EXTRA_DATA_BYTES":
|
case "MAX_EXTRA_DATA_BYTES":
|
||||||
assert.Equal(t, "97", v)
|
assert.Equal(t, "96", v)
|
||||||
case "BYTES_PER_LOGS_BLOOM":
|
case "BYTES_PER_LOGS_BLOOM":
|
||||||
assert.Equal(t, "98", v)
|
assert.Equal(t, "97", v)
|
||||||
case "MAX_TRANSACTIONS_PER_PAYLOAD":
|
case "MAX_TRANSACTIONS_PER_PAYLOAD":
|
||||||
assert.Equal(t, "99", v)
|
assert.Equal(t, "98", v)
|
||||||
case "FIELD_ELEMENTS_PER_BLOB":
|
case "FIELD_ELEMENTS_PER_BLOB":
|
||||||
assert.Equal(t, "100", v)
|
assert.Equal(t, "99", v)
|
||||||
case "KZG_COMMITMENT_INCLUSION_PROOF_DEPTH":
|
case "KZG_COMMITMENT_INCLUSION_PROOF_DEPTH":
|
||||||
assert.Equal(t, "101", v)
|
assert.Equal(t, "100", v)
|
||||||
case "BLOB_SIDECAR_SUBNET_COUNT":
|
case "BLOB_SIDECAR_SUBNET_COUNT":
|
||||||
assert.Equal(t, "102", v)
|
assert.Equal(t, "101", v)
|
||||||
case "BLOB_SIDECAR_SUBNET_COUNT_ELECTRA":
|
case "BLOB_SIDECAR_SUBNET_COUNT_ELECTRA":
|
||||||
assert.Equal(t, "103", v)
|
assert.Equal(t, "102", v)
|
||||||
case "SYNC_MESSAGE_DUE_BPS":
|
case "SYNC_MESSAGE_DUE_BPS":
|
||||||
assert.Equal(t, "104", v)
|
assert.Equal(t, "103", v)
|
||||||
case "BLOB_SCHEDULE":
|
case "BLOB_SCHEDULE":
|
||||||
blobSchedule, ok := v.([]any)
|
blobSchedule, ok := v.([]any)
|
||||||
assert.Equal(t, true, ok)
|
assert.Equal(t, true, ok)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ go_library(
|
|||||||
"//beacon-chain/rpc/eth/helpers:go_default_library",
|
"//beacon-chain/rpc/eth/helpers:go_default_library",
|
||||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||||
"//beacon-chain/rpc/lookup:go_default_library",
|
"//beacon-chain/rpc/lookup:go_default_library",
|
||||||
|
"//config/fieldparams:go_default_library",
|
||||||
"//config/params:go_default_library",
|
"//config/params:go_default_library",
|
||||||
"//consensus-types/blocks:go_default_library",
|
"//consensus-types/blocks:go_default_library",
|
||||||
"//consensus-types/primitives:go_default_library",
|
"//consensus-types/primitives:go_default_library",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/core"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/core"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/eth/helpers"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/eth/helpers"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/eth/shared"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/rpc/eth/shared"
|
||||||
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
"github.com/OffchainLabs/prysm/v7/config/params"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
||||||
@@ -308,7 +309,7 @@ func (s *Server) DataColumnSidecars(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// parseDataColumnIndices filters out invalid and duplicate data column indices
|
// parseDataColumnIndices filters out invalid and duplicate data column indices
|
||||||
func parseDataColumnIndices(url *url.URL) ([]int, error) {
|
func parseDataColumnIndices(url *url.URL) ([]int, error) {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
rawIndices := url.Query()["indices"]
|
rawIndices := url.Query()["indices"]
|
||||||
indices := make([]int, 0, numberOfColumns)
|
indices := make([]int, 0, numberOfColumns)
|
||||||
invalidIndices := make([]string, 0)
|
invalidIndices := make([]string, 0)
|
||||||
|
|||||||
@@ -709,15 +709,6 @@ func TestDataColumnSidecars(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParseDataColumnIndices(t *testing.T) {
|
func TestParseDataColumnIndices(t *testing.T) {
|
||||||
// Save the original config
|
|
||||||
originalConfig := params.BeaconConfig()
|
|
||||||
defer func() { params.OverrideBeaconConfig(originalConfig) }()
|
|
||||||
|
|
||||||
// Set NumberOfColumns to 128 for testing
|
|
||||||
config := params.BeaconConfig().Copy()
|
|
||||||
config.NumberOfColumns = 128
|
|
||||||
params.OverrideBeaconConfig(config)
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
queryParams map[string][]string
|
queryParams map[string][]string
|
||||||
|
|||||||
@@ -628,6 +628,8 @@ func (p *BeaconDbBlocker) neededDataColumnSidecars(root [fieldparams.RootLength]
|
|||||||
// - no block, 404
|
// - no block, 404
|
||||||
// - block exists, before Fulu fork, 400 (data columns are not supported before Fulu fork)
|
// - block exists, before Fulu fork, 400 (data columns are not supported before Fulu fork)
|
||||||
func (p *BeaconDbBlocker) DataColumns(ctx context.Context, id string, indices []int) ([]blocks.VerifiedRODataColumn, *core.RpcError) {
|
func (p *BeaconDbBlocker) DataColumns(ctx context.Context, id string, indices []int) ([]blocks.VerifiedRODataColumn, *core.RpcError) {
|
||||||
|
const numberOfColumns = fieldparams.NumberOfColumns
|
||||||
|
|
||||||
// Check for genesis block first (not supported for data columns)
|
// Check for genesis block first (not supported for data columns)
|
||||||
if id == "genesis" {
|
if id == "genesis" {
|
||||||
return nil, &core.RpcError{Err: errors.New("data columns are not supported for Phase 0 fork"), Reason: core.BadRequest}
|
return nil, &core.RpcError{Err: errors.New("data columns are not supported for Phase 0 fork"), Reason: core.BadRequest}
|
||||||
@@ -681,7 +683,6 @@ func (p *BeaconDbBlocker) DataColumns(ctx context.Context, id string, indices []
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Validate and convert indices
|
// Validate and convert indices
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
for _, index := range indices {
|
for _, index := range indices {
|
||||||
if index < 0 || uint64(index) >= numberOfColumns {
|
if index < 0 || uint64(index) >= numberOfColumns {
|
||||||
return nil, &core.RpcError{
|
return nil, &core.RpcError{
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ func requestIndirectSidecarsFromPeers(
|
|||||||
) (map[[fieldparams.RootLength]byte][]blocks.VerifiedRODataColumn, error) {
|
) (map[[fieldparams.RootLength]byte][]blocks.VerifiedRODataColumn, error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
const numberOfColumns = uint64(fieldparams.NumberOfColumns)
|
||||||
minimumColumnCountToReconstruct := peerdas.MinimumColumnCountToReconstruct()
|
minimumColumnCountToReconstruct := peerdas.MinimumColumnCountToReconstruct()
|
||||||
|
|
||||||
// Create a new random source for peer selection.
|
// Create a new random source for peer selection.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestFetchDataColumnSidecars(t *testing.T) {
|
func TestFetchDataColumnSidecars(t *testing.T) {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
const numberOfColumns = uint64(fieldparams.NumberOfColumns)
|
||||||
// Slot 1: All needed sidecars are available in storage ==> Retrieval from storage only.
|
// Slot 1: All needed sidecars are available in storage ==> Retrieval from storage only.
|
||||||
// Slot 2: No commitment ==> Nothing to do.
|
// Slot 2: No commitment ==> Nothing to do.
|
||||||
// Slot 3: Some sidecars are in the storage, other have to be retrieved from peers ==> Retrieval from storage and peers.
|
// Slot 3: Some sidecars are in the storage, other have to be retrieved from peers ==> Retrieval from storage and peers.
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/helpers"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/helpers"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
||||||
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/time/slots"
|
"github.com/OffchainLabs/prysm/v7/time/slots"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@@ -113,15 +112,13 @@ func (s *Service) processDataColumnSidecarsFromReconstruction(ctx context.Contex
|
|||||||
|
|
||||||
// shouldReconstruct returns true if we should attempt to reconstruct the data columns for the given block root.
|
// shouldReconstruct returns true if we should attempt to reconstruct the data columns for the given block root.
|
||||||
func (s *Service) shouldReconstruct(root [fieldparams.RootLength]byte) bool {
|
func (s *Service) shouldReconstruct(root [fieldparams.RootLength]byte) bool {
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
// Get the columns we store.
|
// Get the columns we store.
|
||||||
storedDataColumns := s.cfg.dataColumnStorage.Summary(root)
|
storedDataColumns := s.cfg.dataColumnStorage.Summary(root)
|
||||||
storedColumnsCount := storedDataColumns.Count()
|
storedColumnsCount := storedDataColumns.Count()
|
||||||
|
|
||||||
// Reconstruct only if we have at least the minimum number of columns to reconstruct, but not all the columns.
|
// Reconstruct only if we have at least the minimum number of columns to reconstruct, but not all the columns.
|
||||||
// (If we have not enough columns, reconstruction is impossible. If we have all the columns, reconstruction is unnecessary.)
|
// (If we have not enough columns, reconstruction is impossible. If we have all the columns, reconstruction is unnecessary.)
|
||||||
return storedColumnsCount >= peerdas.MinimumColumnCountToReconstruct() && storedColumnsCount != numberOfColumns
|
return storedColumnsCount >= peerdas.MinimumColumnCountToReconstruct() && storedColumnsCount != fieldparams.NumberOfColumns
|
||||||
}
|
}
|
||||||
|
|
||||||
// computeRandomDelay computes a random delay duration to wait before reconstructing data column sidecars.
|
// computeRandomDelay computes a random delay duration to wait before reconstructing data column sidecars.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/db/filesystem"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/db/filesystem"
|
||||||
p2ptest "github.com/OffchainLabs/prysm/v7/beacon-chain/p2p/testing"
|
p2ptest "github.com/OffchainLabs/prysm/v7/beacon-chain/p2p/testing"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/testing/require"
|
"github.com/OffchainLabs/prysm/v7/testing/require"
|
||||||
"github.com/OffchainLabs/prysm/v7/testing/util"
|
"github.com/OffchainLabs/prysm/v7/testing/util"
|
||||||
@@ -19,7 +19,6 @@ import (
|
|||||||
|
|
||||||
func TestProcessDataColumnSidecarsFromReconstruction(t *testing.T) {
|
func TestProcessDataColumnSidecarsFromReconstruction(t *testing.T) {
|
||||||
const blobCount = 4
|
const blobCount = 4
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ func TestProcessDataColumnSidecarsFromReconstruction(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
roBlock, _, verifiedRoDataColumns := util.GenerateTestFuluBlockWithSidecars(t, blobCount)
|
roBlock, _, verifiedRoDataColumns := util.GenerateTestFuluBlockWithSidecars(t, blobCount)
|
||||||
require.Equal(t, numberOfColumns, uint64(len(verifiedRoDataColumns)))
|
require.Equal(t, fieldparams.NumberOfColumns, len(verifiedRoDataColumns))
|
||||||
|
|
||||||
minimumCount := peerdas.MinimumColumnCountToReconstruct()
|
minimumCount := peerdas.MinimumColumnCountToReconstruct()
|
||||||
|
|
||||||
@@ -138,8 +137,10 @@ func TestComputeRandomDelay(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSemiSupernodeReconstruction(t *testing.T) {
|
func TestSemiSupernodeReconstruction(t *testing.T) {
|
||||||
const blobCount = 4
|
const (
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
blobCount = 4
|
||||||
|
numberOfColumns = uint64(fieldparams.NumberOfColumns)
|
||||||
|
)
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ func TestSemiSupernodeReconstruction(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
roBlock, _, verifiedRoDataColumns := util.GenerateTestFuluBlockWithSidecars(t, blobCount)
|
roBlock, _, verifiedRoDataColumns := util.GenerateTestFuluBlockWithSidecars(t, blobCount)
|
||||||
require.Equal(t, numberOfColumns, uint64(len(verifiedRoDataColumns)))
|
require.Equal(t, fieldparams.NumberOfColumns, len(verifiedRoDataColumns))
|
||||||
|
|
||||||
minimumCount := peerdas.MinimumColumnCountToReconstruct()
|
minimumCount := peerdas.MinimumColumnCountToReconstruct()
|
||||||
|
|
||||||
|
|||||||
@@ -1366,8 +1366,8 @@ func TestFetchSidecars(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Nominal", func(t *testing.T) {
|
t.Run("Nominal", func(t *testing.T) {
|
||||||
|
const numberOfColumns = uint64(fieldparams.NumberOfColumns)
|
||||||
cfg := params.BeaconConfig()
|
cfg := params.BeaconConfig()
|
||||||
numberOfColumns := cfg.NumberOfColumns
|
|
||||||
samplesPerSlot := cfg.SamplesPerSlot
|
samplesPerSlot := cfg.SamplesPerSlot
|
||||||
|
|
||||||
// Define "now" to be one epoch after genesis time + retention period.
|
// Define "now" to be one epoch after genesis time + retention period.
|
||||||
|
|||||||
@@ -465,8 +465,6 @@ func SendDataColumnSidecarsByRangeRequest(
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := params.BeaconConfig()
|
|
||||||
numberOfColumns := cfg.NumberOfColumns
|
|
||||||
maxRequestDataColumnSidecars := params.BeaconConfig().MaxRequestDataColumnSidecars
|
maxRequestDataColumnSidecars := params.BeaconConfig().MaxRequestDataColumnSidecars
|
||||||
|
|
||||||
// Check if we do not request too many sidecars.
|
// Check if we do not request too many sidecars.
|
||||||
@@ -486,7 +484,7 @@ func SendDataColumnSidecarsByRangeRequest(
|
|||||||
|
|
||||||
// Build the logs.
|
// Build the logs.
|
||||||
var columnsLog any = "all"
|
var columnsLog any = "all"
|
||||||
if columnsCount < numberOfColumns {
|
if columnsCount < fieldparams.NumberOfColumns {
|
||||||
columns := request.Columns
|
columns := request.Columns
|
||||||
slices.Sort(columns)
|
slices.Sort(columns)
|
||||||
columnsLog = columns
|
columnsLog = columns
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
|
||||||
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/transition/interop"
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/transition/interop"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/features"
|
"github.com/OffchainLabs/prysm/v7/config/features"
|
||||||
|
fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams"
|
||||||
"github.com/OffchainLabs/prysm/v7/config/params"
|
"github.com/OffchainLabs/prysm/v7/config/params"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
||||||
"github.com/OffchainLabs/prysm/v7/consensus-types/interfaces"
|
"github.com/OffchainLabs/prysm/v7/consensus-types/interfaces"
|
||||||
@@ -169,8 +170,6 @@ func (s *Service) processDataColumnSidecarsFromExecution(ctx context.Context, so
|
|||||||
const delay = 250 * time.Millisecond
|
const delay = 250 * time.Millisecond
|
||||||
secondsPerHalfSlot := time.Duration(params.BeaconConfig().SecondsPerSlot/2) * time.Second
|
secondsPerHalfSlot := time.Duration(params.BeaconConfig().SecondsPerSlot/2) * time.Second
|
||||||
|
|
||||||
numberOfColumns := params.BeaconConfig().NumberOfColumns
|
|
||||||
|
|
||||||
commitments, err := source.Commitments()
|
commitments, err := source.Commitments()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "blob kzg commitments")
|
return nil, errors.Wrap(err, "blob kzg commitments")
|
||||||
@@ -214,8 +213,8 @@ func (s *Service) processDataColumnSidecarsFromExecution(ctx context.Context, so
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Boundary check.
|
// Boundary check.
|
||||||
if sidecarCount != numberOfColumns {
|
if sidecarCount != fieldparams.NumberOfColumns {
|
||||||
return nil, errors.Errorf("reconstruct data column sidecars returned %d sidecars, expected %d - should never happen", sidecarCount, numberOfColumns)
|
return nil, errors.Errorf("reconstruct data column sidecars returned %d sidecars, expected %d - should never happen", sidecarCount, fieldparams.NumberOfColumns)
|
||||||
}
|
}
|
||||||
|
|
||||||
unseenIndices, err := s.broadcastAndReceiveUnseenDataColumnSidecars(ctx, source.Slot(), source.ProposerIndex(), columnIndicesToSample, constructedSidecars)
|
unseenIndices, err := s.broadcastAndReceiveUnseenDataColumnSidecars(ctx, source.Slot(), source.ProposerIndex(), columnIndicesToSample, constructedSidecars)
|
||||||
|
|||||||
4
changelog/manu-removed-unused-config.md
Normal file
4
changelog/manu-removed-unused-config.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
### Removed
|
||||||
|
|
||||||
|
- `NUMBER_OF_COLUMNS` configuration (not in the specification any more, replaced by a preset)
|
||||||
|
- `MAX_CELLS_IN_EXTENDED_MATRIX` configuration (not in the specification any more)
|
||||||
@@ -281,12 +281,10 @@ type BeaconChainConfig struct {
|
|||||||
UnsetDepositRequestsStartIndex uint64 `yaml:"UNSET_DEPOSIT_REQUESTS_START_INDEX" spec:"true"` // UnsetDepositRequestsStartIndex is used to check the start index for eip6110
|
UnsetDepositRequestsStartIndex uint64 `yaml:"UNSET_DEPOSIT_REQUESTS_START_INDEX" spec:"true"` // UnsetDepositRequestsStartIndex is used to check the start index for eip6110
|
||||||
|
|
||||||
// Values introduced in Fulu upgrade
|
// Values introduced in Fulu upgrade
|
||||||
NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix.
|
|
||||||
SamplesPerSlot uint64 `yaml:"SAMPLES_PER_SLOT" spec:"true"` // SamplesPerSlot is the minimum number of samples for an honest node.
|
SamplesPerSlot uint64 `yaml:"SAMPLES_PER_SLOT" spec:"true"` // SamplesPerSlot is the minimum number of samples for an honest node.
|
||||||
NumberOfCustodyGroups uint64 `yaml:"NUMBER_OF_CUSTODY_GROUPS" spec:"true"` // NumberOfCustodyGroups available for nodes to custody.
|
NumberOfCustodyGroups uint64 `yaml:"NUMBER_OF_CUSTODY_GROUPS" spec:"true"` // NumberOfCustodyGroups available for nodes to custody.
|
||||||
CustodyRequirement uint64 `yaml:"CUSTODY_REQUIREMENT" spec:"true"` // CustodyRequirement is minimum number of custody groups an honest node custodies and serves samples from.
|
CustodyRequirement uint64 `yaml:"CUSTODY_REQUIREMENT" spec:"true"` // CustodyRequirement is minimum number of custody groups an honest node custodies and serves samples from.
|
||||||
MinEpochsForDataColumnSidecarsRequest primitives.Epoch `yaml:"MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS" spec:"true"` // MinEpochsForDataColumnSidecarsRequest is the minimum number of epochs the node will keep the data columns for.
|
MinEpochsForDataColumnSidecarsRequest primitives.Epoch `yaml:"MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS" spec:"true"` // MinEpochsForDataColumnSidecarsRequest is the minimum number of epochs the node will keep the data columns for.
|
||||||
MaxCellsInExtendedMatrix uint64 `yaml:"MAX_CELLS_IN_EXTENDED_MATRIX"` // MaxCellsInExtendedMatrix is the full data of one-dimensional erasure coding extended blobs (in row major format).
|
|
||||||
DataColumnSidecarSubnetCount uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT" spec:"true"` // DataColumnSidecarSubnetCount is the number of data column sidecar subnets used in the gossipsub protocol
|
DataColumnSidecarSubnetCount uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT" spec:"true"` // DataColumnSidecarSubnetCount is the number of data column sidecar subnets used in the gossipsub protocol
|
||||||
MaxRequestDataColumnSidecars uint64 `yaml:"MAX_REQUEST_DATA_COLUMN_SIDECARS" spec:"true"` // MaxRequestDataColumnSidecars is the maximum number of data column sidecars in a single request
|
MaxRequestDataColumnSidecars uint64 `yaml:"MAX_REQUEST_DATA_COLUMN_SIDECARS" spec:"true"` // MaxRequestDataColumnSidecars is the maximum number of data column sidecars in a single request
|
||||||
ValidatorCustodyRequirement uint64 `yaml:"VALIDATOR_CUSTODY_REQUIREMENT" spec:"true"` // ValidatorCustodyRequirement is the minimum number of custody groups an honest node with validators attached custodies and serves samples from
|
ValidatorCustodyRequirement uint64 `yaml:"VALIDATOR_CUSTODY_REQUIREMENT" spec:"true"` // ValidatorCustodyRequirement is the minimum number of custody groups an honest node with validators attached custodies and serves samples from
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ var placeholderFields = []string{
|
|||||||
"MAX_REQUEST_BLOB_SIDECARS_FULU",
|
"MAX_REQUEST_BLOB_SIDECARS_FULU",
|
||||||
"MAX_REQUEST_INCLUSION_LIST",
|
"MAX_REQUEST_INCLUSION_LIST",
|
||||||
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
|
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
|
||||||
|
"NUMBER_OF_COLUMNS", // Configured as a constant in config/fieldparams/mainnet.go
|
||||||
"PAYLOAD_ATTESTATION_DUE_BPS",
|
"PAYLOAD_ATTESTATION_DUE_BPS",
|
||||||
"PROPOSER_INCLUSION_LIST_CUTOFF",
|
"PROPOSER_INCLUSION_LIST_CUTOFF",
|
||||||
"PROPOSER_INCLUSION_LIST_CUTOFF_BPS",
|
"PROPOSER_INCLUSION_LIST_CUTOFF_BPS",
|
||||||
|
|||||||
@@ -322,12 +322,10 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
|||||||
// Values related to fulu
|
// Values related to fulu
|
||||||
MaxRequestDataColumnSidecars: 16384,
|
MaxRequestDataColumnSidecars: 16384,
|
||||||
DataColumnSidecarSubnetCount: 128,
|
DataColumnSidecarSubnetCount: 128,
|
||||||
NumberOfColumns: 128,
|
|
||||||
SamplesPerSlot: 8,
|
SamplesPerSlot: 8,
|
||||||
NumberOfCustodyGroups: 128,
|
NumberOfCustodyGroups: 128,
|
||||||
CustodyRequirement: 4,
|
CustodyRequirement: 4,
|
||||||
MinEpochsForDataColumnSidecarsRequest: 4096,
|
MinEpochsForDataColumnSidecarsRequest: 4096,
|
||||||
MaxCellsInExtendedMatrix: 768,
|
|
||||||
ValidatorCustodyRequirement: 8,
|
ValidatorCustodyRequirement: 8,
|
||||||
BalancePerAdditionalCustodyGroup: 32_000_000_000,
|
BalancePerAdditionalCustodyGroup: 32_000_000_000,
|
||||||
// Values related to networking parameters.
|
// Values related to networking parameters.
|
||||||
|
|||||||
@@ -557,8 +557,8 @@
|
|||||||
|
|
||||||
- name: NUMBER_OF_COLUMNS
|
- name: NUMBER_OF_COLUMNS
|
||||||
sources:
|
sources:
|
||||||
- file: config/params/config.go
|
- file: config/fieldparams/mainnet.go
|
||||||
search: NumberOfColumns\s+uint64
|
search: NumberOfColumns\s*=
|
||||||
regex: true
|
regex: true
|
||||||
spec: |
|
spec: |
|
||||||
<spec preset_var="NUMBER_OF_COLUMNS" fork="fulu" hash="f6441e62">
|
<spec preset_var="NUMBER_OF_COLUMNS" fork="fulu" hash="f6441e62">
|
||||||
|
|||||||
Reference in New Issue
Block a user