Skip to content

Commit dc9f282

Browse files
committed
Add distributed signing
1 parent 1a9fc5e commit dc9f282

6 files changed

Lines changed: 840 additions & 168 deletions

File tree

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ DOCKER_TEST_CMD = docker run --rm \
2121
-e GOCACHE=/home/user/.cache/go-build \
2222
-e GOMODCACHE=/home/user/.go-mod-cache \
2323
-w /app \
24-
--add-host=signer-test01:127.0.0.1 \
25-
--add-host=signer-test02:127.0.0.1 \
26-
--add-host=signer-test03:127.0.0.1 \
27-
--add-host=signer-test04:127.0.0.1 \
28-
--add-host=signer-test05:127.0.0.1 \
24+
--add-host=signer-test01:0.0.0.0 \
25+
--add-host=signer-test02:0.0.0.0 \
26+
--add-host=signer-test03:0.0.0.0 \
27+
--add-host=signer-test04:0.0.0.0 \
28+
--add-host=signer-test05:0.0.0.0 \
2929
remote-signer-dirk-interop-dependencies go test $(_GO_TEST_FLAGS) ./...
3030

3131
.PHONY: build
Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,29 @@
1-
package test
1+
package dirkdaemon
22

33
import (
44
"context"
55
"fmt"
6-
"net"
76
"path/filepath"
87

9-
"github.com/attestantio/dirk/testing/daemon"
108
"github.com/attestantio/dirk/testing/logger"
9+
"github.com/jshufro/remote-signer-dirk-interop/test/dirkdaemon/proc"
1110
)
1211

13-
func getUnusedPort() (uint32, error) {
14-
listener, err := net.Listen("tcp", "localhost:0")
15-
if err != nil {
16-
return 0, fmt.Errorf("failed to get unused port: %w", err)
17-
}
18-
defer func() { _ = listener.Close() }()
19-
return uint32(listener.Addr().(*net.TCPAddr).Port), nil
12+
var ports = map[int]uint32{
13+
1: 34925,
14+
2: 33015,
15+
3: 42923,
16+
4: 46453,
17+
5: 41283,
2018
}
2119

2220
func StartDaemons(ctx context.Context, tmpdir string) (map[uint64]string, map[int]*logger.LogCapture, error) {
23-
portMap := make(map[int]uint32)
2421
logCaptureMap := make(map[int]*logger.LogCapture)
25-
for id := 1; id <= 5; id++ {
26-
port, err := getUnusedPort()
27-
if err != nil {
28-
return nil, nil, fmt.Errorf("failed to get unused port: %w", err)
29-
}
30-
portMap[id] = port
31-
}
3222
peerMap := make(map[uint64]string)
33-
for id, port := range portMap {
23+
for id, port := range ports {
3424
peerMap[uint64(id)] = fmt.Sprintf("signer-test%02d:%d", id, port)
3525
}
36-
for id, port := range portMap {
26+
for id, port := range ports {
3727
walletPath := filepath.Join(tmpdir, fmt.Sprintf("signer-test%02d", id))
3828
logCapture, err := newDirkDaemon(ctx, uint64(id), port, walletPath, peerMap)
3929
if err != nil {
@@ -45,7 +35,7 @@ func StartDaemons(ctx context.Context, tmpdir string) (map[uint64]string, map[in
4535
}
4636

4737
func newDirkDaemon(ctx context.Context, id uint64, port uint32, tmpdir string, peerMap map[uint64]string) (*logger.LogCapture, error) {
48-
logCapture, _, err := daemon.New(
38+
logCapture, _, err := proc.New(
4939
ctx,
5040
tmpdir,
5141
id,

0 commit comments

Comments
 (0)