Skip to content

Commit 9491350

Browse files
authored
Merge pull request #355 from dedis/memcoin_dvoting
Renaming memcoin to dvoting
2 parents 945200e + 2ac3767 commit 9491350

File tree

23 files changed

+124
-124
lines changed

23 files changed

+124
-124
lines changed

.github/workflows/go_memcoin_test.yml .github/workflows/go_dvoting_test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Memcoin (CLI+HTTP) Test
1+
name: Dvoting (CLI+HTTP) Test
22

33
on:
44
push:
@@ -29,17 +29,17 @@ jobs:
2929
- name: Create a private key
3030
run: crypto bls signer new --save private.key
3131

32-
- name: Install memcoin
32+
- name: Install dvoting
3333
run: make build
3434

3535
- name: Start 3 nodes
3636
run: |
37-
./memcoin --config /tmp/node1 start --port 2001 &
38-
./memcoin --config /tmp/node2 start --port 2002 &
39-
./memcoin --config /tmp/node3 start --port 2003 &
37+
./dvoting --config /tmp/node1 start --port 2001 &
38+
./dvoting --config /tmp/node2 start --port 2002 &
39+
./dvoting --config /tmp/node3 start --port 2003 &
4040
4141
- name: Run the setup
4242
run: ./setup.sh
4343

4444
- name: Run the scenario test
45-
run: ./memcoin --config /tmp/node1 e-voting scenarioTest
45+
run: ./dvoting --config /tmp/node1 e-voting scenarioTest

.github/workflows/go_scenario_test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Create a private key
2929
run: crypto bls signer new --save private.key
3030

31-
- name: Install memcoin
31+
- name: Install dvoting
3232
run: make build
3333

3434
- name: Start and setup 5 nodes

.github/workflows/releases.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
types: [published]
66

77
jobs:
8-
memcoin:
9-
name: release memcoin and .deb
8+
dvoting:
9+
name: release dvoting and .deb
1010
runs-on: ubuntu-latest
1111

1212
steps:
@@ -40,7 +40,7 @@ jobs:
4040
uses: softprops/action-gh-release@v1
4141
with:
4242
files: |
43-
memcoin-*
43+
dvoting-*
4444
deb-package/dist/*
4545
4646
backend:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ private.key
55
web/app/node_modules
66
.idea
77

8-
memcoin*
8+
dvoting*
99

1010
*.log
1111

Dockerfiles/Dockerfile.dela

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ RUN git clone https://github.com/dedis/dela.git
55
RUN git clone https://github.com/dedis/d-voting.git
66
WORKDIR /go/dela/cli/crypto
77
RUN go install
8-
WORKDIR /go/d-voting/cli/memcoin
8+
WORKDIR /go/d-voting/cli/dvoting
99
RUN go build
10-
ENV PATH=/go/dela/cli/crypto:/go/d-voting/cli/memcoin:${PATH}
10+
ENV PATH=/go/dela/cli/crypto:/go/d-voting/cli/dvoting:${PATH}
1111
WORKDIR /go
12-
ENTRYPOINT ["/bin/bash", "-c", "memcoin --config /data/node start --postinstall --proxyaddr :$PROXYPORT --proxykey $PROXYKEY --listen tcp://0.0.0.0:2000 --public http://$HOSTNAME:2000 --routing tree"]
12+
ENTRYPOINT ["/bin/bash", "-c", "dvoting --config /data/node start --postinstall --proxyaddr :$PROXYPORT --proxykey $PROXYKEY --listen tcp://0.0.0.0:2000 --public http://$HOSTNAME:2000 --routing tree"]
1313
CMD []

Dockerfiles/Dockerfile.dela.debug

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ RUN git clone https://github.com/dedis/dela.git
88
RUN git clone https://github.com/dedis/d-voting.git
99
WORKDIR /go/dela/cli/crypto
1010
RUN go install
11-
WORKDIR /go/d-voting/cli/memcoin
11+
WORKDIR /go/d-voting/cli/dvoting
1212

1313
RUN go build -gcflags="all=-N -l"
1414

15-
ENV PATH=/go/dela/cli/crypto:/go/d-voting/cli/memcoin:${PATH}
15+
ENV PATH=/go/dela/cli/crypto:/go/d-voting/cli/dvoting:${PATH}
1616
WORKDIR /go
17-
ENTRYPOINT ["/bin/bash", "-c", "dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /go/d-voting/cli/memcoin/memcoin -- --config /data/node start --postinstall --proxyaddr :$PROXYPORT --proxykey $PROXYKEY --listen tcp://0.0.0.0:2000 --public http://$HOSTNAME:2000 --routing tree"]
17+
ENTRYPOINT ["/bin/bash", "-c", "dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /go/d-voting/cli/dvoting/dvoting -- --config /data/node start --postinstall --proxyaddr :$PROXYPORT --proxykey $PROXYKEY --listen tcp://0.0.0.0:2000 --public http://$HOSTNAME:2000 --routing tree"]
1818
CMD []

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ test_integration:
2424
go test ./integration
2525

2626
build:
27-
go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o memcoin ./cli/memcoin
28-
GOOS=linux GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o memcoin-linux-amd64-$(versionFile) ./cli/memcoin
29-
GOOS=darwin GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o memcoin-darwin-amd64-$(versionFile) ./cli/memcoin
30-
GOOS=windows GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o memcoin-windows-amd64-$(versionFile) ./cli/memcoin
27+
go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting ./cli/dvoting
28+
GOOS=linux GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-linux-amd64-$(versionFile) ./cli/dvoting
29+
GOOS=darwin GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-darwin-amd64-$(versionFile) ./cli/dvoting
30+
GOOS=windows GOARCH=amd64 go build -ldflags="-X $(versionFlag) -X $(timeFlag)" -o dvoting-windows-amd64-$(versionFile) ./cli/dvoting
3131

3232
deb: build
3333
cd deb-package; ./build-deb.sh; cd ..

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
<a href="https://github.com/dedis/d-voting/actions/workflows/go_test.yml">
3030
<img src="https://github.com/dedis/d-voting/actions/workflows/go_test.yml/badge.svg">
3131
</a>
32-
<a href="https://github.com/dedis/d-voting/actions/workflows/go_memcoin_test.yml">
33-
<img src="https://github.com/dedis/d-voting/actions/workflows/go_memcoin_test.yml/badge.svg">
32+
<a href="https://github.com/dedis/d-voting/actions/workflows/go_dvoting_test.yml">
33+
<img src="https://github.com/dedis/d-voting/actions/workflows/go_dvoting_test.yml/badge.svg">
3434
</a>
3535
<a href="https://github.com/dedis/d-voting/actions/workflows/go_scenario_test.yml">
3636
<img src="https://github.com/dedis/d-voting/actions/workflows/go_scenario_test.yml/badge.svg">
@@ -277,7 +277,7 @@ results.
277277
.
278278
├── cli
279279
│ ├── cosipbftcontroller Custom initialization of the blockchain node
280-
│ ├── <b>memcoin</b> Build the node CLI
280+
│ ├── <b>dvoting</b> Build the node CLI
281281
│ └── postinstall Custom node CLI setup
282282
├── <b>contracts</b>
283283
│ └── <b>evoting</b> D-Voting smart contract
@@ -505,13 +505,13 @@ In three different terminal sessions, from the root folder:
505505
```sh
506506
pk=adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3
507507

508-
LLVL=info memcoin --config /tmp/node1 start --postinstall \
508+
LLVL=info dvoting --config /tmp/node1 start --postinstall \
509509
--promaddr :9100 --proxyaddr :9080 --proxykey $pk --listen tcp://0.0.0.0:2001 --public //localhost:2001
510510

511-
LLVL=info memcoin --config /tmp/node2 start --postinstall \
511+
LLVL=info dvoting --config /tmp/node2 start --postinstall \
512512
--promaddr :9101 --proxyaddr :9081 --proxykey $pk --listen tcp://0.0.0.0:2002 --public //localhost:2002
513513

514-
LLVL=info memcoin --config /tmp/node3 start --postinstall \
514+
LLVL=info dvoting --config /tmp/node3 start --postinstall \
515515
--promaddr :9102 --proxyaddr :9082 --proxykey $pk --listen tcp://0.0.0.0:2003 --public //localhost:2003
516516
```
517517

@@ -569,7 +569,7 @@ you can run a test scenario:
569569

570570
```sh
571571
sk=28912721dfd507e198b31602fb67824856eb5a674c021d49fdccbe52f0234409
572-
LLVL=info memcoin --config /tmp/node1 e-voting scenarioTest --secretkey $sk
572+
LLVL=info dvoting --config /tmp/node1 e-voting scenarioTest --secretkey $sk
573573
```
574574

575575
You can also run scenario_test.go, by running in the integration folder this
@@ -643,7 +643,7 @@ A d-Voting node exposes Prometheus metrics. You can start an HTTP server that
643643
serves those metrics with:
644644

645645
```sh
646-
./memcoin --config /tmp/node1 metrics start --addr 127.0.0.1:9100 --path /metrics
646+
./dvoting --config /tmp/node1 metrics start --addr 127.0.0.1:9100 --path /metrics
647647
```
648648

649649
Build info can be added to the binary with the `ldflags`, at build time. Infos
@@ -653,7 +653,7 @@ are stored on variables in the root `mod.go`. For example:
653653
versionFlag="github.com/dedis/d-voting.Version=`git describe --tags`"
654654
timeFlag="github.com/dedis/d-voting.BuildTime=`date +'%d/%m/%y_%H:%M'`"
655655

656-
go build -ldflags="-X $versionFlag -X $timeFlag" ./cli/memcoin
656+
go build -ldflags="-X $versionFlag -X $timeFlag" ./cli/dvoting
657657
```
658658

659659
Note that `make build` will do that for you.

cli/memcoin/mod.go cli/dvoting/mod.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
// Package main implements a ledger based on in-memory components.
1+
// Package main implements the dvoting backend
22
//
33
// Unix example:
44
//
5-
// # Expect GOPATH to be correctly set to have memcoin available.
5+
// # Expect GOPATH to be correctly set to have dvoting available.
66
// go install
77
//
8-
// memcoin --config /tmp/node1 start --port 2001 &
9-
// memcoin --config /tmp/node2 start --port 2002 &
10-
// memcoin --config /tmp/node3 start --port 2003 &
8+
// dvoting --config /tmp/node1 start --port 2001 &
9+
// dvoting --config /tmp/node2 start --port 2002 &
10+
// dvoting --config /tmp/node3 start --port 2003 &
1111
//
1212
// # Share the different certificates among the participants.
13-
// memcoin --config /tmp/node2 minogrpc join --address 127.0.0.1:2001\
14-
// $(memcoin --config /tmp/node1 minogrpc token)
15-
// memcoin --config /tmp/node3 minogrpc join --address 127.0.0.1:2001\
16-
// $(memcoin --config /tmp/node1 minogrpc token)
13+
// dvoting --config /tmp/node2 minogrpc join --address 127.0.0.1:2001\
14+
// $(dvoting --config /tmp/node1 minogrpc token)
15+
// dvoting --config /tmp/node3 minogrpc join --address 127.0.0.1:2001\
16+
// $(dvoting --config /tmp/node1 minogrpc token)
1717
//
1818
// # Create a chain with two members.
19-
// memcoin --config /tmp/node1 ordering setup\
20-
// --member $(memcoin --config /tmp/node1 ordering export)\
21-
// --member $(memcoin --config /tmp/node2 ordering export)
19+
// dvoting --config /tmp/node1 ordering setup\
20+
// --member $(dvoting --config /tmp/node1 ordering export)\
21+
// --member $(dvoting --config /tmp/node2 ordering export)
2222
//
2323
// # Add the third after the chain is set up.
24-
// memcoin --config /tmp/node1 ordering roster add\
25-
// --member $(memcoin --config /tmp/node3 ordering export)
24+
// dvoting --config /tmp/node1 ordering roster add\
25+
// --member $(dvoting --config /tmp/node3 ordering export)
2626
//
2727
package main
2828

cli/memcoin/mod_test.go cli/dvoting/mod_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ import (
1616
"github.com/stretchr/testify/require"
1717
)
1818

19-
func TestMemcoin_Main(t *testing.T) {
19+
func TestDvoting_Main(t *testing.T) {
2020
main()
2121
}
2222

2323
// This test creates a chain with initially 3 nodes. It then adds node 4 and 5
2424
// in two blocks. Node 4 does not share its certificate which means others won't
2525
// be able to communicate, but the chain should proceed because of the
2626
// threshold.
27-
func TestMemcoin_Scenario_SetupAndTransactions(t *testing.T) {
28-
dir, err := os.MkdirTemp(os.TempDir(), "memcoin1")
27+
func TestDvoting_Scenario_SetupAndTransactions(t *testing.T) {
28+
dir, err := os.MkdirTemp(os.TempDir(), "dvoting1")
2929
require.NoError(t, err)
3030

3131
defer os.RemoveAll(dir)
@@ -116,8 +116,8 @@ func TestMemcoin_Scenario_SetupAndTransactions(t *testing.T) {
116116
// finally restarts both of them to make sure the chain can proceed after the
117117
// restart. It basically tests if the components are correctly loaded from the
118118
// persisten storage.
119-
func TestMemcoin_Scenario_RestartNode(t *testing.T) {
120-
dir, err := os.MkdirTemp(os.TempDir(), "memcoin2")
119+
func TestDvoting_Scenario_RestartNode(t *testing.T) {
120+
dir, err := os.MkdirTemp(os.TempDir(), "dvoting2")
121121
require.NoError(t, err)
122122

123123
defer os.RemoveAll(dir)

contracts/evoting/controller/mod.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (m controller) SetCommands(builder node.Builder) {
2525
cmd := builder.SetCommand("e-voting")
2626
cmd.SetDescription("interact with the evoting service")
2727

28-
// memcoin --config /tmp/node1 e-voting \
28+
// dvoting --config /tmp/node1 e-voting \
2929
// registerHandlers --signer private.key
3030
sub := cmd.SetSubCommand("registerHandlers")
3131
sub.SetDescription("register the e-voting handlers on the default proxy")
@@ -38,7 +38,7 @@ func (m controller) SetCommands(builder node.Builder) {
3838
)
3939
sub.SetAction(builder.MakeAction(&RegisterAction{}))
4040

41-
// memcoin --config /tmp/node1 e-voting scenarioTest
41+
// dvoting --config /tmp/node1 e-voting scenarioTest
4242
sub = cmd.SetSubCommand("scenarioTest")
4343
sub.SetDescription("evoting scenario test")
4444
sub.SetFlags(

deb-package/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Check how a node is started in `pkg/opt/dedis/dvoting/bin/start-voting`. For
6969
example:
7070

7171
```sh
72-
LLVL=info ./memcoin-darwin-amd64-v0_4_5-alpha \
72+
LLVL=info ./dvoting-darwin-amd64-v0_4_5-alpha \
7373
--config /tmp/node8 \
7474
start \
7575
--postinstall \
@@ -115,7 +115,7 @@ credentials.
115115
Get the token and certificate (24h * 30 = 720):
116116

117117
```sh
118-
sudo memcoin --config /var/opt/dedis/dvoting/data/dela minogrpc token \
118+
sudo dvoting --config /var/opt/dedis/dvoting/data/dela minogrpc token \
119119
--expiration 720h
120120
```
121121

@@ -133,7 +133,7 @@ that the certificates are stored in the DB, which means that this operation must
133133
be re-done in case the DB is reset.
134134

135135
```sh
136-
sudo memcoin --config /var/opt/dedis/dvoting/data/dela minogrpc join \
136+
sudo dvoting --config /var/opt/dedis/dvoting/data/dela minogrpc join \
137137
--address <MASTER NODE ADDRESS> --token <TOKEN> --cert-hash <CERT HASH>
138138
```
139139

@@ -144,7 +144,7 @@ Example of `<MASTER NODE ADDRESS>`: `'//172.16.253.150:9000'`
144144
First get the address of all nodes by running:
145145

146146
```sh
147-
sudo memcoin --config /var/opt/dedis/dvoting/data/dela ordering export
147+
sudo dvoting --config /var/opt/dedis/dvoting/data/dela ordering export
148148
```
149149

150150
This will yield a base64 encoded string `<ADDRESS>:<PUB KEY>`.
@@ -156,7 +156,7 @@ From the first node.
156156
Include ALL nodes, the first and all other nodes.
157157

158158
```sh
159-
sudo memcoin --config /var/opt/dedis/dvoting/data/dela ordering setup \
159+
sudo dvoting --config /var/opt/dedis/dvoting/data/dela ordering setup \
160160
--member <RESULT FROM ordering export>\
161161
--member <...>
162162
...
@@ -168,7 +168,7 @@ To be done on each node.
168168

169169
```sh
170170
PK=<> # taken from the "ordering export", the part after ":"
171-
sudo memcoin --config /var/opt/dedis/dvoting/data/dela pool add \
171+
sudo dvoting --config /var/opt/dedis/dvoting/data/dela pool add \
172172
--key $keypath \
173173
--args go.dedis.ch/dela.ContractArg --args go.dedis.ch/dela.Access \
174174
--args access:grant_id --args 0300000000000000000000000000000000000000000000000000000000000000 \

deb-package/build-deb.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mkdir -p $INSTALL_DIR
1212
GITVERSION=$(git describe --abbrev=0 --tags || echo '0.0.0')
1313
VERSION=${GITVERSION:1}
1414

15-
cp ../memcoin $INSTALL_DIR/
15+
cp ../dvoting $INSTALL_DIR/
1616

1717
# add config files
1818
cp -a pkg/etc deb

deb-package/pkg/after-install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ DVOTING_SERVICE=dvoting.service
2828
enable_service ${DVOTING_SERVICE}
2929
systemctl start ${DVOTING_SERVICE}
3030

31-
ln -s /opt/dedis/dvoting/bin/memcoin /usr/bin/memcoin
31+
ln -s /opt/dedis/dvoting/bin/dvoting /usr/bin/dvoting

deb-package/pkg/before-remove.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# stop service
44
systemctl stop dvoting.service
55

6-
rm -f /usr/bin/memcoin
6+
rm -f /usr/bin/dvoting

deb-package/pkg/opt/dedis/dvoting/config/config.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# This file should not be updated unless for very specific use cases.
44
# For user configuration see /etc/dedis/dvoting
55
#
6-
export dela_bin="/opt/dedis/dvoting/bin/memcoin"
6+
export dela_bin="/opt/dedis/dvoting/bin/dvoting"
77
export dela_data="/var/opt/dedis/dvoting/data/dela"

integration/nodes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func restartNode(nodeNub int, t *testing.T) {
103103
err = cmd.Run()
104104
require.NoError(t, err)
105105

106-
cmd = exec.Command("bash", "-c", fmt.Sprintf("docker exec -d node%v memcoin --config /tmp/node%v start --postinstall --promaddr :9100 --proxyaddr :9080 --proxykey adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3 --listen tcp://0.0.0.0:2001 --public //172.18.0.%v:2001", nodeNub, nodeNub, nodeNub+1))
106+
cmd = exec.Command("bash", "-c", fmt.Sprintf("docker exec -d node%v dvoting --config /tmp/node%v start --postinstall --promaddr :9100 --proxyaddr :9080 --proxykey adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3 --listen tcp://0.0.0.0:2001 --public //172.18.0.%v:2001", nodeNub, nodeNub, nodeNub+1))
107107
err = cmd.Run()
108108
require.NoError(t, err)
109109
}

0 commit comments

Comments
 (0)