From de5e5dab7ff91e591143c76b75a22ccface18059 Mon Sep 17 00:00:00 2001 From: "xingqiang.yuan" <707312973@qq.com> Date: Wed, 26 Jun 2024 18:53:20 +0800 Subject: [PATCH] aggregator dispatch jobs to prover in parallel (#224) * agg para * fix lint * fix ci * fix ci * fix ci * update config file * fix ci * move the code to independent file * update * update --- aggregator/aggregator.go | 7 + aggregator/aggregator_xlayer.go | 164 +++++++++++++++++++++++ aggregator/config.go | 5 + aggregator/prover/prover.go | 5 + config/default.go | 2 + docs/config-file/node-config-doc.html | 2 +- docs/config-file/node-config-doc.md | 70 +++++++--- docs/config-file/node-config-schema.json | 10 ++ test/Makefile | 13 ++ test/config/test.executor.config.json | 106 +++++++++++++++ test/config/test.mock.prover.config.json | 90 +++++++++++++ test/config/test.prover.config.json | 1 - test/docker-compose.yml | 55 ++++++++ 13 files changed, 508 insertions(+), 22 deletions(-) create mode 100644 test/config/test.executor.config.json create mode 100644 test/config/test.mock.prover.config.json diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index 27c6d49925..858fd2f407 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -172,6 +172,13 @@ func (a *Aggregator) Stop() { // Channel implements the bi-directional communication channel between the // Prover client and the Aggregator server. func (a *Aggregator) Channel(stream prover.AggregatorService_ChannelServer) error { + if a.cfg.Parallel { + return a.channelParallel(stream) + } + return a.channelSerialize(stream) +} + +func (a *Aggregator) channelSerialize(stream prover.AggregatorService_ChannelServer) error { metrics.ConnectedProver() defer metrics.DisconnectedProver() diff --git a/aggregator/aggregator_xlayer.go b/aggregator/aggregator_xlayer.go index 2b90cb5e96..30c988b5a7 100644 --- a/aggregator/aggregator_xlayer.go +++ b/aggregator/aggregator_xlayer.go @@ -2,20 +2,27 @@ package aggregator import ( "context" + "errors" "fmt" + "net" "strings" "time" agglayerTypes "github.com/0xPolygon/agglayer/rpc/types" "github.com/0xPolygon/agglayer/tx" + "github.com/0xPolygonHermez/zkevm-node/aggregator/metrics" + "github.com/0xPolygonHermez/zkevm-node/aggregator/prover" ethmanTypes "github.com/0xPolygonHermez/zkevm-node/etherman/types" "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" "github.com/0xPolygonHermez/zkevm-node/log" "github.com/0xPolygonHermez/zkevm-node/state" "github.com/ethereum/go-ethereum/common" "github.com/jackc/pgx/v4" + "google.golang.org/grpc/peer" ) +const minParaCount = 2 + func (a *Aggregator) settleDirect( ctx context.Context, proof *state.Proof, @@ -131,3 +138,160 @@ func (a *Aggregator) handleFailureToSendToAggLayer(ctx context.Context, proof *s a.endProofVerification() } + +func (a *Aggregator) channelParallel(stream prover.AggregatorService_ChannelServer) error { + metrics.ConnectedProver() + defer metrics.DisconnectedProver() + + ctx := stream.Context() + var proverAddr net.Addr + p, ok := peer.FromContext(ctx) + if ok { + proverAddr = p.Addr + } + prover, err := prover.New(stream, proverAddr, a.cfg.ProofStatePollingInterval) + if err != nil { + return err + } + + log := log.WithFields( + "prover", prover.Name(), + "proverId", prover.ID(), + "proverAddr", prover.Addr(), + ) + log.Info("Establishing stream connection with prover") + + // Check if prover supports the required Fork ID + if !prover.SupportsForkID(forkId9) { + err := errors.New("prover does not support required fork ID") + log.Warn(FirstToUpper(err.Error())) + return err + } + + // We start multi batch proof routines, one aggregate proof routine and one final proof routine in parallel. + paraCount := a.cfg.ParaCount + if paraCount < minParaCount { + paraCount = minParaCount + } + for i := uint64(0); i < paraCount; i++ { + go a.generateBatchProofRoutine(ctx, prover) + } + go a.aggregateProofsRoutine(ctx, prover) + go a.buildFinalProofRoutine(ctx, prover) + + select { + case <-a.ctx.Done(): + // server disconnected + return a.ctx.Err() + case <-ctx.Done(): + // client disconnected + return ctx.Err() + } +} + +func (a *Aggregator) aggregateProofsRoutine(ctx context.Context, prover *prover.Prover) { + for { + select { + case <-a.ctx.Done(): + // server disconnected + return + case <-ctx.Done(): + // client disconnected + return + + default: + isIdle, err := prover.IsIdle() + if err != nil { + log.Errorf("Failed to check if prover is idle: %v", err) + time.Sleep(a.cfg.RetryTime.Duration) + continue + } + if !isIdle { + log.Debug("Prover is not idle") + time.Sleep(a.cfg.RetryTime.Duration) + continue + } + + proofGenerated, err := a.tryAggregateProofs(ctx, prover) + if err != nil { + log.Errorf("Error trying to aggregate proofs: %v", err) + } + + if !proofGenerated { + // if no proof was generated (aggregated or batch) wait some time before retry + time.Sleep(a.cfg.RetryTime.Duration) + } // if proof was generated we retry immediately as probably we have more proofs to process + } + } +} + +func (a *Aggregator) generateBatchProofRoutine(ctx context.Context, prover *prover.Prover) { + for { + select { + case <-a.ctx.Done(): + // server disconnected + return + case <-ctx.Done(): + // client disconnected + return + + default: + isIdle, err := prover.IsIdle() + if err != nil { + log.Errorf("Failed to check if prover is idle: %v", err) + time.Sleep(a.cfg.RetryTime.Duration) + continue + } + if !isIdle { + log.Debug("Prover is not idle") + time.Sleep(a.cfg.RetryTime.Duration) + continue + } + + proofGenerated, err := a.tryGenerateBatchProof(ctx, prover) + if err != nil { + log.Errorf("Error trying to generate proof: %v", err) + } + if !proofGenerated { + // if no proof was generated (aggregated or batch) wait some time before retry + time.Sleep(a.cfg.RetryTime.Duration) + } // if proof was generated we retry immediately as probably we have more proofs to process + } + } +} + +func (a *Aggregator) buildFinalProofRoutine(ctx context.Context, prover *prover.Prover) { + for { + select { + case <-a.ctx.Done(): + // server disconnected + return + case <-ctx.Done(): + // client disconnected + return + + default: + isIdle, err := prover.IsIdle() + if err != nil { + log.Errorf("Failed to check if prover is idle: %v", err) + time.Sleep(a.cfg.RetryTime.Duration) + continue + } + if !isIdle { + log.Debug("Prover is not idle") + time.Sleep(a.cfg.RetryTime.Duration) + continue + } + + proofGenerated, err := a.tryBuildFinalProof(ctx, prover, nil) + if err != nil { + log.Errorf("Error checking proofs to verify: %v", err) + } + + if !proofGenerated { + // if no proof was generated (aggregated or batch) wait some time before retry + time.Sleep(a.cfg.RetryTime.Duration) + } // if proof was generated we retry immediately as probably we have more proofs to process + } + } +} diff --git a/aggregator/config.go b/aggregator/config.go index 825062dded..e484e766fa 100644 --- a/aggregator/config.go +++ b/aggregator/config.go @@ -35,6 +35,11 @@ type Config struct { // Port for the grpc server Port int `mapstructure:"Port"` + // Parallel means send requests to prover in parallel + Parallel bool `mapstructure:"Parallel"` + // ParaCount means parallel count for sending requests to prover + ParaCount uint64 `mapstructure:"ParaCount"` + // RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate // or batches to generate proofs. It is also used in the isSynced loop RetryTime types.Duration `mapstructure:"RetryTime"` diff --git a/aggregator/prover/prover.go b/aggregator/prover/prover.go index fbaf72715f..d2d55a3e14 100644 --- a/aggregator/prover/prover.go +++ b/aggregator/prover/prover.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "net" + "sync" "time" "github.com/0xPolygonHermez/zkevm-node/aggregator/metrics" @@ -24,6 +25,8 @@ var ( // Prover abstraction of the grpc prover client. type Prover struct { + sync.Mutex + name string id string address net.Addr @@ -325,6 +328,8 @@ func (p *Prover) waitProof(ctx context.Context, proofID string) (*GetProofRespon // call sends a message to the prover and waits to receive the response over // the connection stream. func (p *Prover) call(req *AggregatorMessage) (*ProverMessage, error) { + p.Lock() + defer p.Unlock() if err := p.stream.Send(req); err != nil { return nil, err } diff --git a/config/default.go b/config/default.go index 8e99b35e69..e1e987ea03 100644 --- a/config/default.go +++ b/config/default.go @@ -222,6 +222,8 @@ GasOffset = 80000 [Aggregator] Host = "0.0.0.0" Port = 50081 +Parallel = false +ParaCount = 0 RetryTime = "5s" VerifyProofInterval = "90s" TxProfitabilityCheckerType = "acceptall" diff --git a/docs/config-file/node-config-doc.html b/docs/config-file/node-config-doc.html index a07f59acaf..8839d4b587 100644 --- a/docs/config-file/node-config-doc.html +++ b/docs/config-file/node-config-doc.html @@ -70,7 +70,7 @@
"300ms"
L1BlockTimestampMargin is the time difference (margin) that must exists between last L1 block and last L2 block in the sequence before
to send the sequence to L1. If the difference is lower than this value then sequencesender will wait until the difference is equal or greater
"1m"
"300ms"
-
MaxTxSizeForL1 is the maximum size a single transaction can have. This field has
non-trivial consequences: larger transactions than 128KB are significantly harder and
more expensive to propagate; larger transactions also take more resources
to validate whether they fit into the pool or not.
SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs
Must contain a minimum of 20
items
Must contain a maximum of 20
items
L2Coinbase defines which address is going to receive the fees
Must contain a minimum of 20
items
Must contain a maximum of 20
items
Path is the file path for the key store file
Password is the password to decrypt the key store file
Batch number where there is a forkid change (fork upgrade)
GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100
XLayer config
MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx
Path is the file path for the key store file
Password is the password to decrypt the key store file
Host for the grpc server
Port for the grpc server
RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate
or batches to generate proofs. It is also used in the isSynced loop
"1m"
+
MaxTxSizeForL1 is the maximum size a single transaction can have. This field has
non-trivial consequences: larger transactions than 128KB are significantly harder and
more expensive to propagate; larger transactions also take more resources
to validate whether they fit into the pool or not.
SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs
Must contain a minimum of 20
items
Must contain a maximum of 20
items
L2Coinbase defines which address is going to receive the fees
Must contain a minimum of 20
items
Must contain a maximum of 20
items
Path is the file path for the key store file
Password is the password to decrypt the key store file
Batch number where there is a forkid change (fork upgrade)
GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100
XLayer config
MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx
Path is the file path for the key store file
Password is the password to decrypt the key store file
Host for the grpc server
Port for the grpc server
Parallel means send requests to prover in parallel
ParaCount means parallel count for sending requests to prover
RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate
or batches to generate proofs. It is also used in the isSynced loop
"1m"
"300ms"
VerifyProofInterval is the interval of time to verify/send an proof in L1
"1m"
"300ms"
diff --git a/docs/config-file/node-config-doc.md b/docs/config-file/node-config-doc.md
index 986e0cefc0..4be852f2af 100644
--- a/docs/config-file/node-config-doc.md
+++ b/docs/config-file/node-config-doc.md
@@ -3973,6 +3973,8 @@ Password="testonly"
| --------------------------------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| - [Host](#Aggregator_Host ) | No | string | No | - | Host for the grpc server |
| - [Port](#Aggregator_Port ) | No | integer | No | - | Port for the grpc server |
+| - [Parallel](#Aggregator_Parallel ) | No | boolean | No | - | Parallel means send requests to prover in parallel |
+| - [ParaCount](#Aggregator_ParaCount ) | No | integer | No | - | ParaCount means parallel count for sending requests to prover |
| - [RetryTime](#Aggregator_RetryTime ) | No | string | No | - | Duration |
| - [VerifyProofInterval](#Aggregator_VerifyProofInterval ) | No | string | No | - | Duration |
| - [ProofStatePollingInterval](#Aggregator_ProofStatePollingInterval ) | No | string | No | - | Duration |
@@ -4020,7 +4022,35 @@ Host="0.0.0.0"
Port=50081
```
-### 12.3. `Aggregator.RetryTime`
+### 12.3. `Aggregator.Parallel`
+
+**Type:** : `boolean`
+
+**Default:** `false`
+
+**Description:** Parallel means send requests to prover in parallel
+
+**Example setting the default value** (false):
+```
+[Aggregator]
+Parallel=false
+```
+
+### 12.4. `Aggregator.ParaCount`
+
+**Type:** : `integer`
+
+**Default:** `0`
+
+**Description:** ParaCount means parallel count for sending requests to prover
+
+**Example setting the default value** (0):
+```
+[Aggregator]
+ParaCount=0
+```
+
+### 12.5. `Aggregator.RetryTime`
**Title:** Duration
@@ -4047,7 +4077,7 @@ or batches to generate proofs. It is also used in the isSynced loop
RetryTime="5s"
```
-### 12.4. `Aggregator.VerifyProofInterval`
+### 12.6. `Aggregator.VerifyProofInterval`
**Title:** Duration
@@ -4073,7 +4103,7 @@ RetryTime="5s"
VerifyProofInterval="1m30s"
```
-### 12.5. `Aggregator.ProofStatePollingInterval`
+### 12.7. `Aggregator.ProofStatePollingInterval`
**Title:** Duration
@@ -4099,7 +4129,7 @@ VerifyProofInterval="1m30s"
ProofStatePollingInterval="5s"
```
-### 12.6. `Aggregator.TxProfitabilityCheckerType`
+### 12.8. `Aggregator.TxProfitabilityCheckerType`
**Type:** : `string`
@@ -4114,13 +4144,13 @@ possible values: base/acceptall
TxProfitabilityCheckerType="acceptall"
```
-### 12.7. `[Aggregator.TxProfitabilityMinReward]`
+### 12.9. `[Aggregator.TxProfitabilityMinReward]`
**Type:** : `object`
**Description:** TxProfitabilityMinReward min reward for base tx profitability checker when aggregator will validate batch
this parameter is used for the base tx profitability checker
-### 12.8. `Aggregator.IntervalAfterWhichBatchConsolidateAnyway`
+### 12.10. `Aggregator.IntervalAfterWhichBatchConsolidateAnyway`
**Title:** Duration
@@ -4146,7 +4176,7 @@ this parameter is used for the base tx profitability checker
IntervalAfterWhichBatchConsolidateAnyway="0s"
```
-### 12.9. `Aggregator.ChainID`
+### 12.11. `Aggregator.ChainID`
**Type:** : `integer`
@@ -4160,7 +4190,7 @@ IntervalAfterWhichBatchConsolidateAnyway="0s"
ChainID=0
```
-### 12.10. `Aggregator.ForkId`
+### 12.12. `Aggregator.ForkId`
**Type:** : `integer`
@@ -4174,7 +4204,7 @@ ChainID=0
ForkId=0
```
-### 12.11. `Aggregator.SenderAddress`
+### 12.13. `Aggregator.SenderAddress`
**Type:** : `string`
@@ -4189,7 +4219,7 @@ to sign the L1 txs
SenderAddress=""
```
-### 12.12. `Aggregator.CleanupLockedProofsInterval`
+### 12.14. `Aggregator.CleanupLockedProofsInterval`
**Title:** Duration
@@ -4215,7 +4245,7 @@ SenderAddress=""
CleanupLockedProofsInterval="2m0s"
```
-### 12.13. `Aggregator.GeneratingProofCleanupThreshold`
+### 12.15. `Aggregator.GeneratingProofCleanupThreshold`
**Type:** : `string`
@@ -4231,7 +4261,7 @@ allowed to be cleared.
GeneratingProofCleanupThreshold="10m"
```
-### 12.14. `Aggregator.GasOffset`
+### 12.16. `Aggregator.GasOffset`
**Type:** : `integer`
@@ -4254,7 +4284,7 @@ final gas: 1100
GasOffset=0
```
-### 12.15. `Aggregator.UpgradeEtrogBatchNumber`
+### 12.17. `Aggregator.UpgradeEtrogBatchNumber`
**Type:** : `integer`
@@ -4268,7 +4298,7 @@ GasOffset=0
UpgradeEtrogBatchNumber=0
```
-### 12.16. `Aggregator.BatchProofL1BlockConfirmations`
+### 12.18. `Aggregator.BatchProofL1BlockConfirmations`
**Type:** : `integer`
@@ -4282,7 +4312,7 @@ UpgradeEtrogBatchNumber=0
BatchProofL1BlockConfirmations=2
```
-### 12.17. `Aggregator.SettlementBackend`
+### 12.19. `Aggregator.SettlementBackend`
**Type:** : `string`
@@ -4296,7 +4326,7 @@ BatchProofL1BlockConfirmations=2
SettlementBackend="l1"
```
-### 12.18. `Aggregator.AggLayerTxTimeout`
+### 12.20. `Aggregator.AggLayerTxTimeout`
**Title:** Duration
@@ -4322,7 +4352,7 @@ SettlementBackend="l1"
AggLayerTxTimeout="5m0s"
```
-### 12.19. `Aggregator.AggLayerURL`
+### 12.21. `Aggregator.AggLayerURL`
**Type:** : `string`
@@ -4336,7 +4366,7 @@ AggLayerTxTimeout="5m0s"
AggLayerURL=""
```
-### 12.20. `[Aggregator.SequencerPrivateKey]`
+### 12.22. `[Aggregator.SequencerPrivateKey]`
**Type:** : `object`
**Description:** SequencerPrivateKey Private key of the trusted sequencer
@@ -4346,7 +4376,7 @@ AggLayerURL=""
| - [Path](#Aggregator_SequencerPrivateKey_Path ) | No | string | No | - | Path is the file path for the key store file |
| - [Password](#Aggregator_SequencerPrivateKey_Password ) | No | string | No | - | Password is the password to decrypt the key store file |
-#### 12.20.1. `Aggregator.SequencerPrivateKey.Path`
+#### 12.22.1. `Aggregator.SequencerPrivateKey.Path`
**Type:** : `string`
@@ -4360,7 +4390,7 @@ AggLayerURL=""
Path=""
```
-#### 12.20.2. `Aggregator.SequencerPrivateKey.Password`
+#### 12.22.2. `Aggregator.SequencerPrivateKey.Password`
**Type:** : `string`
diff --git a/docs/config-file/node-config-schema.json b/docs/config-file/node-config-schema.json
index df973e70e8..bc98359466 100644
--- a/docs/config-file/node-config-schema.json
+++ b/docs/config-file/node-config-schema.json
@@ -1571,6 +1571,16 @@
"description": "Port for the grpc server",
"default": 50081
},
+ "Parallel": {
+ "type": "boolean",
+ "description": "Parallel means send requests to prover in parallel",
+ "default": false
+ },
+ "ParaCount": {
+ "type": "integer",
+ "description": "ParaCount means parallel count for sending requests to prover",
+ "default": 0
+ },
"RetryTime": {
"type": "string",
"title": "Duration",
diff --git a/test/Makefile b/test/Makefile
index 5c124b9df8..56fc104f92 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -18,6 +18,11 @@ DOCKERCOMPOSEEXPLORERL2DB := xlayer-explorer-l2-db
DOCKERCOMPOSEEXPLORERRPC := xlayer-explorer-json-rpc
DOCKERCOMPOSEDACNODE := xlayer-data-availability
DOCKERCOMPOSEZKPROVER := xlayer-prover
+DOCKERCOMPOSEMOCKPROVER := xlayer-mock-prover
+DOCKERCOMPOSEMOCKPROVER2 := xlayer-mock-prover2
+DOCKERCOMPOSEMOCKPROVER3 := xlayer-mock-prover3
+DOCKERCOMPOSEMOCKPROVER4 := xlayer-mock-prover4
+DOCKERCOMPOSEEXECUTOR := xlayer-executor
DOCKERCOMPOSEPERMISSIONLESSDB := xlayer-permissionless-db
DOCKERCOMPOSEPERMISSIONLESSNODE := xlayer-permissionless-node
DOCKERCOMPOSEPERMISSIONLESSNODEDAC := xlayer-permissionless-node-forced-DAC
@@ -73,6 +78,11 @@ RUNEXPLORERL2 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL2)
RUNEXPLORERL2DB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL2DB)
RUNEXPLORERJSONRPC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERRPC)
RUNZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEZKPROVER)
+RUNMOCKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEMOCKPROVER)
+RUNMOCKPROVER2 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEMOCKPROVER2)
+RUNMOCKPROVER3 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEMOCKPROVER3)
+RUNMOCKPROVER4 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEMOCKPROVER4)
+RUNEXECUTOR := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXECUTOR)
RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
@@ -685,6 +695,9 @@ run: ## Runs a full node
$(RUNL1NETWORK)
sleep 1
$(RUNZKPROVER)
+ $(RUNMOCKPROVER2)
+ $(RUNMOCKPROVER3)
+ $(RUNMOCKPROVER4)
$(RUNAPPROVE)
sleep 3
$(RUNSYNC)
diff --git a/test/config/test.executor.config.json b/test/config/test.executor.config.json
new file mode 100644
index 0000000000..74509465af
--- /dev/null
+++ b/test/config/test.executor.config.json
@@ -0,0 +1,106 @@
+{
+ "runExecutorServer": true,
+ "runExecutorClient": false,
+ "runExecutorClientMultithread": false,
+
+ "runHashDBServer": true,
+ "runHashDBTest": false,
+
+ "runAggregatorServer": false,
+ "runAggregatorClient": false,
+
+ "runFileGenBatchProof": false,
+ "runFileGenAggregatedProof": false,
+ "runFileGenFinalProof": false,
+ "runFileProcessBatch": false,
+ "runFileProcessBatchMultithread": false,
+ "runFileExecutor": false,
+
+ "runKeccakScriptGenerator": false,
+ "runKeccakTest": false,
+ "runStorageSMTest": false,
+ "runBinarySMTest": false,
+ "runMemAlignSMTest": false,
+ "runSHA256Test": false,
+ "runBlakeTest": false,
+ "runECRecoverTest": false,
+
+ "executeInParallel": true,
+ "useMainExecGenerated": true,
+
+ "saveRequestToFile": false,
+ "saveInputToFile": false,
+ "saveDbReadsToFile": false,
+ "saveDbReadsToFileOnChange": false,
+ "saveOutputToFile": false,
+ "saveProofToFile": false,
+ "saveResponseToFile": false,
+ "saveFilesInSubfolders": false,
+
+ "loadDBToMemCache": true,
+ "loadDBToMemCacheInParallel": false,
+ "loadDBToMemTimeout": 30000000,
+ "dbMTCacheSize": 1024,
+ "dbProgramCacheSize": 1024,
+
+ "opcodeTracer": false,
+ "logRemoteDbReads": false,
+ "logExecutorServerInput": false,
+ "logExecutorServerInputGasThreshold": 0,
+ "logExecutorServerResponses": false,
+ "logExecutorServerTxs": true,
+
+ "executorServerPort": 50071,
+ "executorROMLineTraces": false,
+ "executorTimeStatistics": false,
+ "executorClientPort": 50071,
+ "executorClientHost": "127.0.0.1",
+ "executorClientLoops": 1,
+
+ "hashDBServerPort": 50061,
+ "hashDBURL": "local",
+ "dbCacheSynchURL_disabled": "127.0.0.1:50061",
+
+ "aggregatorServerPort": 50081,
+ "aggregatorClientPort": 50081,
+ "aggregatorClientHost": "xlayer-aggregator",
+ "aggregatorClientMockTimeout": 10000000,
+ "aggregatorClientWatchdogTimeout": 60000000,
+
+ "mapConstPolsFile": false,
+ "mapConstantsTreeFile": false,
+
+ "inputFile": "input_executor_0.json",
+ "inputFile2": "input_executor_1.json",
+
+ "outputPath": "runtime/output",
+ "configPath": "config",
+
+ "zkevmCmPols_disabled": "runtime/zkevm.commit",
+ "zkevmCmPolsAfterExecutor_disabled": "runtime/zkevm.commit",
+ "c12aCmPols": "runtime/c12a.commit",
+ "recursive1CmPols_disabled": "runtime/recursive1.commit",
+ "recursive2CmPols_disabled": "runtime/recursive2.commit",
+ "recursivefCmPols_disabled": "runtime/recursivef.commit",
+ "finalCmPols_disabled": "runtime/final.commit",
+ "publicsOutput": "public.json",
+ "proofFile": "proof.json",
+
+ "databaseURL": "postgresql://prover_user:prover_pass@xlayer-state-db:5432/prover_db",
+ "dbNodesTableName": "state.nodes",
+ "dbProgramTableName": "state.program",
+ "dbMultiWrite": true,
+ "dbConnectionsPool": true,
+ "dbNumberOfPoolConnections": 30,
+ "dbMetrics": false,
+ "dbClearCache": false,
+ "dbGetTree": false,
+ "dbReadRetryDelay": 100000,
+ "cleanerPollingPeriod": 600,
+ "requestsPersistence": 3600,
+ "maxExecutorThreads": 20,
+ "maxProverThreads": 8,
+ "maxHashDBThreads": 8,
+
+ "fullTracerTraceReserveSize": 262144
+ }
diff --git a/test/config/test.mock.prover.config.json b/test/config/test.mock.prover.config.json
new file mode 100644
index 0000000000..8ff67fea36
--- /dev/null
+++ b/test/config/test.mock.prover.config.json
@@ -0,0 +1,90 @@
+{
+ "runExecutorServer": false,
+ "runExecutorClient": false,
+ "runExecutorClientMultithread": false,
+
+ "runHashDBServer": false,
+ "runHashDBTest": false,
+
+ "runAggregatorServer": false,
+ "runAggregatorClient": false,
+ "runAggregatorClientMock": true,
+ "aggregatorClientMockTimeout": 10,
+ "proverName": "test-prover",
+
+ "runFileGenBatchProof": false,
+ "runFileGenAggregatedProof": false,
+ "runFileGenFinalProof": false,
+ "runFileProcessBatch": false,
+ "runFileProcessBatchMultithread": false,
+
+ "runKeccakScriptGenerator": false,
+ "runKeccakTest": false,
+ "runStorageSMTest": false,
+ "runBinarySMTest": false,
+ "runMemAlignSMTest": false,
+ "runSHA256Test": false,
+ "runBlakeTest": false,
+
+ "executeInParallel": true,
+ "useMainExecGenerated": true,
+ "saveRequestToFile": false,
+ "saveInputToFile": false,
+ "saveDbReadsToFile": false,
+ "saveDbReadsToFileOnChange": false,
+ "saveOutputToFile": true,
+ "saveProofToFile": true,
+ "saveResponseToFile": false,
+ "loadDBToMemCache": true,
+ "opcodeTracer": false,
+ "logRemoteDbReads": false,
+ "logExecutorServerResponses": false,
+
+ "proverServerPort": 50051,
+ "proverServerMockPort": 50052,
+ "proverServerMockTimeout": 10000000,
+ "proverClientPort": 50051,
+ "proverClientHost": "127.0.0.1",
+
+ "executorServerPort": 50071,
+ "executorROMLineTraces": false,
+ "executorClientPort": 50071,
+ "executorClientHost": "127.0.0.1",
+
+ "hashDBServerPort": 50061,
+ "hashDBURL": "local",
+
+ "aggregatorServerPort": 50081,
+ "aggregatorClientPort": 50081,
+ "aggregatorClientHost": "xlayer-aggregator",
+
+ "mapConstPolsFile": false,
+ "mapConstantsTreeFile": false,
+
+ "inputFile": "input_executor_0.json",
+ "inputFile2": "input_executor_1.json",
+
+ "keccakScriptFile": "config/scripts/keccak_script.json",
+ "storageRomFile": "config/scripts/storage_sm_rom.json",
+
+ "outputPath": "output",
+
+ "databaseURL": "postgresql://prover_user:prover_pass@xlayer-state-db:5432/prover_db",
+ "dbNodesTableName": "state.nodes",
+ "dbProgramTableName": "state.program",
+ "dbMultiWrite": true,
+ "dbFlushInParallel": false,
+ "dbMTCacheSize": 1024,
+ "dbProgramCacheSize": 512,
+ "dbNumberOfPoolConnections": 30,
+ "dbGetTree": true,
+ "cleanerPollingPeriod": 600,
+ "requestsPersistence": 3600,
+ "maxExecutorThreads": 20,
+ "maxProverThreads": 8,
+ "maxHashDBThreads": 8,
+ "ECRecoverPrecalc": false,
+ "ECRecoverPrecalcNThreads": 4,
+ "stateManager": true,
+ "useAssociativeCache" : false
+}
diff --git a/test/config/test.prover.config.json b/test/config/test.prover.config.json
index 5a17e17f58..68356078c9 100644
--- a/test/config/test.prover.config.json
+++ b/test/config/test.prover.config.json
@@ -88,4 +88,3 @@
"stateManager": true,
"useAssociativeCache" : false
}
-
diff --git a/test/docker-compose.yml b/test/docker-compose.yml
index 67cf47fe3c..52f0acaee7 100644
--- a/test/docker-compose.yml
+++ b/test/docker-compose.yml
@@ -525,6 +525,61 @@ services:
command: >
zkProver -c /usr/src/app/config.json
+ xlayer-mock-prover:
+ container_name: xlayer-mock-prover
+ image: hermeznetwork/zkevm-prover:v6.0.0
+ ports:
+ # - 50051:50051 # Prover
+ - 50052:50052 # Mock prover
+ volumes:
+ - ./config/test.mock.prover.config.json:/usr/src/app/config.json
+ command: >
+ zkProver -c /usr/src/app/config.json
+
+ xlayer-mock-prover2:
+ container_name: xlayer-mock-prover2
+ image: hermeznetwork/zkevm-prover:v6.0.0
+ ports:
+ # - 50051:50051 # Prover
+ - 50252:50052 # Mock prover
+ volumes:
+ - ./config/test.mock.prover.config.json:/usr/src/app/config.json
+ command: >
+ zkProver -c /usr/src/app/config.json
+
+ xlayer-mock-prover3:
+ container_name: xlayer-mock-prover3
+ image: hermeznetwork/zkevm-prover:v6.0.0
+ ports:
+ # - 50051:50051 # Prover
+ - 50352:50052 # Mock prover
+ volumes:
+ - ./config/test.mock.prover.config.json:/usr/src/app/config.json
+ command: >
+ zkProver -c /usr/src/app/config.json
+
+ xlayer-mock-prover4:
+ container_name: xlayer-mock-prover4
+ image: hermeznetwork/zkevm-prover:v6.0.0
+ ports:
+ # - 50051:50051 # Prover
+ - 50452:50052 # Mock prover
+ volumes:
+ - ./config/test.mock.prover.config.json:/usr/src/app/config.json
+ command: >
+ zkProver -c /usr/src/app/config.json
+
+ xlayer-executor:
+ container_name: xlayer-executor
+ image: hermeznetwork/zkevm-prover:v6.0.0
+ ports:
+ - 50061:50061 # MT
+ - 50071:50071 # Executor
+ volumes:
+ - ./config/test.executor.config.json:/usr/src/app/config.json
+ command: >
+ zkProver -c /usr/src/app/config.json
+
zkprover-mock:
container_name: zkprover-mock
image: hermeznetwork/zkprover-mock:latest