Skip to content

Commit

Permalink
Merge pull request #1917 from dedis/work-be1-stuart-end-files-reorgan…
Browse files Browse the repository at this point in the history
…ization

[BE1] last handler files reorganization
  • Loading branch information
sgueissa authored Jun 12, 2024
2 parents 55a30ef + bd4b003 commit 57c2ca0
Show file tree
Hide file tree
Showing 248 changed files with 7,175 additions and 6,336 deletions.
4 changes: 3 additions & 1 deletion be1-go/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ coverage.html
configServer1.json
configServer2.json
configServer3.json
configServer4.json
configServer4.json
/internal/handler/**/testdata/
/internal/validation/protocol/
125 changes: 120 additions & 5 deletions be1-go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ shaFlag="popstellar.ShortSHA=$(shortsha)"
.PHONY: test

build: export CGO_ENABLED=0
build: protocol
build: protocol test-data
go build -ldflags="-X $(versionFlag) -X $(timeFlag) -X $(shaFlag)" -o pop ./cli
GOOS=linux GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag) -X $(shaFlag)" -o pop-linux-amd64-$(versionFile) ./cli
GOOS=darwin GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag) -X $(shaFlag)" -o pop-darwin-amd64-$(versionFile) ./cli
Expand All @@ -20,26 +20,141 @@ lint:
@go mod tidy
staticcheck ./...

test: protocol
test: protocol test-data
go test -v -race ./...

test-no-cache: protocol
test-no-cache: protocol test-data
go test -v -race ./... -count=1

test-cov: protocol
test-cov: protocol test-data
go test -v ./... -coverprofile=coverage.out -json > report.json

vet: protocol
vet: protocol test-data
go vet ./...

check: test test-cov lint vet

protocol:
cp -r ../protocol ./internal/validation

test-data:
# Answer
cp -r ../protocol/examples/answer/. ./internal/handler/answer/manswer/testdata

# Methods
cp -r ../protocol/examples/query/broadcast/. ./internal/handler/method/broadcast/mbroadcast/testdata
cp -r ../protocol/examples/query/catchup/. ./internal/handler/method/catchup/mcatchup/testdata
cp -r ../protocol/examples/query/get_messages_by_id/. ./internal/handler/method/getmessagesbyid/mgetmessagesbyid/testdata
cp -r ../protocol/examples/query/greet_server/. ./internal/handler/method/greetserver/mgreetserver/testdata
cp -r ../protocol/examples/query/heartbeat/. ./internal/handler/method/heartbeat/mheartbeat/testdata
cp -r ../protocol/examples/query/publish/. ./internal/handler/method/publish/mpublish/testdata
cp -r ../protocol/examples/query/subscribe/. ./internal/handler/method/subscribe/msubscribe/testdata
cp -r ../protocol/examples/query/unsubscribe/. ./internal/handler/method/unsubscribe/munsubscribe/testdata

# Message
cp -r ../protocol/examples/messageData/lao_create/. ./internal/handler/message/mmessage/testdata

# Channel
cp -r ../protocol/examples/messageData/test_messages/. ./internal/handler/channel/testdata

# Authentification
cp -r ../protocol/examples/messageData/popcha_authenticate/. ./internal/handler/channel/authentication/mauthentication/testdata

# Chirp
cp -r ../protocol/examples/messageData/chirp_add_publish/. ./internal/handler/channel/chirp/mchirp/testdata
cp -r ../protocol/examples/messageData/chirp_delete_publish/. ./internal/handler/channel/chirp/mchirp/testdata
cp -r ../protocol/examples/messageData/chirp_notify_add/. ./internal/handler/channel/chirp/mchirp/testdata
cp -r ../protocol/examples/messageData/chirp_notify_delete/. ./internal/handler/channel/chirp/mchirp/testdata

# Coin
cp -r ../protocol/examples/messageData/coin/. ./internal/handler/channel/coin/hcoin/testdata
cp -r ../protocol/examples/messageData/coin/. ./internal/handler/channel/coin/mcoin/testdata

# Consensus
cp -r ../protocol/examples/messageData/consensus_accept/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_elect/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_elect_accept/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_failure/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_learn/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_prepare/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_promise/. ./internal/handler/channel/consensus/mconsensus/testdata
cp -r ../protocol/examples/messageData/consensus_propose/. ./internal/handler/channel/consensus/mconsensus/testdata

# Election
cp -r ../protocol/examples/messageData/election_end/. ./internal/handler/channel/election/melection/testdata
cp -r ../protocol/examples/messageData/election_key/. ./internal/handler/channel/election/melection/testdata
cp -r ../protocol/examples/messageData/election_open/. ./internal/handler/channel/election/melection/testdata
cp -r ../protocol/examples/messageData/election_result.json ./internal/handler/channel/election/melection/testdata
cp -r ../protocol/examples/messageData/vote_cast_vote/. ./internal/handler/channel/election/melection/testdata

# Lao
cp -r ../protocol/examples/messageData/election_setup/. ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/lao_greet/. ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/lao_state/. ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/lao_update/. ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/meeting_create.json ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/meeting_state.json ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/message_witness.json ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/roll_call_close.json ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/roll_call_create.json ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/roll_call_open.json ./internal/handler/channel/lao/mlao/testdata
cp -r ../protocol/examples/messageData/roll_call_reopen.json ./internal/handler/channel/lao/mlao/testdata

# Reaction
cp -r ../protocol/examples/messageData/reaction_add/. ./internal/handler/channel/reaction/mreaction/testdata
cp -r ../protocol/examples/messageData/reaction_delete/. ./internal/handler/channel/reaction/mreaction/testdata

# Root
cp -r ../protocol/examples/messageData/lao_create/. ./internal/handler/channel/root/mroot/testdata


clean:
rm -rf ./internal/validation/protocol

# Answer
rm -rf ./internal/handler/answer/manswer/testdata

# Methods
rm -rf ./internal/handler/method/broadcast/mbroadcast/testdata
rm -rf ./internal/handler/method/catchup/mcatchup/testdata
rm -rf ./internal/handler/method/getmessagesbyid/mgetmessagesbyid/testdata
rm -rf ./internal/handler/method/greetserver/mgreetserver/testdata
rm -rf ./internal/handler/method/heartbeat/mheartbeat/testdata
rm -rf ./internal/handler/method/publish/mpublish/testdata
rm -rf ./internal/handler/method/subscribe/msubscribe/testdata
rm -rf ./internal/handler/method/unsubscribe/munsubscribe/testdata

# Message
rm -rf ./internal/handler/message/mmessage/testdata

# Channel
rm -rf ./internal/handler/channel/testdata

# Authentication
rm -rf ./internal/handler/channel/authentication/mauthentication/testdata

# Chirp
rm -rf ./internal/handler/channel/chirp/mchirp/testdata

# Coin
rm -rf ./internal/handler/channel/coin/hcoin/testdata
rm -rf ./internal/handler/channel/coin/mcoin/testdata

# Consensus
rm -rf ./internal/handler/channel/consensus/mconsensus/testdata

# Election
rm -rf ./internal/handler/channel/election/melection/testdata

# Lao
rm -rf ./internal/handler/channel/lao/mlao/testdata

# Reaction
rm -rf ./internal/handler/channel/reaction/mreaction/testdata

# Root
rm -rf ./internal/handler/channel/root/mroot/testdata

fmt:
gofmt -s -w ./

Expand Down
15 changes: 6 additions & 9 deletions be1-go/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/fsnotify/fsnotify"
"github.com/gorilla/websocket"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
"go.dedis.ch/kyber/v3"
"golang.org/x/exp/slices"
"golang.org/x/xerrors"
"net/url"
"os"
"popstellar/internal/crypto"
Expand All @@ -17,15 +23,6 @@ import (
oldHub "popstellar/internal/old/hub"
"sync"
"time"

"github.com/rs/zerolog/log"
"go.dedis.ch/kyber/v3"

"github.com/gorilla/websocket"

"github.com/fsnotify/fsnotify"
"github.com/urfave/cli/v2"
"golang.org/x/xerrors"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion be1-go/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"popstellar/internal/crypto"
"popstellar/internal/network"
"popstellar/internal/network/socket"
"popstellar/internal/old/channel/lao"
"popstellar/internal/old/hub/standard_hub"
"popstellar/internal/old/oldchannel/lao"
"sync"
"testing"
"time"
Expand Down
3 changes: 1 addition & 2 deletions be1-go/cli/pop.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ package main

import (
"context"
"github.com/urfave/cli/v2"
"log"
"os"

"github.com/urfave/cli/v2"
)

func main() {
Expand Down
Loading

0 comments on commit 57c2ca0

Please sign in to comment.