Skip to content

Commit 38b2a64

Browse files
committed
Test 1
1 parent 6d77547 commit 38b2a64

File tree

9 files changed

+47
-24
lines changed

9 files changed

+47
-24
lines changed

Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ RUN apt-get update && \
5353
rm -rf /var/lib/apt/lists/*
5454

5555
# Set work directory for Node.js
56-
WORKDIR /app
56+
WORKDIR /rits
5757

5858
# Copy Node.js dependencies and install
5959
COPY package*.json ./
@@ -64,14 +64,18 @@ COPY . .
6464

6565
COPY federate-node-SNAPSHOT-7.1.0.0-all.jar /opt/federate-node.jar
6666

67-
RUN chmod +x /app/configure.sh
68-
RUN /app/configure.sh
67+
RUN chmod +x /rits/configure.sh
68+
RUN /rits/configure.sh
6969

70-
RUN tar xzf tcpsigner/bin/manager-tcp.tgz -C tcpsigner/bin
70+
RUN tar xzf /rits/tcpsigner/bin/manager-tcp.tgz -C /rits/tcpsigner/bin
7171

72-
RUN chmod +x tcpsigner/entrypoint.sh \
73-
&& chmod +x tcpsigner/bin/tcpsigner \
74-
&& chmod +x tcpsigner/bin/manager-tcp
72+
RUN chmod +x /rits/tcpsigner/entrypoint.sh \
73+
&& chmod +x /rits/tcpsigner/bin/tcpsigner \
74+
&& chmod +x /rits/tcpsigner/bin/manager-tcp
75+
76+
# Remove after debugging
77+
RUN apt-get update && apt-get install -y iproute2 && apt-get clean
78+
RUN apt update && apt install -y netcat-openbsd
7579

7680
# Default test command
7781
CMD ["npm", "run", "test-fail-fast"]

configure.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
cd config/node-keys
1+
chmod 400 config/node-keys/genesis-federation/fed1.key
2+
chmod 400 config/node-keys/genesis-federation/fed2.key
3+
chmod 400 config/node-keys/genesis-federation/fed3.key
24

3-
chmod 400 genesis-federation/fed1.key
4-
chmod 400 genesis-federation/fed2.key
5-
chmod 400 genesis-federation/fed3.key
5+
chmod 400 config/node-keys/second-federation/fed1.key
6+
chmod 400 config/node-keys/second-federation/fed2.key
7+
chmod 400 config/node-keys/second-federation/fed3.key
68

7-
chmod 400 second-federation/fed1.key
8-
chmod 400 second-federation/fed2.key
9-
chmod 400 second-federation/fed3.key
9+
chmod 400 config/node-keys/third-federation/fed1.key
10+
chmod 400 config/node-keys/third-federation/fed2.key
11+
chmod 400 config/node-keys/third-federation/fed3.key
1012

11-
chmod 400 third-federation/fed1.key
12-
chmod 400 third-federation/fed2.key
13-
chmod 400 third-federation/fed3.key
13+
tar xzf tcpsigner/bin/manager-tcp.tgz -C tcpsigner/bin/
14+
15+
chmod +x tcpsigner/entrypoint.sh
16+
chmod +x tcpsigner/bin/tcpsigner
17+
chmod +x tcpsigner/bin/manager-tcp

lib/tcpsigner-runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function startTcpsignerInstance(id, port, extraArgs = []) {
1717
return null;
1818
}
1919

20-
const scriptPath = path.resolve('../tcpsigner/entrypoint.sh');
20+
const scriptPath = path.resolve(__dirname, '../tcpsigner/entrypoint.sh');
2121
console.log('scriptPath: ', scriptPath);
2222
const args = [`-p${port}`, ...extraArgs];
2323

@@ -52,7 +52,7 @@ function stopTcpsignerInstance(id) {
5252
} catch (err) {
5353
console.error(`❌ Failed to stop instance "${id}":`, err.message);
5454
}
55-
55+
5656
}
5757

5858
/**

tcpsigner/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:bookworm-slim
1+
FROM ubuntu:24.04
22

33
RUN apt-get update && \
44
apt-get install -y procps libsecp256k1-dev && \

tcpsigner/bin/manager-tcp.tgz

311 KB
Binary file not shown.

tcpsigner/bin/tcpsigner

-63.2 KB
Binary file not shown.

tcpsigner/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ done
3131
TCP_SIGNER_PORT=$((PORT - 1))
3232

3333
# Start the TCPSigner
34-
"$DIR/bin/tcpsigner" $@ -p"$TCP_SIGNER_PORT" > ./tcpsigner.log 2>&1 &
34+
"$DIR/bin/tcpsigner" $@ -p"$TCP_SIGNER_PORT" &
3535

3636
# Wait for it to be up and running
37-
sleep 2
37+
sleep 5
3838

3939
# Start the manager for the TCPSigner
4040
"$DIR/bin/manager-tcp" -b0.0.0.0 -p$PORT -tp $TCP_SIGNER_PORT &

tcpsigner/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ DOCKNAME=tcpsigner-bundle
1515

1616
echo "The port $PORT"
1717

18-
docker build -t $DOCKNAME .
18+
docker buildx build --platform linux/amd64 -t $DOCKNAME .
1919

20-
docker run -ti --rm -p $PORT:$PORT $DOCKNAME ./entrypoint.sh -p$PORT $@
20+
docker run --platform linux/amd64 -ti --rm -p $PORT:$PORT $DOCKNAME ./entrypoint.sh -p$PORT $@

tests/00_00_01-sync.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,25 @@ const rskUtils = require('../lib/rsk-utils');
44
const { expect, assert } = require('chai');
55
const { getRskTransactionHelpers } = require('../lib/rsk-tx-helper-provider');
66

7+
const {
8+
startTcpsignerInstance,
9+
stopTcpsignerInstance,
10+
stopAllTcpsignerInstances,
11+
} = require('../lib/tcpsigner-runner');
12+
13+
714
const WAIT_IN_MILLISECONDS = 5000;
815

916
describe('Federators sync', () => {
1017

18+
before(async () => {
19+
20+
startTcpsignerInstance('federator1', 9991, ['-c0xf98c614b921913a70d36a68512e1bf3717a6ede3e05b9d1ab1fd8ba7bd0e9842', '--difficulty=0x03']);
21+
22+
startTcpsignerInstance('federator2', 9995, ['-c0xf98c614b921913a70d36a68512e1bf3717a6ede3e05b9d1ab1fd8ba7bd0e9843', '--difficulty=0x05']);
23+
24+
});
25+
1126
it('should sync all rsk federator nodes when one of them manually mines', async () => {
1227
try {
1328
await wait(WAIT_IN_MILLISECONDS);

0 commit comments

Comments
 (0)