diff --git a/beacon-chain/rpc/eth/config/BUILD.bazel b/beacon-chain/rpc/eth/config/BUILD.bazel index 5536a3f08a65..82cdbbce4f41 100644 --- a/beacon-chain/rpc/eth/config/BUILD.bazel +++ b/beacon-chain/rpc/eth/config/BUILD.bazel @@ -7,6 +7,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//api/server/structs:go_default_library", + "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", diff --git a/beacon-chain/rpc/eth/config/handlers.go b/beacon-chain/rpc/eth/config/handlers.go index 38c29839d24a..9a03f12f7aa9 100644 --- a/beacon-chain/rpc/eth/config/handlers.go +++ b/beacon-chain/rpc/eth/config/handlers.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/OffchainLabs/prysm/v7/api/server/structs" + fieldparams "github.com/OffchainLabs/prysm/v7/config/fieldparams" "github.com/OffchainLabs/prysm/v7/config/params" "github.com/OffchainLabs/prysm/v7/monitoring/tracing/trace" "github.com/OffchainLabs/prysm/v7/network/httputil" @@ -181,6 +182,16 @@ func prepareConfigSpec() (map[string]any, error) { data[tag] = convertValueForJSON(val, tag) } + // Add Fulu preset values. These are compile-time constants from fieldparams, + // not runtime configs, but are required by the /eth/v1/config/spec API. + data["NUMBER_OF_COLUMNS"] = convertValueForJSON(reflect.ValueOf(uint64(fieldparams.NumberOfColumns)), "NUMBER_OF_COLUMNS") + data["CELLS_PER_EXT_BLOB"] = convertValueForJSON(reflect.ValueOf(uint64(fieldparams.NumberOfColumns)), "CELLS_PER_EXT_BLOB") + data["FIELD_ELEMENTS_PER_CELL"] = convertValueForJSON(reflect.ValueOf(uint64(fieldparams.CellsPerBlob)), "FIELD_ELEMENTS_PER_CELL") + data["FIELD_ELEMENTS_PER_EXT_BLOB"] = convertValueForJSON(reflect.ValueOf(config.FieldElementsPerBlob*2), "FIELD_ELEMENTS_PER_EXT_BLOB") + data["KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH"] = convertValueForJSON(reflect.ValueOf(uint64(4)), "KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH") + // UPDATE_TIMEOUT is derived from SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD + data["UPDATE_TIMEOUT"] = convertValueForJSON(reflect.ValueOf(uint64(config.SlotsPerEpoch)*uint64(config.EpochsPerSyncCommitteePeriod)), "UPDATE_TIMEOUT") + return data, nil } diff --git a/beacon-chain/rpc/eth/config/handlers_test.go b/beacon-chain/rpc/eth/config/handlers_test.go index fcfb9dfda844..0d5703c22a83 100644 --- a/beacon-chain/rpc/eth/config/handlers_test.go +++ b/beacon-chain/rpc/eth/config/handlers_test.go @@ -212,7 +212,7 @@ func TestGetSpec(t *testing.T) { require.NoError(t, json.Unmarshal(writer.Body.Bytes(), &resp)) data, ok := resp.Data.(map[string]any) require.Equal(t, true, ok) - assert.Equal(t, 180, len(data)) + assert.Equal(t, 186, len(data)) for k, v := range data { t.Run(k, func(t *testing.T) { switch k { @@ -598,6 +598,18 @@ func TestGetSpec(t *testing.T) { blobSchedule, ok := v.([]any) assert.Equal(t, true, ok) assert.Equal(t, 2, len(blobSchedule)) + case "FIELD_ELEMENTS_PER_CELL": + assert.Equal(t, "64", v) // From fieldparams.CellsPerBlob + case "FIELD_ELEMENTS_PER_EXT_BLOB": + assert.Equal(t, "198", v) // FieldElementsPerBlob (99) * 2 + case "KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH": + assert.Equal(t, "4", v) // Preset value + case "CELLS_PER_EXT_BLOB": + assert.Equal(t, "128", v) // From fieldparams.NumberOfColumns + case "NUMBER_OF_COLUMNS": + assert.Equal(t, "128", v) // From fieldparams.NumberOfColumns + case "UPDATE_TIMEOUT": + assert.Equal(t, "1782", v) // SlotsPerEpoch (27) * EpochsPerSyncCommitteePeriod (66) default: t.Errorf("Incorrect key: %s", k) } diff --git a/changelog/satushh-fulu-beacon-config.md b/changelog/satushh-fulu-beacon-config.md new file mode 100644 index 000000000000..5fd8800bed8c --- /dev/null +++ b/changelog/satushh-fulu-beacon-config.md @@ -0,0 +1,3 @@ +### Added + +- Added missing beacon config in fulu so that the presets don't go missing in /eth/v1/config/spec beacon api. \ No newline at end of file diff --git a/specrefs/.ethspecify.yml b/specrefs/.ethspecify.yml index b93e19a915b9..23ff034667d6 100644 --- a/specrefs/.ethspecify.yml +++ b/specrefs/.ethspecify.yml @@ -13,10 +13,6 @@ specrefs: exceptions: presets: - # Not implemented - - CELLS_PER_EXT_BLOB#fulu - - UPDATE_TIMEOUT#altair - # Not implemented: gloas (future fork) - BUILDER_PENDING_WITHDRAWALS_LIMIT#gloas - MAX_PAYLOAD_ATTESTATIONS#gloas @@ -415,10 +411,8 @@ exceptions: - update_proposer_boost_root#phase0 presets: - - CELLS_PER_EXT_BLOB#fulu - BUILDER_PENDING_WITHDRAWALS_LIMIT#gloas - BUILDER_REGISTRY_LIMIT#gloas - MAX_BUILDERS_PER_WITHDRAWALS_SWEEP#gloas - MAX_PAYLOAD_ATTESTATIONS#gloas - PTC_SIZE#gloas - - UPDATE_TIMEOUT#altair diff --git a/specrefs/presets.yml b/specrefs/presets.yml index 21371d77fdd0..a5d42928d2d5 100644 --- a/specrefs/presets.yml +++ b/specrefs/presets.yml @@ -19,7 +19,10 @@ - name: CELLS_PER_EXT_BLOB - sources: [] + sources: + - file: beacon-chain/rpc/eth/config/handlers.go + search: data\["CELLS_PER_EXT_BLOB"\] + regex: true spec: | CELLS_PER_EXT_BLOB = 128 @@ -685,6 +688,16 @@ TARGET_COMMITTEE_SIZE: uint64 = 128 +- name: UPDATE_TIMEOUT + sources: + - file: beacon-chain/rpc/eth/config/handlers.go + search: data\["UPDATE_TIMEOUT"\] + regex: true + spec: | + + UPDATE_TIMEOUT = 8192 + + - name: VALIDATOR_REGISTRY_LIMIT sources: - file: config/fieldparams/mainnet.go