From 70c6b6e73e8f711c6e07d925c721848d5ce0a43f Mon Sep 17 00:00:00 2001 From: sadMaxim Date: Wed, 12 Feb 2025 12:13:20 +0000 Subject: [PATCH 1/2] fix congestion env variables regulation --- README.md | 11 +++++++++-- docker-compose.yaml | 12 ++++++++---- scripts/gen_testnet_conf.sh | 24 ++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a3deb3c..d47f8e3 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,19 @@ node examples/get-ada-submit-tx.js ``` -Also you can run your own Genesis SPO node with ogmios-kupo-faucet-share_config and simulate congestion using spammer: +You can also run your own Genesis SPO node with Ogmios, Kupo, Faucet, Share Config, and Prometheus Metrics, and simulate congestion using Spammer. It is worth mentioning that we can regulate congestion using the MEMPOOL_PAUSE_LIMIT (max 1_000_000 bytes). This means, the Spammer will run until the mempool reaches the target value. + +It is possible that the cardano-node on your machine outpaces the Spammer, and you want to simulate higher congestion. In this case, we can reduce the block size, increase the slotLength, or both. ```bash git clone https://github.com/mlabs-haskell/congested-testnet cd congested-testnet -SPAMMER_ON=true FAUCET_ON=true docker-compose --profile genesis_spo up -d +MEMPOOL_PAUSE_LIMIT=200000 \ +SLOT_LENGTH=2 \ +MAX_BLOCK_BODY_SIZE=20000 \ +SPAMMER_ON=true \ +FAUCET_ON=true \ +docker-compose --profile genesis_spo up -d ``` If you only need to run a relay node connected to the Genesis SPO, use the following command: ```bash diff --git a/docker-compose.yaml b/docker-compose.yaml index f115190..443e60b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,6 +10,10 @@ services: - PORT=3000 - BYRON_GENESIS_SPEC_JSON=/scripts/byron.genesis.spec.json - CONFIGURATION_YAML=/scripts/configuration.yaml + # maxBlockBodySize and slotLength influence on cardano-node throughput + - MAX_BLOCK_BODY_SIZE=${MAX_BLOCK_BODY_SIZE:-65536} + - SLOT_LENGTH=${SLOT_LENGTH:-1} + ports: - "3000:3000" - "12789:12789" @@ -98,10 +102,10 @@ services: - N_WORKERS=2 - OGMIOS_URL=ogmios.local - KUPO_URL=kupo.local - - MEMPOOL_PAUSE_LIMIT=80000 - # off if you don't need spammer or faucet - - SPAMMER_ON=true - - FAUCET_ON=true + # mempool pause limit affects congestion + - MEMPOOL_PAUSE_LIMIT=${MEMPOOL_PAUSE_LIMIT:-80000} + - SPAMMER_ON=${SPAMMER_ON:-true} + - FAUCET_ON=${FAUCET_ON:-true} ports: # await tx time metric diff --git a/scripts/gen_testnet_conf.sh b/scripts/gen_testnet_conf.sh index fcf0076..6d48285 100755 --- a/scripts/gen_testnet_conf.sh +++ b/scripts/gen_testnet_conf.sh @@ -4,7 +4,8 @@ # export CONFIGURATION_YAML # export ROOT # export SHARE -# +# export MAX_BLOCK_BODY_SIZE +# export SLOT_LENGTH mkdir -p $ROOT @@ -49,7 +50,26 @@ cardano-cli conway genesis create-testnet-data \ # change some parameters in shelley genesis -jq --argjson maxSupply "$MAX_SUPPLY" --argjson secParam "$SECURITY_PARAM" '.maxLovelaceSupply = $maxSupply | .slotLength = 2 | .securityParam = $secParam | .activeSlotsCoeff = 0.05 | .epochLength = 432000 | .updateQuorum = 2 | .protocolParams.protocolVersion.major = 9 | .protocolParams.minFeeA = 44 | .protocolParams.minFeeB = 155381 | .protocolParams.minUTxOValue = 1000000 | .protocolParams.decentralisationParam = 1 | .protocolParams.rho = 0.003 | .protocolParams.tau = 0.2 | .protocolParams.a0 = 0.3 | .protocolParams.maxBlockBodySize = 17000 | .protocolParams.maxBlockHeaderSize = 1100' "$ROOT/shelley-genesis.json" > "$ROOT/temp.json" && mv "$ROOT/temp.json" "$ROOT/shelley-genesis.json" +jq --argjson maxSupply "$MAX_SUPPLY" \ + --argjson secParam "$SECURITY_PARAM" \ + --argjson maxBody "$MAX_BLOCK_BODY_SIZE" \ + --argjson maxBody "$SLOT_LENGTH" \ + '.maxLovelaceSupply = $maxSupply + | .slotLength = 1 + | .securityParam = $secParam + | .activeSlotsCoeff = 0.05 + | .epochLength = 432000 + | .updateQuorum = 2 + | .protocolParams.protocolVersion.major = 9 + | .protocolParams.minFeeA = 44 + | .protocolParams.minFeeB = 155381 + | .protocolParams.minUTxOValue = 1000000 + | .protocolParams.decentralisationParam = 1 + | .protocolParams.rho = 0.003 + | .protocolParams.tau = 0.2 + | .protocolParams.a0 = 0.3 + | .protocolParams.maxBlockBodySize = $maxBody + | .protocolParams.maxBlockHeaderSize = 1100' "$ROOT/shelley-genesis.json" > "$ROOT/temp.json" && mv "$ROOT/temp.json" "$ROOT/shelley-genesis.json" From 0956396ee9c8ba595ebc6e6fbe656039fb3e0456 Mon Sep 17 00:00:00 2001 From: sadMaxim Date: Wed, 12 Feb 2025 12:21:00 +0000 Subject: [PATCH 2/2] fix in services.nix --- README.md | 4 ++-- nix/services.nix | 2 ++ scripts/gen_testnet_conf.sh | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d47f8e3..1efc4d5 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ It is possible that the cardano-node on your machine outpaces the Spammer, and y git clone https://github.com/mlabs-haskell/congested-testnet cd congested-testnet MEMPOOL_PAUSE_LIMIT=200000 \ -SLOT_LENGTH=2 \ -MAX_BLOCK_BODY_SIZE=20000 \ +SLOT_LENGTH=1 \ +MAX_BLOCK_BODY_SIZE=65000 \ SPAMMER_ON=true \ FAUCET_ON=true \ docker-compose --profile genesis_spo up -d diff --git a/nix/services.nix b/nix/services.nix index e0ea402..a9adfa5 100644 --- a/nix/services.nix +++ b/nix/services.nix @@ -22,6 +22,8 @@ in export PORT=3000 export SHARE=${share-config} export ROOT=${root} + export SLOT_LENGTH=2 + export MAX_BLOCK_BODY_SIZE=18000 rm -rf "$ROOT" rm -rf "$SHARE" mkdir -p "$ROOT" diff --git a/scripts/gen_testnet_conf.sh b/scripts/gen_testnet_conf.sh index 6d48285..f79b4df 100755 --- a/scripts/gen_testnet_conf.sh +++ b/scripts/gen_testnet_conf.sh @@ -53,9 +53,9 @@ cardano-cli conway genesis create-testnet-data \ jq --argjson maxSupply "$MAX_SUPPLY" \ --argjson secParam "$SECURITY_PARAM" \ --argjson maxBody "$MAX_BLOCK_BODY_SIZE" \ - --argjson maxBody "$SLOT_LENGTH" \ + --argjson slotLength "$SLOT_LENGTH" \ '.maxLovelaceSupply = $maxSupply - | .slotLength = 1 + | .slotLength = $slotLength | .securityParam = $secParam | .activeSlotsCoeff = 0.05 | .epochLength = 432000