Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-armstrong committed Jan 8, 2024
1 parent 379266e commit 00ffd0d
Show file tree
Hide file tree
Showing 8 changed files with 277 additions and 12 deletions.
51 changes: 51 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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",
]
},
]
}
2 changes: 1 addition & 1 deletion test/.env
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/.env.bitcoin
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 2 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ run: ## Runs a full node
$(RUNZKPROVER)
$(RUNAPPROVE)
sleep 3
# read -p "Press enter to continue"
$(RUNSYNC)
sleep 4
$(RUNETHTXMANAGER)
Expand All @@ -482,7 +483,7 @@ run: ## Runs a full node
$(RUNL2GASPRICER)
$(RUNAGGREGATOR)
$(RUNJSONRPC)
$(RUNMETRICS)
# $(RUNMETRICS)

.PHONY: stop
stop: ## Stops all services
Expand Down
185 changes: 185 additions & 0 deletions test/config/non-container-test.node.config.toml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions test/config/test.node.config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
IsTrustedSequencer = true

[Log]
Environment = "production" # "production" or "development"
Level = "info"
Environment = "development" # "production" or "development"
Level = "debug"
Outputs = ["stderr"]

[State]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -170,7 +170,7 @@ Port = 9091
Enabled = true
ProfilingHost = "0.0.0.0"
ProfilingPort = 6060
ProfilingEnabled = true
ProfilingEnabled = false

[EventLog]
[EventLog.DB]
Expand Down
9 changes: 7 additions & 2 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
27 changes: 25 additions & 2 deletions test/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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() {
Expand Down Expand Up @@ -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*
}

$@

0 comments on commit 00ffd0d

Please sign in to comment.