diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 93fd964..10a80a2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -102,11 +102,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Docker meta custom api - id: meta_customapi + - name: Docker meta stats api + id: meta_statsapi uses: docker/metadata-action@v4 with: - images: spacemeshos/explorer-custom-api-dev + images: spacemeshos/explorer-stats-api-dev - name: Login to DockerHub uses: docker/login-action@v1 @@ -117,7 +117,7 @@ jobs: - uses: docker/build-push-action@v2 with: context: . - repository: spacemeshos/explorer-custom-api-dev + repository: spacemeshos/explorer-stats-api-dev file: ./Dockerfile.api push: true - tags: ${{ steps.meta_customapi.outputs.tags }} \ No newline at end of file + tags: ${{ steps.meta_statsapi.outputs.tags }} \ No newline at end of file diff --git a/Dockerfile.api b/Dockerfile.api index 3404e66..6731632 100644 --- a/Dockerfile.api +++ b/Dockerfile.api @@ -2,10 +2,10 @@ FROM golang:1.22.3-alpine AS build WORKDIR /src COPY . . RUN apk add --no-cache gcc musl-dev -RUN go build -o explorer-custom-api ./cmd/api/ +RUN go build -o explorer-stats-api ./cmd/api/ FROM alpine:3.17 -COPY --from=build /src/explorer-custom-api /bin/ +COPY --from=build /src/explorer-stats-api /bin/ EXPOSE 5000 EXPOSE 5050 -ENTRYPOINT ["/bin/explorer-custom-api"] +ENTRYPOINT ["/bin/explorer-stats-api"] diff --git a/storage/epoch.go b/storage/epoch.go index b0d79f2..eece7ca 100644 --- a/storage/epoch.go +++ b/storage/epoch.go @@ -378,9 +378,9 @@ func (s *Storage) computeStatistics(epoch *model.Epoch) { } atxs, _ := s.GetActivations(context.Background(), &bson.D{{Key: "targetEpoch", Value: epoch.Number}}) if atxs != nil { - smeshers := make(map[string]int64) + smeshers := make(map[string]uint64) for _, atx := range atxs { - var commitmentSize int64 + var commitmentSize uint64 var smesher string for _, e := range atx { if e.Key == "smesher" { @@ -389,15 +389,15 @@ func (s *Storage) computeStatistics(epoch *model.Epoch) { } if e.Key == "commitmentSize" { if value, ok := e.Value.(int64); ok { - commitmentSize = value + commitmentSize = uint64(value) } else if value, ok := e.Value.(int32); ok { - commitmentSize = int64(value) + commitmentSize = uint64(value) } } } if smesher != "" { smeshers[smesher] += commitmentSize - epoch.Stats.Current.Security += commitmentSize + epoch.Stats.Current.Security += int64(commitmentSize) } } epoch.Stats.Current.Smeshers = int64(len(smeshers))