Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Fix compose for running in local #75

Merged
merged 7 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ build-docker-nc: ## Builds a docker image with the agglayer binary - but without

.PHONY: run-docker
run-docker: ## Builds and runs agglayer with the default list of required services such as l1 and zkevm node
docker compose -f ./docker/docker-compose.yaml up -d l1 zkevm-prover zkevm-node
docker compose -f ./docker/docker-compose.yaml up -d zkevm-mock-l1-network zkevm-prover zkevm-node
docker compose -f ./docker/docker-compose.yaml up -d --build agglayer

.PHONY: run-docker-bo
Expand Down
2 changes: 1 addition & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DefaultValues = `

[L1]
ChainID = 1337
NodeURL = "http://l1:8545"
NodeURL = "http://zkevm-mock-l1-network:8545"
RollupManagerContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" # v0.0.4

[Telemetry]
Expand Down
14 changes: 14 additions & 0 deletions db/scripts/init_event_db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TYPE level_t AS ENUM ('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug');

CREATE TABLE public.event (
id BIGSERIAL PRIMARY KEY,
received_at timestamp WITH TIME ZONE default CURRENT_TIMESTAMP,
ip_address inet,
source varchar(32) not null,
component varchar(32),
level level_t not null,
event_id varchar(32) not null,
description text,
data bytea,
json jsonb
);
2 changes: 1 addition & 1 deletion docker/data/agglayer/agglayer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

[L1]
ChainID = 1337
NodeURL = "http://l1:8545"
NodeURL = "http://zkevm-mock-l1-network:8545"
RollupManagerContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" # v0.0.4

[Telemetry]
Expand Down
202 changes: 100 additions & 102 deletions docker/data/zkevm/genesis.json

Large diffs are not rendered by default.

189 changes: 107 additions & 82 deletions docker/data/zkevm/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@ Level = "debug"
Outputs = ["stderr"]

[State]
[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
[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 = 1125899906842624
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538
MaxSHA256Hashes = 1596

[Pool]
FreeClaimGasLimit = 1500000
Expand All @@ -38,30 +39,32 @@ MinAllowedGasPriceInterval = "5m"
PollMinAllowedGasPriceInterval = "15s"
AccountQueue = 64
GlobalQueue = 1024
[Pool.EffectiveGasPrice]
Enabled = false
L1GasPriceFactor = 0.25
ByteGasCost = 16
ZeroByteGasCost = 4
NetProfit = 1
BreakEvenFactor = 1.1
FinalDeviationPct = 10
L2GasPriceSuggesterFactor = 0.5
[Pool.DB]
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "zkevm-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
[Pool.EffectiveGasPrice]
Enabled = false
L1GasPriceFactor = 0.25
ByteGasCost = 16
ZeroByteGasCost = 4
NetProfit = 1
BreakEvenFactor = 1.1
FinalDeviationPct = 10
EthTransferGasPrice = 0
EthTransferL1GasPriceFactor = 0
L2GasPriceSuggesterFactor = 0.5
[Pool.DB]
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "zkevm-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200

[Etherman]
URL = "http://l1:8545"
URL = "http://zkevm-mock-l1-network:8545"
ForkIDChunkSize = 20000
MultiGasProvider = false
[Etherscan]
ApiKey = ""
[Etherscan]
ApiKey = ""

[RPC]
Host = "0.0.0.0"
Expand All @@ -71,58 +74,66 @@ WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = ""
EnableL2SuggestedGasPricePolling = true
[RPC.WebSockets]
Enabled = true
Port = 8133
[RPC.WebSockets]
Enabled = true
Port = 8133

[Synchronizer]
SyncInterval = "1s"
SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc.
L1SynchronizationMode = "sequential" # "sequential" or "parallel"
[Synchronizer.L1ParallelSynchronization]
MaxClients = 10
MaxPendingNoProcessedBlocks = 25
RequestLastBlockPeriod = "5s"
RequestLastBlockTimeout = "5s"
RequestLastBlockMaxRetries = 3
StatisticsPeriod = "5m"
TimeoutMainLoop = "5m"
RollupInfoRetriesSpacing = "5s"
FallbackToSequentialModeOnSynchronized = false
[Synchronizer.L1ParallelSynchronization.PerformanceWarning]
AceptableInacctivityTime = "5s"
ApplyAfterNumRollupReceived = 10
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc.
L1SynchronizationMode = "parallel"
[Synchronizer.L1ParallelSynchronization]
MaxClients = 10
MaxPendingNoProcessedBlocks = 25
RequestLastBlockPeriod = "5s"
RequestLastBlockTimeout = "5s"
RequestLastBlockMaxRetries = 3
StatisticsPeriod = "5m"
TimeoutMainLoop = "5m"
RollupInfoRetriesSpacing= "5s"
FallbackToSequentialModeOnSynchronized = false
[Synchronizer.L1ParallelSynchronization.PerformanceWarning]
AceptableInacctivityTime = "5s"
ApplyAfterNumRollupReceived = 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"
DeletePoolTxsL1BlockConfirmations = 100
DeletePoolTxsCheckInterval = "12h"
TxLifetimeCheckInterval = "10m"
TxLifetimeMax = "3h"
LoadPoolTxsCheckInterval = "500ms"
StateConsistencyCheckInterval = "5s"
[Sequencer.Finalizer]
NewTxsWaitInterval = "100ms"
ForcedBatchesTimeout = "5s"
ForcedBatchesL1BlockConfirmations = 0
ForcedBatchesCheckInterval = "10s"
L1InfoTreeL1BlockConfirmations = 0
L1InfoTreeCheckInterval = "10s"
BatchMaxDeltaTimestamp = "20s"
L2BlockMaxDeltaTimestamp = "4s"
ResourceExhaustedMarginPct = 10
HaltOnBatchNumber = 0
SequentialBatchSanityCheck = false
SequentialProcessL2Block = true
[Sequencer.StreamServer]
Port = 6900
Filename = "/datastreamer/datastream.bin"
Version = 1
ChainID = 1337
Enabled = true


[SequenceSender]
WaitPeriodSendSequence = "15s"
LastBatchVirtualizationTimeMaxWaitPeriod = "10s"
L1BlockTimestampMargin = "5s"
MaxTxSizeForL1 = 131072
L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKey = { Path = "/pk/sequencer.keystore", Password = "testonly" }
PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
[SequenceSender.StreamClient]
Server = "zkevm-sequencer:6900"

[Aggregator]
Host = "0.0.0.0"
Expand All @@ -135,14 +146,18 @@ ProofStatePollingInterval = "5s"
SenderAddress = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
CleanupLockedProofsInterval = "2m"
GeneratingProofCleanupThreshold = "10m"
UpgradeEtrogBatchNumber = 0
SettlementBackend = "agglayer"
AggLayerTxTimeout = "5m"
AggLayerURL = "http://agglayer:4444"
AggLayerTxTimeout = "30s"
SequencerPrivateKey = { Path = "/pk/sequencer.keystore", Password = "testonly" }

[EthTxManager]
ForcedGas = 0
PrivateKeys = [{ Path = "/pk/sequencer.keystore", Password = "testonly" }]
PrivateKeys = [
{Path = "/pk/sequencer.keystore", Password = "testonly"},
{Path = "/pk/aggregator.keystore", Password = "testonly"}
]

[L2GasPriceSuggester]
Type = "default"
Expand All @@ -166,6 +181,16 @@ 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 = "5432"
EnableLog = false
MaxConns = 200

[HashDB]
User = "prover_user"
Password = "prover_pass"
Expand Down
47 changes: 40 additions & 7 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3.9'

services:
l1:
container_name: l1
zkevm-mock-l1-network:
container_name: zkevm-mock-l1-network
image: hermeznetwork/geth-cdk-validium-contracts:v0.0.4
command: [
"--http",
Expand Down Expand Up @@ -63,8 +63,38 @@ services:
networks:
- agglayer-localnet

zkevm-event-db:
container_name: zkevm-event-db
image: postgres:16.0-alpine
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 1G
ports:
- 5435:5432
volumes:
- ../db/scripts/init_event_db.sql:/docker-entrypoint-initdb.d/init.sql
environment:
- POSTGRES_USER=event_user
- POSTGRES_PASSWORD=event_password
- POSTGRES_DB=event_db
command:
- "postgres"
- "-N"
- "500"
healthcheck:
test: [ "CMD-SHELL", "pg_isready", "-d", "event_db" ]
interval: 30s
timeout: 60s
retries: 5
start_period: 10s
networks:
- agglayer-localnet

zkevm-prover:
image: hermeznetwork/zkevm-prover:v3.0.2
image: hermeznetwork/zkevm-prover:v4.0.17
platform: linux/amd64
command: [
"zkProver",
Expand All @@ -85,8 +115,7 @@ services:
- agglayer-localnet

zkevm-node:
image: 0xpolygon/cdk-validium-node:agglayer-v0.0.1
platform: linux/amd64
image: 0xpolygon/cdk-validium-node:0.5.13-cdk.3
command:
- "/bin/sh"
- "-c"
Expand All @@ -100,14 +129,18 @@ services:
condition: service_healthy
zkevm-pool-db:
condition: service_healthy
zkevm-event-db:
condition: service_healthy
zkevm-prover:
condition: service_started
l1:
zkevm-mock-l1-network:
condition: service_started
volumes:
- ./data/zkevm/sequencer.keystore:/pk/sequencer.keystore
- ./data/zkevm/aggregator.keystore:/pk/aggregator.keystore
- ./data/zkevm/node.toml:/app/config.toml
- ./data/zkevm/genesis.json:/app/genesis.json
- ./data:/datastreamer
networks:
- agglayer-localnet

Expand All @@ -130,7 +163,7 @@ services:
restart: always

# agglayer requires L1 working and available. The config file "./data/agglayer/agglayer.toml"
# has "l1" (see above) service defined as L1 so make sure "l1" service is started before running agglayer.
# has "zkevm-mock-l1-network" (see above) service defined as L1 so make sure "zkevm-mock-l1-network" service is started before running agglayer.
# Same point with "zkevm-node" service.
# In order to run "agglayer" attached to an external L1 and zkevm node, the config file should be
# updated accordingly.
Expand Down
Loading