From 71edf96c7d7b3f08cba919154f46fc2b37448f17 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Thu, 26 Sep 2024 08:26:12 -0500 Subject: [PATCH] Add sepolia config.yaml check with eth-clients/sepolia (#14484) * Add sepolia config.yaml check with eth-clients/sepolia * Update CHANGELOG.md --- CHANGELOG.md | 1 + WORKSPACE | 16 +++++++++++ config/params/BUILD.bazel | 2 ++ config/params/testnet_sepolia_config_test.go | 28 ++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 config/params/testnet_sepolia_config_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9edf1f5ef9..963d28e981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Light client support: Implement `BlockToLightClientHeaderXXX` functions upto Deneb - GetBeaconStateV2: add Electra case. - Implement [consensus-specs/3875](https://github.com/ethereum/consensus-specs/pull/3875) +- Tests to ensure sepolia config matches the official upstream yaml ### Changed diff --git a/WORKSPACE b/WORKSPACE index 641d6ed81b..d7e10683fd 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -342,6 +342,22 @@ filegroup( url = "https://github.com/eth-clients/holesky/archive/874c199423ccd180607320c38cbaca05d9a1573a.tar.gz", # 2024-06-18 ) +http_archive( + name = "sepolia_testnet", + build_file_content = """ +filegroup( + name = "configs", + srcs = [ + "metadata/config.yaml", + ], + visibility = ["//visibility:public"], +) +""", + integrity = "sha256-cY/UgpCcYEhQf7JefD65FI8tn/A+rAvKhcm2/qiVdqY=", + strip_prefix = "sepolia-f2c219a93c4491cee3d90c18f2f8e82aed850eab", + url = "https://github.com/eth-clients/sepolia/archive/f2c219a93c4491cee3d90c18f2f8e82aed850eab.tar.gz", # 2024-09-19 +) + http_archive( name = "com_google_protobuf", sha256 = "9bd87b8280ef720d3240514f884e56a712f2218f0d693b48050c836028940a42", diff --git a/config/params/BUILD.bazel b/config/params/BUILD.bazel index 35660c89b9..eed7a596fe 100644 --- a/config/params/BUILD.bazel +++ b/config/params/BUILD.bazel @@ -49,6 +49,7 @@ go_test( "mainnet_config_test.go", "testnet_config_test.go", "testnet_holesky_config_test.go", + "testnet_sepolia_config_test.go", ], data = glob(["*.yaml"]) + [ "testdata/e2e_config.yaml", @@ -57,6 +58,7 @@ go_test( "@consensus_spec_tests_minimal//:test_data", "@eth2_networks//:configs", "@holesky_testnet//:configs", + "@sepolia_testnet//:configs", ], embed = [":go_default_library"], gotags = ["develop"], diff --git a/config/params/testnet_sepolia_config_test.go b/config/params/testnet_sepolia_config_test.go new file mode 100644 index 0000000000..6b87f3385c --- /dev/null +++ b/config/params/testnet_sepolia_config_test.go @@ -0,0 +1,28 @@ +package params_test + +import ( + "path" + "testing" + + "github.com/bazelbuild/rules_go/go/tools/bazel" + "github.com/prysmaticlabs/prysm/v5/config/params" + "github.com/prysmaticlabs/prysm/v5/testing/require" +) + +func TestSepoliaConfigMatchesUpstreamYaml(t *testing.T) { + presetFPs := presetsFilePath(t, "mainnet") + mn, err := params.ByName(params.MainnetName) + require.NoError(t, err) + cfg := mn.Copy() + for _, fp := range presetFPs { + cfg, err = params.UnmarshalConfigFile(fp, cfg) + require.NoError(t, err) + } + fPath, err := bazel.Runfile("external/sepolia_testnet") + require.NoError(t, err) + configFP := path.Join(fPath, "metadata", "config.yaml") + pcfg, err := params.UnmarshalConfigFile(configFP, nil) + require.NoError(t, err) + fields := fieldsFromYamls(t, append(presetFPs, configFP)) + assertYamlFieldsMatch(t, "sepolia", fields, pcfg, params.SepoliaConfig()) +}