github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/test/Makefile (about)

     1  DOCKERCOMPOSE := docker-compose -f docker-compose.yml
     2  DOCKERCOMPOSEAPPSEQ := supernets2-sequencer
     3  DOCKERCOMPOSEAPPSEQSENDER := supernets2-sequence-sender
     4  DOCKERCOMPOSEAPPL2GASP := supernets2-l2gaspricer
     5  DOCKERCOMPOSEAPPAGG := supernets2-aggregator
     6  DOCKERCOMPOSEAPPRPC := supernets2-json-rpc
     7  DOCKERCOMPOSEAPPSYNC := supernets2-sync
     8  DOCKERCOMPOSEAPPETHTXMANAGER := supernets2-eth-tx-manager
     9  DOCKERCOMPOSESTATEDB := supernets2-state-db
    10  DOCKERCOMPOSEPOOLDB := supernets2-pool-db
    11  DOCKERCOMPOSEEVENTDB := supernets2-event-db
    12  DOCKERCOMPOSENETWORK := supernets2-mock-l1-network
    13  DOCKERCOMPOSEEXPLORERL1 := supernets2-explorer-l1
    14  DOCKERCOMPOSEEXPLORERL1DB := supernets2-explorer-l1-db
    15  DOCKERCOMPOSEEXPLORERL2 := supernets2-explorer-l2
    16  DOCKERCOMPOSEEXPLORERL2DB := supernets2-explorer-l2-db
    17  DOCKERCOMPOSEEXPLORERRPC := supernets2-explorer-json-rpc
    18  DOCKERCOMPOSEZKPROVER := supernets2-prover
    19  DOCKERCOMPOSEPERMISSIONLESSDB := supernets2-permissionless-db
    20  DOCKERCOMPOSEPERMISSIONLESSNODE := supernets2-permissionless-node
    21  DOCKERCOMPOSEPERMISSIONLESSNODEDAC := supernets2-permissionless-node-forced-DAC
    22  DOCKERCOMPOSEPERMISSIONLESSZKPROVER := supernets2-permissionless-prover
    23  DOCKERCOMPOSENODEAPPROVE := supernets2-approve
    24  DOCKERCOMPOSEMETRICS := supernets2-metrics
    25  DOCKERCOMPOSEGRAFANA := grafana
    26  
    27  RUNSTATEDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSESTATEDB)
    28  RUNPOOLDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPOOLDB)
    29  RUNEVENTDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEVENTDB)
    30  RUNSEQUENCER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSEQ)
    31  RUNSEQUENCESENDER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSEQSENDER)
    32  RUNL2GASPRICER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPL2GASP)
    33  RUNAGGREGATOR := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPAGG)
    34  RUNJSONRPC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPRPC)
    35  RUNSYNC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSYNC)
    36  RUNETHTXMANAGER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPETHTXMANAGER)
    37  RUNGRAFANA := DOCKERGID=`stat -c '%g' /var/run/docker.sock` $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEGRAFANA)
    38  
    39  RUNL1NETWORK := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENETWORK)
    40  RUNEXPLORERL1 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL1)
    41  RUNEXPLORERL1DB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL1DB)
    42  RUNEXPLORERL2 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL2)
    43  RUNEXPLORERL2DB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL2DB)
    44  RUNEXPLORERJSONRPC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERRPC)
    45  RUNZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEZKPROVER)
    46  
    47  RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
    48  RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
    49  RUNPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
    50  RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
    51  
    52  RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
    53  
    54  RUNMETRICS := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEMETRICS)
    55  
    56  RUN := $(DOCKERCOMPOSE) up -d
    57  
    58  STOPSTATEDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSESTATEDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSESTATEDB)
    59  STOPPOOLDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPOOLDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPOOLDB)
    60  STOPEVENTDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEVENTDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEVENTDB)
    61  STOPSEQUENCER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSEQ) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSEQ)
    62  STOPSEQUENCESENDER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSEQSENDER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSEQSENDER)
    63  STOPL2GASPRICER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPL2GASP) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPL2GASP)
    64  STOPAGGREGATOR := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPAGG) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPAGG)
    65  STOPJSONRPC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPRPC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPRPC)
    66  STOPSYNC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSYNC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSYNC)
    67  STOPETHTXMANAGER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPETHTXMANAGER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPETHTXMANAGER)
    68  STOPGRAFANA := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEGRAFANA) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEGRAFANA)
    69  
    70  STOPNETWORK := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENETWORK) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENETWORK)
    71  STOPEXPLORERL1 := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERL1) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERL1)
    72  STOPEXPLORERL1DB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERL1DB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERL1DB)
    73  STOPEXPLORERL2 := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERL2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERL2)
    74  STOPEXPLORERL2DB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERL2DB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERL2DB)
    75  STOPEXPLORERJSONRPC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERRPC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERRPC)
    76  STOPZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEZKPROVER)
    77  
    78  STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
    79  STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
    80  STOPPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
    81  STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
    82  
    83  RUNDACDB := docker-compose up -d supernets2-data-node-db
    84  STOPDACDB := docker-compose stop supernets2-data-node-db && docker-compose rm -f supernets2-data-node-db
    85  
    86  STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
    87  
    88  STOPMETRICS := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEMETRICS) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEMETRICS)
    89  
    90  STOP := $(DOCKERCOMPOSE) down --remove-orphans
    91  
    92  .PHONY: test-full-non-e2e
    93  test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
    94  	$(RUNSTATEDB)
    95  	$(RUNPOOLDB)
    96  	$(RUNEVENTDB)
    97  	$(RUNZKPROVER)
    98  	sleep 7
    99  	$(RUNL1NETWORK)
   100  	sleep 15
   101  	docker logs $(DOCKERCOMPOSEZKPROVER)
   102  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -timeout 60s ../...
   103  
   104  .PHONY: test-e2e-group-1
   105  test-e2e-group-1: stop ## Runs group 1 e2e tests checking race conditions
   106  	$(RUNSTATEDB)
   107  	$(RUNPOOLDB)
   108  	$(RUNEVENTDB)
   109  	sleep 5
   110  	$(RUNZKPROVER)
   111  	docker ps -a
   112  	docker logs $(DOCKERCOMPOSEZKPROVER)
   113  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 600s ../ci/e2e-group1/...
   114  
   115  .PHONY: test-e2e-group-2
   116  test-e2e-group-2: stop ## Runs group 2 e2e tests checking race conditions
   117  	$(RUNSTATEDB)
   118  	$(RUNPOOLDB)
   119  	$(RUNEVENTDB)
   120  	sleep 5
   121  	$(RUNZKPROVER)
   122  	docker ps -a
   123  	docker logs $(DOCKERCOMPOSEZKPROVER)
   124  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 600s ../ci/e2e-group2/...
   125  
   126  .PHONY: test-e2e-group-3
   127  test-e2e-group-3: stop ## Runs group 3 e2e tests checking race conditions
   128  	$(RUNSTATEDB)
   129  	$(RUNPOOLDB)
   130  	$(RUNEVENTDB)
   131  	sleep 5
   132  	$(RUNZKPROVER)
   133  	docker ps -a
   134  	docker logs $(DOCKERCOMPOSEZKPROVER)
   135  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 600s ../ci/e2e-group3/...
   136  
   137  .PHONY: test-e2e-group-4
   138  test-e2e-group-4: stop ## Runs group 4 e2e tests checking race conditions
   139  	$(RUNSTATEDB)
   140  	$(RUNPOOLDB)
   141  	$(RUNEVENTDB)
   142  	sleep 5
   143  	$(RUNZKPROVER)
   144  	docker ps -a
   145  	docker logs $(DOCKERCOMPOSEZKPROVER)
   146  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 600s ../ci/e2e-group4/...
   147  
   148  .PHONY: test-e2e-group-5
   149  test-e2e-group-5: stop ## Runs group 5 e2e tests checking race conditions
   150  	$(RUNSTATEDB)
   151  	$(RUNPOOLDB)
   152  	$(RUNEVENTDB)
   153  	sleep 5
   154  	$(RUNZKPROVER)
   155  	docker ps -a
   156  	docker logs $(DOCKERCOMPOSEZKPROVER)
   157  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 1200s ../ci/e2e-group5/...
   158  
   159  .PHONY: test-e2e-group-6
   160  test-e2e-group-6: stop ## Runs group 6 e2e tests checking race conditions
   161  	$(RUNSTATEDB)
   162  	$(RUNPOOLDB)
   163  	$(RUNEVENTDB)
   164  	sleep 5
   165  	$(RUNZKPROVER)
   166  	docker ps -a
   167  	docker logs $(DOCKERCOMPOSEZKPROVER)
   168  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 600s ../ci/e2e-group6/...
   169  
   170  .PHONY: test-e2e-group-7
   171  test-e2e-group-7: stop ## Runs group 7 e2e tests checking race conditions
   172  	$(RUNSTATEDB)
   173  	$(RUNPOOLDB)
   174  	$(RUNEVENTDB)
   175  	sleep 5
   176  	$(RUNZKPROVER)
   177  	docker ps -a
   178  	docker logs $(DOCKERCOMPOSEZKPROVER)
   179  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 600s ../ci/e2e-group7/...
   180  
   181  .PHONY: test-e2e-group-8
   182  test-e2e-group-8: stop ## Runs group 8 e2e tests checking race conditions
   183  	$(RUNSTATEDB)
   184  	$(RUNPOOLDB)
   185  	$(RUNEVENTDB)
   186  	sleep 5
   187  	$(RUNZKPROVER)
   188  	docker ps -a
   189  	docker logs $(DOCKERCOMPOSEZKPROVER)
   190  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 1200s ../ci/e2e-group8/...
   191  
   192  
   193  .PHONY: test-e2e-group-9
   194  test-e2e-group-9: stop ## Runs group 9 e2e tests checking race conditions
   195  	$(RUNSTATEDB)
   196  	$(RUNPOOLDB)
   197  	$(RUNEVENTDB)
   198  	sleep 5
   199  	$(RUNZKPROVER)
   200  	docker ps -a
   201  	docker logs $(DOCKERCOMPOSEZKPROVER)
   202  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group9/...
   203  
   204  
   205  .PHONY: test-e2e-group-10
   206  test-e2e-group-10: stop ## Runs group 10 e2e tests checking race conditions
   207  	$(RUNSTATEDB)
   208  	$(RUNPOOLDB)
   209  	$(RUNEVENTDB)
   210  	sleep 5
   211  	$(RUNZKPROVER)
   212  	docker ps -a
   213  	docker logs $(DOCKERCOMPOSEZKPROVER)
   214  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group10/...
   215  
   216  
   217  .PHONY: test-e2e-group-11
   218  test-e2e-group-11: stop ## Runs group 11 e2e tests checking race conditions
   219  	$(RUNSTATEDB)
   220  	$(RUNPOOLDB)
   221  	$(RUNEVENTDB)
   222  	sleep 5
   223  	$(RUNZKPROVER)
   224  	docker ps -a
   225  	docker logs $(DOCKERCOMPOSEZKPROVER)
   226  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
   227  
   228  
   229  .PHONY: test-e2e-group-supernets2-1
   230  test-e2e-group-supernets2-1: stop ## Runs supernets2-1 e2e tests checking race conditions
   231  	$(RUNSTATEDB)
   232  	$(RUNPOOLDB)
   233  	$(RUNEVENTDB)
   234  	sleep 5
   235  	$(RUNZKPROVER)
   236  	docker ps -a
   237  	docker logs $(DOCKERCOMPOSEZKPROVER)
   238  	trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group-supernets2-1/...
   239  
   240  .PHONY: benchmark-sequencer-eth-transfers
   241  benchmark-sequencer-eth-transfers: stop
   242  	$(RUNL1NETWORK)
   243  	$(RUNSTATEDB)
   244  	$(RUNPOOLDB)
   245  	$(RUNEVENTDB)
   246  	sleep 5
   247  	$(RUNZKPROVER)
   248  	$(RUNSYNC)
   249  	sleep 2
   250  	$(RUNL2GASPRICER)
   251  	$(RUNJSONRPC)
   252  	docker ps -a
   253  	docker logs $(DOCKERCOMPOSEZKPROVER)
   254  	@ cd benchmarks/sequencer/eth-transfers ; \
   255   	mkdir -p results ; \
   256   	touch ./results/out.dat ; \
   257  	go test -bench=. -timeout=600m | tee ./results/out.dat ;
   258  
   259  .PHONY: benchmark-sequencer-erc20-transfers
   260  benchmark-sequencer-erc20-transfers: stop
   261  	$(RUNL1NETWORK)
   262  	$(RUNSTATEDB)
   263  	$(RUNPOOLDB)
   264  	$(RUNEVENTDB)
   265  	sleep 5
   266  	$(RUNZKPROVER)
   267  	$(RUNSYNC)
   268  	sleep 2
   269  	$(RUNL2GASPRICER)
   270  	$(RUNJSONRPC)
   271  	docker ps -a
   272  	docker logs $(DOCKERCOMPOSEZKPROVER)
   273  	@ cd benchmarks/sequencer/erc20-transfers ; \
   274   	mkdir -p results ; \
   275   	touch ./results/out.dat ; \
   276  	go test -bench=. -timeout=600m | tee ./results/out.dat ;
   277  
   278  .PHONY: run-db
   279  run-db: ## Runs the node database
   280  	$(RUNSTATEDB)
   281  	$(RUNPOOLDB)
   282  	$(RUNEVENTDB)
   283  
   284  .PHONY: stop-db
   285  stop-db: ## Stops the node database
   286  	$(STOPEVENTDB)
   287  	$(STOPPOOLDB)
   288  	$(STOPSTATEDB)
   289  
   290  .PHONY: run-node
   291  run-node: ## Runs the node
   292  	$(RUNETHTXMANAGER)
   293  	$(RUNSYNC)
   294  	sleep 2
   295  	$(RUNSEQUENCER)
   296  	$(RUNSEQUENCESENDER)
   297  	$(RUNL2GASPRICER)
   298  	$(RUNAGGREGATOR)
   299  	$(RUNJSONRPC)
   300  
   301  .PHONY: stop-node
   302  stop-node: ## Stops the node
   303  	$(STOPSEQUENCER)
   304  	$(STOPSEQUENCESENDER)
   305  	$(STOPJSONRPC)
   306  	$(STOPL2GASPRICER)
   307  	$(STOPAGGREGATOR)
   308  	$(STOPSYNC)
   309  	$(STOPETHTXMANAGER)
   310  
   311  .PHONY: run-network
   312  run-network: ## Runs the l1 network
   313  	$(RUNL1NETWORK)
   314  
   315  .PHONY: stop-network
   316  stop-network: ## Stops the l1 network
   317  	$(STOPNETWORK)
   318  
   319  .PHONY: run-zkprover
   320  run-zkprover: ## Runs zkprover
   321  	$(RUNZKPROVER)
   322  
   323  .PHONY: stop-zkprover
   324  stop-zkprover: ## Stops zkprover
   325  	$(STOPZKPROVER)
   326  
   327  .PHONY: run-l1-explorer
   328  run-l1-explorer: ## Runs L1 blockscan explorer 
   329  	$(RUNEXPLORERL1DB)
   330  	$(RUNEXPLORERL1)
   331  
   332  .PHONY: run-l2-explorer
   333  run-l2-explorer: ## Runs L2 blockscan explorer
   334  	$(RUNEXPLORERL2DB)
   335  	$(RUNEXPLORERJSONRPC)
   336  	$(RUNEXPLORERL2)
   337  
   338  .PHONY: run-l2-explorer-json-rpc
   339  run-l2-explorer-json-rpc: ## Runs L2 explorer json rpc
   340  	$(RUNEXPLORERJSONRPC)
   341  
   342  .PHONY: stop-l2-explorer-json-rpc
   343  stop-l2-explorer-json-rpc: ## Stops L2 explorer json rpc
   344  	$(STOPEXPLORERJSONRPC)
   345  
   346  .PHONY: run-explorer
   347  run-explorer: run-l1-explorer run-l2-explorer ## Runs both L1 and L2 explorers
   348  
   349  .PHONY: stop-explorer
   350  stop-explorer: ## Stops the explorer
   351  	$(STOPEXPLORERL2)
   352  	$(STOPEXPLORERL1)
   353  	$(STOPEXPLORERJSONRPC)
   354  	$(STOPEXPLORERL2DB)
   355  	$(STOPEXPLORERL1DB)
   356  
   357  .PHONY: run-explorer-db
   358  run-explorer-db: ## Runs the explorer database
   359  	$(RUNEXPLORERL1DB)
   360  	$(RUNEXPLORERL2DB)
   361  
   362  .PHONY: stop-explorer-db
   363  stop-explorer-db: ## Stops the explorer database
   364  	$(STOPEXPLORERL2DB)
   365  	$(STOPEXPLORERL1DB)
   366  
   367  .PHONY: run-seq
   368  run-seq: ## runs the sequencer
   369  	$(RUNSEQUENCER)
   370  
   371  .PHONY: stop-seq
   372  stop-seq: ## stops the sequencer
   373  	$(STOPSEQUENCER)
   374  
   375  .PHONY: run-seqsender
   376  run-seqsender: ## runs the sequencer sender
   377  	$(RUNSEQUENCESENDER)
   378  
   379  .PHONY: stop-seqsender
   380  stop-seqsender: ## stops the sequencer sender
   381  	$(STOPSEQUENCESENDER)
   382  	
   383  .PHONY: run-sync
   384  run-sync: ## runs the synchronizer
   385  	$(RUNSYNC)
   386  
   387  .PHONY: stop-sync
   388  stop-sync: ## stops the synchronizer
   389  	$(STOPSYNC)
   390  
   391  .PHONY: run-json-rpc
   392  run-json-rpc: ## runs the JSON-RPC
   393  	$(RUNJSONRPC)
   394  
   395  .PHONY: stop-json-rpc
   396  stop-json-rpc: ## stops the JSON-RPC
   397  	$(STOPJSONRPC)
   398  
   399  .PHONY: run-l2gaspricer
   400  run-l2gaspricer: ## runs the L2 Gas Price component
   401  	$(RUNL2GASPRICER)
   402  
   403  .PHONY: stop-l2gaspricer
   404  stop-l2gaspricer: ## stops the L2 Gas Price component
   405  	$(STOPL2GASPRICER)
   406  
   407  .PHONY: run-eth-tx-manager
   408  run-eth-tx-manager: ## Runs the eth tx manager service
   409  	$(RUNETHTXMANAGER)
   410  
   411  .PHONY: stop-eth-tx-manager
   412  stop-eth-tx-manager: ## Stops the eth tx manager service
   413  	$(STOPETHTXMANAGER)
   414  	
   415  .PHONY: run-agg
   416  run-agg: ## Runs the aggregator service
   417  	$(RUNAGGREGATOR)
   418  
   419  .PHONY: stop-agg
   420  stop-agg: ## Stops the aggregator service
   421  	$(STOPAGGREGATOR)
   422  
   423  .PHONY: run-grafana
   424  run-grafana: ## Runs the grafana service
   425  	$(RUNGRAFANA)
   426  
   427  .PHONY: stop-grafana
   428  stop-grafana: ## Stops the grafana service
   429  	$(STOPGRAFANA)
   430  
   431  .PHONY: run-permissionless
   432  run-permissionless: run-node ## Runs the trusted and permissionless node
   433  	$(RUNPERMISSIONLESSDB)
   434  	sleep 1
   435  	$(RUNPERMISSIONLESSZKPROVER)
   436  	$(RUNPERMISSIONLESSNODE)
   437  
   438  .PHONY: stop-permissionless
   439  stop-permissionless: stop-node## Stops the trusted and permissionless node
   440  	$(STOPPERMISSIONLESSNODE)
   441  	$(STOPPERMISSIONLESSZKPROVER)
   442  	$(STOPPERMISSIONLESSDB)
   443  
   444  .PHONY: run-permissionless-dac
   445  run-permissionless-dac: ## Runs a permissionless node that is forced to sync through DAC
   446  	$(RUNPERMISSIONLESSDB)
   447  	sleep 1
   448  	$(RUNPERMISSIONLESSZKPROVER)
   449  	$(RUNPERMISSIONLESSNODEDAC)
   450  
   451  .PHONY: stop-permissionless-dac
   452  stop-permissionless-dac: ## Stops the permissionless node that is forced to sync through DAC
   453  	$(STOPPERMISSIONLESSNODEDAC)
   454  	$(STOPPERMISSIONLESSZKPROVER)
   455  	$(STOPPERMISSIONLESSDB)
   456  
   457  .PHONY: run-approve-matic
   458  run-approve-matic: ## Runs approve in node container
   459  	$(RUNAPPROVE)
   460  
   461  .PHONY: stop-approve-matic
   462  stop-approve-matic: ## Stops approve in node container
   463  	$(STOPAPPROVE)
   464  
   465  .PHONY: run
   466  run: ## Runs a full node
   467  	$(RUNSTATEDB)
   468  	$(RUNPOOLDB)
   469  	$(RUNEVENTDB)
   470  	$(RUNL1NETWORK)
   471  	sleep 1
   472  	$(RUNZKPROVER)
   473  	$(RUNAPPROVE)
   474  	sleep 3
   475  	$(RUNSYNC)
   476  	sleep 2
   477  	$(RUNETHTXMANAGER)
   478  	$(RUNSEQUENCER)
   479  	$(RUNSEQUENCESENDER)
   480  	$(RUNL2GASPRICER)
   481  	$(RUNAGGREGATOR)
   482  	$(RUNJSONRPC)
   483  
   484  .PHONY: stop
   485  stop: ## Stops all services
   486  	$(STOP)
   487  
   488  .PHONY: ship
   489  ship: ## Builds docker images and run them
   490  	cd .. && make build-docker && cd ./test && make run
   491  
   492  .PHONY: reship
   493  reship: stop ship ## Executes `make stop` and `make sail` commands
   494  
   495  .PHONY: restart
   496  restart: stop run ## Executes `make stop` and `make run` commands
   497  
   498  .PHONY: run-metrics
   499  run-metrics: ## Runs the metrics container
   500  	$(RUNMETRICS)
   501  
   502  .PHONY: stop-metrics
   503  stop-metrics: ## Stops the metrics container
   504  	$(STOPMETRICS)
   505  
   506  .PHONY: run-dac-db
   507  run-dac-db: ## Suns the DAC DB
   508  	$(RUNDACDB)
   509  
   510  .PHONY: stop-dac-db
   511  stop-dac-db: ## Stops the DAC DB
   512  	$(STOPDACDB)
   513  
   514  
   515  .PHONY: init-network
   516  init-network: ## Initializes the network
   517  	go run ./scripts/init_network/main.go .
   518  
   519  .PHONY: deploy-sc
   520  deploy-sc: ## deploys some examples of transactions and smart contracts
   521  	go run ./scripts/deploy_sc/main.go .
   522  
   523  .PHONY: send-transfers
   524  send-transfers: ## sends some ETH transfers txs to test the network
   525  	go run ./scripts/send_transfers/main.go .
   526  
   527  .PHONY: deploy-uniswap
   528  deploy-uniswap: ## deploy the uniswap environment to the network
   529  	go run ./scripts/uniswap/main.go .
   530  
   531  .PHONY: run-db-scripts
   532  run-db-scripts: ## Executes scripts on the db after it has been initialized, potentially using info from the environment
   533  	./scripts/postgres/run.sh
   534  
   535  .PHONY: install-mockery
   536  install-mockery: ## Installs mockery with the correct version to generate the mocks
   537  	go install github.com/vektra/mockery/v2@v2.22.1
   538  
   539  .PHONY: generate-mocks
   540  generate-mocks: ## Generates mocks for the tests, using mockery tool
   541  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=storageInterface --dir=../jsonrpc --output=../jsonrpc --outpkg=jsonrpc --inpackage --structname=storageMock --filename=mock_storage.go
   542  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=PoolInterface --dir=../jsonrpc/types --output=../jsonrpc/mocks --outpkg=mocks --structname=PoolMock --filename=mock_pool.go
   543  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=StateInterface --dir=../jsonrpc/types --output=../jsonrpc/mocks --outpkg=mocks --structname=StateMock --filename=mock_state.go
   544  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../jsonrpc/mocks --outpkg=mocks --structname=DBTxMock --filename=mock_dbtx.go
   545  
   546  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=workerInterface --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=WorkerMock --filename=mock_worker.go
   547  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=StateMock --filename=mock_state.go
   548  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=txPool --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage  --structname=PoolMock --filename=mock_pool.go
   549  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../sequencer --outpkg=sequencer --structname=DbTxMock --filename=mock_dbtx.go
   550  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=dbManagerInterface --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=DbManagerMock --filename=mock_db_manager.go
   551  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=etherman --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=EthermanMock --filename=mock_etherman.go
   552  
   553  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go
   554  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=stateMock --filename=mock_state.go
   555  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethTxManager --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go
   556  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go
   557  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=zkEVMClientInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=zkEVMClientMock --filename=mock_supernets2client.go
   558  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../synchronizer --outpkg=synchronizer --structname=dbTxMock --filename=mock_dbtx.go
   559  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ClientFactoryInterface --srcpkg=github.com/0xPolygon/supernets2-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientFactoryMock --filename=mock_datacommitteeclientfactory.go
   560  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ClientInterface --srcpkg=github.com/0xPolygon/supernets2-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientMock --filename=mock_datacommitteeclient.go
   561  
   562  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=etherscanMock --filename=mock_etherscan.go
   563  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=ethGasStationMock --filename=mock_ethgasstation.go
   564  
   565  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../ethtxmanager --output=../ethtxmanager --outpkg=ethtxmanager --structname=ethermanMock --filename=mock_etherman_test.go
   566  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../ethtxmanager --output=../ethtxmanager --outpkg=ethtxmanager --structname=stateMock --filename=mock_state_test.go
   567  
   568  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=pool --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go
   569  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go
   570  
   571  	## mocks for the aggregator tests
   572  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=StateMock --filename=mock_state.go
   573  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=proverInterface --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=ProverMock --filename=mock_prover.go
   574  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=etherman --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=Etherman --filename=mock_etherman.go
   575  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethTxManager --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=EthTxManager --filename=mock_ethtxmanager.go
   576  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=aggregatorTxProfitabilityChecker --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=ProfitabilityCheckerMock --filename=mock_profitabilitychecker.go
   577  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../aggregator/mocks --outpkg=mocks --structname=DbTxMock --filename=mock_dbtx.go
   578  
   579  .PHONY: run-benchmarks
   580  run-benchmarks: run-db ## Runs benchmars
   581  	go test -bench=. ./state/tree
   582  
   583  .PHONY: compile-scs
   584  compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
   585  	go run ./scripts/cmd... compilesc --input ./contracts
   586  
   587  ## Help display.
   588  ## Pulls comments from beside commands and prints a nicely formatted
   589  ## display with the commands and their usage information.
   590  .DEFAULT_GOAL := help
   591  
   592  .PHONY: help
   593  help: ## Prints this help
   594  		@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
   595  		| sort \
   596  		| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'