Skip to content

Commit

Permalink
fix ut (#49)
Browse files Browse the repository at this point in the history
* fix null effective_percentage

* fix forkID calculation

* fix script

* generate json-schema + docs for node config file and network_custom

* fix unittest

* Hotfixv0.1.4 to v0.2.0 (0xPolygonHermez#2255)

* Hotfix v0.1.4 to main (0xPolygonHermez#2250)

* fix concurrent web socket writes

* fix eth_syncing

* fix custom trace internal tx call error handling and update prover

* add test to custom tracer depth issue; fix internal call error and gas used

* fix custom tracer for internal tx with error and no more steps after it

* remove debug code

* Make max grpc message size configurable  (0xPolygonHermez#2179)

* make max grpc message size configurable

* fix state tests

* fix tests

* fix tests

* get SequencerNodeURI from SC if empty and not IsTrustedSequencer

* Optimize trace (0xPolygonHermez#2183)

* optimize trace

* fix memory reading

* update docker image

* update prover image

* fix converter

* fix memory

* fix step memory

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* update prover image

* fix struclogs

* fix memory size

* fix memory size

* fix memory size

* refactor memory resize

* refactor memory resize

* move log for the best fitting tx (0xPolygonHermez#2192)

* fix load zkCounters from pool

* remove unnecessary log.info

* add custom tracer support to CREATES opcode without depth increase (0xPolygonHermez#2213)

* logs

* fix getting stateroot from previous batch (GetWIPBatch)

* logs

* Fix GetWipBatch when previous last batch is a forced batch

* fix forcedBatch trusted state

* Revert "fix getting stateroot from previous batch (GetWIPBatch)"

This reverts commit 860f0e7.

* force GHA

* add pool limits (0xPolygonHermez#2189)

* Hotfix/batch l2 data (0xPolygonHermez#2223)

* Fix BatchL2Data

* Force GHA

* remove failed txs from the pool limit check (0xPolygonHermez#2233)

* debug trace by batch number via external rpc requests (0xPolygonHermez#2235)

* fix trace batch remote requests in parallel limitation (0xPolygonHermez#2244)

* Added RPC.TraceBatchUseHTTPS config parameter

* fix executor version

---------

Co-authored-by: tclemos <[email protected]>
Co-authored-by: tclemos <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>

* fix test

* fix test

---------

Co-authored-by: tclemos <[email protected]>
Co-authored-by: tclemos <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>

* Effective GasPrice refactor+fixes (0xPolygonHermez#2247)

* effective GasPrice refactor

* bugs fixes and finalizer tests fixes

* fix typo

* fix calculate effective gasprice percentage

* fix test gas price

* Fix/0xPolygonHermez#2257 effective gas price receipt (0xPolygonHermez#2258)

* effective gas price returned by the rpc in the receipt

* linter

* bugfix: fixing l2blocks timestamp for the fist batch (0xPolygonHermez#2260)

* bugfix: fixing l2blocks timestamp for the fist batch

Signed-off-by: Nikolay Nedkov <[email protected]>

* fix finalizer unit test

---------

Signed-off-by: Nikolay Nedkov <[email protected]>

* add more comments, and removed fields PrivateKeyPath and PrivateKeyPassword from etherman.Config that are not in use

* add info to git action

* add info to git action

* fix github action

* updated comments

* updated comments

* Fix/0xPolygonHermez#2263 gas used (0xPolygonHermez#2264)

* fix fea2scalar and gas used

* suggestion

* fix fea2scalar

* suggestion

* Fix pending tx when duplicate nonce (0xPolygonHermez#2270)

* fix pending tx when duplicate nonce

* set pool.transaction.failed_reason to NULL when updating an existing tx

* add more log details when adding tx to AddrQueue

* fix query to add tx to the pool. Fix lint errors

* change failed_reason for tx discarded due duplicate nonce

* Only return a tx from the pool if tx is in pending status (0xPolygonHermez#2273)

* Return a tx from the pool only if it is

* fix TestGetTransactionByHash

---------

Co-authored-by: agnusmor <[email protected]>

* fix documentation with  config file

* improve: adding check to skip appending effectivePercentage if current forkId is under 5.

Signed-off-by: Nikolay Nedkov <[email protected]>

* Fiex effectiveGasprice unsigned txs with forkId lower than 5 (0xPolygonHermez#2278)

* feat: adding functionality to stop sequencer on specific batch num from config param.

Signed-off-by: Nikolay Nedkov <[email protected]>

* patch: adding print for X-Real-IP in JSON-RPC

Signed-off-by: Nikolay Nedkov <[email protected]>

* Fix checkIfSynced (0xPolygonHermez#2289)

* [Rehashing] Check logs order and fix blockhash and blockNumber in the log conversion (0xPolygonHermez#2280)

* fix and check order

* linter

* flushID synchronizer (0xPolygonHermez#2287)

* FlushID in synchronizer

* linter

* fix logs

* commnets

* executor error refactor (0xPolygonHermez#2299)

* handle invalid rlp ROM error (0xPolygonHermez#2297)

* add maxL2GasPrice (0xPolygonHermez#2294)

* add maxL2GasPrice

* fix

* fix

* add test

* document parameter

* update description

* Error refactor (0xPolygonHermez#2302)

* error refactor

* refactor

* Fix replaced tx as failed when duplicated nonce (0xPolygonHermez#2308)

* Fix UpdateTxStatus for replacedTx

* Fix adding tx with same nonce on AddrQueue

* log reprocess need (0xPolygonHermez#2309)

* log reprocess need

* Update finalizer.go

* Feature/2300 synchronizer detect if executor restart (0xPolygonHermez#2306)

* detect if executor restarts and stop synchonizer

* Update prover images (0xPolygonHermez#2311)

* update prover image

* update prover images

* change executor param

* Update testnet.prover.config.json

* Update test.permissionless.prover.config.json

* Update test.prover.config.json

* Update public.prover.config.json

* prover params

* prover params

* prover params

* update prover images

* add doc, and fix dockers to be able to use snap/restore feature (0xPolygonHermez#2315)

* add doc, and fix dockers to be able to use snap/restore feature

* add doc for snap/restore feature

---------

Co-authored-by: Toni Ramírez <[email protected]>

* Update docker-compose.yml

* Update docker-compose.yml

* do not add tx to the pool in case err != nil

* do not add tx into the pool if a fatal error in the executor happens during pre execution

* fix dbMultiWriteSinglePosition config value

* workarround for the error error closing batch

* workarround for the error error closing batch

* workarround for the error error closing batch

* workaround for the error of closing batch, another case

* `Worker`'s `AddTxTracker` Bug Fix (0xPolygonHermez#2343)

* bugfix: Resolve  Function Bug in Worker Module

Signed-off-by: Nikolay Nedkov <[email protected]>

* improve: improving the wait for pending txs to be for only the txs for the current address.

Signed-off-by: Nikolay Nedkov <[email protected]>

---------

Signed-off-by: Nikolay Nedkov <[email protected]>

* rename config files (0xPolygonHermez#2349)

* fix closing batch + logs (0xPolygonHermez#2348)

* fix closing batch + logs

* fix

* log description

* typo errors

* fix error: failed to store transactions for batch due to duplicate key

* test

* typo

* Update README.md

* Update release.yml

* bugfix: fixing place where we need to increment the wg per address for pending txs

Signed-off-by: Nikolay Nedkov <[email protected]>

* Store batchL2Data when the batch is opened (0xPolygonHermez#2358)

* add GasPriceMarginFactor and MaxGasPrice to eth-tx-manager (0xPolygonHermez#2360)

* add GasPriceMarginFactor and MaxGasPrice to eth-tx-manager

* add logs, fix config

* update config file documentation

---------

Co-authored-by: joanestebanr <[email protected]>

* bugfix: attaching missing TxTracker.From to pending txs to store for forced batches. (0xPolygonHermez#2365)

Signed-off-by: Nikolay Nedkov <[email protected]>

* Update README.md

* improve: adding logs (0xPolygonHermez#2373)

* improve: adding logs

Signed-off-by: Nikolay Nedkov <[email protected]>

* adding more logs

Signed-off-by: Nikolay Nedkov <[email protected]>

* adding more logs #2

Signed-off-by: Nikolay Nedkov <[email protected]>

---------

Signed-off-by: Nikolay Nedkov <[email protected]>

* bugfix: fixing finalizer's  handling. (0xPolygonHermez#2375)

Signed-off-by: Nikolay Nedkov <[email protected]>

* Update README.md

* change hashdb go package

* new hashdb interface

* aggregator pb refactor

* new prover image

* change prover config

* update prover image

* update to latest proto and prover image

* Refactor nonce calculation for addQueue (0xPolygonHermez#2382)

* refactor nonce

* fix

* fix

* fix script

* check to avoid data inconsistencies (0xPolygonHermez#2387)

* check to avoid data inconsistencies

* check batchL2Data

* names in the logs

* Refactor: avoid delete addrQueue if it has pending txs to store (0xPolygonHermez#2391)

* refactor delete addrQueue only if not pending txs to store

* fix finalizer test

* fix olsStateRoot in handleForcedTxsProcessResp

* Update sequencer/addrqueue.go

Co-authored-by: Alonso Rodriguez <[email protected]>

---------

Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: Alonso Rodriguez <[email protected]>

* Sort txs in worker by gasPrice (remove efficiency sort) (0xPolygonHermez#2392)

* Sort txs in worker by GasPrice (remove efficiency sort)

* update config docs

---------

Co-authored-by: Toni Ramírez <[email protected]>

* use useMainExecGenerated (0xPolygonHermez#2393)

* Fix store forced batch tx (0xPolygonHermez#2394)

* l2coinbase (0xPolygonHermez#2400)

* l2coinbase

* add default config

* add support  config fields that are common.Address

* docs

* prover image

---------

Co-authored-by: joanestebanr <[email protected]>

* Check flushID != 0 (0xPolygonHermez#2406)

* Show tx.GasPrice in the worker logs (instead of tx.Cost) (0xPolygonHermez#2416)

* Check flushID != 0 in Sequencer (0xPolygonHermez#2415)

* check flushid != 0 in sequencer

* Use f.halt instead of log.Fatal to report that flushid is 0

Co-authored-by: Toni Ramírez <[email protected]>

* fix lint

---------

Co-authored-by: Toni Ramírez <[email protected]>

* update config params for Prover v2.1.0 (0xPolygonHermez#2418)

* cherry-pick 0xPolygonHermez#2385 and 0xPolygonHermez#2396 from develop into v0.2.6 (0xPolygonHermez#2412)

* fix http request instance null for websocket requests (0xPolygonHermez#2385)

* fix ws subscribe to get filtered log notifications (0xPolygonHermez#2396)

* new block endpoints and improvements to batch endpoint (0xPolygonHermez#2411)

* Add forced batches tx to addrQueue (0xPolygonHermez#2398)

* add forced batches tx to addrQueue

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* refactor

* fix test

* fix test

* fix test

* fix test

* fix test

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixe hash and from

* fixe hash and from

* fixe hash and from

* fixe hash and from

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* improve tests

* improve tests

* improve tests

* improve tests

* improve tests

* refactor

* refactor

* improve logs

* bugifx: adding missing tx.BreakEvenGasPrice nil check

Signed-off-by: Nikolay Nedkov <[email protected]>

* Sync halt (0xPolygonHermez#2428)

* cherry-pick 0xPolygonHermez#2245 and 0xPolygonHermez#2424 from develop into v0.2.6 (0xPolygonHermez#2447)

* fix safe and finalized l2 block to consider l1 safe and finalized blocks respectively (0xPolygonHermez#2245)

* fix and add tests for safe and finalized l2 blocks (0xPolygonHermez#2424)

* New executor errors refactor (0xPolygonHermez#2438)

* wip

* new errors

* retry on executor db error

* new prover images

* fix comment

* update hasdh proto and prover images

* handle excutor db error

* update test

* update test

* update test

* update test

* refactor error check in unsigned tx

* Reprocess full batch in parallel (sanity check) (0xPolygonHermez#2425)

* reprocess full batch in parallel (sanity check)

* update doc

* update reprocessFullBatch logs

* Speed up deleting batches from stateDB creating an index for state.receipt.block_num (0xPolygonHermez#2457)

* receipt deletion index

* receipt deletion index

* Feature/0xPolygonHermez#2429 fork id improvement (0xPolygonHermez#2450)

* db table + tests

* GetForks func modified to get them by range

* Sync forkID

* forkIDIntervals and forkID genesis

* linter

* docs

* Avoid resetForkID in trustedNode

* fix test group 9

* suggestions

* doc and mocks

* fix check storedFlushID (0xPolygonHermez#2458)

* remove stored flush id 0 (0xPolygonHermez#2459)

* Feature/0xPolygonHermez#2403 snap (0xPolygonHermez#2404)

* Path snapshot command

* restore

* readme

* options used by dbeaver

* #2429_forkID_improvement: #2429_forkID_improvement:

* fix

* fix postgres version to v15

* fix permissionless init script

* bugfix: removing measuring of metrics from async batch reprocessing f… (0xPolygonHermez#2461)

* bugfix: removing measuring of metrics from async batch reprocessing for executor.

Signed-off-by: Nikolay Nedkov <[email protected]>

* fixing unit tests

Signed-off-by: Nikolay Nedkov <[email protected]>

---------

Signed-off-by: Nikolay Nedkov <[email protected]>

* update prover images (0xPolygonHermez#2473)

* Update production-setup.md

* init

* update

* update

* update

* update

* update

* Add logs for sequencer (#14)

* add log statistics

* add reset and batch number

* total duration with milliseconds

* add batch gas used statistics

* support innertx (#16)

* add switch for pending transaction filter (#18)

* suport free gas to claim asset (#22)

* add gp adjust (#17)

* add the fixed type for gp adjust

* add ut and adjust the code about kafka

* add fixed config to the local.node.config.toml

* fix lint error

* fix lint error

* read rootca from path

* fix conflict

* fix kafka lint

* rebranding (#23)

* rebrand

* update

* fix license

* fix build docker

* rename to xgon (#24)

* validium/rollup switch (#26)

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update abi

* update go mod file

* add wait tick

* fix config name

* fix logs

* modify is zero byte array function

* support nacos (#27)

* support nacos

* reorgnize nacos configuration

* modify the nacos configure name

* add example configure file

* sync fix ws debug (#28)

* sync the code and fix the ws bug for the rpc method

* adaptive the err judge

* fix ut and e2e test  (#29)

* fix ut

* update image

* bridgel2

* update doc

* Support websocket to register nacos (#33)

* add nacos support for websocket

* lint code

* support flatCallTracer  and result limit for trace transaction (#40)

* support flatCallTracer

* trace result limit

* rebranding to X1 (#36)

* update name

* rename

* renmae

* fix e2e

* fix e2e

* fix e2e

* fix e2e

* fix e2e

* fix e2e

* fix e2e

* fix e2e

* update e2e image

* update mod file

* update e2e image

* fix make deploy-sc error (#38)

* update

* update

* update

* add gas price dynamic adjust in follower mode (#34)

* add dynamic adjust for follower

* modify the config

* fix lint and schema

* modify the comment

* modify the comment

* make doc

* first commit

* Update db.go

* Update datacommittee_test.go

* format

* fmt

* goimport

* 1

* 1

* fix

* Update start.go

* 1

* a

* 1

* a

* Update Makefile

* fix test

* Update setup.go

* a

* update makefile

* update makefile

* fix ut

* update

* update

* update

* disabel

* udpate

* update

* update

* fix e2e

* update permissionless-node

---------

Signed-off-by: Nikolay Nedkov <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: joanestebanr <[email protected]>
Co-authored-by: Alonso Rodriguez <[email protected]>
Co-authored-by: tclemos <[email protected]>
Co-authored-by: tclemos <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>
Co-authored-by: joanestebanr <[email protected]>
Co-authored-by: Nikolay Nedkov <[email protected]>
Co-authored-by: jianguo <[email protected]>
Co-authored-by: KamiD <[email protected]>
Co-authored-by: zhangkai <[email protected]>
Co-authored-by: lyh169 <[email protected]>
Co-authored-by: chengzhinei <[email protected]>
Co-authored-by: ylsGit <[email protected]>
Co-authored-by: root <[email protected]>
  • Loading branch information
19 people authored Dec 15, 2023
1 parent 7b2112f commit c273137
Show file tree
Hide file tree
Showing 118 changed files with 5,594 additions and 1,659 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: Report a bug
about: Something with Polygon zkEVM is not working as expected
about: Something with X1 is not working as expected
title: ''
labels: 'type:bug'
assignees: ''
---

#### System information

zkEVM Node version: `v0.0.X-RCXX`
X1 Node version: `v0.0.X-RCXX`
OS & Version: `Windows/Linux/OSX`
Commit hash : (if `develop`)
Network: `Mainnet/Testnet`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
go-version: [ 1.21.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
e2e-group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, dac-1 ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-from-prover.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test from zkevm-prover call
name: Test from x1-prover call
on:
workflow_call:
inputs:
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: 0xPolygonHermez/zkevm-node
repository: okx/x1-node

- name: Install Go
uses: actions/setup-go@v3
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ RUN cd /src && make build

# CONTAINER FOR RUNNING BINARY
FROM alpine:3.18.0
COPY --from=build /src/dist/xgon-node /app/xgon-node
COPY --from=build /src/dist/x1-node /app/x1-node
COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml
RUN apk update && apk add postgresql15-client
EXPOSE 8123
CMD ["/bin/sh", "-c", "/app/xgon-node run"]
CMD ["/bin/sh", "-c", "/app/x1-node run"]
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/dist
GOENVVARS := GOBIN=$(GOBIN) CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH)
GOBINARY := xgon-node
GOBINARY := x1-node
GOCMD := $(GOBASE)/cmd

LDFLAGS += -X 'github.com/0xPolygonHermez/zkevm-node.Version=$(VERSION)'
Expand Down Expand Up @@ -80,21 +80,21 @@ build: ## Builds the binary locally into ./dist

.PHONY: build-docker
build-docker: ## Builds a docker image with the node binary
docker build -t xgon-node -f ./Dockerfile .
docker build -t x1-node -f ./Dockerfile .

.PHONY: build-docker-nc
build-docker-nc: ## Builds a docker image with the node binary - but without build cache
docker build --no-cache=true -t xgon-node -f ./Dockerfile .
docker build --no-cache=true -t x1-node -f ./Dockerfile .

.PHONY: run-rpc
run-rpc: ## Runs all the services needed to run a local zkEVM RPC node
docker-compose up -d xgon-state-db xgon-pool-db
docker-compose up -d x1-state-db x1-pool-db
sleep 2
docker-compose up -d xgon-prover
docker-compose up -d x1-prover
sleep 5
docker-compose up -d xgon-sync
docker-compose up -d x1-sync
sleep 2
docker-compose up -d xgon-rpc
docker-compose up -d x1-rpc

.PHONY: stop
stop: ## Stops all services
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# zkEVM Node
# X1 Node

zkEVM Node is a Go implementation of a node that operates the Polygon zkEVM Network.
X1 Node is a Go implementation of a node that operates the X1 Network.

## About the Polygon zkEVM network
## About the X1 network

Since this is an implementation of a protocol it's fundamental to understand it, [here](https://zkevm.polygon.technology/docs/zknode/zknode-overview) you can find the specification of the protocol.
Since this is an implementation of a protocol it's fundamental to understand it, [here]() you can find the specification of the protocol.

Glossary:

- L1: Base blockchain where the rollup smart contracts are deployed. It's Ethereum or a testnet of Ethereum, but it could be any EVM compatible blockchain.
- L2: the rollup network aka the Polygon zkEVM network.
- Batch: a group of transactions that are executed/proved, using the [zkEVM prover](https://github.com/0xPolygonHermez/zkevm-prover) and sent to / synchronized from L1
- L2: the rollup network aka the X1 network.
- Batch: a group of transactions that are executed/proved, using the [X1 prover]() and sent to / synchronized from L1
- Sequencer: the actor that is responsible for selecting transactions, putting them in a specific order, and sending them in batches to L1
- Trusted sequencer: sequencer that has special privileges, there can only be one trusted sequencer. The privileges granted to the trusted sequencer allow it to forecast the batches that will be applied to L1. This way it can commit to a specific sequence before interacting with L1. This is done to achieve fast finality and reduce costs associated with using the network (lower gas fees)
- Permissionless sequencer: sequencer role that can be performed by anyone. It has competitive disadvantages compared to the trusted sequencer (slow finality, MEV attacks). Its main purpose is to provide censorship resistance and unstoppability features to the network.
Expand All @@ -20,7 +20,7 @@ Glossary:
- Trusted state: state reached through processing transactions that have been shared by the trusted sequencer. This state is considered trusted as the trusted sequencer could commit to a certain sequence, and then send a different one to L1
- Virtual state: state reached through processing transactions that have already been submitted to L1. These transactions are sent in batches by either trusted or permissionless sequencers. Those batches are also called virtual batches. Note that this state is trustless as it relies on L1 security assumptions
- Consolidated state: state that is proven on-chain by submitting a ZKP (Zero Knowledge Proof) that proves the execution of a sequence of the last virtual batch.
- Invalid transaction: a transaction that can't be processed and doesn't affect the state. Note that such a transaction could be included in a virtual batch. The reason for a transaction to be invalid could be related to the Ethereum protocol (invalid nonce, not enough balance, ...) or due to limitations introduced by the zkEVM (each batch can make use of a limited amount of resources such as the total amount of keccak hashes that can be computed)
- Invalid transaction: a transaction that can't be processed and doesn't affect the state. Note that such a transaction could be included in a virtual batch. The reason for a transaction to be invalid could be related to the Ethereum protocol (invalid nonce, not enough balance, ...) or due to limitations introduced by the X1 (each batch can make use of a limited amount of resources such as the total amount of keccak hashes that can be computed)
- Reverted transaction: a transaction that is executed, but is reverted (because of smart contract logic). The main difference with *invalid transaction* is that this transaction modifies the state, at least to increment nonce of the sender.

## Architecture
Expand All @@ -31,7 +31,7 @@ Glossary:

The diagram represents the main components of the software and how they interact between them. Note that this reflects a single entity running a node, in particular a node that acts as the trusted sequencer. But there are many entities running nodes in the network, and each of these entities can perform different roles. More on this later.

- (JSON) RPC: an HTTP interface that allows users (dApps, metamask, etherscan, ...) to interact with the node. Fully compatible with Ethereum RPC + some extra [custom endpoints](./docs/zkEVM-custom-endpoints.md) specifics of the network. It interacts with the `state` (to get data and process transactions) as well as the `pool` (to store transactions).
- (JSON) RPC: an HTTP interface that allows users (dApps, metamask, etherscan, ...) to interact with the node. Fully compatible with Ethereum RPC + some extra [custom endpoints]() specifics of the network. It interacts with the `state` (to get data and process transactions) as well as the `pool` (to store transactions).
- L2GasPricer: it fetches the L1 gas price and applies some formula to calculate the gas price that will be suggested for the users to use for paying fees on L2. The suggestions are stored on the `pool`, and will be consumed by the `rpc`
- Pool: DB that stores transactions by the `RPC` to be selected/discarded by the `sequencer` later on
- Sequencer: responsible for building the trusted state. To do so, it gets transactions from the pool and puts them in a specific order. It needs to take care of opening and closing batches while trying to make them as full as possible. To achieve this it needs to use the executor to actually process the transaction not only to execute the state transition (and update the hashDB) but also to check the consumed resources by the transactions and the remaining resources of the batch. After executing a transaction that fits into a batch, it gets stored on the `state`. Once transactions are added into the state, they are immediately available through the `rpc`.
Expand All @@ -42,7 +42,7 @@ The diagram represents the main components of the software and how they interact
- State: Responsible for managing the state data (batches, blocks, transactions, ...) that is stored on the `state SB`. It also handles the integration with the `executor` and the `Merkletree` service
- State DB: persistence layer for the state data (except the Merkletree that is handled by the `HashDB` service), it stores informationrelated to L1 (blocks, global exit root updates, ...) and L2 (batches, L2 blocks, transactions, ...)
- Aggregator: consolidates batches by generating ZKPs (Zero Knowledge proofs). To do so it gathers the necessary data that the `prover` needs as input through the `state` and sends a request to it. Once the proof is generated it sends a request to send an L1 tx to verify the proof and move the state from virtual to verified to the `ethtxmanager`. Note that provers connect to the aggregator and not the other way arround. The aggregator can handle multiple connected provers at once and make them work concurrently in the generation of different proofs
- Prover/Executor/hashDB: service that generates ZK proofs. Note that this component is not implemented in this repository, and it's treated as a "black box" from the perspective of the node. The prover/executor has two implementations: [JS reference implementation](https://github.com/0xPolygonHermez/zkevm-proverjs) and [C production-ready implementation](https://github.com/0xPolygonHermez/zkevm-prover). Although it's the same software/binary, it implements three services:
- Prover/Executor/hashDB: service that generates ZK proofs. Note that this component is not implemented in this repository, and it's treated as a "black box" from the perspective of the node. The prover/executor has two implementations: [JS reference implementation](https://github.com/okx/x1-proverjs) and [C production-ready implementation](https://github.com/okx/x1-prover). Although it's the same software/binary, it implements three services:
- Executor: Provides an EVM implementation that allows processing batches as well as getting metadata (state root, transaction receipts, logs, ...) of all the needed results.
- Prover: Generates ZKPs for batches, batches aggregation, and final proofs.
- HashDB: service that stores the Merkletree, containing all the account information (balances, nonces, smart contract code, and smart contract storage)
Expand All @@ -64,8 +64,8 @@ Required services and components:

There must be only one synchronizer, and it's recommended that it has exclusive access to an executor instance, although it's not necessary. This role can perfectly be run in a single instance, however, the JSON RPC and executor services can benefit from running in multiple instances, if the performance decreases due to the number of requests received

- [`zkEVM RPC endpoints`](./docs/json-rpc-endpoints.md)
- [`zkEVM RPC Custom endpoints documentation`](./docs/zkEVM-custom-endpoints.md)
- [`X1 RPC endpoints`](./docs/json-rpc-endpoints.md)
- [`X1 RPC Custom endpoints documentation`]()

### Trusted sequencer

Expand Down
5 changes: 3 additions & 2 deletions aggregator/prover/aggregator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions aggregator/prover/aggregator_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ci/e2e-group-dac-1/datacommittee_test.go
15 changes: 8 additions & 7 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import (
"crypto/ecdsa"
"errors"
"fmt"
"net"
"net/http"
"net/http/pprof"
"os"
"os/signal"
"runtime"
"time"

dataCommitteeClient "github.com/0xPolygon/cdk-data-availability/client"
datastreamerlog "github.com/0xPolygonHermez/zkevm-data-streamer/log"
"github.com/0xPolygonHermez/zkevm-node"
Expand Down Expand Up @@ -34,13 +42,6 @@ import (
"github.com/jackc/pgx/v4/pgxpool"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/urfave/cli/v2"
"net"
"net/http"
"net/http/pprof"
"os"
"os/signal"
"runtime"
"time"
)

func start(cliCtx *cli.Context) error {
Expand Down
12 changes: 6 additions & 6 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ func Test_Defaults(t *testing.T) {
expectedValue: types.NewDuration(5 * time.Second),
},
{
path: "SequenceSender.MaxTxSizeForL1",
expectedValue: uint64(131072),
path: "SequenceSender.MaxBatchesForL1",
expectedValue: uint64(10),
},
{
path: "SequenceSender.GasOffset",
Expand Down Expand Up @@ -210,7 +210,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "MTClient.URI",
expectedValue: "zkevm-prover:50061",
expectedValue: "x1-prover:50061",
},
{
path: "State.DB.User",
Expand All @@ -226,7 +226,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "State.DB.Host",
expectedValue: "zkevm-state-db",
expectedValue: "x1-state-db",
},
{
path: "State.DB.Port",
Expand Down Expand Up @@ -315,7 +315,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Pool.DB.Host",
expectedValue: "zkevm-pool-db",
expectedValue: "x1-pool-db",
},
{
path: "Pool.DB.Port",
Expand Down Expand Up @@ -399,7 +399,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Executor.URI",
expectedValue: "zkevm-prover:50071",
expectedValue: "x1-prover:50071",
},
{
path: "Executor.MaxResourceExhaustedAttempts",
Expand Down
12 changes: 6 additions & 6 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Outputs = ["stderr"]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "xgon-state-db"
Host = "x1-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down Expand Up @@ -58,7 +58,7 @@ FreeGasAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "xgon-pool-db"
Host = "x1-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down Expand Up @@ -146,7 +146,7 @@ MaxTxLifetime = "3h"
[SequenceSender]
WaitPeriodSendSequence = "5s"
LastBatchVirtualizationTimeMaxWaitPeriod = "5s"
MaxTxSizeForL1 = 1000
MaxBatchesForL1 = 10
L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
UseValidium = true
Expand Down Expand Up @@ -174,10 +174,10 @@ CleanHistoryPeriod = "1h"
CleanHistoryTimeRetention = "5m"
[MTClient]
URI = "xgon-prover:50061"
URI = "x1-prover:50061"
[Executor]
URI = "xgon-prover:50071"
URI = "x1-prover:50071"
MaxResourceExhaustedAttempts = 3
WaitOnResourceExhaustion = "1s"
MaxGRPCMessageSize = 100000000
Expand All @@ -191,7 +191,7 @@ Enabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xgon-state-db"
Host = "x1-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down
Loading

0 comments on commit c273137

Please sign in to comment.