Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 0 additions & 25 deletions .github/workflows/go_lint_dela.yml

This file was deleted.

11 changes: 6 additions & 5 deletions .github/workflows/go_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ jobs:

- name: Check out code into the Go module directory
uses: actions/checkout@v4

# TODO: https://github.com/c4dt/d-voting/issues/392
# - name: Run lint
# run: make lint
#

# Legacy DELA used golangci-lint, but 70 files in d-voting fail it.
# TODO: re-enable golangci-lint once those issues are resolved.
- name: Run lint
run: make lint

- name: Run vet
run: make vet

Expand Down
71 changes: 0 additions & 71 deletions .github/workflows/go_test_dela.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ private.key
web/app/node_modules
.idea

dvoting*
/dvoting*

*.log

Expand All @@ -25,3 +25,4 @@ dela/mino/minogrpc/controller/cert.key
dela/contracts/access/controller/access.json
dela/profile.cov
dela/report.json
scripts/system-tests/.cookies
4 changes: 2 additions & 2 deletions Dockerfiles/Dockerfile.dela
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ COPY go.sum .
RUN go mod download
COPY . .
ENV GOCACHE=/root/.cache/go-build
WORKDIR /go/d-voting/cli/dvoting
WORKDIR /go/d-voting/cmd/dvoting
RUN --mount=type=cache,target="/root/.cache/go-build" go install
# DELA is part of the D-Voting module and is built from this checkout.
WORKDIR /go/d-voting
RUN --mount=type=cache,target="/root/.cache/go-build" go install ./dela/cli/crypto
RUN --mount=type=cache,target="/root/.cache/go-build" go install ./internal/cli/crypto

FROM golang:1.25.0-bookworm AS build
WORKDIR /usr/local/bin
Expand Down
56 changes: 15 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lint:

vet:
@echo "⚠️ Warning: the following only works with go >= 1.14" && \
go install ./internal/mcheck && \
go install ./internal/testing/mcheck && \
go vet -vettool=`go env GOPATH`/bin/mcheck -commentLen -ifInit ./...

# target to run all the possible checks except integration; it's a good habit to
Expand All @@ -24,64 +24,38 @@ test_integration:
go test ./integration -timeout 50s

build:
go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting ./cli/dvoting
GOOS=linux GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-linux-amd64-$(versionFile) ./cli/dvoting
GOOS=darwin GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-darwin-amd64-$(versionFile) ./cli/dvoting
GOOS=windows GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-windows-amd64-$(versionFile) ./cli/dvoting
go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting ./cmd/dvoting
GOOS=linux GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-linux-amd64-$(versionFile) ./cmd/dvoting
GOOS=darwin GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-darwin-amd64-$(versionFile) ./cmd/dvoting
GOOS=windows GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-windows-amd64-$(versionFile) ./cmd/dvoting



# ------------------------------------------------------------
# DELA targets
# ------------------------------------------------------------

.PHONY: dela-all tidy generate-dela lint-dela tests-dela test-dela coverage-dela

export PATH := $(shell go env GOPATH)/bin:$(PATH)

# Default DELA target to check locally that everything is ok, BEFORE pushing remotely
dela-all: generate-dela lint-dela test-dela
@echo "Done with the standard DELA checks"
.PHONY: tidy test-flaky

# tidy runs go mod tidy pinned to the Go version declared in go.mod.
tidy:
@go mod tidy -go="1.25.0"

generate-dela: tidy
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.5
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
go generate ./dela/...

lint-dela: tidy
@echo "Running golangci-lint for DELA"
@GOTOOLCHAIN=go1.25.0 go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
golangci-lint run --config dela/.golangci.yml ./dela/...

tests-dela:
while make test-dela; do echo "Testing again at $$(date)"; done; echo "Failed testing"

FLAKY_TESTS_PBFT := (TestService_Scenario_Basic|TestService_Scenario_ViewChange|TestService_Scenario_FinalizeFailure)
FLAKY_TESTS_MINOWS := (Test_session_Recv_SessionEnded)

# test runs all tests in DELA without coverage
# Flaky tests that need retries
# It first runs all the tests in "short" mode, so the flaky tests don't run.
# Then the flaky tests get run separately for at most 3 times, and hopefully it all works out.
test-dela: tidy
go test ./dela/... -short -count=1 || exit 1
FLAKY_TESTS_PBFT := (TestService_Scenario_Basic|TestService_Scenario_ViewChange|TestService_Scenario_FinalizeFailure)
FLAKY_TESTS_MINOWS := (Test_session_Recv_SessionEnded|Test_session_Send_SessionEnded)

# test runs the flaky tests without coverage, retrying each up to 3 times.
test-flaky: tidy
@for count in $$( seq 4 ); do \
if [ "$$count" -eq 4 ]; then \
echo "Couldn't run all flaky tests in 3 tries"; \
exit 1; \
fi; \
echo "Running $$count/3"; \
if ! go test -count=1 ./dela/mino/minows -run="${FLAKY_TESTS_MINOWS}"; then \
if ! go test -count=1 ./internal/network/mino/minows -run="${FLAKY_TESTS_MINOWS}"; then \
continue; \
fi; \
if ! go test -count=1 ./dela/core/ordering/cosipbft -run="${FLAKY_TESTS_PBFT}"; then \
if ! go test -count=1 ./internal/core/ordering/cosipbft -run="${FLAKY_TESTS_PBFT}"; then \
continue; \
fi; \
break; \
done

# test runs all tests in DELA and generates coverage output (to be used by SonarCloud)
coverage-dela: tidy
go test -json -covermode=count -coverprofile=dela/profile.cov ./dela/... | tee dela/report.json
30 changes: 15 additions & 15 deletions cli/dvoting/mod.go → cmd/dvoting/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ import (
"io"
"os"

dkg "github.com/c4dt/d-voting/services/dkg/pedersen/controller"
"github.com/c4dt/d-voting/services/dkg/pedersen/json"
shuffle "github.com/c4dt/d-voting/services/shuffle/neff/controller"
dkg "github.com/c4dt/d-voting/internal/services/dkg/pedersen/controller"
"github.com/c4dt/d-voting/internal/services/dkg/pedersen/json"
shuffle "github.com/c4dt/d-voting/internal/services/shuffle/neff/controller"

cosipbft "github.com/c4dt/d-voting/cli/cosipbftcontroller"
"github.com/c4dt/d-voting/cli/postinstall"
evoting "github.com/c4dt/d-voting/contracts/evoting/controller"
"github.com/c4dt/d-voting/dela/cli/node"
access "github.com/c4dt/d-voting/dela/contracts/access/controller"
db "github.com/c4dt/d-voting/dela/core/store/kv/controller"
pool "github.com/c4dt/d-voting/dela/core/txn/pool/controller"
signed "github.com/c4dt/d-voting/dela/core/txn/signed/controller"
mino "github.com/c4dt/d-voting/dela/mino/minogrpc/controller"
proxy "github.com/c4dt/d-voting/dela/mino/proxy/http/controller"
metrics "github.com/c4dt/d-voting/metrics/controller"
"github.com/c4dt/d-voting/internal/cli/node"
"github.com/c4dt/d-voting/internal/cli/postinstall"
access "github.com/c4dt/d-voting/internal/contracts/access/controller"
evoting "github.com/c4dt/d-voting/internal/contracts/evoting/controller"
cosipbft "github.com/c4dt/d-voting/internal/core/ordering/cosipbft/controller"
db "github.com/c4dt/d-voting/internal/core/store/kv/controller"
pool "github.com/c4dt/d-voting/internal/core/txn/pool/controller"
signed "github.com/c4dt/d-voting/internal/core/txn/signed/controller"
mino "github.com/c4dt/d-voting/internal/network/mino/minogrpc/controller"
proxy "github.com/c4dt/d-voting/internal/network/mino/proxy/http/controller"
metrics "github.com/c4dt/d-voting/internal/observability/metrics/controller"

_ "github.com/c4dt/d-voting/services/shuffle/neff/json"
_ "github.com/c4dt/d-voting/internal/services/shuffle/neff/json"
)

func main() {
Expand Down
File renamed without changes.
52 changes: 0 additions & 52 deletions dela/.editorconfig

This file was deleted.

Loading
Loading