diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index d36e379a9..9cc2fdd9e 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -6,4 +6,4 @@ runs: - name: Setup go uses: actions/setup-go@v4 with: - go-version: '1.22.5' + go-version: '1.23' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9c6ba92dc..a05d7464c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,7 +21,7 @@ on: - cron: '18 19 * * 6' env: - GOLANG_VERSION: '1.22' + GOLANG_VERSION: '1.23' jobs: analyze: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 735861149..73051431d 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -19,7 +19,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59.1 + version: v1.60.3 - name: notify failure if: failure() && github.ref == 'refs/heads/main' env: diff --git a/.golangci.yml b/.golangci.yml index 41a679662..20a6b434a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,6 @@ run: timeout: 5m - go: "1.22.5" + go: "1.23" linters-settings: cyclop: max-complexity: 15 @@ -116,6 +116,12 @@ linters-settings: - expected-actual go-require: ignore-http-handlers: true + gosec: + excludes: + # Flags for potentially-unsafe casting of ints, seems good, + # but currently is really unstable with no clear way to make the linter pass. + # https://github.com/securego/gosec/issues/1187 + - G115 issues: fix: true @@ -145,6 +151,7 @@ linters: enable-all: true disable: # Keep disabled + - intrange - containedctx - contextcheck - cyclop @@ -158,7 +165,6 @@ linters: - gocyclo - godot - godox - - goerr113 - gomnd - gomoddirectives - inamedparam @@ -176,13 +182,5 @@ linters: - varnamelen - wsl # Deprecated - - deadcode - - exhaustivestruct - - golint - - ifshort - - interfacer - - maligned - - nosnakecase - - structcheck - - scopelint - - varcheck + - goerr113 + - execinquery diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82f26597f..beb5019b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: rev: v0.0.3 hooks: - id: check-go-version - args: [ -v=go1.22 ] # Only check minor version locally + args: [ -v=go1.23 ] # Only check minor version locally pass_filenames: false additional_dependencies: [ packaging ] - id: check-licence-header diff --git a/.pre-commit/run_linter.sh b/.pre-commit/run_linter.sh index 46a738ec7..86d167724 100755 --- a/.pre-commit/run_linter.sh +++ b/.pre-commit/run_linter.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="1.59.1" +VERSION="1.60.3" if ! command -v golangci-lint &> /dev/null then diff --git a/Dockerfile b/Dockerfile index f9ab8a8be..75f0184f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,18 @@ # Container for building Go binary. -FROM golang:1.22.5-bookworm AS builder +FROM golang:1.23.2-bookworm AS builder # Install dependencies -RUN apt-get update && apt-get install -y build-essential git +RUN apt-get update && apt-get install -y --no-install-recommends build-essential git + # Prep and copy source WORKDIR /app/charon + COPY . . + # Populate GO_BUILD_FLAG with a build arg to provide an optional go build flag. ARG GO_BUILD_FLAG ENV GO_BUILD_FLAG=${GO_BUILD_FLAG} RUN echo "Building with GO_BUILD_FLAG='${GO_BUILD_FLAG}'" + # Build with Go module and Go build caches. RUN \ --mount=type=cache,target=/go/pkg \ @@ -18,30 +22,35 @@ RUN echo "Built charon version=$(./charon version)" # Copy final binary into light stage. FROM debian:bookworm-slim -RUN apt-get update && apt-get install -y ca-certificates wget fio +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates fio wget \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ARG GITHUB_SHA=local ENV GITHUB_SHA=${GITHUB_SHA} + COPY --from=builder /app/charon/charon /usr/local/bin/ + # Don't run container as root ENV USER=charon ENV UID=1000 ENV GID=1000 -RUN addgroup --gid "$GID" "$USER" -RUN adduser \ +RUN addgroup --gid "$GID" "$USER" \ + && adduser \ --disabled-password \ --gecos "charon" \ --home "/opt/$USER" \ --ingroup "$USER" \ --no-create-home \ --uid "$UID" \ - "$USER" -RUN chown charon /usr/local/bin/charon -RUN chmod u+x /usr/local/bin/charon + "$USER" \ + && chown "$USER" /usr/local/bin/charon \ + && chmod u+x /usr/local/bin/charon + WORKDIR "/opt/$USER" -RUN chown charon "/opt/$USER" USER charon + ENTRYPOINT ["/usr/local/bin/charon"] CMD ["run"] + # Used by GitHub to associate container with repo. LABEL org.opencontainers.image.source="https://github.com/obolnetwork/charon" LABEL org.opencontainers.image.title="charon" diff --git a/app/eth2wrap/eth2wrap_test.go b/app/eth2wrap/eth2wrap_test.go index bcb64264e..3e35dfad6 100644 --- a/app/eth2wrap/eth2wrap_test.go +++ b/app/eth2wrap/eth2wrap_test.go @@ -462,27 +462,27 @@ func TestLazyDomain(t *testing.T) { { name: "mainnet fork", in: eth2util.Mainnet.GenesisForkVersionHex[2:], - expRes: "040000008c6ebbceb21209e6af5ab7db4a3027998c412c0eb0e15fbc1ee75617", + expRes: "04000000a39ec13dbafa3a331644f8d3a1513e57898fab998fec78f5ada4b8b0", }, { name: "goerli fork", in: eth2util.Goerli.GenesisForkVersionHex[2:], - expRes: "04000000628941ef21d1fe8c7134720add10bb91e3b02c007e0046d2472c6695", + expRes: "04000000f1e25bda59286379f9a2b3ffeb090d650a4db4cfd089e1cc72388a33", }, { name: "gnosis fork", in: eth2util.Gnosis.GenesisForkVersionHex[2:], - expRes: "04000000398beb768264920602d7d79f88da05cac0550ae4108753fd846408b5", + expRes: "040000007c97bfcba5d28a3cdef2ab010944574e387f4b3c7963c215eed87f32", }, { name: "sepolia fork", in: eth2util.Sepolia.GenesisForkVersionHex[2:], - expRes: "040000007191d9b3c210dbffc7810b6ccb436c1b3897b6772452924b20f6f5f2", + expRes: "0400000005b54270938f654bd779212d3be2a63f806a4f58794d455393d8dad8", }, { name: "holesky fork", in: eth2util.Holesky.GenesisForkVersionHex[2:], - expRes: "040000002b3e2c2d17a0d820f3099580a72d1bc743b17616ff7851f32aa303ad", + expRes: "0400000017e2dad36f1d3595152042a9ad23430197557e2e7e82bc7f7fc72972", }, { name: "unknown fork", diff --git a/app/eth2wrap/httpwrap.go b/app/eth2wrap/httpwrap.go index d257fa5d1..747ab546d 100644 --- a/app/eth2wrap/httpwrap.go +++ b/app/eth2wrap/httpwrap.go @@ -296,7 +296,6 @@ func httpPost(ctx context.Context, base string, endpoint string, body io.Reader, return nil, errors.Wrap(err, "failed to read POST response") } - //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable if res.StatusCode/100 != 2 { return nil, errors.New("post failed", z.Int("status", res.StatusCode), z.Str("body", string(data))) } diff --git a/app/eth2wrap/synthproposer_test.go b/app/eth2wrap/synthproposer_test.go index 132d41c67..492bd1104 100644 --- a/app/eth2wrap/synthproposer_test.go +++ b/app/eth2wrap/synthproposer_test.go @@ -67,15 +67,10 @@ func TestSynthProposer(t *testing.T) { activeVals++ return cached(ctx) } - signedBeaconBlock := bmock.SignedBeaconBlock bmock.SignedBeaconBlockFunc = func(ctx context.Context, blockID string) (*eth2spec.VersionedSignedBeaconBlock, error) { - opts := ð2api.SignedBeaconBlockOpts{Block: blockID} - resp, err := signedBeaconBlock(ctx, opts) - if err != nil { - return nil, err - } + resp := testutil.RandomCapellaVersionedSignedBeaconBlock() - return resp.Data, nil + return resp, nil } eth2Cl := eth2wrap.WithSyntheticDuties(bmock) diff --git a/app/expbackoff/expbackoff.go b/app/expbackoff/expbackoff.go index f76c647a8..863c37816 100644 --- a/app/expbackoff/expbackoff.go +++ b/app/expbackoff/expbackoff.go @@ -148,14 +148,14 @@ func Backoff(config Config, retries int) time.Duration { } backoff := float64(config.BaseDelay) - max := float64(config.MaxDelay) + maxVal := float64(config.MaxDelay) - for backoff < max && retries > 0 { + for backoff < maxVal && retries > 0 { backoff *= config.Multiplier retries-- } - if backoff > max { - backoff = max + if backoff > maxVal { + backoff = maxVal } // Randomize backoff delays so that if a cluster of requests start at // the same time, they won't operate in lockstep. diff --git a/app/health/checks.go b/app/health/checks.go index 0af5b4e61..ef1603829 100644 --- a/app/health/checks.go +++ b/app/health/checks.go @@ -70,12 +70,12 @@ var checks = []check{ Description: "Beacon Node in syncing state.", Severity: severityCritical, Func: func(q query, _ Metadata) (bool, error) { - max, err := q("app_monitoring_beacon_node_syncing", noLabels, gaugeMax) + maxVal, err := q("app_monitoring_beacon_node_syncing", noLabels, gaugeMax) if err != nil { return false, err } - return max == 1, nil + return maxVal == 1, nil }, }, { @@ -83,14 +83,14 @@ var checks = []check{ Description: "Not connected to at least quorum peers. Check logs for networking issue or coordinate with peers.", Severity: severityCritical, Func: func(q query, m Metadata) (bool, error) { - max, err := q("p2p_ping_success", countNonZeroLabels, gaugeMax) + maxVal, err := q("p2p_ping_success", countNonZeroLabels, gaugeMax) if err != nil { return false, err } required := float64(m.QuorumPeers) - 1 // Exclude self - return max < required, nil + return maxVal < required, nil }, }, { @@ -98,14 +98,14 @@ var checks = []check{ Description: "Pending validators detected. Activate them to start validating.", Severity: severityInfo, Func: func(q query, _ Metadata) (bool, error) { - max, err := q("core_scheduler_validator_status", + maxVal, err := q("core_scheduler_validator_status", countLabels(l("status", "pending")), gaugeMax) if err != nil { return false, err } - return max > 0, nil + return maxVal > 0, nil }, }, { @@ -140,12 +140,12 @@ var checks = []check{ Description: "Metrics reached high cardinality threshold. Please check metrics reported by app_health_metrics_high_cardinality.", Severity: severityWarning, Func: func(q query, _ Metadata) (bool, error) { - max, err := q("app_health_metrics_high_cardinality", sumLabels(), gaugeMax) + maxVal, err := q("app_health_metrics_high_cardinality", sumLabels(), gaugeMax) if err != nil { return false, err } - return max > 0, nil + return maxVal > 0, nil }, }, } diff --git a/app/health/checks_internal_test.go b/app/health/checks_internal_test.go index 2e3b17aa0..332bc6bba 100644 --- a/app/health/checks_internal_test.go +++ b/app/health/checks_internal_test.go @@ -407,19 +407,19 @@ func testCheck(t *testing.T, m Metadata, checkName string, expect bool, metrics genGauge(genLabels("bar", "bar2"), 1, 1, 1), ) - var max int - if len(metrics) > max { - max = len(metrics) + var maxVal int + if len(metrics) > maxVal { + maxVal = len(metrics) } - if len(randomFamFoo) > max { - max = len(randomFamFoo) + if len(randomFamFoo) > maxVal { + maxVal = len(randomFamFoo) } - if len(randomFamBar) > max { - max = len(randomFamBar) + if len(randomFamBar) > maxVal { + maxVal = len(randomFamBar) } - multiFams := make([][]*pb.MetricFamily, max) - for i := range max { + multiFams := make([][]*pb.MetricFamily, maxVal) + for i := range maxVal { var fam []*pb.MetricFamily if i < len(metrics) { fam = append(fam, metrics[i]) @@ -455,14 +455,14 @@ func genFam(name string, metrics ...[]*pb.Metric) []*pb.MetricFamily { typ = pb.MetricType_GAUGE } - var max int + var maxVal int for _, series := range metrics { - if len(series) > max { - max = len(series) + if len(series) > maxVal { + maxVal = len(series) } } - resp := make([]*pb.MetricFamily, max) + resp := make([]*pb.MetricFamily, maxVal) for _, series := range metrics { for i, metric := range series { if resp[i] == nil { diff --git a/app/health/reducers.go b/app/health/reducers.go index 52507cb7f..a81ab5428 100644 --- a/app/health/reducers.go +++ b/app/health/reducers.go @@ -29,16 +29,16 @@ func increase(samples []*pb.Metric) (float64, error) { // gaugeMax returns the maximum value in a time series of gauge metrics. func gaugeMax(samples []*pb.Metric) (float64, error) { - var max float64 + var maxVal float64 for _, sample := range samples { if sample.GetGauge() == nil { return 0, errors.New("bug: non-gauge metric passed") } - if sample.GetGauge().GetValue() > max { - max = sample.GetGauge().GetValue() + if sample.GetGauge().GetValue() > maxVal { + maxVal = sample.GetGauge().GetValue() } } - return max, nil + return maxVal, nil } diff --git a/app/health/select.go b/app/health/select.go index 3d42f5b68..a1c17d62e 100644 --- a/app/health/select.go +++ b/app/health/select.go @@ -15,8 +15,8 @@ type labelSelector func(*pb.MetricFamily) (*pb.Metric, error) // maxLabel returns the metric with the highest value. func maxLabel(metricsFam *pb.MetricFamily) *pb.Metric { //nolint: unused // This is used in the future. var ( - max float64 - resp *pb.Metric + maxVal float64 + resp *pb.Metric ) for _, metric := range metricsFam.GetMetric() { var val float64 @@ -29,8 +29,8 @@ func maxLabel(metricsFam *pb.MetricFamily) *pb.Metric { //nolint: unused // This panic("invalid metric type for simple value labelSelector") } - if max == 0 || val > max { - max = val + if maxVal == 0 || val > maxVal { + maxVal = val resp = metric } } diff --git a/app/log/loki/client.go b/app/log/loki/client.go index e1b3c18c9..327fd72be 100644 --- a/app/log/loki/client.go +++ b/app/log/loki/client.go @@ -210,7 +210,6 @@ func send(ctx context.Context, client *http.Client, endpoint string, batch *batc } defer resp.Body.Close() - //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable if resp.StatusCode/100 != 2 { scanner := bufio.NewScanner(io.LimitReader(resp.Body, maxErrMsgLen)) line := "" diff --git a/app/log/loki/lokipb/v1/loki.pb.go b/app/log/loki/lokipb/v1/loki.pb.go index 4b6d54ab0..30c9403ae 100644 --- a/app/log/loki/lokipb/v1/loki.pb.go +++ b/app/log/loki/lokipb/v1/loki.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: app/log/loki/lokipb/v1/loki.proto @@ -31,11 +31,9 @@ type PushRequest struct { func (x *PushRequest) Reset() { *x = PushRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PushRequest) String() string { @@ -46,7 +44,7 @@ func (*PushRequest) ProtoMessage() {} func (x *PushRequest) ProtoReflect() protoreflect.Message { mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -80,11 +78,9 @@ type Stream struct { func (x *Stream) Reset() { *x = Stream{} - if protoimpl.UnsafeEnabled { - mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Stream) String() string { @@ -95,7 +91,7 @@ func (*Stream) ProtoMessage() {} func (x *Stream) ProtoReflect() protoreflect.Message { mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -142,11 +138,9 @@ type Entry struct { func (x *Entry) Reset() { *x = Entry{} - if protoimpl.UnsafeEnabled { - mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Entry) String() string { @@ -157,7 +151,7 @@ func (*Entry) ProtoMessage() {} func (x *Entry) ProtoReflect() protoreflect.Message { mi := &file_app_log_loki_lokipb_v1_loki_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -253,44 +247,6 @@ func file_app_log_loki_lokipb_v1_loki_proto_init() { if File_app_log_loki_lokipb_v1_loki_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_app_log_loki_lokipb_v1_loki_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*PushRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_log_loki_lokipb_v1_loki_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*Stream); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_log_loki_lokipb_v1_loki_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*Entry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/app/obolapi/api.go b/app/obolapi/api.go index 0c58a67b4..4ce60a1a8 100644 --- a/app/obolapi/api.go +++ b/app/obolapi/api.go @@ -123,7 +123,6 @@ func httpPost(ctx context.Context, url *url.URL, b []byte) error { return errors.Wrap(err, "failed to read POST response") } - //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable if res.StatusCode/100 != 2 { return errors.New("post failed", z.Int("status", res.StatusCode), z.Str("body", string(data))) } diff --git a/app/peerinfo/peerinfopb/v1/peerinfo.pb.go b/app/peerinfo/peerinfopb/v1/peerinfo.pb.go index daaa60454..e23453cf0 100644 --- a/app/peerinfo/peerinfopb/v1/peerinfo.pb.go +++ b/app/peerinfo/peerinfopb/v1/peerinfo.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: app/peerinfo/peerinfopb/v1/peerinfo.proto @@ -36,11 +36,9 @@ type PeerInfo struct { func (x *PeerInfo) Reset() { *x = PeerInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerInfo) String() string { @@ -51,7 +49,7 @@ func (*PeerInfo) ProtoMessage() {} func (x *PeerInfo) ProtoReflect() protoreflect.Message { mi := &file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -175,20 +173,6 @@ func file_app_peerinfo_peerinfopb_v1_peerinfo_proto_init() { if File_app_peerinfo_peerinfopb_v1_peerinfo_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*PeerInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ diff --git a/app/protonil/testdata/v1/test.pb.go b/app/protonil/testdata/v1/test.pb.go index 8b50c2d1b..be5292b85 100644 --- a/app/protonil/testdata/v1/test.pb.go +++ b/app/protonil/testdata/v1/test.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: app/protonil/testdata/v1/test.proto @@ -32,11 +32,9 @@ type M1 struct { func (x *M1) Reset() { *x = M1{} - if protoimpl.UnsafeEnabled { - mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *M1) String() string { @@ -47,7 +45,7 @@ func (*M1) ProtoMessage() {} func (x *M1) ProtoReflect() protoreflect.Message { mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -95,11 +93,9 @@ type M2 struct { func (x *M2) Reset() { *x = M2{} - if protoimpl.UnsafeEnabled { - mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *M2) String() string { @@ -110,7 +106,7 @@ func (*M2) ProtoMessage() {} func (x *M2) ProtoReflect() protoreflect.Message { mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -156,11 +152,9 @@ type M3 struct { func (x *M3) Reset() { *x = M3{} - if protoimpl.UnsafeEnabled { - mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *M3) String() string { @@ -171,7 +165,7 @@ func (*M3) ProtoMessage() {} func (x *M3) ProtoReflect() protoreflect.Message { mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -205,11 +199,9 @@ type M4 struct { func (x *M4) Reset() { *x = M4{} - if protoimpl.UnsafeEnabled { - mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *M4) String() string { @@ -220,7 +212,7 @@ func (*M4) ProtoMessage() {} func (x *M4) ProtoReflect() protoreflect.Message { mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -267,11 +259,9 @@ type MaxIndex struct { func (x *MaxIndex) Reset() { *x = MaxIndex{} - if protoimpl.UnsafeEnabled { - mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MaxIndex) String() string { @@ -282,7 +272,7 @@ func (*MaxIndex) ProtoMessage() {} func (x *MaxIndex) ProtoReflect() protoreflect.Message { mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -321,11 +311,9 @@ type Attack struct { func (x *Attack) Reset() { *x = Attack{} - if protoimpl.UnsafeEnabled { - mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Attack) String() string { @@ -336,7 +324,7 @@ func (*Attack) ProtoMessage() {} func (x *Attack) ProtoReflect() protoreflect.Message { mi := &file_app_protonil_testdata_v1_test_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -502,80 +490,6 @@ func file_app_protonil_testdata_v1_test_proto_init() { if File_app_protonil_testdata_v1_test_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_app_protonil_testdata_v1_test_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*M1); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_protonil_testdata_v1_test_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*M2); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_protonil_testdata_v1_test_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*M3); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_protonil_testdata_v1_test_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*M4); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_protonil_testdata_v1_test_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*MaxIndex); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_app_protonil_testdata_v1_test_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*Attack); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_app_protonil_testdata_v1_test_proto_msgTypes[0].OneofWrappers = []any{} file_app_protonil_testdata_v1_test_proto_msgTypes[1].OneofWrappers = []any{} file_app_protonil_testdata_v1_test_proto_msgTypes[5].OneofWrappers = []any{} diff --git a/app/version/version.go b/app/version/version.go index 8fdc5c540..a2cc30cee 100644 --- a/app/version/version.go +++ b/app/version/version.go @@ -15,7 +15,7 @@ import ( ) // version a string since it is overwritten at build-time with the git tag for official releases. -var version = "v1.1-rc" +var version = "v1.2-rc" // Version is the branch version of the codebase. // - Main branch: v0.X-dev @@ -25,6 +25,7 @@ var Version, _ = Parse(version) // Error is caught in tests. // Supported returns the supported minor versions in order of precedence. func Supported() []SemVer { return []SemVer{ + {major: 1, minor: 2}, {major: 1, minor: 1}, {major: 1, minor: 0}, } diff --git a/cluster/helpers.go b/cluster/helpers.go index 788bdc696..8ff3ee1ef 100644 --- a/cluster/helpers.go +++ b/cluster/helpers.go @@ -40,7 +40,6 @@ func FetchDefinition(ctx context.Context, url string) (Definition, error) { return Definition{}, errors.Wrap(err, "fetch file") } - //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable if resp.StatusCode/100 != 2 { return Definition{}, errors.New("http error", z.Int("status_code", resp.StatusCode)) } diff --git a/cluster/manifestpb/v1/manifest.pb.go b/cluster/manifestpb/v1/manifest.pb.go index aa6b000c1..cec646a99 100644 --- a/cluster/manifestpb/v1/manifest.pb.go +++ b/cluster/manifestpb/v1/manifest.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: cluster/manifestpb/v1/manifest.proto @@ -39,11 +39,9 @@ type Cluster struct { func (x *Cluster) Reset() { *x = Cluster{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Cluster) String() string { @@ -54,7 +52,7 @@ func (*Cluster) ProtoMessage() {} func (x *Cluster) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -138,11 +136,9 @@ type Mutation struct { func (x *Mutation) Reset() { *x = Mutation{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Mutation) String() string { @@ -153,7 +149,7 @@ func (*Mutation) ProtoMessage() {} func (x *Mutation) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -202,11 +198,9 @@ type SignedMutation struct { func (x *SignedMutation) Reset() { *x = SignedMutation{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SignedMutation) String() string { @@ -217,7 +211,7 @@ func (*SignedMutation) ProtoMessage() {} func (x *SignedMutation) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -264,11 +258,9 @@ type SignedMutationList struct { func (x *SignedMutationList) Reset() { *x = SignedMutationList{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SignedMutationList) String() string { @@ -279,7 +271,7 @@ func (*SignedMutationList) ProtoMessage() {} func (x *SignedMutationList) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -313,11 +305,9 @@ type Operator struct { func (x *Operator) Reset() { *x = Operator{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Operator) String() string { @@ -328,7 +318,7 @@ func (*Operator) ProtoMessage() {} func (x *Operator) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -372,11 +362,9 @@ type Validator struct { func (x *Validator) Reset() { *x = Validator{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Validator) String() string { @@ -387,7 +375,7 @@ func (*Validator) ProtoMessage() {} func (x *Validator) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -448,11 +436,9 @@ type ValidatorList struct { func (x *ValidatorList) Reset() { *x = ValidatorList{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ValidatorList) String() string { @@ -463,7 +449,7 @@ func (*ValidatorList) ProtoMessage() {} func (x *ValidatorList) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -496,11 +482,9 @@ type LegacyLock struct { func (x *LegacyLock) Reset() { *x = LegacyLock{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *LegacyLock) String() string { @@ -511,7 +495,7 @@ func (*LegacyLock) ProtoMessage() {} func (x *LegacyLock) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -542,11 +526,9 @@ type Empty struct { func (x *Empty) Reset() { *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Empty) String() string { @@ -557,7 +539,7 @@ func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { mi := &file_cluster_manifestpb_v1_manifest_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -700,116 +682,6 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { if File_cluster_manifestpb_v1_manifest_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_cluster_manifestpb_v1_manifest_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Cluster); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*Mutation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*SignedMutation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*SignedMutationList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*Operator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*Validator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*ValidatorList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*LegacyLock); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/cmd/markdown_internal_test.go b/cmd/markdown_internal_test.go index b46a95a47..98815d0e3 100644 --- a/cmd/markdown_internal_test.go +++ b/cmd/markdown_internal_test.go @@ -205,6 +205,7 @@ func writeMarkdown(t *testing.T, file string, tpl *template.Template, data any) content, err := os.ReadFile(file) require.NoError(t, err) + //nolint:testifylint // don't remove fmt.Sprintf, it's not unnecessary require.Equal(t, string(content), result, fmt.Sprintf("%s doesn't contain latest metrics.\n"+ "To fix, run: go test github.com/obolnetwork/charon/cmd -update-markdown", file)) diff --git a/cmd/testpeers_internal_test.go b/cmd/testpeers_internal_test.go index 1d9fb8e4a..1c15a71d8 100644 --- a/cmd/testpeers_internal_test.go +++ b/cmd/testpeers_internal_test.go @@ -384,13 +384,15 @@ func testWriteFile(t *testing.T, expectedRes testCategoryResult, path string) { require.NoError(t, err) require.Equal(t, expectedRes.CategoryName, res.CategoryName) - require.Equal(t, expectedRes.Score, res.Score) require.Equal(t, len(expectedRes.Targets), len(res.Targets)) + checkFinalScore := true for targetName, testResults := range res.Targets { for idx, testRes := range testResults { // do not test verdicts based on measurements if expectedRes.Targets[targetName][idx].Verdict == testVerdictOk || expectedRes.Targets[targetName][idx].Verdict == testVerdictFail { require.Equal(t, expectedRes.Targets[targetName][idx].Verdict, testRes.Verdict) + } else { + checkFinalScore = false } require.Equal(t, expectedRes.Targets[targetName][idx].IsAcceptable, testRes.IsAcceptable) if expectedRes.Targets[targetName][idx].Error.error != nil { @@ -402,6 +404,10 @@ func testWriteFile(t *testing.T, expectedRes testCategoryResult, path string) { require.Equal(t, expectedRes.Targets[targetName][idx].Suggestion, testRes.Suggestion) } } + // check final score only if there are no tests based on actual measurement + if checkFinalScore { + require.Equal(t, expectedRes.Score, res.Score) + } } func startPeer(t *testing.T, conf testPeersConfig, peerPrivKey *k1.PrivateKey) enr.Record { diff --git a/cmd/testperformance.go b/cmd/testperformance.go index 7acd4b839..69e5980d4 100644 --- a/cmd/testperformance.go +++ b/cmd/testperformance.go @@ -656,7 +656,6 @@ func fetchOoklaServer(_ context.Context, conf *testPerformanceConfig) (speedtest } if len(conf.InternetTestServersExclude) != 0 { - var targets speedtest.Servers for _, server := range serverList { if !slices.Contains(conf.InternetTestServersExclude, server.Name) { targets = append(targets, server) diff --git a/core/aggsigdb/memory_v2_internal_test.go b/core/aggsigdb/memory_v2_internal_test.go index 1b15cb946..6bd30a5be 100644 --- a/core/aggsigdb/memory_v2_internal_test.go +++ b/core/aggsigdb/memory_v2_internal_test.go @@ -35,8 +35,8 @@ func TestDutyExpirationV2(t *testing.T) { deadliner.Expire() - require.Zero(t, len(db.data)) - require.Zero(t, len(db.keysByDuty)) + require.Empty(t, db.data) + require.Empty(t, db.keysByDuty) } func TestCancelledQueryV2(t *testing.T) { diff --git a/core/consensus/component.go b/core/consensus/component.go index fe5ffb1dd..c98f07f89 100644 --- a/core/consensus/component.go +++ b/core/consensus/component.go @@ -432,15 +432,31 @@ func (c *Component) runInstance(ctx context.Context, duty core.Duty) (err error) } // Instrument consensus instance. - var decided bool + var ( + decided bool + nodes = len(c.peers) + ) + decideCallback := func(qcommit []qbft.Msg[core.Duty, [32]byte]) { + round := qcommit[0].Round() decided = true - decidedRoundsGauge.WithLabelValues(duty.Type.String(), string(roundTimer.Type())).Set(float64(qcommit[0].Round())) + decidedRoundsGauge.WithLabelValues(duty.Type.String(), string(roundTimer.Type())).Set(float64(round)) inst.decidedAtCh <- time.Now() + + leaderIndex := leader(duty, round, nodes) + leaderName := c.peers[leaderIndex].Name + log.Debug(ctx, "QBFT consensus decided", + z.Str("duty", duty.Type.String()), + z.U64("slot", duty.Slot), + z.I64("round", round), + z.I64("leader_index", leaderIndex), + z.Str("leader_name", leaderName)) + + decidedLeaderGauge.WithLabelValues(duty.Type.String()).Set(float64(leaderIndex)) } // Create a new qbft definition for this instance. - def := newDefinition(len(c.peers), c.subscribers, roundTimer, decideCallback) + def := newDefinition(nodes, c.subscribers, roundTimer, decideCallback) // Create a new transport that handles sending and receiving for this instance. t := transport{ @@ -466,7 +482,7 @@ func (c *Component) runInstance(ctx context.Context, duty core.Duty) (err error) } // Run the algo, blocking until the context is cancelled. - err = qbft.Run[core.Duty, [32]byte](ctx, def, qt, duty, peerIdx, inst.hashCh) + err = qbft.Run(ctx, def, qt, duty, peerIdx, inst.hashCh) if err != nil && !isContextErr(err) { consensusError.Inc() return err // Only return non-context errors. diff --git a/core/consensus/metrics.go b/core/consensus/metrics.go index 0c9b98648..8a6eee996 100644 --- a/core/consensus/metrics.go +++ b/core/consensus/metrics.go @@ -9,12 +9,21 @@ import ( ) var ( + // Using gauge since the value changes slowly, once per slot. decidedRoundsGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "core", Subsystem: "consensus", Name: "decided_rounds", Help: "Number of rounds it took to decide consensus instances by duty and timer type.", - }, []string{"duty", "timer"}) // Using gauge since the value changes slowly, once per slot. + }, []string{"duty", "timer"}) + + // Using gauge since the value changes slowly, once per slot. + decidedLeaderGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "core", + Subsystem: "consensus", + Name: "decided_leader_index", + Help: "Leader node index of the decision round by duty.", + }, []string{"duty"}) consensusDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ Namespace: "core", diff --git a/core/corepb/v1/consensus.pb.go b/core/corepb/v1/consensus.pb.go index 82ceec09a..fb70b6c67 100644 --- a/core/corepb/v1/consensus.pb.go +++ b/core/corepb/v1/consensus.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: core/corepb/v1/consensus.proto @@ -39,11 +39,9 @@ type QBFTMsg struct { func (x *QBFTMsg) Reset() { *x = QBFTMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_consensus_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_consensus_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *QBFTMsg) String() string { @@ -54,7 +52,7 @@ func (*QBFTMsg) ProtoMessage() {} func (x *QBFTMsg) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_consensus_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -137,11 +135,9 @@ type ConsensusMsg struct { func (x *ConsensusMsg) Reset() { *x = ConsensusMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_consensus_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_consensus_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ConsensusMsg) String() string { @@ -152,7 +148,7 @@ func (*ConsensusMsg) ProtoMessage() {} func (x *ConsensusMsg) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_consensus_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -199,11 +195,9 @@ type SniffedConsensusMsg struct { func (x *SniffedConsensusMsg) Reset() { *x = SniffedConsensusMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_consensus_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_consensus_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SniffedConsensusMsg) String() string { @@ -214,7 +208,7 @@ func (*SniffedConsensusMsg) ProtoMessage() {} func (x *SniffedConsensusMsg) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_consensus_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -256,11 +250,9 @@ type SniffedConsensusInstance struct { func (x *SniffedConsensusInstance) Reset() { *x = SniffedConsensusInstance{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_consensus_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_consensus_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SniffedConsensusInstance) String() string { @@ -271,7 +263,7 @@ func (*SniffedConsensusInstance) ProtoMessage() {} func (x *SniffedConsensusInstance) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_consensus_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -325,11 +317,9 @@ type SniffedConsensusInstances struct { func (x *SniffedConsensusInstances) Reset() { *x = SniffedConsensusInstances{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_consensus_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_consensus_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SniffedConsensusInstances) String() string { @@ -340,7 +330,7 @@ func (*SniffedConsensusInstances) ProtoMessage() {} func (x *SniffedConsensusInstances) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_consensus_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -490,68 +480,6 @@ func file_core_corepb_v1_consensus_proto_init() { return } file_core_corepb_v1_core_proto_init() - if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_consensus_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*QBFTMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_consensus_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*ConsensusMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_consensus_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*SniffedConsensusMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_consensus_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*SniffedConsensusInstance); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_consensus_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*SniffedConsensusInstances); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/core/corepb/v1/core.pb.go b/core/corepb/v1/core.pb.go index 7b472d6fd..d83df0143 100644 --- a/core/corepb/v1/core.pb.go +++ b/core/corepb/v1/core.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: core/corepb/v1/core.proto @@ -31,11 +31,9 @@ type Duty struct { func (x *Duty) Reset() { *x = Duty{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_core_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_core_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Duty) String() string { @@ -46,7 +44,7 @@ func (*Duty) ProtoMessage() {} func (x *Duty) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_core_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -85,11 +83,9 @@ type UnsignedDataSet struct { func (x *UnsignedDataSet) Reset() { *x = UnsignedDataSet{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_core_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_core_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnsignedDataSet) String() string { @@ -100,7 +96,7 @@ func (*UnsignedDataSet) ProtoMessage() {} func (x *UnsignedDataSet) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_core_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -132,11 +128,9 @@ type ParSignedDataSet struct { func (x *ParSignedDataSet) Reset() { *x = ParSignedDataSet{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_core_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_core_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ParSignedDataSet) String() string { @@ -147,7 +141,7 @@ func (*ParSignedDataSet) ProtoMessage() {} func (x *ParSignedDataSet) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_core_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -181,11 +175,9 @@ type ParSignedData struct { func (x *ParSignedData) Reset() { *x = ParSignedData{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_core_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_core_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ParSignedData) String() string { @@ -196,7 +188,7 @@ func (*ParSignedData) ProtoMessage() {} func (x *ParSignedData) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_core_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -309,56 +301,6 @@ func file_core_corepb_v1_core_proto_init() { if File_core_corepb_v1_core_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_core_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Duty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_core_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*UnsignedDataSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_core_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*ParSignedDataSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_core_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*ParSignedData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/core/corepb/v1/parsigex.pb.go b/core/corepb/v1/parsigex.pb.go index aa767fd59..78097a497 100644 --- a/core/corepb/v1/parsigex.pb.go +++ b/core/corepb/v1/parsigex.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: core/corepb/v1/parsigex.proto @@ -31,11 +31,9 @@ type ParSigExMsg struct { func (x *ParSigExMsg) Reset() { *x = ParSigExMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_parsigex_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_parsigex_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ParSigExMsg) String() string { @@ -46,7 +44,7 @@ func (*ParSigExMsg) ProtoMessage() {} func (x *ParSigExMsg) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_parsigex_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -130,20 +128,6 @@ func file_core_corepb_v1_parsigex_proto_init() { return } file_core_corepb_v1_core_proto_init() - if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_parsigex_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*ParSigExMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/core/corepb/v1/priority.pb.go b/core/corepb/v1/priority.pb.go index e40e12cc8..1083b8e07 100644 --- a/core/corepb/v1/priority.pb.go +++ b/core/corepb/v1/priority.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: core/corepb/v1/priority.proto @@ -33,11 +33,9 @@ type PriorityResult struct { func (x *PriorityResult) Reset() { *x = PriorityResult{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_priority_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_priority_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PriorityResult) String() string { @@ -48,7 +46,7 @@ func (*PriorityResult) ProtoMessage() {} func (x *PriorityResult) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_priority_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -91,11 +89,9 @@ type PriorityMsg struct { func (x *PriorityMsg) Reset() { *x = PriorityMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_priority_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_priority_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PriorityMsg) String() string { @@ -106,7 +102,7 @@ func (*PriorityMsg) ProtoMessage() {} func (x *PriorityMsg) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_priority_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -161,11 +157,9 @@ type PriorityTopicProposal struct { func (x *PriorityTopicProposal) Reset() { *x = PriorityTopicProposal{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_priority_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_priority_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PriorityTopicProposal) String() string { @@ -176,7 +170,7 @@ func (*PriorityTopicProposal) ProtoMessage() {} func (x *PriorityTopicProposal) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_priority_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -219,11 +213,9 @@ type PriorityTopicResult struct { func (x *PriorityTopicResult) Reset() { *x = PriorityTopicResult{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_priority_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_priority_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PriorityTopicResult) String() string { @@ -234,7 +226,7 @@ func (*PriorityTopicResult) ProtoMessage() {} func (x *PriorityTopicResult) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_priority_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -275,11 +267,9 @@ type PriorityScoredResult struct { func (x *PriorityScoredResult) Reset() { *x = PriorityScoredResult{} - if protoimpl.UnsafeEnabled { - mi := &file_core_corepb_v1_priority_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_core_corepb_v1_priority_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PriorityScoredResult) String() string { @@ -290,7 +280,7 @@ func (*PriorityScoredResult) ProtoMessage() {} func (x *PriorityScoredResult) ProtoReflect() protoreflect.Message { mi := &file_core_corepb_v1_priority_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -421,68 +411,6 @@ func file_core_corepb_v1_priority_proto_init() { return } file_core_corepb_v1_core_proto_init() - if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_priority_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*PriorityResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_priority_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*PriorityMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_priority_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*PriorityTopicProposal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_priority_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*PriorityTopicResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_corepb_v1_priority_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*PriorityScoredResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/core/tracker/tracker.go b/core/tracker/tracker.go index f9bf3d695..728c0e6f7 100644 --- a/core/tracker/tracker.go +++ b/core/tracker/tracker.go @@ -196,6 +196,7 @@ func dutyFailedStep(es []event) (bool, step, error) { } // Final step was successful. + //nolint:gosec // false positive slice index out of range if lastEvent.step == lastStep(es[0].duty.Type) && lastEvent.stepErr == nil { return false, zero, nil } diff --git a/core/validatorapi/router.go b/core/validatorapi/router.go index 6de62dbb9..8abd8af58 100644 --- a/core/validatorapi/router.go +++ b/core/validatorapi/router.go @@ -1144,7 +1144,6 @@ func writeError(ctx context.Context, w http.ResponseWriter, endpoint string, err } } - //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable if aerr.StatusCode/100 == 4 { // 4xx status codes are client errors (not server), so log as debug only. log.Debug(ctx, "Validator api 4xx response", diff --git a/core/validatorapi/validatorapi.go b/core/validatorapi/validatorapi.go index baafe2aeb..5805b1ebf 100644 --- a/core/validatorapi/validatorapi.go +++ b/core/validatorapi/validatorapi.go @@ -13,8 +13,10 @@ import ( eth2api "github.com/attestantio/go-eth2-client/api" eth2v1 "github.com/attestantio/go-eth2-client/api/v1" + eth2spec "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0" + ssz "github.com/ferranbt/fastssz" "go.opentelemetry.io/otel/trace" "github.com/obolnetwork/charon/app/errors" @@ -394,19 +396,120 @@ func (c Component) Proposal(ctx context.Context, opts *eth2api.ProposalOpts) (*e return wrapResponse(proposal), nil } +// propDataMatchesDuty checks that the VC-signed proposal data and prop are the same. +func propDataMatchesDuty(opts *eth2api.SubmitProposalOpts, prop *eth2api.VersionedProposal) error { + ourPropIdx, err := prop.ProposerIndex() + if err != nil { + return errors.Wrap(err, "cannot fetch validator index from dutydb proposal") + } + + vcPropIdx, err := opts.Proposal.ProposerIndex() + if err != nil { + return errors.Wrap(err, "cannot fetch validator index from VC proposal") + } + + if ourPropIdx != vcPropIdx { + return errors.New( + "dutydb and VC proposals have different index", + z.U64("vc", uint64(vcPropIdx)), + z.U64("dutydb", uint64(ourPropIdx)), + ) + } + + if opts.Proposal.Blinded != prop.Blinded { + return errors.New( + "dutydb and VC proposals have different blinded value", + z.Bool("vc", opts.Proposal.Blinded), + z.Bool("dutydb", prop.Blinded), + ) + } + + if opts.Proposal.Version != prop.Version { + return errors.New( + "dutydb and VC proposals have different version", + z.Str("vc", opts.Proposal.Version.String()), + z.Str("dutydb", prop.Version.String()), + ) + } + + checkHashes := func(d1, d2 ssz.HashRoot) error { + ddb, err := d1.HashTreeRoot() + if err != nil { + return errors.Wrap(err, "hash tree root dutydb") + } + + if d2 == nil { + return errors.New("validator client proposal data for the associated dutydb proposal is nil") + } + + vc, err := d2.HashTreeRoot() + if err != nil { + return errors.Wrap(err, "hash tree root dutydb") + } + + if ddb != vc { + return errors.New("dutydb and VC proposal data have different hash tree root") + } + + return nil + } + + switch prop.Version { + case eth2spec.DataVersionPhase0: + return checkHashes(prop.Phase0, opts.Proposal.Phase0.Message) + case eth2spec.DataVersionAltair: + return checkHashes(prop.Altair, opts.Proposal.Altair.Message) + case eth2spec.DataVersionBellatrix: + switch prop.Blinded { + case false: + return checkHashes(prop.Bellatrix, opts.Proposal.Bellatrix.Message) + case true: + return checkHashes(prop.BellatrixBlinded, opts.Proposal.BellatrixBlinded.Message) + } + case eth2spec.DataVersionCapella: + switch prop.Blinded { + case false: + return checkHashes(prop.Capella, opts.Proposal.Capella.Message) + case true: + return checkHashes(prop.CapellaBlinded, opts.Proposal.CapellaBlinded.Message) + } + case eth2spec.DataVersionDeneb: + switch prop.Blinded { + case false: + return checkHashes(prop.Deneb.Block, opts.Proposal.Deneb.SignedBlock.Message) + case true: + return checkHashes(prop.DenebBlinded, opts.Proposal.DenebBlinded.Message) + } + case eth2spec.DataVersionUnknown: + return errors.New("unexpected block version", z.Str("version", prop.Version.String())) + } + + return nil +} + func (c Component) SubmitProposal(ctx context.Context, opts *eth2api.SubmitProposalOpts) error { slot, err := opts.Proposal.Slot() if err != nil { return err } - pubkey, err := c.getProposerPubkey(ctx, core.NewProposerDuty(uint64(slot))) + duty := core.NewProposerDuty(uint64(slot)) + + pubkey, err := c.getProposerPubkey(ctx, duty) if err != nil { return err } + prop, err := c.awaitProposalFunc(ctx, uint64(slot)) + if err != nil { + return errors.Wrap(err, "could not fetch block definition from dutydb") + } + + if err := propDataMatchesDuty(opts, prop); err != nil { + return errors.Wrap(err, "consensus proposal and VC-submitted one do not match") + } + // Save Partially Signed Block to ParSigDB - duty := core.NewProposerDuty(uint64(slot)) ctx = log.WithCtx(ctx, z.Any("duty", duty)) signedData, err := core.NewPartialVersionedSignedProposal(opts.Proposal, c.shareIdx) @@ -440,15 +543,34 @@ func (c Component) SubmitBlindedProposal(ctx context.Context, opts *eth2api.Subm return err } - pubkey, err := c.getProposerPubkey(ctx, core.NewProposerDuty(uint64(slot))) + duty := core.NewProposerDuty(uint64(slot)) + ctx = log.WithCtx(ctx, z.Any("duty", duty)) + + pubkey, err := c.getProposerPubkey(ctx, duty) if err != nil { return err } - // Save Partially Signed Blinded Block to ParSigDB - duty := core.NewProposerDuty(uint64(slot)) - ctx = log.WithCtx(ctx, z.Any("duty", duty)) + prop, err := c.awaitProposalFunc(ctx, uint64(slot)) + if err != nil { + return errors.Wrap(err, "could not fetch block definition from dutydb") + } + + if err := propDataMatchesDuty(ð2api.SubmitProposalOpts{ + Common: opts.Common, + Proposal: ð2api.VersionedSignedProposal{ + Version: opts.Proposal.Version, + Blinded: true, + BellatrixBlinded: opts.Proposal.Bellatrix, + CapellaBlinded: opts.Proposal.Capella, + DenebBlinded: opts.Proposal.Deneb, + }, + BroadcastValidation: opts.BroadcastValidation, + }, prop); err != nil { + return errors.Wrap(err, "consensus proposal and VC-submitted one do not match") + } + // Save Partially Signed Blinded Block to ParSigDB signedData, err := core.NewPartialVersionedSignedBlindedProposal(opts.Proposal, c.shareIdx) if err != nil { return err diff --git a/core/validatorapi/validatorapi_test.go b/core/validatorapi/validatorapi_test.go index 1bea36d83..97c1090df 100644 --- a/core/validatorapi/validatorapi_test.go +++ b/core/validatorapi/validatorapi_test.go @@ -409,6 +409,104 @@ func TestComponent_Proposal(t *testing.T) { require.Equal(t, block1, block2) } +func TestComponent_SubmitProposalsWithWrongVCData(t *testing.T) { + ctx := context.Background() + + // Create keys (just use normal keys, not split tbls) + secret, err := tbls.GenerateSecretKey() + require.NoError(t, err) + + pubkey, err := tbls.SecretToPublicKey(secret) + require.NoError(t, err) + + const ( + vIdx = 1 + shareIdx = 1 + slot = 123 + epoch = eth2p0.Epoch(3) + ) + + // Convert pubkey + corePubKey, err := core.PubKeyFromBytes(pubkey[:]) + require.NoError(t, err) + allPubSharesByKey := map[core.PubKey]map[int]tbls.PublicKey{corePubKey: {shareIdx: pubkey}} // Maps self to self since not tbls + + // Configure beacon mock + bmock, err := beaconmock.New() + require.NoError(t, err) + + // Construct the validator api component + vapi, err := validatorapi.NewComponent(bmock, allPubSharesByKey, shareIdx, nil, testutil.BuilderFalse, nil) + require.NoError(t, err) + + t.Run("full block fails", func(t *testing.T) { + unsignedBlock := ð2spec.VersionedBeaconBlock{ + Version: eth2spec.DataVersionCapella, + Capella: testutil.RandomCapellaBeaconBlock(), + } + vapi.RegisterGetDutyDefinition(func(ctx context.Context, duty core.Duty) (core.DutyDefinitionSet, error) { + return core.DutyDefinitionSet{corePubKey: nil}, nil + }) + + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + unsignedBlock := ð2spec.VersionedBeaconBlock{ + Version: eth2spec.DataVersionCapella, + Capella: testutil.RandomCapellaBeaconBlock(), + } + + return ð2api.VersionedProposal{ + Version: unsignedBlock.Version, + Capella: unsignedBlock.Capella, + }, nil + }) + + err = vapi.SubmitProposal(ctx, ð2api.SubmitProposalOpts{ + Proposal: ð2api.VersionedSignedProposal{ + Version: unsignedBlock.Version, + Capella: &capella.SignedBeaconBlock{ + Message: unsignedBlock.Capella, + Signature: eth2p0.BLSSignature{}, + }, + }, + }) + require.ErrorContains(t, err, "consensus proposal and VC-submitted one do not match: dutydb and VC proposal data have different hash tree root") + }) + + t.Run("blinded block fails", func(t *testing.T) { + unsignedBlindedBlock := testutil.RandomCapellaBlindedBeaconBlock() + + vapi.RegisterGetDutyDefinition(func(ctx context.Context, duty core.Duty) (core.DutyDefinitionSet, error) { + return core.DutyDefinitionSet{corePubKey: nil}, nil + }) + + signedBlindedBlock := ð2api.VersionedSignedBlindedProposal{ + Version: eth2spec.DataVersionCapella, + Capella: ð2capella.SignedBlindedBeaconBlock{ + Message: unsignedBlindedBlock, + Signature: eth2p0.BLSSignature{}, + }, + } + + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + p := ð2api.VersionedProposal{ + Blinded: true, + Version: eth2spec.DataVersionCapella, + CapellaBlinded: testutil.RandomCapellaBlindedBeaconBlock(), + } + + p.CapellaBlinded.ProposerIndex = signedBlindedBlock.Capella.Message.ProposerIndex + + return p, nil + }) + + err = vapi.SubmitBlindedProposal(ctx, ð2api.SubmitBlindedProposalOpts{ + Proposal: signedBlindedBlock, + }) + + require.ErrorContains(t, err, "consensus proposal and VC-submitted one do not match: dutydb and VC proposal data have different hash tree root") + }) +} + func TestComponent_SubmitProposal(t *testing.T) { ctx := context.Background() @@ -478,6 +576,13 @@ func TestComponent_SubmitProposal(t *testing.T) { }, } + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return ð2api.VersionedProposal{ + Version: signedBlock.Version, + Capella: unsignedBlock.Capella, + }, nil + }) + // Register subscriber vapi.Subscribe(func(ctx context.Context, duty core.Duty, set core.ParSignedDataSet) error { block, ok := set[corePubKey].SignedData.(core.VersionedSignedProposal) @@ -577,6 +682,17 @@ func TestComponent_SubmitProposal_Gnosis(t *testing.T) { return nil }) + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return ð2api.VersionedProposal{ + Version: signedBlock.Version, + Deneb: ð2deneb.BlockContents{ + Block: signedBlock.Deneb.SignedBlock.Message, + KZGProofs: signedBlock.Deneb.KZGProofs, + Blobs: signedBlock.Deneb.Blobs, + }, + }, nil + }) + err = vapi.SubmitProposal(ctx, ð2api.SubmitProposalOpts{ Proposal: signedBlock, }) @@ -638,6 +754,13 @@ func TestComponent_SubmitProposalInvalidSignature(t *testing.T) { }, } + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return ð2api.VersionedProposal{ + Version: signedBlock.Version, + Capella: signedBlock.Capella.Message, + }, nil + }) + // Register subscriber vapi.Subscribe(func(ctx context.Context, duty core.Duty, set core.ParSignedDataSet) error { block, ok := set[corePubKey].SignedData.(core.VersionedSignedProposal) @@ -720,8 +843,49 @@ func TestComponent_SubmitProposalInvalidBlock(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + b := test.block + proposal := ð2api.VersionedProposal{ + Version: b.Version, + Blinded: b.Blinded, + ConsensusValue: b.ConsensusValue, + ExecutionValue: b.ExecutionValue, + } + + if b.Phase0 != nil { + proposal.Phase0 = b.Phase0.Message + } + if b.Altair != nil { + proposal.Altair = b.Altair.Message + } + if b.Bellatrix != nil { + proposal.Bellatrix = b.Bellatrix.Message + } + if b.BellatrixBlinded != nil { + proposal.BellatrixBlinded = b.BellatrixBlinded.Message + } + if b.Capella != nil { + proposal.Capella = b.Capella.Message + } + if b.CapellaBlinded != nil { + proposal.CapellaBlinded = b.CapellaBlinded.Message + } + if b.Deneb != nil { + proposal.Deneb = ð2deneb.BlockContents{ + Block: test.block.Deneb.SignedBlock.Message, + KZGProofs: test.block.Deneb.KZGProofs, + Blobs: test.block.Deneb.Blobs, + } + } + if b.DenebBlinded != nil { + proposal.DenebBlinded = b.DenebBlinded.Message + } + + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return proposal, nil + }) + err = vapi.SubmitProposal(ctx, ð2api.SubmitProposalOpts{ - Proposal: test.block, + Proposal: b, }) require.ErrorContains(t, err, test.errMsg) }) @@ -793,6 +957,14 @@ func TestComponent_SubmitBlindedProposal(t *testing.T) { }, } + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return ð2api.VersionedProposal{ + Version: signedBlindedBlock.Version, + Blinded: true, + CapellaBlinded: signedBlindedBlock.Capella.Message, + }, nil + }) + // Register subscriber vapi.Subscribe(func(ctx context.Context, duty core.Duty, set core.ParSignedDataSet) error { block, ok := set[corePubKey].SignedData.(core.VersionedSignedProposal) @@ -880,6 +1052,14 @@ func TestComponent_SubmitBlindedProposalInvalidSignature(t *testing.T) { return nil }) + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return ð2api.VersionedProposal{ + Version: signedBlindedBlock.Version, + Blinded: true, + CapellaBlinded: signedBlindedBlock.Capella.Message, + }, nil + }) + err = vapi.SubmitBlindedProposal(ctx, ð2api.SubmitBlindedProposalOpts{ Proposal: signedBlindedBlock, }) @@ -970,8 +1150,29 @@ func TestComponent_SubmitBlindedProposalInvalidBlock(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + b := test.block + proposal := ð2api.VersionedProposal{ + Version: b.Version, + Blinded: true, + } + + if b.Bellatrix != nil { + proposal.BellatrixBlinded = b.Bellatrix.Message + } + if b.Capella != nil { + proposal.CapellaBlinded = b.Capella.Message + } + + if b.Deneb != nil { + proposal.DenebBlinded = b.Deneb.Message + } + + vapi.RegisterAwaitProposal(func(ctx context.Context, slot uint64) (*eth2api.VersionedProposal, error) { + return proposal, nil + }) + err = vapi.SubmitBlindedProposal(ctx, ð2api.SubmitBlindedProposalOpts{ - Proposal: test.block, + Proposal: b, }) require.ErrorContains(t, err, test.errMsg) }) diff --git a/dkg/dkg_test.go b/dkg/dkg_test.go index b830c3d8c..97e1dd2bf 100644 --- a/dkg/dkg_test.go +++ b/dkg/dkg_test.go @@ -6,6 +6,7 @@ import ( "context" "encoding/hex" "encoding/json" + "errors" "fmt" "math/rand" "net/http" @@ -537,7 +538,9 @@ func TestSyncFlow(t *testing.T) { var disconnectedCount int for err := range dkgErrChan { testutil.SkipIfBindErr(t, err) - require.NoError(t, err) + if !errors.Is(err, context.Canceled) { + require.NoError(t, err) + } disconnectedCount++ if disconnectedCount == test.nodes { break diff --git a/dkg/dkgpb/v1/bcast.pb.go b/dkg/dkgpb/v1/bcast.pb.go index 2b31dc35e..19674c2fb 100644 --- a/dkg/dkgpb/v1/bcast.pb.go +++ b/dkg/dkgpb/v1/bcast.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: dkg/dkgpb/v1/bcast.proto @@ -32,11 +32,9 @@ type BCastSigRequest struct { func (x *BCastSigRequest) Reset() { *x = BCastSigRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BCastSigRequest) String() string { @@ -47,7 +45,7 @@ func (*BCastSigRequest) ProtoMessage() {} func (x *BCastSigRequest) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -87,11 +85,9 @@ type BCastSigResponse struct { func (x *BCastSigResponse) Reset() { *x = BCastSigResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BCastSigResponse) String() string { @@ -102,7 +98,7 @@ func (*BCastSigResponse) ProtoMessage() {} func (x *BCastSigResponse) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -143,11 +139,9 @@ type BCastMessage struct { func (x *BCastMessage) Reset() { *x = BCastMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BCastMessage) String() string { @@ -158,7 +152,7 @@ func (*BCastMessage) ProtoMessage() {} func (x *BCastMessage) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_bcast_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -258,44 +252,6 @@ func file_dkg_dkgpb_v1_bcast_proto_init() { if File_dkg_dkgpb_v1_bcast_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_bcast_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*BCastSigRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_bcast_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*BCastSigResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_bcast_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*BCastMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/dkg/dkgpb/v1/frost.pb.go b/dkg/dkgpb/v1/frost.pb.go index 84e3f2028..140bd6709 100644 --- a/dkg/dkgpb/v1/frost.pb.go +++ b/dkg/dkgpb/v1/frost.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: dkg/dkgpb/v1/frost.proto @@ -32,11 +32,9 @@ type FrostMsgKey struct { func (x *FrostMsgKey) Reset() { *x = FrostMsgKey{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostMsgKey) String() string { @@ -47,7 +45,7 @@ func (*FrostMsgKey) ProtoMessage() {} func (x *FrostMsgKey) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -93,11 +91,9 @@ type FrostRound1Casts struct { func (x *FrostRound1Casts) Reset() { *x = FrostRound1Casts{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostRound1Casts) String() string { @@ -108,7 +104,7 @@ func (*FrostRound1Casts) ProtoMessage() {} func (x *FrostRound1Casts) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -143,11 +139,9 @@ type FrostRound1Cast struct { func (x *FrostRound1Cast) Reset() { *x = FrostRound1Cast{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostRound1Cast) String() string { @@ -158,7 +152,7 @@ func (*FrostRound1Cast) ProtoMessage() {} func (x *FrostRound1Cast) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -211,11 +205,9 @@ type FrostRound1P2P struct { func (x *FrostRound1P2P) Reset() { *x = FrostRound1P2P{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostRound1P2P) String() string { @@ -226,7 +218,7 @@ func (*FrostRound1P2P) ProtoMessage() {} func (x *FrostRound1P2P) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -260,11 +252,9 @@ type FrostRound1ShamirShare struct { func (x *FrostRound1ShamirShare) Reset() { *x = FrostRound1ShamirShare{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostRound1ShamirShare) String() string { @@ -275,7 +265,7 @@ func (*FrostRound1ShamirShare) ProtoMessage() {} func (x *FrostRound1ShamirShare) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -321,11 +311,9 @@ type FrostRound2Casts struct { func (x *FrostRound2Casts) Reset() { *x = FrostRound2Casts{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostRound2Casts) String() string { @@ -336,7 +324,7 @@ func (*FrostRound2Casts) ProtoMessage() {} func (x *FrostRound2Casts) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -370,11 +358,9 @@ type FrostRound2Cast struct { func (x *FrostRound2Cast) Reset() { *x = FrostRound2Cast{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrostRound2Cast) String() string { @@ -385,7 +371,7 @@ func (*FrostRound2Cast) ProtoMessage() {} func (x *FrostRound2Cast) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_frost_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -517,92 +503,6 @@ func file_dkg_dkgpb_v1_frost_proto_init() { if File_dkg_dkgpb_v1_frost_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_frost_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*FrostMsgKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_frost_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*FrostRound1Casts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_frost_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*FrostRound1Cast); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_frost_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*FrostRound1P2P); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_frost_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*FrostRound1ShamirShare); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_frost_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*FrostRound2Casts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_frost_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*FrostRound2Cast); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/dkg/dkgpb/v1/nodesigs.pb.go b/dkg/dkgpb/v1/nodesigs.pb.go index c76d912c8..0ca2721d8 100644 --- a/dkg/dkgpb/v1/nodesigs.pb.go +++ b/dkg/dkgpb/v1/nodesigs.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: dkg/dkgpb/v1/nodesigs.proto @@ -31,11 +31,9 @@ type MsgNodeSig struct { func (x *MsgNodeSig) Reset() { *x = MsgNodeSig{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_nodesigs_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_nodesigs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MsgNodeSig) String() string { @@ -46,7 +44,7 @@ func (*MsgNodeSig) ProtoMessage() {} func (x *MsgNodeSig) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_nodesigs_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -120,20 +118,6 @@ func file_dkg_dkgpb_v1_nodesigs_proto_init() { if File_dkg_dkgpb_v1_nodesigs_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_nodesigs_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*MsgNodeSig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/dkg/dkgpb/v1/sync.pb.go b/dkg/dkgpb/v1/sync.pb.go index 53d1a1e2f..c9f62afb6 100644 --- a/dkg/dkgpb/v1/sync.pb.go +++ b/dkg/dkgpb/v1/sync.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.35.1 // protoc (unknown) // source: dkg/dkgpb/v1/sync.proto @@ -35,11 +35,9 @@ type MsgSync struct { func (x *MsgSync) Reset() { *x = MsgSync{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_sync_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_sync_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MsgSync) String() string { @@ -50,7 +48,7 @@ func (*MsgSync) ProtoMessage() {} func (x *MsgSync) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_sync_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -111,11 +109,9 @@ type MsgSyncResponse struct { func (x *MsgSyncResponse) Reset() { *x = MsgSyncResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_dkg_dkgpb_v1_sync_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_dkg_dkgpb_v1_sync_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MsgSyncResponse) String() string { @@ -126,7 +122,7 @@ func (*MsgSyncResponse) ProtoMessage() {} func (x *MsgSyncResponse) ProtoReflect() protoreflect.Message { mi := &file_dkg_dkgpb_v1_sync_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -220,32 +216,6 @@ func file_dkg_dkgpb_v1_sync_proto_init() { if File_dkg_dkgpb_v1_sync_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_sync_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*MsgSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dkg_dkgpb_v1_sync_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*MsgSyncResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/docs/metrics.md b/docs/metrics.md index 4bcfcbe96..aa8e0e771 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -43,6 +43,7 @@ when storing metrics from multiple nodes or clusters in one Prometheus instance. | `core_bcast_recast_errors_total` | Counter | The total count of failed recasted registrations by source; `pregen` vs `downstream` | `source` | | `core_bcast_recast_registration_total` | Counter | The total number of unique validator registration stored in recaster per pubkey | `pubkey` | | `core_bcast_recast_total` | Counter | The total count of recasted registrations by source; `pregen` vs `downstream` | `source` | +| `core_consensus_decided_leader_index` | Gauge | Leader node index of the decision round by duty. | `duty` | | `core_consensus_decided_rounds` | Gauge | Number of rounds it took to decide consensus instances by duty and timer type. | `duty, timer` | | `core_consensus_duration_seconds` | Histogram | Duration of a consensus instance in seconds by duty and timer type. | `duty, timer` | | `core_consensus_error_total` | Counter | Total count of consensus errors | | diff --git a/eth2util/keymanager/keymanager.go b/eth2util/keymanager/keymanager.go index fdfaed76b..124f0dfab 100644 --- a/eth2util/keymanager/keymanager.go +++ b/eth2util/keymanager/keymanager.go @@ -110,7 +110,6 @@ func postKeys(ctx context.Context, addr, authToken string, reqBody keymanagerReq } _ = resp.Body.Close() - //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable if resp.StatusCode/100 != 2 { return errors.New("failed posting keys", z.Int("status", resp.StatusCode), z.Str("body", string(data))) } diff --git a/eth2util/registration/registration_test.go b/eth2util/registration/registration_test.go index 9a22b6ab9..fd67700c2 100644 --- a/eth2util/registration/registration_test.go +++ b/eth2util/registration/registration_test.go @@ -106,21 +106,21 @@ func TestVerifySignedRegistration(t *testing.T) { require.NoError(t, err) registrationJSON := ` - { - "message": { - "fee_recipient": "0x000000000000000000000000000000000000dead", - "gas_limit": "30000000", - "timestamp": "1646092800", - "pubkey": "0x86966350b672bd502bfbdb37a6ea8a7392e8fb7f5ebb5c5e2055f4ee168ebfab0fef63084f28c9f62c3ba71f825e527e" - }, - "signature": "0xb101da0fc08addcc5d010ee569f6bbbdca049a5cb27efad231565bff2e3af504ec2bb87b11ed22843e9c1094f1dfe51a0b2a5ad1808df18530a2f59f004032dbf6281ecf0fc3df86d032da5b9d32a3d282c05923de491381f8f28c2863a00180" - }` + { + "message": { + "fee_recipient": "0x000000000000000000000000000000000000dEaD", + "gas_limit": "30000000", + "timestamp": "1646092800", + "pubkey": "0x86966350b672bd502bfbdb37a6ea8a7392e8fb7f5ebb5c5e2055f4ee168ebfab0fef63084f28c9f62c3ba71f825e527e" + }, + "signature": "0xad393c5b42b382cf93cd14f302b0175b4f9ccb000c201d42c3a6389971b8d910a81333d55ad2944b836a9bb35ba968ab06635dcd706380516ad0c653f48b1c6d52b8771c78d708e943b3ea8da59392fbf909decde262adc944fe3e57120d9bb4" + }` reg := new(eth2v1.SignedValidatorRegistration) err = json.Unmarshal([]byte(registrationJSON), reg) require.NoError(t, err) - forkVersion, err := eth2util.NetworkToForkVersionBytes("goerli") + forkVersion, err := eth2util.NetworkToForkVersionBytes("holesky") require.NoError(t, err) sigRoot, err := registration.GetMessageSigningRoot(reg.Message, eth2p0.Version(forkVersion)) diff --git a/eth2util/signing/signing.go b/eth2util/signing/signing.go index 04effc690..6df16c330 100644 --- a/eth2util/signing/signing.go +++ b/eth2util/signing/signing.go @@ -52,6 +52,11 @@ func GetDomain(ctx context.Context, eth2Cl eth2wrap.Client, name DomainName, epo return eth2p0.Domain{}, errors.New("invalid domain type") } + // Domain needs to be genesis one for DomainApplicationBuilder + if name == DomainApplicationBuilder { + return eth2Cl.GenesisDomain(ctx, domainTyped) + } + return eth2Cl.Domain(ctx, domainTyped, epoch) } diff --git a/eth2util/signing/signing_test.go b/eth2util/signing/signing_test.go index dac379fae..0639a0ecd 100644 --- a/eth2util/signing/signing_test.go +++ b/eth2util/signing/signing_test.go @@ -13,6 +13,8 @@ import ( eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/stretchr/testify/require" + "github.com/obolnetwork/charon/eth2util" + "github.com/obolnetwork/charon/eth2util/registration" "github.com/obolnetwork/charon/eth2util/signing" "github.com/obolnetwork/charon/tbls" "github.com/obolnetwork/charon/tbls/tblsconv" @@ -32,24 +34,27 @@ func TestVerifyRegistrationReference(t *testing.T) { require.NoError(t, err) registrationJSON := ` - { - "message": { - "fee_recipient": "0x000000000000000000000000000000000000dead", - "gas_limit": "30000000", - "timestamp": "1646092800", - "pubkey": "0x86966350b672bd502bfbdb37a6ea8a7392e8fb7f5ebb5c5e2055f4ee168ebfab0fef63084f28c9f62c3ba71f825e527e" - }, - "signature": "0xb101da0fc08addcc5d010ee569f6bbbdca049a5cb27efad231565bff2e3af504ec2bb87b11ed22843e9c1094f1dfe51a0b2a5ad1808df18530a2f59f004032dbf6281ecf0fc3df86d032da5b9d32a3d282c05923de491381f8f28c2863a00180" - }` - - registration := new(eth2v1.SignedValidatorRegistration) - err = json.Unmarshal([]byte(registrationJSON), registration) + { + "message": { + "fee_recipient": "0x000000000000000000000000000000000000dEaD", + "gas_limit": "30000000", + "timestamp": "1646092800", + "pubkey": "0x86966350b672bd502bfbdb37a6ea8a7392e8fb7f5ebb5c5e2055f4ee168ebfab0fef63084f28c9f62c3ba71f825e527e" + }, + "signature": "0xad393c5b42b382cf93cd14f302b0175b4f9ccb000c201d42c3a6389971b8d910a81333d55ad2944b836a9bb35ba968ab06635dcd706380516ad0c653f48b1c6d52b8771c78d708e943b3ea8da59392fbf909decde262adc944fe3e57120d9bb4" + }` + + reg := new(eth2v1.SignedValidatorRegistration) + err = json.Unmarshal([]byte(registrationJSON), reg) require.NoError(t, err) - sigRoot, err := registration.Message.HashTreeRoot() + sigRoot, err := reg.Message.HashTreeRoot() require.NoError(t, err) - sigData, err := signing.GetDataRoot(context.Background(), bmock, signing.DomainApplicationBuilder, 0, sigRoot) + fork, err := eth2util.NetworkToForkVersionBytes("holesky") + require.NoError(t, err) + + sigData, err := registration.GetMessageSigningRoot(reg.Message, eth2p0.Version(fork)) require.NoError(t, err) sig, err := tbls.Sign(secretShare, sigData[:]) @@ -57,7 +62,7 @@ func TestVerifyRegistrationReference(t *testing.T) { sigEth2 := eth2p0.BLSSignature(sig) require.Equal(t, - hex.EncodeToString(registration.Signature[:]), + hex.EncodeToString(reg.Signature[:]), hex.EncodeToString(sigEth2[:]), ) @@ -69,10 +74,10 @@ func TestVerifyRegistrationReference(t *testing.T) { } func TestConstantApplicationBuilder(t *testing.T) { - v0 := eth2p0.Version{0x00, 0x00, 0x10, 0x20} - v1 := eth2p0.Version{0x01, 0x00, 0x10, 0x20} - v2 := eth2p0.Version{0x02, 0x00, 0x10, 0x20} - v3 := eth2p0.Version{0x03, 0x00, 0x10, 0x20} + v0 := eth2p0.Version{0x01, 0x01, 0x70, 0x00} + v1 := eth2p0.Version{0x02, 0x01, 0x70, 0x00} + v2 := eth2p0.Version{0x03, 0x01, 0x70, 0x00} + v3 := eth2p0.Version{0x04, 0x01, 0x70, 0x00} forkSchedule := []*eth2p0.Fork{ {PreviousVersion: v0, CurrentVersion: v0, Epoch: 0}, @@ -97,10 +102,10 @@ func TestConstantApplicationBuilder(t *testing.T) { // Assert genesis domain is used for any fork schedule. expect := eth2p0.Domain{ - 0x00, 0x00, 0x00, 0x01, 0xe4, 0xbe, 0x93, 0x93, - 0xb0, 0x74, 0xca, 0x1f, 0x3e, 0x4a, 0xab, 0xd5, - 0x85, 0xca, 0x4b, 0xea, 0x10, 0x11, 0x70, 0xcc, - 0xfa, 0xf7, 0x1b, 0x89, 0xce, 0x5c, 0x5c, 0x38, + 0x0, 0x0, 0x0, 0x1, 0x5b, 0x83, 0xa2, 0x37, + 0x59, 0xc5, 0x60, 0xb2, 0xd0, 0xc6, 0x45, 0x76, + 0xe1, 0xdc, 0xfc, 0x34, 0xea, 0x94, 0xc4, 0x98, + 0x8f, 0x3e, 0xd, 0x9f, 0x77, 0xf0, 0x53, 0x87, } for i := range len(forkSchedule) { diff --git a/go.mod b/go.mod index d21da46e7..1dfe35996 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/obolnetwork/charon -go 1.22 +go 1.23 require ( github.com/attestantio/go-eth2-client v0.21.9 @@ -19,8 +19,8 @@ require ( github.com/libp2p/go-libp2p v0.33.2 github.com/libp2p/go-msgio v0.3.0 github.com/multiformats/go-multiaddr v0.13.0 - github.com/pelletier/go-toml/v2 v2.2.2 - github.com/prometheus/client_golang v1.19.1 + github.com/pelletier/go-toml/v2 v2.2.3 + github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 github.com/protolambda/eth2-shuffle v1.1.0 github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e @@ -32,21 +32,21 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 - go.opentelemetry.io/otel v1.28.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 + go.opentelemetry.io/otel v1.31.0 go.opentelemetry.io/otel/exporters/jaeger v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 - go.opentelemetry.io/otel/sdk v1.28.0 - go.opentelemetry.io/otel/trace v1.28.0 - go.uber.org/automaxprocs v1.5.3 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 + go.opentelemetry.io/otel/sdk v1.31.0 + go.opentelemetry.io/otel/trace v1.31.0 + go.uber.org/automaxprocs v1.6.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.25.0 + golang.org/x/crypto v0.28.0 golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 - golang.org/x/sync v0.7.0 - golang.org/x/term v0.22.0 - golang.org/x/time v0.5.0 - golang.org/x/tools v0.23.0 + golang.org/x/sync v0.8.0 + golang.org/x/term v0.25.0 + golang.org/x/time v0.7.0 + golang.org/x/tools v0.26.0 google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) @@ -70,7 +70,7 @@ require ( github.com/bufbuild/protovalidate-go v0.6.2 // indirect github.com/bufbuild/protoyaml-go v0.1.9 // indirect github.com/bwesterb/go-ristretto v1.2.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/containerd/cgroups v1.1.0 // indirect @@ -120,6 +120,7 @@ require ( github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/koron/go-ssdp v0.0.4 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect @@ -151,6 +152,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/ginkgo/v2 v2.15.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect @@ -161,8 +163,8 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/quic-go v0.42.0 // indirect github.com/quic-go/webtransport-go v0.6.0 // indirect @@ -181,16 +183,16 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect github.com/vbatts/tar-split v0.11.5 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.1 // indirect go.uber.org/fx v1.20.1 // indirect go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect diff --git a/go.sum b/go.sum index 8d31047ec..15754e640 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ github.com/bwesterb/go-ristretto v1.2.0 h1:xxWOVbN5m8NNKiSDZXE1jtZvZnC6JSJ9cYFAD github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= github.com/chromedp/chromedp v0.9.2/go.mod h1:LkSXJKONWTCHAfQasKFUZI+mxqS4tZqhmtGzzhLsnLs= github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww= @@ -284,6 +284,8 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= @@ -382,6 +384,8 @@ github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dy github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= @@ -399,8 +403,8 @@ github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTm github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/pk910/dynamic-ssz v0.0.3 h1:fCWzFowq9P6SYCc7NtJMkZcIHk+r5hSVD+32zVi6Aio= github.com/pk910/dynamic-ssz v0.0.3/go.mod h1:b6CrLaB2X7pYA+OSEEbkgXDEcRnjLOZIxZTsMuO/Y9c= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= @@ -416,17 +420,17 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= -github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/protolambda/eth2-shuffle v1.1.0 h1:gixIBI84IeugTwwHXm8vej1bSSEhueBCSryA4lAKRLU= github.com/protolambda/eth2-shuffle v1.1.0/go.mod h1:FhA2c0tN15LTC+4T9DNVm+55S7uXTTjQ8TQnBuXlkF8= github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4= @@ -516,7 +520,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -539,33 +542,33 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4= go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 h1:EVSnY9JbEEW92bEkIYOVMw4q1WJxIAGoFTrtYOzWuRQ= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0/go.mod h1:Ea1N1QQryNXpCD0I1fdLibBAIpQuBkznMmkdKrapk1Y= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= go.opentelemetry.io/otel/sdk/metric v1.19.0 h1:EJoTO5qysMsYCa+w4UghwFV/ptQgqSL/8Ni+hx+8i1k= go.opentelemetry.io/otel/sdk/metric v1.19.0/go.mod h1:XjG0jQyFJrv2PbMvwND7LwCEhsJzCzV5210euduKcKY= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= -go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.20.1 h1:zVwVQGS8zYvhh9Xxcu4w1M6ESyeMzebzj2NbSayZ4Mk= @@ -591,8 +594,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= @@ -605,8 +608,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -624,8 +627,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -639,8 +642,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -668,21 +671,21 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -695,8 +698,8 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= -golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/p2p/bootnode.go b/p2p/bootnode.go index 53d7f3380..4ebd4495b 100644 --- a/p2p/bootnode.go +++ b/p2p/bootnode.go @@ -153,7 +153,7 @@ func queryRelayAddrs(ctx context.Context, relayURL string, backoff func(), lockH if err != nil { log.Warn(ctx, "Failure querying relay addresses (will try again)", err) continue - } else if resp.StatusCode/100 != 2 { //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable + } else if resp.StatusCode/100 != 2 { log.Warn(ctx, "Non-200 response querying relay addresses (will try again)", nil, z.Int("status_code", resp.StatusCode)) continue } diff --git a/testutil/beaconmock/options.go b/testutil/beaconmock/options.go index 1e9905530..201648a27 100644 --- a/testutil/beaconmock/options.go +++ b/testutil/beaconmock/options.go @@ -528,7 +528,7 @@ func defaultMock(httpMock HTTPMock, httpServer *http.Server, clock clockwork.Clo return block, nil }, SignedBeaconBlockFunc: func(context.Context, string) (*eth2spec.VersionedSignedBeaconBlock, error) { - return testutil.RandomCapellaVersionedSignedBeaconBlock(), nil // Note the slot is probably wrong. + return testutil.RandomDenebVersionedSignedBeaconBlock(), nil // Note the slot is probably wrong. }, ProposerDutiesFunc: func(context.Context, eth2p0.Epoch, []eth2p0.ValidatorIndex) ([]*eth2v1.ProposerDuty, error) { return []*eth2v1.ProposerDuty{}, nil diff --git a/testutil/beaconmock/server_test.go b/testutil/beaconmock/server_test.go index a022c0958..98f204a55 100644 --- a/testutil/beaconmock/server_test.go +++ b/testutil/beaconmock/server_test.go @@ -25,11 +25,12 @@ func TestStatic(t *testing.T) { configResp, err := eth2Cl.Spec(ctx, ð2api.SpecOpts{}) require.NoError(t, err) - require.Equal(t, uint64(36660), configResp.Data["ALTAIR_FORK_EPOCH"]) + require.Equal(t, uint64(0), configResp.Data["ALTAIR_FORK_EPOCH"]) + require.Equal(t, uint64(29696), configResp.Data["DENEB_FORK_EPOCH"]) contractResp, err := eth2Cl.DepositContract(ctx, ð2api.DepositContractOpts{}) require.NoError(t, err) - require.Equal(t, uint64(5), contractResp.Data.ChainID) + require.Equal(t, uint64(17000), contractResp.Data.ChainID) slotsPerEpoch, err := eth2Cl.SlotsPerEpoch(ctx) require.NoError(t, err) diff --git a/testutil/beaconmock/static.json b/testutil/beaconmock/static.json index 7902ec02a..41ef96e6a 100644 --- a/testutil/beaconmock/static.json +++ b/testutil/beaconmock/static.json @@ -1,176 +1,196 @@ { "/eth/v1/beacon/genesis": { "data": { - "genesis_time": "1616508000", - "genesis_validators_root": "0x043db0d9a83813551ee2f33450d23797757d430911a9320530ad8a0eabc43efb", - "genesis_fork_version": "0x00001020" + "genesis_time": "1695902400", + "genesis_validators_root": "0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1", + "genesis_fork_version": "0x01017000" } }, "/eth/v1/config/deposit_contract": { "data": { - "chain_id": "5", - "address": "0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b" + "chain_id": "17000", + "address": "0x4242424242424242424242424242424242424242" } }, "/eth/v1/config/fork_schedule": { "data": [ { - "previous_version": "0x00001020", - "current_version": "0x00001020", + "previous_version": "0x01017000", + "current_version": "0x01017000", "epoch": "0" }, { - "previous_version": "0x00001020", - "current_version": "0x01001020", - "epoch": "36660" + "previous_version": "0x01017000", + "current_version": "0x02017000", + "epoch": "0" }, { - "previous_version": "0x01001020", - "current_version": "0x02001020", - "epoch": "112260" + "previous_version": "0x02017000", + "current_version": "0x03017000", + "epoch": "0" + }, + { + "previous_version": "0x03017000", + "current_version": "0x04017000", + "epoch": "256" + }, + { + "previous_version": "0x04017000", + "current_version": "0x05017000", + "epoch": "29696" } ] }, "/eth/v1/node/version": { "data": { - "version": "teku/v22.8.0/linux-x86_64/-eclipseadoptium-openjdk64bitservervm-java-17" + "version": "teku/v24.6.1/linux-x86_64/-ubuntu-openjdk64bitservervm-java-21" } }, "/eth/v1/config/spec": { "data": { - "ALTAIR_FORK_EPOCH": "36660", - "ALTAIR_FORK_VERSION": "0x01001020", - "ATTESTATION_PROPAGATION_SLOT_RANGE": "32", - "ATTESTATION_SUBNET_COUNT": "64", - "ATTESTATION_SUBNET_EXTRA_BITS": "0", - "ATTESTATION_SUBNET_PREFIX_BITS": "6", - "BASE_REWARD_FACTOR": "64", - "BELLATRIX_FORK_EPOCH": "112260", - "BELLATRIX_FORK_VERSION": "0x02001020", - "BLS_WITHDRAWAL_PREFIX": "0x00", - "BYTES_PER_LOGS_BLOOM": "256", - "CHURN_LIMIT_QUOTIENT": "65536", - "CONFIG_NAME": "prater", - "DEPOSIT_CHAIN_ID": "5", - "DEPOSIT_CONTRACT_ADDRESS": "0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b", - "DEPOSIT_NETWORK_ID": "5", - "DOMAIN_AGGREGATE_AND_PROOF": "0x06000000", - "DOMAIN_APPLICATION_BUILDER": "0x00000001", - "DOMAIN_BEACON_ATTESTER": "0x01000000", - "DOMAIN_BEACON_PROPOSER": "0x00000000", - "DOMAIN_CONTRIBUTION_AND_PROOF": "0x09000000", - "DOMAIN_DEPOSIT": "0x03000000", - "DOMAIN_RANDAO": "0x02000000", - "DOMAIN_SELECTION_PROOF": "0x05000000", - "DOMAIN_SYNC_COMMITTEE": "0x07000000", - "DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF": "0x08000000", - "DOMAIN_VOLUNTARY_EXIT": "0x04000000", - "EFFECTIVE_BALANCE_INCREMENT": "1000000000", - "EJECTION_BALANCE": "16000000000", - "EPOCHS_PER_ETH1_VOTING_PERIOD": "4", - "EPOCHS_PER_HISTORICAL_VECTOR": "64", - "EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION": "256", - "EPOCHS_PER_SLASHINGS_VECTOR": "64", - "EPOCHS_PER_SUBNET_SUBSCRIPTION": "256", - "EPOCHS_PER_SYNC_COMMITTEE_PERIOD": "256", - "ETH1_FOLLOW_DISTANCE": "2048", - "GOSSIP_MAX_SIZE": "10485760", - "GENESIS_DELAY": "1919188", - "GENESIS_FORK_VERSION": "0x00001020", - "HISTORICAL_ROOTS_LIMIT": "16777216", - "HYSTERESIS_DOWNWARD_MULTIPLIER": "1", - "HYSTERESIS_QUOTIENT": "4", - "HYSTERESIS_UPWARD_MULTIPLIER": "5", - "INACTIVITY_PENALTY_QUOTIENT": "33554432", - "INACTIVITY_PENALTY_QUOTIENT_ALTAIR": "50331648", - "INACTIVITY_PENALTY_QUOTIENT_BELLATRIX": "16777216", + "SLOTS_PER_EPOCH": "32", + "PRESET_BASE": "mainnet", + "TERMINAL_TOTAL_DIFFICULTY": "0", "INACTIVITY_SCORE_BIAS": "4", - "INACTIVITY_SCORE_RECOVERY_RATE": "16", - "MAX_ATTESTATIONS": "128", + "PENDING_BALANCE_DEPOSITS_LIMIT": "134217728", "MAX_ATTESTER_SLASHINGS": "2", - "MAX_CHUNK_SIZE": "10485760", + "MAX_WITHDRAWALS_PER_PAYLOAD": "16", + "INACTIVITY_PENALTY_QUOTIENT_BELLATRIX": "16777216", + "PENDING_PARTIAL_WITHDRAWALS_LIMIT": "134217728", + "INACTIVITY_PENALTY_QUOTIENT": "67108864", + "SAFE_SLOTS_TO_UPDATE_JUSTIFIED": "8", + "SECONDS_PER_ETH1_BLOCK": "14", + "MIN_SEED_LOOKAHEAD": "1", + "VALIDATOR_REGISTRY_LIMIT": "1099511627776", + "REORG_MAX_EPOCHS_SINCE_FINALIZATION": "2", + "SLOTS_PER_HISTORICAL_ROOT": "8192", + "RESP_TIMEOUT": "10", + "DOMAIN_VOLUNTARY_EXIT": "0x04000000", + "MAX_VALIDATORS_PER_COMMITTEE": "2048", + "MIN_GENESIS_TIME": "1695902100", + "ALTAIR_FORK_EPOCH": "0", + "HYSTERESIS_QUOTIENT": "4", + "ALTAIR_FORK_VERSION": "0x02017000", "MAX_BYTES_PER_TRANSACTION": "1073741824", - "MAX_COMMITTEES_PER_SLOT": "4", + "MAX_CHUNK_SIZE": "10485760", + "TTFB_TIMEOUT": "5", + "WHISTLEBLOWER_REWARD_QUOTIENT": "512", + "PROPOSER_REWARD_QUOTIENT": "8", + "MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP": "16384", + "EPOCHS_PER_HISTORICAL_VECTOR": "65536", + "MIN_PER_EPOCH_CHURN_LIMIT": "4", + "MAX_ATTESTER_SLASHINGS_ELECTRA": "1", + "TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE": "16", "MAX_DEPOSITS": "16", - "MAX_EFFECTIVE_BALANCE": "32000000000", + "BELLATRIX_FORK_EPOCH": "0", + "MAX_REQUEST_BLOB_SIDECARS": "768", + "REORG_HEAD_WEIGHT_THRESHOLD": "20", + "TARGET_AGGREGATORS_PER_COMMITTEE": "16", + "DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF": "0x08000000", + "MESSAGE_DOMAIN_INVALID_SNAPPY": "0x00000000", + "EPOCHS_PER_SLASHINGS_VECTOR": "8192", + "MIN_SLASHING_PENALTY_QUOTIENT": "128", + "MAX_BLS_TO_EXECUTION_CHANGES": "16", + "GOSSIP_MAX_SIZE": "10485760", + "DOMAIN_BEACON_ATTESTER": "0x01000000", + "EPOCHS_PER_SUBNET_SUBSCRIPTION": "256", + "MAX_ATTESTATIONS_ELECTRA": "8", + "ATTESTATION_SUBNET_COUNT": "64", + "GENESIS_DELAY": "300", + "MAX_SEED_LOOKAHEAD": "4", + "ETH1_FOLLOW_DISTANCE": "2048", + "SECONDS_PER_SLOT": "12", + "REORG_PARENT_WEIGHT_THRESHOLD": "160", + "MIN_SYNC_COMMITTEE_PARTICIPANTS": "1", + "BELLATRIX_FORK_VERSION": "0x03017000", + "PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX": "3", + "EFFECTIVE_BALANCE_INCREMENT": "1000000000", + "FIELD_ELEMENTS_PER_BLOB": "4096", + "MIN_EPOCHS_TO_INACTIVITY_PENALTY": "4", + "BASE_REWARD_FACTOR": "64", "MAX_EXTRA_DATA_BYTES": "32", + "CONFIG_NAME": "holesky", "MAX_PROPOSER_SLASHINGS": "16", - "MAX_REQUEST_BLOCKS": "1024", - "MAX_SEED_LOOKAHEAD": "4", + "MAX_CONSOLIDATIONS": "1", + "INACTIVITY_SCORE_RECOVERY_RATE": "16", + "MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS": "4096", "MAX_TRANSACTIONS_PER_PAYLOAD": "1048576", - "MAX_VALIDATORS_PER_COMMITTEE": "2048", - "MAX_VOLUNTARY_EXITS": "16", - "MAXIMUM_GOSSIP_CLOCK_DISPARITY": "500", - "MESSAGE_DOMAIN_INVALID_SNAPPY": "0x00000000", - "MESSAGE_DOMAIN_VALID_SNAPPY": "0x01000000", + "DEPOSIT_CONTRACT_ADDRESS": "0x4242424242424242424242424242424242424242", "MIN_ATTESTATION_INCLUSION_DELAY": "1", - "MIN_DEPOSIT_AMOUNT": "1000000000", - "MIN_EPOCHS_FOR_BLOCK_REQUESTS": "33024", - "MIN_EPOCHS_TO_INACTIVITY_PENALTY": "4", - "MIN_GENESIS_ACTIVE_VALIDATOR_COUNT": "16384", - "MIN_GENESIS_TIME": "1614588812", - "MIN_PER_EPOCH_CHURN_LIMIT": "4", - "MIN_SEED_LOOKAHEAD": "1", - "MIN_SLASHING_PENALTY_QUOTIENT": "64", - "MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR": "64", + "SHUFFLE_ROUND_COUNT": "90", + "TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH": "18446744073709551615", + "MAX_EFFECTIVE_BALANCE": "32000000000", + "DOMAIN_BEACON_PROPOSER": "0x00000000", + "DENEB_FORK_EPOCH": "29696", + "DOMAIN_SYNC_COMMITTEE": "0x07000000", + "PROPOSER_SCORE_BOOST": "40", + "DOMAIN_SELECTION_PROOF": "0x05000000", "MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX": "32", - "MIN_SYNC_COMMITTEE_PARTICIPANTS": "1", - "MIN_VALIDATOR_WITHDRAWABILITY_DELAY": "256", - "PRESET_BASE": "minimal", - "PROPORTIONAL_SLASHING_MULTIPLIER": "2", - "PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR": "2", - "PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX": "3", - "PROPOSER_REWARD_QUOTIENT": "8", - "PROPOSER_SCORE_BOOST": "70", - "RANDOM_SUBNETS_PER_VALIDATOR": "1", - "RESP_TIMEOUT": "10", - "SAFE_SLOTS_TO_UPDATE_JUSTIFIED": "8", - "SECONDS_PER_ETH1_BLOCK": "14", - "SECONDS_PER_SLOT": "12", - "SHARD_COMMITTEE_PERIOD": "256", - "SHUFFLE_ROUND_COUNT": "10", - "SLOTS_PER_EPOCH": "32", - "SLOTS_PER_HISTORICAL_ROOT": "64", + "MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT": "8", + "HYSTERESIS_UPWARD_MULTIPLIER": "5", "SUBNETS_PER_NODE": "2", - "SYNC_COMMITTEE_SIZE": "512", - "SYNC_COMMITTEE_SUBNET_COUNT": "4", - "TARGET_AGGREGATORS_PER_COMMITTEE": "16", - "TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE": "16", - "TARGET_COMMITTEE_SIZE": "4", + "MIN_DEPOSIT_AMOUNT": "1000000000", + "MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA": "4096", + "PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR": "2", + "MAX_BLOBS_PER_BLOCK": "6", + "MIN_VALIDATOR_WITHDRAWABILITY_DELAY": "256", + "MAXIMUM_GOSSIP_CLOCK_DISPARITY": "500", + "TARGET_COMMITTEE_SIZE": "128", "TERMINAL_BLOCK_HASH": "0x0000000000000000000000000000000000000000000000000000000000000000", - "TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH": "18446744073709551615", - "TERMINAL_TOTAL_DIFFICULTY": "10790000", - "TTFB_TIMEOUT": "5", + "DOMAIN_DEPOSIT": "0x03000000", + "DOMAIN_CONTRIBUTION_AND_PROOF": "0x09000000", "UPDATE_TIMEOUT": "8192", - "VALIDATOR_REGISTRY_LIMIT": "1099511627776", - "WHISTLEBLOWER_REWARD_QUOTIENT": "512" + "ELECTRA_FORK_EPOCH": "18446744073709551615", + "SYNC_COMMITTEE_BRANCH_LENGTH": "5", + "DEPOSIT_CHAIN_ID": "17000", + "MAX_BLOB_COMMITMENTS_PER_BLOCK": "4096", + "DOMAIN_RANDAO": "0x02000000", + "CAPELLA_FORK_VERSION": "0x04017000", + "MAX_EFFECTIVE_BALANCE_ELECTRA": "2048000000000", + "MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR": "64", + "EPOCHS_PER_ETH1_VOTING_PERIOD": "64", + "MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD": "8192", + "WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA": "4096", + "HISTORICAL_ROOTS_LIMIT": "16777216", + "ATTESTATION_PROPAGATION_SLOT_RANGE": "32", + "SYNC_COMMITTEE_SIZE": "512", + "ATTESTATION_SUBNET_PREFIX_BITS": "6", + "PROPORTIONAL_SLASHING_MULTIPLIER": "1", + "MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD": "16", + "MESSAGE_DOMAIN_VALID_SNAPPY": "0x01000000", + "MAX_VOLUNTARY_EXITS": "16", + "PENDING_CONSOLIDATIONS_LIMIT": "262144", + "HYSTERESIS_DOWNWARD_MULTIPLIER": "1", + "DOMAIN_APPLICATION_BUILDER": "0x00000001", + "MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP": "8", + "EPOCHS_PER_SYNC_COMMITTEE_PERIOD": "256", + "BYTES_PER_LOGS_BLOOM": "256", + "MIN_GENESIS_ACTIVE_VALIDATOR_COUNT": "16384", + "MAX_ATTESTATIONS": "128", + "MIN_EPOCHS_FOR_BLOCK_REQUESTS": "33024", + "DENEB_FORK_VERSION": "0x05017000", + "ELECTRA_FORK_VERSION": "0x06017000", + "MAX_REQUEST_BLOCKS": "1024", + "GENESIS_FORK_VERSION": "0x01017000", + "KZG_COMMITMENT_INCLUSION_PROOF_DEPTH": "17", + "DEPOSIT_NETWORK_ID": "17000", + "MAX_REQUEST_BLOCKS_DENEB": "128", + "BLOB_SIDECAR_SUBNET_COUNT": "6", + "SYNC_COMMITTEE_SUBNET_COUNT": "4", + "CAPELLA_FORK_EPOCH": "256", + "EJECTION_BALANCE": "28000000000", + "ATTESTATION_SUBNET_EXTRA_BITS": "0", + "MAX_COMMITTEES_PER_SLOT": "64", + "SHARD_COMMITTEE_PERIOD": "256", + "INACTIVITY_PENALTY_QUOTIENT_ALTAIR": "50331648", + "DOMAIN_AGGREGATE_AND_PROOF": "0x06000000", + "CHURN_LIMIT_QUOTIENT": "65536", + "BLS_WITHDRAWAL_PREFIX": "0x00", + "MIN_ACTIVATION_BALANCE": "32000000000" } }, "/eth/v2/beacon/blocks/0": { - "version": "phase0", - "execution_optimistic": false, - "data": { - "message": { - "slot": "0", - "proposer_index": "0", - "parent_root": "0x0000000000000000000000000000000000000000000000000000000000000000", - "state_root": "0x895390e92edc03df7096e9f51e51896e8dbe6e7e838180dadbfd869fdd77a659", - "body": { - "randao_reveal": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "eth1_data": { - "deposit_root": "0x0000000000000000000000000000000000000000000000000000000000000000", - "deposit_count": "0", - "block_hash": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - "graffiti": "0x0000000000000000000000000000000000000000000000000000000000000000", - "proposer_slashings": [], - "attester_slashings": [], - "attestations": [], - "deposits": [], - "voluntary_exits": [] - } - }, - "signature": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - } + "code": 404, + "message": "Not found" } } diff --git a/testutil/compose/smoke/smoke_test.go b/testutil/compose/smoke/smoke_test.go index 449634b48..b4a921e42 100644 --- a/testutil/compose/smoke/smoke_test.go +++ b/testutil/compose/smoke/smoke_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/obolnetwork/charon/app/version" "github.com/obolnetwork/charon/testutil" "github.com/obolnetwork/charon/testutil/compose" ) @@ -84,26 +85,26 @@ func TestSmoke(t *testing.T) { }, Timeout: time.Minute * 2, }, - // TODO: https://github.com/ObolNetwork/charon/issues/3004 - // { - // Name: "run_version_matrix_with_dkg", - // PrintYML: true, - // ConfigFunc: func(conf *compose.Config) { - // conf.KeyGen = compose.KeyGenDKG - // // NOTE: Add external VCs when supported versions include minimal preset. - // conf.VCs = []compose.VCType{compose.VCMock} - // }, - // DefineTmplFunc: func(data *compose.TmplData) { - // // Use oldest supported version for cluster lock - // pegImageTag(data.Nodes, 0, last(version.Supported()[1:])+"-rc") - // }, - // RunTmplFunc: func(data *compose.TmplData) { - // // Node 0 is local build - // pegImageTag(data.Nodes, 1, nth(version.Supported(), 0)+"-dev") // Node 1 is previous commit on this branch (v0.X-dev/rc) Note this will fail for first commit on new branch version. - // pegImageTag(data.Nodes, 2, nth(version.Supported()[1:], 1)+"-rc") - // pegImageTag(data.Nodes, 3, nth(version.Supported()[1:], 2)+"-rc") - // }, - // }, + { + Name: "run_version_matrix_with_dkg", + PrintYML: true, + ConfigFunc: func(conf *compose.Config) { + conf.KeyGen = compose.KeyGenDKG + // NOTE: Add external VCs when supported versions include minimal preset. + conf.VCs = []compose.VCType{compose.VCMock} + }, + DefineTmplFunc: func(data *compose.TmplData) { + // Use oldest supported version for cluster lock + pegImageTag(data.Nodes, 0, last(version.Supported()[1:])+".0-rc1") + }, + RunTmplFunc: func(data *compose.TmplData) { + // Node 0 is local build + // NodeŃ‹ 1-3 use the previous release; ensure better diversity in the matrix when more releases are added. + pegImageTag(data.Nodes, 1, nth(version.Supported(), 1)+".0-rc1") + pegImageTag(data.Nodes, 2, nth(version.Supported(), 1)+".0-rc1") + pegImageTag(data.Nodes, 3, nth(version.Supported(), 1)+".0-rc1") + }, + }, { Name: "teku_versions", ConfigFunc: func(conf *compose.Config) { @@ -171,8 +172,7 @@ func TestSmoke(t *testing.T) { for _, test := range tests { t.Run(test.Name, func(t *testing.T) { - dir, err := os.MkdirTemp("", "") - require.NoError(t, err) + dir := t.TempDir() conf := compose.NewDefaultConfig() conf.Monitoring = false @@ -204,7 +204,7 @@ func TestSmoke(t *testing.T) { autoConfig.LogFile = path.Join(*logDir, test.Name+".log") } - err = compose.Auto(context.Background(), autoConfig) + err := compose.Auto(context.Background(), autoConfig) testutil.RequireNoError(t, err) }) } @@ -212,17 +212,17 @@ func TestSmoke(t *testing.T) { // pegImageTag pegs the charon docker image tag for one of the nodes. // It overrides the default that uses locally built latest version. -// func pegImageTag(nodes []compose.TmplNode, index int, imageTag string) { -// nodes[index].ImageTag = imageTag -// nodes[index].Entrypoint = "/usr/local/bin/charon" // Use contains binary, not locally built latest version. -// } - -// // last returns the last element of a slice. -// func last(s []version.SemVer) string { -// return s[len(s)-1].String() -// } - -// // nth returns the nth element of a slice, wrapping if n > len(s). -// func nth(s []version.SemVer, n int) string { -// return s[n%len(s)].String() -// } +func pegImageTag(nodes []compose.TmplNode, index int, imageTag string) { + nodes[index].ImageTag = imageTag + nodes[index].Entrypoint = "/usr/local/bin/charon" // Use contains binary, not locally built latest version. +} + +// last returns the last element of a slice. +func last(s []version.SemVer) string { + return s[len(s)-1].String() +} + +// nth returns the nth element of a slice, wrapping if n > len(s). +func nth(s []version.SemVer, n int) string { + return s[n%len(s)].String() +} diff --git a/testutil/compose/static/lodestar/run.sh b/testutil/compose/static/lodestar/run.sh index b8350d0e1..eb4ebbfa0 100755 --- a/testutil/compose/static/lodestar/run.sh +++ b/testutil/compose/static/lodestar/run.sh @@ -24,8 +24,6 @@ echo "Imported all keys" node /usr/app/packages/cli/bin/lodestar validator \ --network="dev" \ - --presetFile="/tmp/testnet/config.yaml" \ - --paramsFile="/tmp/testnet/config.yaml" \ --metrics=true \ --metrics.address="0.0.0.0" \ --metrics.port=5064 \ diff --git a/testutil/integration/simnet_test.go b/testutil/integration/simnet_test.go index 5029970b5..2b4ff0378 100644 --- a/testutil/integration/simnet_test.go +++ b/testutil/integration/simnet_test.go @@ -196,7 +196,9 @@ func newSimnetArgs(t *testing.T) simnetArgs { ) seed := 99 random := rand.New(rand.NewSource(int64(seed))) - lock, p2pKeys, secretShares := cluster.NewForT(t, numDVs, n, n, seed, random) + lock, p2pKeys, secretShares := cluster.NewForT(t, numDVs, n, n, seed, random, func(definition *cluster.Definition) { + definition.ForkVersion = []byte{0x01, 0x01, 0x70, 0x00} + }) secrets := secretShares[0] diff --git a/testutil/promrated/Dockerfile b/testutil/promrated/Dockerfile index d75382daf..a757b24ee 100644 --- a/testutil/promrated/Dockerfile +++ b/testutil/promrated/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.5-alpine AS builder +FROM golang:1.23.0-alpine AS builder # Install dependencies RUN apk add --no-cache build-base git diff --git a/testutil/promrated/rated.go b/testutil/promrated/rated.go index 68fb76182..e175025ef 100644 --- a/testutil/promrated/rated.go +++ b/testutil/promrated/rated.go @@ -106,7 +106,7 @@ func queryRatedAPI(ctx context.Context, url *url.URL, ratedAuth string, network backoff() continue - } else if res.StatusCode/100 != 2 { //nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable + } else if res.StatusCode/100 != 2 { incRatedErrors(res.StatusCode) return nil, errors.New("not ok http response", z.Str("body", string(body)))