Skip to content
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

Remove fog local network test #3799

Merged
merged 1 commit into from
Dec 14, 2023
Merged
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
208 changes: 7 additions & 201 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ jobs:

strategy:
matrix:
num_runners: [2]
runner_index: [1, 2]
num_runners: [4]
runner_index: [1, 2, 3, 4]
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved
# Run each shard to completion.
fail-fast: false
env:
Expand Down Expand Up @@ -359,204 +359,10 @@ jobs:
- name: Check dirty git
uses: ./.github/actions/check-dirty-git


fog-local-network-tests:
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved
runs-on: [self-hosted, Linux, large]
container: mobilecoin/builder-install:v0.0.32

services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3'
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Build and generate sample data
run: |
# Generate enclave signing key
openssl genrsa -out Enclave_private.pem -3 3072
export CONSENSUS_ENCLAVE_PRIVKEY="$PWD/Enclave_private.pem"
export INGEST_ENCLAVE_PRIVKEY="$PWD/Enclave_private.pem"
export LEDGER_ENCLAVE_PRIVKEY="$PWD/Enclave_private.pem"
export VIEW_ENCLAVE_PRIVKEY="$PWD/Enclave_private.pem"
export MC_LOG=debug

# Build binaries
cargo build \
-p mc-admin-http-gateway \
-p mc-consensus-mint-client \
-p mc-consensus-service \
-p mc-consensus-tool \
-p mc-crypto-x509-test-vectors \
-p mc-fog-distribution \
-p mc-fog-ingest-client \
-p mc-fog-ingest-server \
-p mc-fog-ledger-server \
-p mc-fog-report-server \
-p mc-fog-sql-recovery-db \
-p mc-fog-test-client \
-p mc-fog-view-server \
-p mc-ledger-distribution \
-p mc-mobilecoind \
-p mc-mobilecoind-dev-faucet \
-p mc-util-generate-sample-ledger \
-p mc-util-grpc-admin-tool \
-p mc-util-keyfile \
-p mc-util-seeded-ed25519-key-gen \
--release

BIN_DIR="$PWD/target/release"

# Run in temp dir to appease check-dirty-git.
mkdir -p /tmp/fog-local-network
cd /tmp/fog-local-network

# Generate sample keys and ledger.
FOG_AUTHORITY_ROOT=$("$BIN_DIR/mc-crypto-x509-test-vectors" --type=chain --test-name=ok_rsa_head)
"$BIN_DIR/sample-keys" --num 10 --seed=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
"$BIN_DIR/generate-sample-ledger" --txs 100

# Generate sample Fog keys.
"$BIN_DIR/sample-keys" --num 4 --output-dir fog_keys --fog-report-url 'insecure-fog://localhost:6200' --fog-authority-root "$FOG_AUTHORITY_ROOT"

- name: Run local network
env:
PGHOST: postgres
PGUSER: postgres
run: |
BIN_DIR="$PWD/target/release"
SCRIPT_DIR="$PWD/tools/fog-local-network"
export MC_CHAIN_ID="local"
export MC_LOG=info
# This is needed since we want to capture the output of mc-consensus-tool, and we can't have the
# logs getting in the way.
export MC_LOG_STDERR=1

cd /tmp/fog-local-network
export LEDGER_BASE="$PWD/ledger"

# Run local network in background.
MC_LOG="info,rustls=warn,hyper=warn,tokio_reactor=warn,mio=warn,want=warn,rusoto_core=error,h2=error,reqwest=error,rocket=error,<unknown>=error" \
python3 "$SCRIPT_DIR/fog_local_network.py" --network-type dense5 --skip-build &

# Give it time to spin up
for PORT in 3200 3201 3202 3203 3204 4444; do
for _unused in $(seq 0 60); do
if ss -l | grep -q ":$PORT"; then break; else sleep 1; fi;
done
done

# Save some typing
export MC_PEER="insecure-mc://localhost:3200/,insecure-mc://localhost:3201/,insecure-mc://localhost:3202/,insecure-mc://localhost:3203/,insecure-mc://localhost:3204/"

# Run fog-distribution client to exercise Fog
echo "Running fog distro"
"$BIN_DIR/fog-distribution" \
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved
--sample-data-dir . \
--max-threads 1 \
--num-tx-to-send 10

# Give it time to quiet down
"$BIN_DIR/mc-consensus-tool" wait-for-quiet

# Run test-client
echo "Running test client"
"$BIN_DIR/test_client" \
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved
--consensus insecure-mc://localhost:3200/ \
--consensus insecure-mc://localhost:3201/ \
--consensus insecure-mc://localhost:3202/ \
--consensus insecure-mc://localhost:3203/ \
--consensus insecure-mc://localhost:3204/ \
--num-clients 4 \
--num-transactions 40 \
--consensus-wait 300 \
--transfer-amount 20 \
--fog-view insecure-fog-view://localhost:8200 \
--fog-ledger insecure-fog-ledger://localhost:8200 \
--key-dir "$PWD/fog_keys"

PRE_AUTH_BLOCK_INDEX=$("$BIN_DIR/mc-consensus-tool" wait-for-quiet)

# Authorize minters
echo "Authorizing minters"
python3 "$SCRIPT_DIR/../local-network/authorize-minters.py"

PRE_MINT_BLOCK_INDEX=$("$BIN_DIR/mc-consensus-tool" wait-for-quiet --beyond-block="$PRE_AUTH_BLOCK_INDEX")
echo "Done waiting, PRE_MINT_BLOCK_INDEX=${PRE_MINT_BLOCK_INDEX}"

# Mint 1 million token1's to the first 4 fog accounts
echo "Minting"
for ACCOUNT_NUM in $(seq 0 3); do
"$BIN_DIR/mc-consensus-mint-client" \
"generate-and-submit-mint-tx" \
--node insecure-mc://localhost:3200/ \
--signing-key "$BIN_DIR/mc-local-network/minting-keys/minter1" \
--recipient "$(cat "fog_keys/account_keys_${ACCOUNT_NUM}.b58pub")" \
--fog-ingest-enclave-css "$BIN_DIR/ingest-enclave.css" \
--token-id 1 \
--amount 1000000
done

"$BIN_DIR/mc-consensus-tool" wait-for-quiet --beyond-block="$PRE_MINT_BLOCK_INDEX"

# Run test-client
echo "Running test client (tokens 0 and 1)"
"$BIN_DIR/test_client" \
--consensus insecure-mc://localhost:3200/ \
--consensus insecure-mc://localhost:3201/ \
--consensus insecure-mc://localhost:3202/ \
--consensus insecure-mc://localhost:3203/ \
--consensus insecure-mc://localhost:3204/ \
--num-clients 4 \
--num-transactions 40 \
--consensus-wait 300 \
--transfer-amount 20 \
--token-ids 0,1 \
--fog-view insecure-fog-view://localhost:8200 \
--fog-ledger insecure-fog-ledger://localhost:8200 \
--key-dir "$PWD/fog_keys"

# Run mobilecoind-dev-faucet
MC_LOG="info" \
"$BIN_DIR"/mobilecoind-dev-faucet \
--keyfile "$PWD/keys/account_keys_0.json" --activate --target-queue-depth 500 &

# Give it time to spin up
for _unused in $(seq 0 60); do
if ss -l | grep -q ":9090"; then break; else sleep 1; fi;
done

# Try hitting the faucet
curl -s localhost:9090/status
curl -s localhost:9090/ -d '{"b58_address": "5KBMnd8cs5zPsytGgZrjmQ8z9VJYThuh1B39pKzDERTfzm3sVGQxnZPC8JEWP69togpSPRz3e6pBsLzwnMjrXTbDqoRTQ8VF98sQu7LqjL5"}' -X POST
curl -s localhost:9090/ -d '{"b58_address": "5KBMnd8cs5zPsytGgZrjmQ8z9VJYThuh1B39pKzDERTfzm3sVGQxnZPC8JEWP69togpSPRz3e6pBsLzwnMjrXTbDqoRTQ8VF98sQu7LqjL5"}' -X POST

# Try triggering small slam twice and see that it doesn't get stuck
curl -s localhost:9090/slam -d '{"target_num_tx":500}' -X POST

"$BIN_DIR/mc-consensus-tool" wait-for-quiet

curl -s localhost:9090/slam -d '{"target_num_tx":500}' -X POST
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload core dumps
uses: ./.github/actions/upload-core-dumps
- name: Check dirty git
uses: ./.github/actions/check-dirty-git

# An end to end test to ensure minting works and that the fog local
# network script continues to work.
# This test has more than one purpose, due to the time it takes to generate
# sample keys and sample ledger
minting-and-burning-tests:
runs-on: [self-hosted, Linux, large]
container: mobilecoin/builder-install:v0.0.32
Expand Down Expand Up @@ -673,7 +479,7 @@ jobs:

# Mint 1 million token1's to the first 4 accounts
echo "Minting"
for ACCOUNT_NUM in $(seq 0 4); do
for ACCOUNT_NUM in $(seq 0 3); do
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved
"$BIN_DIR/mc-consensus-mint-client" \
generate-and-submit-mint-tx \
--node insecure-mc://localhost:3200/ \
Expand Down
Loading