Skip to content

Commit

Permalink
Merge pull request #315 from 0xPolygon/jhilliard/pprof-fixes
Browse files Browse the repository at this point in the history
Sepolia Deployment Doc Update and Version Bumps
  • Loading branch information
praetoriansentry authored Oct 17, 2024
2 parents d2d3663 + f83158d commit 1403ea6
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 224 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,20 @@ If you intend to interact with and debug the stack, you may also want to conside

Once that is good and installed on your system, you can run the following command to deploy the complete CDK stack locally. This process typically takes around eight to ten minutes.

```bash
kurtosis run --enclave cdk github.com/0xPolygon/kurtosis-cdk
```

The default deployment includes [cdk-erigon](https://github.com/0xPolygonHermez/cdk-erigon) as the sequencer, and [cdk-node](https://github.com/0xPolygon/cdk) functioning as the sequence sender and aggregator. You can verify the default versions of these components and the default fork ID by reviewing input_parser.star. You can check the default versions of the deployed components and the default fork ID by looking at
[input_parser.star](./input_parser.star).

To make customizations to the CDK environment, clone this repo, make any desired configuration changes, and then run:

```bash
# Delete all stop and clean all currently running enclaves
kurtosis clean --all

# Run this command from the root of the repository to start the network
kurtosis run --enclave cdk .
```

Expand Down Expand Up @@ -98,16 +107,16 @@ cast balance --ether 0xE34aaF64b29273B7D567FCFc40544c014EEe9970
Okay, let’s send some transactions...

```bash
export PK="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
cast send --legacy --private-key "$PK" --value 0.01ether 0x0000000000000000000000000000000000000000
private_key="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
cast send --legacy --private-key "$private_key" --value 0.01ether 0x0000000000000000000000000000000000000000
```

Okay, let’s send even more transactions... Note that this step will assume you have [polygon-cli](https://github.com/maticnetwork/polygon-cli) installed.

```bash
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 50000 --rate-limit 50 --concurrency 5 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode 2
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 3 --mode uniswapv3
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$private_key" --verbosity 700 --requests 50000 --rate-limit 50 --concurrency 5 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$private_key" --verbosity 700 --requests 500 --rate-limit 10 --mode 2
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$private_key" --verbosity 700 --requests 500 --rate-limit 3 --mode uniswapv3
```

Pretty often, you will want to check the output from the service. Here is how you can grab some logs:
Expand Down
313 changes: 133 additions & 180 deletions docs/deploy-using-sepolia.org

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ DEFAULT_DEPLOYMENT_STAGES = {

DEFAULT_IMAGES = {
"agglayer_image": "ghcr.io/agglayer/agglayer-rs:pr-96", # https://github.com/agglayer/agglayer/pkgs/container/agglayer-rs
"cdk_erigon_node_image": "hermeznetwork/cdk-erigon:ab3013d", # https://hub.docker.com/r/hermeznetwork/cdk-erigon/tags
"cdk_node_image": "ghcr.io/0xpolygon/cdk:0.3.0-beta4", # https://github.com/0xpolygon/cdk/pkgs/container/cdk
"cdk_erigon_node_image": "hermeznetwork/cdk-erigon:d930066", # https://hub.docker.com/r/hermeznetwork/cdk-erigon/tags
"cdk_node_image": "ghcr.io/0xpolygon/cdk:0.3.0-rc1", # https://github.com/0xpolygon/cdk/pkgs/container/cdk
"cdk_validium_node_image": "0xpolygon/cdk-validium-node:0.7.0-cdk", # https://hub.docker.com/r/0xpolygon/cdk-validium-node/tags
"zkevm_bridge_proxy_image": "haproxy:3.0-bookworm", # https://hub.docker.com/_/haproxy/tags
"zkevm_bridge_service_image": "hermeznetwork/zkevm-bridge-service:v0.6.0-RC1", # https://hub.docker.com/r/hermeznetwork/zkevm-bridge-service/tags
Expand Down Expand Up @@ -60,35 +60,35 @@ DEFAULT_PORTS = {

# Addresses and private keys of the different components.
# They have been generated using the following command:
# polycli wallet inspect --mnemonic 'lab code glass agree maid neutral vessel horror deny frequent favorite soft gate galaxy proof vintage once figure diary virtual scissors marble shrug drop' --addresses 9 | tee keys.txt | jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "zkevm_l2_" roles[NR] "_address: \"" $1 "\""; print "zkevm_l2_" roles[NR] "_private_key: \"0x" $2 "\"\n"}'
# polycli wallet inspect --mnemonic 'lab code glass agree maid neutral vessel horror deny frequent favorite soft gate galaxy proof vintage once figure diary virtual scissors marble shrug drop' --addresses 9 | tee keys.txt | jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "# " roles[NR] "\n\"zkevm_l2_" roles[NR] "_address\": \"" $1 "\","; print "\"zkevm_l2_" roles[NR] "_private_key\": \"0x" $2 "\",\n"}'
DEFAULT_ACCOUNTS = {
# Admin
"zkevm_l2_admin_address": "0xE34aaF64b29273B7D567FCFc40544c014EEe9970",
"zkevm_l2_admin_private_key": "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625",
# Agglayer
"zkevm_l2_agglayer_address": "0x351e560852ee001d5D19b5912a269F849f59479a",
"zkevm_l2_agglayer_private_key": "0x1d45f90c0a9814d8b8af968fa0677dab2a8ff0266f33b136e560fe420858a419",
# Aggregator
# sequencer
"zkevm_l2_sequencer_address": "0x5b06837A43bdC3dD9F114558DAf4B26ed49842Ed",
"zkevm_l2_sequencer_private_key": "0x183c492d0ba156041a7f31a1b188958a7a22eebadca741a7fe64436092dc3181",
# aggregator
"zkevm_l2_aggregator_address": "0xCae5b68Ff783594bDe1b93cdE627c741722c4D4d",
"zkevm_l2_aggregator_private_key": "0x2857ca0e7748448f3a50469f7ffe55cde7299d5696aedd72cfe18a06fb856970",
# L2 claim transaction manager
# claimtxmanager
"zkevm_l2_claimtxmanager_address": "0x5f5dB0D4D58310F53713eF4Df80ba6717868A9f8",
"zkevm_l2_claimtxmanager_private_key": "0x8d5c9ecd4ba2a195db3777c8412f8e3370ae9adffac222a54a84e116c7f8b934",
# L2 data availability committee
"zkevm_l2_dac_address": "0x5951F5b2604c9B42E478d5e2B2437F44073eF9A6",
"zkevm_l2_dac_private_key": "0x85d836ee6ea6f48bae27b31535e6fc2eefe056f2276b9353aafb294277d8159b",
# L2 loadtester
# timelock
"zkevm_l2_timelock_address": "0x130aA39Aa80407BD251c3d274d161ca302c52B7A",
"zkevm_l2_timelock_private_key": "0x80051baf5a0a749296b9dcdb4a38a264d2eea6d43edcf012d20b5560708cf45f",
# admin
"zkevm_l2_admin_address": "0xE34aaF64b29273B7D567FCFc40544c014EEe9970",
"zkevm_l2_admin_private_key": "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625",
# loadtest
"zkevm_l2_loadtest_address": "0x81457240ff5b49CaF176885ED07e3E7BFbE9Fb81",
"zkevm_l2_loadtest_private_key": "0xd7df6d64c569ffdfe7c56e6b34e7a2bdc7b7583db74512a9ffe26fe07faaa5de",
# L2 proof signer
# agglayer
"zkevm_l2_agglayer_address": "0x351e560852ee001d5D19b5912a269F849f59479a",
"zkevm_l2_agglayer_private_key": "0x1d45f90c0a9814d8b8af968fa0677dab2a8ff0266f33b136e560fe420858a419",
# dac
"zkevm_l2_dac_address": "0x5951F5b2604c9B42E478d5e2B2437F44073eF9A6",
"zkevm_l2_dac_private_key": "0x85d836ee6ea6f48bae27b31535e6fc2eefe056f2276b9353aafb294277d8159b",
# proofsigner
"zkevm_l2_proofsigner_address": "0x7569cc70950726784c8D3bB256F48e43259Cb445",
"zkevm_l2_proofsigner_private_key": "0x77254a70a02223acebf84b6ed8afddff9d3203e31ad219b2bf900f4780cf9b51",
# L2 sequencer
"zkevm_l2_sequencer_address": "0x5b06837A43bdC3dD9F114558DAf4B26ed49842Ed",
"zkevm_l2_sequencer_private_key": "0x183c492d0ba156041a7f31a1b188958a7a22eebadca741a7fe64436092dc3181",
# L2 timelock
"zkevm_l2_timelock_address": "0x130aA39Aa80407BD251c3d274d161ca302c52B7A",
"zkevm_l2_timelock_private_key": "0x80051baf5a0a749296b9dcdb4a38a264d2eea6d43edcf012d20b5560708cf45f",
}

DEFAULT_L1_ARGS = {
Expand Down
4 changes: 1 addition & 3 deletions lib/cdk_erigon.star
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def start_node(
"/usr/local/share/proc-runner": proc_runner_file_artifact,
},
entrypoint=["/usr/local/share/proc-runner/proc-runner.sh"],
cmd=[
"cdk-erigon --pprof=true --pprof.addr 0.0.0.0 --config /etc/cdk-erigon/config.yaml"
],
cmd=["cdk-erigon --config /etc/cdk-erigon/config.yaml"],
env_vars=envs,
),
)
4 changes: 2 additions & 2 deletions scripts/sanity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# - Batch verification gap

# Local
l1_rpc_url=$(kurtosis port print cdk-v1 el-1-geth-lighthouse rpc)
l2_rpc_url=$(kurtosis port print cdk-v1 cdk-erigon-sequencer-001 rpc)
l1_rpc_url=$(kurtosis port print cdk el-1-geth-lighthouse rpc)
l2_rpc_url=$(kurtosis port print cdk cdk-erigon-sequencer-001 rpc)
rollup_manager_addr="0x2F50ef6b8e8Ee4E579B17619A92dE3E2ffbD8AD2"
rollup_id=1

Expand Down
19 changes: 16 additions & 3 deletions static_files/additional_services/tx-spammer-config/bridge.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
#!/bin/bash
set -e

# The private key used to send transactions.
private_key="{{.zkevm_l2_admin_private_key}}"
# The amount of value to transfer from the admin to the spammer
spammer_value="10ether"

cast wallet new -j | jq '.[0]' | tee .bridge.wallet.json

eth_address="$(jq -r '.address' .bridge.wallet.json)"
private_key="$(jq -r '.private_key' .bridge.wallet.json)"

until cast send --legacy --private-key "{{.zkevm_l2_admin_private_key}}" --rpc-url "{{.l1_rpc_url}}" --value "$spammer_value" "$eth_address"; do
echo "Attempting to fund a test account on layer 1"
done

until cast send --legacy --private-key "{{.zkevm_l2_admin_private_key}}" --rpc-url "{{.l2_rpc_url}}" --value "$spammer_value" "$eth_address"; do
echo "Attempting to fund a test account on layer 2"
done

# The address of the recipient.
destination_address="{{.zkevm_l2_admin_address}}"
destination_address="$eth_address"

# The destination networks.
ethereum_network="0"
Expand Down
17 changes: 14 additions & 3 deletions static_files/additional_services/tx-spammer-config/spam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,34 @@ set -e
requests=50000
concurrency=5
rate_limit=50
spammer_value="10ether"

cast wallet new -j | jq '.[0]' | tee .spam.wallet.json

eth_address="$(jq -r '.address' .spam.wallet.json)"
private_key="$(jq -r '.private_key' .spam.wallet.json)"

until cast send --legacy --private-key "{{.private_key}}" --rpc-url "{{.rpc_url}}" --value "$spammer_value" "$eth_address"; do
echo "Attempting to fund a test account for the tx spammer"
done

while true; do
echo "Sending a few transactions to the RPC..."
polycli loadtest \
--rpc-url "{{.rpc_url}}" \
--private-key "{{.private_key}}" \
--private-key "$private_key" \
--legacy \
--verbosity 700 \
--mode t,2 \
--requests "$requests" \
--concurrency "$concurrency" \
--rate-limit "$rate_limit"
--rate-limit "$rate_limit" \
--eth-amount "0.000000000000000001"

echo "Making a few RPC calls..."
polycli rpcfuzz \
--rpc-url "{{.rpc_url}}" \
--private-key "{{.private_key}}" \
--private-key "$private_key" \
--verbosity 700

echo "Waiting 60 seconds before sending more transactions..."
Expand Down
12 changes: 6 additions & 6 deletions templates/cdk-erigon/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ zkevm.witness-memdb-size: 2GB
# Enables full witness generation, which provides comprehensive proof data for transactions.
# This can be useful for debugging and verification purposes.
# Default: true
zkevm.witness-full: true
zkevm.witness-full: false

## Limbo Processing
# Activate processing for batches that failed verification, allowing the network to recover gracefully.
Expand All @@ -123,10 +123,10 @@ zkevm.effective-gas-price-erc20-transfer: 1
zkevm.effective-gas-price-contract-invocation: 1
zkevm.effective-gas-price-contract-deployment: 1

# Specify the maximum gas price allowed for transactions.
# A value of 0 indicates that there is no upper limit on gas prices.
# Default: 0
zkevm.default-gas-price: 10000000
# Set the minimum (default) gas price
# If this value is too low or below the L1 fee, transactions can get stuck in the basefee queue
# Default: 10000000
zkevm.default-gas-price: 1000000000

# Apply a factor to convert L1 gas prices into L2 gas prices.
# A value of 1 means no adjustment; values greater than 1 increase L2 costs proportionally.
Expand Down Expand Up @@ -894,7 +894,7 @@ pprof.addr: 0.0.0.0
pprof.port: 6060

# Write CPU profile to the given file
pprof.cpuprofile: /tmp/cdk-erigon.cpuprofile
# pprof.cpuprofile: /tmp/cdk-erigon.cpuprofile


# --------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 1403ea6

Please sign in to comment.