From 00ffd0dd76b1c0cc32c7503dcce585ca520258f2 Mon Sep 17 00:00:00 2001 From: tony-armstrong Date: Mon, 8 Jan 2024 20:16:01 +0800 Subject: [PATCH] chore --- .vscode/launch.json | 51 +++++ test/.env | 2 +- test/.env.bitcoin | 2 +- test/Makefile | 3 +- .../non-container-test.node.config.toml | 185 ++++++++++++++++++ test/config/test.node.config.toml | 10 +- test/docker-compose.yml | 9 +- test/helper.sh | 27 ++- 8 files changed, 277 insertions(+), 12 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 test/config/non-container-test.node.config.toml diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..6cbe8ee04a --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,51 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "debug component", + "type": "go", + "request": "launch", + "mode": "auto", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/cmd", + "args": [ + "run", + "--network", + "custom", + "--custom-network-file", + "test/config/test.genesis.config.json", + "--cfg", + "test/config/non-container-test.node.config.toml", + "--components", + "synchronizer" + ] + }, + { + "name": "debug approve", + "type": "go", + "request": "launch", + "mode": "auto", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/cmd", + "args": [ + "approve", + "--network", + "custom", + "--custom-network-file", + "test/config/test.genesis.config.json", + "--key-store-path", + "test/sequencer.keystore", + "--pw", + "testonly", + "--am", + "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "-y", + "--cfg", + "test/config/non-container-test.node.config.toml", + ] + }, + ] +} \ No newline at end of file diff --git a/test/.env b/test/.env index bb55346ad6..6218f093f3 100644 --- a/test/.env +++ b/test/.env @@ -1,5 +1,5 @@ B2_ZKEVM_NODE_IMAGE=ghcr.io/b2network/b2-zkevm-node:dev-v0.4.0-RC6-20231222-091319-ca7a25af -B2_NODE_IMAGE=ghcr.io/b2network/b2-node:20231222-145531-18655e6-with-datadir-6baf597 +B2_NODE_IMAGE=ghcr.io/b2network/b2-node:20231226-104117-9fd5727-with-datadir-6baf597 B2_ZKEVM_PROVER=ghcr.io/b2network/b2-zkevm-prover:20231127-164129-7accb0b GRAFANA_IMAGE=grafana/grafana-oss diff --git a/test/.env.bitcoin b/test/.env.bitcoin index 69f11eb94b..9d46c2cb1a 100644 --- a/test/.env.bitcoin +++ b/test/.env.bitcoin @@ -1,5 +1,5 @@ BITCOIN_NETWORK_NAME="testnet" -BITCOIN_RPC_HOST="43.157.135.191" +BITCOIN_RPC_HOST="43.157.190.60" BITCOIN_RPC_PORT="8332" BITCOIN_RPC_USER="b2node" BITCOIN_RPC_PASS="b2node@pass" diff --git a/test/Makefile b/test/Makefile index c66b9fc010..248645e66a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -474,6 +474,7 @@ run: ## Runs a full node $(RUNZKPROVER) $(RUNAPPROVE) sleep 3 + # read -p "Press enter to continue" $(RUNSYNC) sleep 4 $(RUNETHTXMANAGER) @@ -482,7 +483,7 @@ run: ## Runs a full node $(RUNL2GASPRICER) $(RUNAGGREGATOR) $(RUNJSONRPC) - $(RUNMETRICS) + # $(RUNMETRICS) .PHONY: stop stop: ## Stops all services diff --git a/test/config/non-container-test.node.config.toml b/test/config/non-container-test.node.config.toml new file mode 100644 index 0000000000..c3e84981dd --- /dev/null +++ b/test/config/non-container-test.node.config.toml @@ -0,0 +1,185 @@ +IsTrustedSequencer = true + +[Log] +Environment = "development" # "production" or "development" +Level = "debug" +Outputs = ["stderr"] + +[State] +AccountQueue = 64 + [State.DB] + User = "state_user" + Password = "state_password" + Name = "state_db" + Host = "zkevm-state-db" + Port = "5432" + EnableLog = false + MaxConns = 200 + [State.Batch] + [State.Batch.Constraints] + MaxTxsPerBatch = 300 + MaxBatchBytesSize = 120000 + MaxCumulativeGasUsed = 30000000 + MaxKeccakHashes = 2145 + MaxPoseidonHashes = 252357 + MaxPoseidonPaddings = 135191 + MaxMemAligns = 236585 + MaxArithmetics = 236585 + MaxBinaries = 473170 + MaxSteps = 7570538 + +[Pool] +FreeClaimGasLimit = 1500000 +IntervalToRefreshBlockedAddresses = "5m" +IntervalToRefreshGasPrices = "5s" +MaxTxBytesSize=100132 +MaxTxDataBytesSize=100000 +DefaultMinGasPriceAllowed = 0 +MinAllowedGasPriceInterval = "5m" +PollMinAllowedGasPriceInterval = "15s" + [Pool.DB] + User = "pool_user" + Password = "pool_password" + Name = "pool_db" + Host = "zkevm-pool-db" + Port = "5433" + EnableLog = false + MaxConns = 200 + +[Etherman] +URL = "http://zkevm-mock-l1-network:8545" +ForkIDChunkSize = 20000 +MultiGasProvider = false + [Etherscan] + ApiKey = "" + +[RPC] +Host = "0.0.0.0" +Port = 8123 +ReadTimeout = "60s" +WriteTimeout = "60s" +MaxRequestsPerIPAndSecond = 5000 +SequencerNodeURI = "" +BatchRequestsEnabled = true +BatchRequestsLimit = 100 +EnableL2SuggestedGasPricePolling = true + [RPC.WebSockets] + Enabled = true + Port = 8133 + +[Synchronizer] +SyncInterval = "5s" +SyncChunkSize = 10 +TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. +UseParallelModeForL1Synchronization = true + [Synchronizer.L1ParallelSynchronization] + NumberOfParallelOfEthereumClients = 5 + CapacityOfBufferingRollupInfoFromL1 = 10 + TimeForCheckLastBlockOnL1Time = "5s" + TimeoutForRequestLastBlockOnL1 = "60s" + MaxNumberOfRetriesForRequestLastBlockOnL1 = 3 + TimeForShowUpStatisticsLog = "1m" + TimeOutMainLoop = "5m" + [Synchronizer.L1ParallelSynchronization.PerformanceCheck] + AcceptableTimeWaitingForNewRollupInfo = "5s" + NumIterationsBeforeStartCheckingTimeWaitinfForNewRollupInfo = 10 + +[Sequencer] +WaitPeriodPoolIsEmpty = "1s" +LastBatchVirtualizationTimeMaxWaitPeriod = "10s" +BlocksAmountForTxsToBeDeleted = 100 +FrequencyToCheckTxsForDelete = "12h" +TxLifetimeCheckTimeout = "10m" +MaxTxLifetime = "3h" + [Sequencer.Finalizer] + GERDeadlineTimeout = "2s" + ForcedBatchDeadlineTimeout = "5s" + SleepDuration = "100ms" + ResourcePercentageToCloseBatch = 10 + GERFinalityNumberOfBlocks = 0 + ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" + ClosingSignalsManagerWaitForCheckingGER = "10s" + ClosingSignalsManagerWaitForCheckingForcedBatches = "10s" + ForcedBatchesFinalityNumberOfBlocks = 0 + TimestampResolution = "10s" + StopSequencerOnBatchNum = 0 + [Sequencer.DBManager] + PoolRetrievalInterval = "500ms" + L2ReorgRetrievalInterval = "5s" + [Sequencer.EffectiveGasPrice] + MaxBreakEvenGasPriceDeviationPercentage = 10 + L1GasPriceFactor = 0.25 + ByteGasCost = 16 + MarginFactor = 1 + Enabled = false + [Sequencer.StreamServer] + Port = 6900 + Filename = "/datastreamer/datastream.bin" + Enabled = true + +[SequenceSender] +WaitPeriodSendSequence = "15s" +LastBatchVirtualizationTimeMaxWaitPeriod = "10s" +MaxTxSizeForL1 = 131072 +L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" +PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} + +[Aggregator] +Host = "0.0.0.0" +Port = 50081 +RetryTime = "5s" +VerifyProofInterval = "10s" +TxProfitabilityCheckerType = "acceptall" +TxProfitabilityMinReward = "1.1" +ProofStatePollingInterval = "5s" +SenderAddress = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8" +CleanupLockedProofsInterval = "2m" +GeneratingProofCleanupThreshold = "10m" + +[EthTxManager] +ForcedGas = 0 +PrivateKeys = [ + {Path = "/pk/sequencer.keystore", Password = "testonly"}, + {Path = "/pk/aggregator.keystore", Password = "testonly"} +] + +[L2GasPriceSuggester] +Type = "default" +UpdatePeriod = "10s" +Factor = 0.5 +DefaultGasPriceWei = 1000000000 +MaxGasPriceWei = 0 + +[MTClient] +URI = "zkevm-prover:50061" + +[Executor] +URI = "zkevm-prover:50071" +MaxGRPCMessageSize = 100000000 + +[Metrics] +Host = "0.0.0.0" +Port = 9091 +Enabled = true +ProfilingHost = "0.0.0.0" +ProfilingPort = 6060 +ProfilingEnabled = true + +[EventLog] + [EventLog.DB] + User = "event_user" + Password = "event_password" + Name = "event_db" + Host = "zkevm-event-db" + Port = "5435" + EnableLog = false + MaxConns = 200 + +[HashDB] +User = "prover_user" +Password = "prover_pass" +Name = "prover_db" +Host = "zkevm-state-db" +Port = "5432" +EnableLog = false +MaxConns = 200 diff --git a/test/config/test.node.config.toml b/test/config/test.node.config.toml index d72e44d688..3e0d364633 100644 --- a/test/config/test.node.config.toml +++ b/test/config/test.node.config.toml @@ -1,8 +1,8 @@ IsTrustedSequencer = true [Log] -Environment = "production" # "production" or "development" -Level = "info" +Environment = "development" # "production" or "development" +Level = "debug" Outputs = ["stderr"] [State] @@ -78,8 +78,8 @@ EnableL2SuggestedGasPricePolling = true Port = 8133 [Synchronizer] -SyncInterval = "1s" -SyncChunkSize = 100 +SyncInterval = "2s" +SyncChunkSize = 10 TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. L1SynchronizationMode = "parallel" # "sequential" or "parallel" [Synchronizer.L1ParallelSynchronization] @@ -170,7 +170,7 @@ Port = 9091 Enabled = true ProfilingHost = "0.0.0.0" ProfilingPort = 6060 -ProfilingEnabled = true +ProfilingEnabled = false [EventLog] [EventLog.DB] diff --git a/test/docker-compose.yml b/test/docker-compose.yml index f7d6dc33eb..89f73e2592 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -56,7 +56,7 @@ services: image: ${B2_ZKEVM_NODE_IMAGE} ports: - 9092:9091 # needed if metrics enabled - - 6060:6060 + # - 6060:6060 - 6900:6900 # Data stream server environment: - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db @@ -98,7 +98,7 @@ services: ports: - 8123:8123 - 8133:8133 # needed if WebSockets enabled - - 9091:9091 # needed if metrics enabled + # - 9091:9091 # needed if metrics enabled environment: - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db @@ -144,6 +144,11 @@ services: - ./config/test.node.config.toml:/app/config.toml - ./config/test.genesis.config.json:/app/genesis.json - /etc/localtime:/etc/localtime:ro + logging: + driver: "json-file" + options: + max-size: "200k" + max-file: "10" command: - "/bin/sh" - "-c" diff --git a/test/helper.sh b/test/helper.sh index 311c6a1bf4..113e35f2d0 100644 --- a/test/helper.sh +++ b/test/helper.sh @@ -78,7 +78,7 @@ jmeter-debug() { addChainStateToB2Node() { set -e docker container rm -f b2-node - B2_NODE_IMAGE=ghcr.io/b2network/b2-node:20231222-145531-18655e6 + B2_NODE_IMAGE=ghcr.io/b2network/b2-node:20231226-104117-9fd5727 TMT_ROOT=/root/b2network/single-client-datadir cd $TMT_ROOT # bash helper.sh restore @@ -133,8 +133,19 @@ onlyProbeL1() { } collectionLog() { - DIRNAME=log-$DATE + docker-compose logs \ + --timestamps \ + --since 2023-12-26T22:42:50 \ + --until 2023-12-26T22:52:50 \ + --no-color > tmp.log + for cmd in wc du head tail; do + $cmd tmp.log + done + return + DIRNAME=log-$DATE-reorgctx mkdir -p $DIRNAME + docker-compose logs \ + --no-color > $DIRNAME/all.log for name in \ zkevm-approve \ zkevm-sync \ @@ -151,6 +162,8 @@ collectionLog() { --no-color \ $name >$DIRNAME/$name.log done + + tar -jcf /stable/work-backup/b2-network/b2-$DIRNAME.tar.bz2 $DIRNAME/* } init() { @@ -247,4 +260,14 @@ changeHost() { toml set --toml-path $FILE HashDB.Port 5432 } +probeReorg(){ + # du -sh * + # wc * + # grep -irnc 'error' * + # grep -irnc 'reorg' * + # grep -irnc 'BatchNumber.*1' zkevm* + grep -irn -m 65 'BatchNumber.*1' zkevm* + # grep -irn fed2e021c9aedfddb4fbab5a143bd35549e4d1edc7d8866a3f8fa3fa3fbe8332 zkevm* +} + $@