Skip to content

10.1.4 base test with fixes #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compose/Dockerfile.compiled
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
# Install packages required in main stage
RUN apt update && \
apt install -y --no-install-recommends \
curl \
dnsutils \
iproute2 \
iputils-ping \
Expand All @@ -106,6 +107,7 @@ RUN apt update && \
netcat-openbsd \
openssl \
procps \
sudo \
tcpdump \
telnet \
vim
Expand All @@ -118,6 +120,10 @@ COPY --from=build --chown=root:root /usr/local/bin/cardano-node /usr/local/bin/c
RUN groupadd --gid 10000 cardano && \
useradd --comment 'cardano' --create-home --gid 10000 --password '!' --shell '/bin/bash' --uid 10000 cardano

# Add cardano to sudoers. Needed for tcpdump in Antithesis environment.
RUN echo 'cardano ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cardano && \
chmod 0440 /etc/sudoers.d/cardano

# Create cardano-node directories
RUN install --directory --owner=root --group=root --mode=0755 /opt/cardano-node && \
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/config && \
Expand Down
22 changes: 22 additions & 0 deletions compose/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ RUN git fetch --all --recurse-submodules --tags && \
RUN echo "package *\n\
ghc-options: +RTS -A128m -n2m -RTS\n\
\n\
package ouroboros-network\n\
flags: +reseed\n\
ghc-options: -fno-ignore-asserts\n\
\n\
package ouroboros-network-framework\n\
ghc-options: -fno-ignore-asserts\n\
\n\
package ouroboros-network-api\n\
ghc-options: -fno-ignore-asserts\n\
\n\
package ouroboros-network-protocols\n\
ghc-options: -fno-ignore-asserts\n\
\n\
package network-mux\n\
ghc-options: -fno-ignore-asserts\n\
\n\
jobs: \$ncpus\n\
semaphore: True" > /usr/local/src/cardano-node/cabal.project.local

Expand Down Expand Up @@ -206,6 +222,7 @@ RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
# Install packages required in main stage
RUN apt update && \
apt install -y --no-install-recommends \
curl \
dnsutils \
iproute2 \
iputils-ping \
Expand All @@ -216,6 +233,7 @@ RUN apt update && \
netcat-openbsd \
openssl \
procps \
sudo \
tcpdump \
telnet \
vim
Expand All @@ -240,6 +258,10 @@ COPY --from=build --chown=root:root /usr/local/bin/cardano-node /usr/local/bin/c
RUN groupadd --gid 10000 cardano && \
useradd --comment 'cardano' --create-home --gid 10000 --password '!' --shell '/bin/bash' --uid 10000 cardano

# Add cardano to sudoers. Needed for tcpdump in Antithesis environment.
RUN echo 'cardano ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cardano && \
chmod 0440 /etc/sudoers.d/cardano

# Create cardano-node directories
RUN install --directory --owner=root --group=root --mode=0755 /opt/cardano-node && \
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/config && \
Expand Down
18 changes: 11 additions & 7 deletions compose/cardano-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ main() {
assemble_command
"${cmd[@]}"
exit_code=$?
if [ ${exit_code} -eq 1 ]; then
echo "exit code: 0"
exit 0
else
echo "exit code: ${exit_code}"
exit ${?}
fi

# XXX Depends on cardano-node hack.
echo "exit code: ${exit_code}"
exit ${exit_code}
# if [ ${exit_code} -eq 1 ]; then
# echo "exit code: 0"
# exit 0
# else
# echo "exit code: ${exit_code}"
# exit ${exit_code}
# fi
}

main
11 changes: 9 additions & 2 deletions compose/sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
# Install packages required in main stage
RUN apt update && \
apt install -y --no-install-recommends \
curl \
dnsutils \
iproute2 \
iputils-ping \
Expand All @@ -61,6 +62,7 @@ RUN apt update && \
netcat-openbsd \
openssl \
procps \
sudo \
tcpdump \
telnet \
vim
Expand All @@ -72,11 +74,16 @@ COPY --from=build --chown=root:root /usr/local/bin/cardano-cli /usr/local/bin/ca
RUN groupadd --gid 10000 cardano && \
useradd --comment 'cardano' --create-home --gid 10000 --password '!' --shell '/bin/bash' --uid 10000 cardano

# Add cardano to sudoers. Needed for tcpdump in Antithesis environment.
RUN echo 'cardano ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cardano && \
chmod 0440 /etc/sudoers.d/cardano

# Create Antithesis directory
RUN install --directory --owner=cardano --group=cardano --mode=0750 /opt/antithesis/test/v1
RUN install --directory --owner=cardano --group=cardano --mode=0750 /opt/antithesis/test/v1/convergence

# Copy Antithesis scripts
COPY composer /opt/antithesis/test/v1/
COPY composer/convergence/eventually_converged.sh /opt/antithesis/test/v1/convergence
COPY composer/convergence/serial_driver_sleep.sh /opt/antithesis/test/v1/convergence
RUN chmod 0755 /opt/antithesis/test/v1/*/*

# Copy sidecar.sh
Expand Down
8 changes: 5 additions & 3 deletions compose/sidecar/composer/convergence/eventually_converged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ validate_block_hash() {
# Fetch hashes in parallel
for i in $(seq 1 "${POOLS}"); do
(
timeout 10 cardano-cli ping -j --magic 42 --host p${i}.example --port ${PORT} --tip --quiet -c1 | jq -r '.tip[0].hash + " " + (.tip[0].blockNo|tostring) + " " + (.tip[0].slotNo|tostring)' >"$temp_dir/hash_${i}"
cardano-cli ping -j --magic 42 --host p${i}.example --port ${PORT} --tip --quiet -c1 | jq -r '.tip[0].hash + " " + (.tip[0].blockNo|tostring) + " " + (.tip[0].slotNo|tostring)' >"$temp_dir/hash_${i}"
) &
pids+=($!)
done

# Wait for all processes and handle errors
for pid in "${pids[@]}"; do
for (( i=0; i < ${#pids[@]}; i++ )); do
pid=${pids[$i]}
if ! wait "$pid"; then
echo "Error: Process $pid failed" >&2
j=$(( i + 1 ))
echo "Error: Host p${j}.example failed" >&2
status=2
fi
done
Expand Down
14 changes: 14 additions & 0 deletions compose/testnets/karknu_10.1.4_sigterm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Description

Plain old 10.4.1, with random number generation adaptions for Antithesis and
clean exit hack for SIGTERM.

## Cardano-Node

- **Version**: 10.1.4
- **Branch**: karknu/10_1_4_anthithesis_sigterm
- **Source/Compiled**: Source

## Testnet

- **Pools**: 3
64 changes: 64 additions & 0 deletions compose/testnets/karknu_10.1.4_sigterm/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---

x-base: &base
image: ${registry}${testnet}:latest
restart: on-failure
build:
context: "../../"
dockerfile: "Dockerfile.source"
args:
CARDANO_NODE_REF: "karknu/10_1_4_anthithesis_sigterm"

x-env: &env
POOL_ID: "0" # Placeholder required for override

services:
p1:
<<: *base
container_name: p1
hostname: p1.example
volumes:
- p1:/opt/cardano-node/data
ports:
- "3001:3001"
environment:
<<: *env
POOL_ID: "1"

p2:
<<: *base
container_name: p2
hostname: p2.example
volumes:
- p2:/opt/cardano-node/data
ports:
- "3002:3001"
environment:
<<: *env
POOL_ID: "2"
PEER_SHARING: "false"

p3:
<<: *base
container_name: p3
hostname: p3.example
volumes:
- p3:/opt/cardano-node/data
ports:
- "3003:3001"
environment:
<<: *env
POOL_ID: "3"

s1:
image: ${registry}${testnet}_sidecar:latest
restart: on-failure
container_name: s1
hostname: s1.example
environment:
POOLS: "3"

volumes:
p1:
p2:
p3:
71 changes: 71 additions & 0 deletions compose/testnets/karknu_10.1.4_sigterm/testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
--- # Required Testnet Parameters
poolCount: 3
poolCost: 340000000
poolMargin: 0.0
poolPledge: 0
delegatedSupply: 600000000000000
systemStart: 'now'
systemStartDelay: 5
networkMagic: 42
testnetDomain: example

--- # Optional Byron Genesis Overide
protocolConsts:
k: 432

--- # Optional Shelley Genesis Overide
epochLength: 86400
securityParam: 432
maxLovelaceSupply: 45000000000000000
protocolParams:
decentralisationParam: 0
protocolVersion:
major: 10
minor: 0

--- # Optional Alonzo Genesis Overide

--- # Optional Conway Genesis Overide

--- # Optional Node Config Overide
ExperimentalHardForksEnabled: true
ExperimentalProtocolsEnabled: true
LastKnownBlockVersion-Alt: 0
LastKnownBlockVersion-Major: 6
LastKnownBlockVersion-Minor: 0
MaxConcurrencyBulkSync: 2
MaxConcurrencyDeadline: 4
MaxKnownMajorProtocolVersion: 2
PeerSharing: true
TargetNumberOfActiveBigLedgerPeers: 2
TargetNumberOfActivePeers: 3
TargetNumberOfEstablishedBigLedgerPeers: 3
TargetNumberOfEstablishedPeers: 3
TargetNumberOfKnownBigLedgerPeers: 10
TargetNumberOfKnownPeers: 30
TargetNumberOfRootPeers: 10
TestAllegraHardForkAtEpoch: 0
TestAlonzoHardForkAtEpoch: 0
TestBabbageHardForkAtEpoch: 0
TestConwayHardForkAtEpoch: 0
TestMaryHardForkAtEpoch: 0
TestShelleyHardForkAtEpoch: 0
TraceConnectionManager: true
TraceConnectionManagerTransitions: false
TraceDNSResolver: false
TraceDNSSubscription: false
TraceDebugPeerSelection: false
TraceForge: false
TraceForgeStateInfo: false
TraceHandshake: false
TraceInboundGovernor: true
TraceIpSubscription: false
TraceLedgerPeers: false
TraceLocalConnectionManager: false
TraceLocalHandshake: false
TraceLocalRootPeers: false
TracePeerSelection: true
TracePeerSelectionActions: false
TracePublicRootPeers: false
TraceServer: true
TurnOnLogMetrics: false