Skip to content

Commit 3d257c2

Browse files
authored
Fix: Ignore duplicated messages of already forgotten messages (#692)
* fix: ignore message confirmations in case that the message was already forgotten * fix: lint issues * feat: specific error code FORGOTTEN_DUPLICATE
1 parent ce18701 commit 3d257c2

File tree

14 files changed

+767
-21
lines changed

14 files changed

+767
-21
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ MANIFEST
5555
venv*/
5656

5757
# User configuration with secrets
58-
config.yml
58+
/config.yml
5959
node-secret.key

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ MANIFEST
5454
venv*/
5555

5656
# Secret files
57-
config.yml
57+
/config.yml
5858
node-secret.key
5959
keys/
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
FROM ubuntu:22.04 as base
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN apt-get update && apt-get -y upgrade && apt-get install -y software-properties-common
6+
RUN add-apt-repository -y ppa:deadsnakes/ppa
7+
8+
# Runtime + build packages
9+
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
10+
git \
11+
libgmp-dev \
12+
libpq5 \
13+
python3.12
14+
15+
FROM base as builder
16+
17+
RUN openssl version
18+
RUN cat /etc/ssl/openssl.cnf
19+
RUN echo "$OPENSSL_CONF"
20+
21+
# Build-only packages
22+
RUN apt-get update && apt-get install -y \
23+
build-essential \
24+
curl \
25+
pkg-config \
26+
python3.12-dev \
27+
python3.12-venv \
28+
libpq-dev \
29+
software-properties-common
30+
31+
# Install Rust to build Python packages
32+
RUN curl https://sh.rustup.rs > rustup-installer.sh
33+
RUN sh rustup-installer.sh -y
34+
ENV PATH="/root/.cargo/bin:${PATH}"
35+
36+
# Some packages (py-ed25519-bindings, required by substrate-interface) need the nightly
37+
# Rust toolchain to be built at this time
38+
RUN rustup default nightly
39+
40+
# Create virtualenv
41+
RUN python3.12 -m venv /opt/venv
42+
43+
# Install pip
44+
ENV PIP_NO_CACHE_DIR yes
45+
RUN /opt/venv/bin/python3.12 -m pip install --upgrade pip wheel
46+
ENV PATH="/opt/venv/bin:${PATH}"
47+
48+
WORKDIR /opt/pyaleph
49+
COPY alembic.ini pyproject.toml ./
50+
COPY LICENSE.txt README.md ./
51+
COPY deployment/migrations ./deployment/migrations
52+
COPY deployment/scripts ./deployment/scripts
53+
COPY .git ./.git
54+
COPY src ./src
55+
56+
RUN pip install -e .[linting]
57+
RUN pip install hatch
58+
59+
FROM base
60+
61+
COPY --from=builder /opt/venv /opt/venv
62+
COPY --from=builder /opt/pyaleph /opt/pyaleph
63+
64+
RUN apt-get update && apt-get install -y \
65+
libsodium23 \
66+
libsodium-dev \
67+
libgmp-dev
68+
69+
# OpenSSL 3 disabled some hash algorithms by default. They must be reenabled
70+
# by enabling the "legacy" providers in /etc/ssl/openssl.cnf.
71+
COPY ./deployment/docker-build/openssl.cnf.patch /etc/ssl/openssl.cnf.patch
72+
RUN patch /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.patch
73+
74+
RUN mkdir /var/lib/pyaleph
75+
76+
ENV PATH="/opt/venv/bin:${PATH}"
77+
WORKDIR /opt/pyaleph
78+
79+
RUN hatch build
80+
ENTRYPOINT ["bash", "deployment/scripts/run_aleph_ccn.sh"]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
nuls2:
3+
chain_id: 1
4+
enabled: false
5+
packing_node: false
6+
sync_address: NULSd6HgUkssMi6oSjwEn3puNSijLKnyiRV7H
7+
api_url: https://apiserver.nuls.io/
8+
explorer_url: https://nuls.world/
9+
token_contract: NULSd6Hh1FjbnAktH1FFvFnTzfgFnZtgAhYut
10+
11+
12+
ethereum:
13+
enabled: true
14+
# api_url: {{ ALEPH_ETHEREUM_URL }}
15+
chain_id: 1
16+
packing_node: false
17+
sync_contract: "0x166fd4299364B21c7567e163d85D78d2fb2f8Ad5"
18+
start_height: 21614811
19+
token_contract: "0x27702a26126e0B3702af63Ee09aC4d1A084EF628"
20+
token_start_height: 21614792
21+
22+
23+
postgres:
24+
host: postgres
25+
port: 5432
26+
user: aleph
27+
password: decentralize-everything
28+
name: aleph-test
29+
30+
31+
storage:
32+
store_files: true
33+
engine: filesystem
34+
folder: /var/lib/pyaleph
35+
36+
37+
ipfs:
38+
enabled: true
39+
host: ipfs
40+
port: 5001
41+
gateway_port: 8080
42+
43+
44+
aleph:
45+
queue_topic: ALEPH-TEST
46+
47+
48+
p2p:
49+
daemon_host: p2p-service
50+
http_port: 4024
51+
port: 4025
52+
control_port: 4030
53+
listen_port: 4031
54+
reconnect_delay: 60
55+
56+
57+
rabbitmq:
58+
host: rabbitmq
59+
port: 5672
60+
username: aleph-p2p
61+
password: decentralize-everything
62+
63+
64+
sentry:
65+
dsn: ""
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
3+
volumes:
4+
pyaleph-ipfs:
5+
pyaleph-local-storage:
6+
pyaleph-postgres:
7+
8+
9+
services:
10+
pyaleph:
11+
# platform: linux/amd64
12+
restart: always
13+
# image: alephim/pyaleph-node:0.5.8
14+
image: localhost/alephim/pyaleph-node-dev:build
15+
build:
16+
dockerfile: ./deployment/docker-build/dev/Dockerfile
17+
context: ../../..
18+
command: --config /opt/pyaleph/config.yml --key-dir /opt/pyaleph/keys -v
19+
volumes:
20+
- pyaleph-local-storage:/var/lib/pyaleph
21+
- ./config.yml:/opt/pyaleph/config.yml
22+
- ./keys:/opt/pyaleph/keys
23+
- ../../..:/opt/pyaleph
24+
depends_on:
25+
- postgres
26+
- ipfs
27+
- p2p-service
28+
- redis
29+
networks:
30+
- pyaleph
31+
logging:
32+
options:
33+
max-size: 50m
34+
35+
pyaleph-api:
36+
# platform: linux/amd64
37+
restart: always
38+
# image: alephim/pyaleph-node:0.5.8
39+
image: localhost/alephim/pyaleph-node:build
40+
build:
41+
dockerfile: ./deployment/docker-build/dev/Dockerfile
42+
context: ../../..
43+
command: --config /opt/pyaleph/config.yml --key-dir /opt/pyaleph/keys -v
44+
entrypoint: ["bash", "deployment/scripts/run_aleph_ccn_api.sh"]
45+
ports:
46+
- "4024:4024/tcp"
47+
volumes:
48+
- pyaleph-local-storage:/var/lib/pyaleph
49+
- ./config.yml:/opt/pyaleph/config.yml
50+
- ../../..:/opt/pyaleph
51+
environment:
52+
CCN_CONFIG_API_PORT: 4024
53+
CCN_CONFIG_API_NB_WORKERS: 8
54+
depends_on:
55+
- pyaleph
56+
networks:
57+
- pyaleph
58+
logging:
59+
options:
60+
max-size: 50m
61+
62+
p2p-service:
63+
restart: always
64+
image: alephim/p2p-service:0.1.3
65+
networks:
66+
- pyaleph
67+
volumes:
68+
- ./config.yml:/etc/p2p-service/config.yml
69+
- ./keys/node-secret.pkcs8.der:/etc/p2p-service/node-secret.pkcs8.der
70+
depends_on:
71+
- rabbitmq
72+
environment:
73+
RUST_LOG: info
74+
ports:
75+
- "4025:4025"
76+
- "127.0.0.1:4030:4030"
77+
command:
78+
- "--config"
79+
- "/etc/p2p-service/config.yml"
80+
- "--private-key-file"
81+
- "/etc/p2p-service/node-secret.pkcs8.der"
82+
83+
postgres:
84+
restart: always
85+
image: postgres:15.1
86+
ports:
87+
- "127.0.0.1:5432:5432"
88+
volumes:
89+
- pyaleph-postgres:/var/lib/postgresql/data
90+
environment:
91+
POSTGRES_USER: aleph
92+
POSTGRES_PASSWORD: decentralize-everything
93+
POSTGRES_DB: aleph
94+
networks:
95+
- pyaleph
96+
shm_size: "2gb"
97+
98+
rabbitmq:
99+
restart: always
100+
image: rabbitmq:3.11.15-management
101+
networks:
102+
- pyaleph
103+
environment:
104+
RABBITMQ_DEFAULT_USER: aleph-p2p
105+
RABBITMQ_DEFAULT_PASS: decentralize-everything
106+
ports:
107+
- "127.0.0.1:5672:5672"
108+
- "127.0.0.1:15672:15672"
109+
110+
redis:
111+
restart: always
112+
image: redis:7.0.10
113+
networks:
114+
- pyaleph
115+
116+
ipfs:
117+
restart: always
118+
image: ipfs/kubo:v0.15.0
119+
ports:
120+
- "4001:4001"
121+
- "4001:4001/udp"
122+
- "127.0.0.1:5001:5001"
123+
volumes:
124+
- "pyaleph-ipfs:/data/ipfs"
125+
environment:
126+
- IPFS_PROFILE=server
127+
networks:
128+
- pyaleph
129+
command: ["daemon", "--enable-pubsub-experiment", "--migrate"]
130+
131+
132+
networks:
133+
pyaleph:
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
FROM ubuntu:22.04
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN apt-get update && apt-get -y upgrade && apt-get install -y software-properties-common
6+
RUN add-apt-repository -y ppa:deadsnakes/ppa
7+
8+
# Runtime + build packages
9+
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
10+
git \
11+
libgmp-dev \
12+
libpq5 \
13+
python3.12
14+
15+
RUN openssl version
16+
RUN cat /etc/ssl/openssl.cnf
17+
RUN echo "$OPENSSL_CONF"
18+
19+
# Build-only packages
20+
RUN apt-get update && apt-get install -y \
21+
build-essential \
22+
curl \
23+
pkg-config \
24+
python3.12-dev \
25+
python3.12-venv \
26+
libpq-dev \
27+
software-properties-common
28+
29+
# Install Rust to build Python packages
30+
RUN curl https://sh.rustup.rs > rustup-installer.sh
31+
RUN sh rustup-installer.sh -y
32+
ENV PATH="/root/.cargo/bin:${PATH}"
33+
34+
# Some packages (py-ed25519-bindings, required by substrate-interface) need the nightly
35+
# Rust toolchain to be built at this time
36+
RUN rustup default nightly
37+
38+
# Create virtualenv
39+
RUN python3.12 -m venv /opt/venv
40+
41+
# Install pip
42+
ENV PIP_NO_CACHE_DIR yes
43+
RUN /opt/venv/bin/python3.12 -m pip install --upgrade pip wheel
44+
ENV PATH="/opt/venv/bin:${PATH}"
45+
46+
WORKDIR /opt/pyaleph
47+
COPY alembic.ini pyproject.toml ./
48+
COPY LICENSE.txt README.md ./
49+
COPY deployment/migrations ./deployment/migrations
50+
COPY deployment/scripts ./deployment/scripts
51+
COPY .git ./.git
52+
COPY src ./src
53+
54+
# Install project deps and test deps
55+
RUN pip install -e .[testing,docs]
56+
RUN pip install hatch
57+
58+
# Install project test deps
59+
RUN apt-get update && apt-get install -y \
60+
libsodium23 \
61+
libsodium-dev \
62+
libgmp-dev \
63+
postgresql \
64+
redis \
65+
curl
66+
67+
# OpenSSL 3 disabled some hash algorithms by default. They must be reenabled
68+
# by enabling the "legacy" providers in /etc/ssl/openssl.cnf.
69+
COPY ./deployment/docker-build/openssl.cnf.patch /etc/ssl/openssl.cnf.patch
70+
RUN patch /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.patch
71+
72+
RUN mkdir /var/lib/pyaleph
73+
ENV PATH="/opt/venv/bin:${PATH}"
74+
WORKDIR /opt/pyaleph
75+
76+
RUN hatch build
77+
CMD ["hatch", "run", "testing:test"]
78+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
postgres:
3+
host: postgres
4+
port: 5432
5+
user: aleph
6+
password: decentralize-everything
7+
database: aleph
8+
9+
10+
redis:
11+
host: redis
12+
port: 6379

0 commit comments

Comments
 (0)