Skip to content

Commit

Permalink
rebranding to X1 (#36)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
zjg555543 authored Nov 14, 2023
1 parent 2bafd67 commit ba6ae61
Show file tree
Hide file tree
Showing 56 changed files with 403 additions and 400 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 Xgon is not working as expected
about: Something with X1 is not working as expected
title: ''
labels: 'type:bug'
assignees: ''
---

#### System information

Xgon 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
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 xgon-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: okx/xgon-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 All @@ -35,21 +35,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 need to run a local zkEMV 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 @@
# Xgon Node
# X1 Node

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

## About the Xgon network
## About the X1 network

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 Xgon network.
- Batch: a group of transactions that are executed/proved, using the [Xgon 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,9 +20,9 @@ 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 Xgon (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.
- Proof of Efficiency (PoE): name of the protocol used by the network, it's enforced by the [smart contracts](https://github.com/okx/xgon-contracts)
- Proof of Efficiency (PoE): name of the protocol used by the network, it's enforced by the [smart contracts](https://github.com/okx/x1-contracts)

## Architecture

Expand All @@ -41,10 +41,10 @@ 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 `Merkletree` service)
- 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's sent to Ethereum through the `etherman`
- Prover/Executor: 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/okx/xgon-prover). Although it's the same software/service, it has two very different purposes:
- Prover/Executor: 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/okx/x1-prover). Although it's the same software/service, it has two very different purposes:
- Provide an EVM implementation that allows processing transactions and getting all needed results metadata (state root, receipts, logs, ...)
- Generate ZKPs
- Merkletree: service that stores the Merkletree, containing all the account information (balances, nonces, smart contract code, and smart contract storage). This component is also not implemented in this repo and is consumed as an external service by the node. The implementation can be found [here](https://github.com/okx/xgon-prover)
- Merkletree: service that stores the Merkletree, containing all the account information (balances, nonces, smart contract code, and smart contract storage). This component is also not implemented in this repo and is consumed as an external service by the node. The implementation can be found [here](https://github.com/okx/x1-prover)

## Roles of the network

Expand All @@ -63,8 +63,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

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

### Trusted sequencer

Expand Down
8 changes: 4 additions & 4 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "MTClient.URI",
expectedValue: "xgon-prover:50061",
expectedValue: "x1-prover:50061",
},
{
path: "StateDB.User",
Expand All @@ -258,7 +258,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "StateDB.Host",
expectedValue: "xgon-state-db",
expectedValue: "x1-state-db",
},
{
path: "StateDB.Port",
Expand Down Expand Up @@ -319,7 +319,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Pool.DB.Host",
expectedValue: "xgon-pool-db",
expectedValue: "x1-pool-db",
},
{
path: "Pool.DB.Port",
Expand Down Expand Up @@ -375,7 +375,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Executor.URI",
expectedValue: "xgon-prover:50071",
expectedValue: "x1-prover:50071",
},
{
path: "Executor.MaxResourceExhaustedAttempts",
Expand Down
10 changes: 5 additions & 5 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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 All @@ -36,7 +36,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 @@ -142,10 +142,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 @@ -159,7 +159,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
12 changes: 6 additions & 6 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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 All @@ -29,7 +29,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 All @@ -47,7 +47,7 @@ Port = 8545
ReadTimeout = "60s"
WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://internal.xgon-test.net:2083/"
SequencerNodeURI = "https://internal.x1-test.net:2083/"
EnableL2SuggestedGasPricePolling = true
[RPC.WebSockets]
Enabled = true
Expand Down Expand Up @@ -152,10 +152,10 @@ MaxGasPriceWei = 0
#L2CoinId = 7184

[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 @@ -172,7 +172,7 @@ ProfilingEnabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xgon-state-db"
Host = "x1-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
12 changes: 6 additions & 6 deletions config/environments/mainnet/node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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 All @@ -24,7 +24,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 All @@ -42,7 +42,7 @@ Port = 8545
ReadTimeout = "60s"
WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://xgon-rpc.com"
SequencerNodeURI = "https://x1-rpc.com"
EnableL2SuggestedGasPricePolling = false
[RPC.WebSockets]
Enabled = true
Expand All @@ -64,10 +64,10 @@ SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc

[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 @@ -84,7 +84,7 @@ ProfilingEnabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xgon-state-db"
Host = "x1-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
2 changes: 1 addition & 1 deletion config/environments/mainnet/prover.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"starkInfoFile": "zkevm.starkinfo.json",
"starkInfoC12aFile": "zkevm.c12a.starkinfo.json",
"starkInfoRecursive1File": "zkevm.recursive1.starkinfo.json",
"databaseURL": "postgresql://prover_user:prover_pass@xgon-state-db:5432/prover_db",
"databaseURL": "postgresql://prover_user:prover_pass@x1-state-db:5432/prover_db",
"dbNodesTableName": "state.nodes",
"dbProgramTableName": "state.program",
"dbAsyncWrite": false,
Expand Down
12 changes: 6 additions & 6 deletions config/environments/testnet/node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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 All @@ -26,7 +26,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 All @@ -44,7 +44,7 @@ Port = 8545
ReadTimeout = "60s"
WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://rpc.public.xgon-test.net/"
SequencerNodeURI = "https://rpc.public.x1-test.net/"
EnableL2SuggestedGasPricePolling = false
[RPC.WebSockets]
Enabled = true
Expand All @@ -65,10 +65,10 @@ SyncInterval = "2s"
SyncChunkSize = 100

[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 @@ -85,7 +85,7 @@ ProfilingEnabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xgon-state-db"
Host = "x1-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
2 changes: 1 addition & 1 deletion config/environments/testnet/prover.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"starkInfoFile": "zkevm.starkinfo.json",
"starkInfoC12aFile": "zkevm.c12a.starkinfo.json",
"starkInfoRecursive1File": "zkevm.recursive1.starkinfo.json",
"databaseURL": "postgresql://prover_user:prover_pass@xgon-state-db:5432/prover_db",
"databaseURL": "postgresql://prover_user:prover_pass@x1-state-db:5432/prover_db",
"dbNodesTableName": "state.nodes",
"dbProgramTableName": "state.program",
"dbAsyncWrite": false,
Expand Down
4 changes: 2 additions & 2 deletions config/metrics/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ scrape_configs:
metrics_path: /metrics
static_configs:
- targets:
- xgon-json-rpc:9091 #inside port of the xgon-json-rpc
- xgon-sequencer:9091 #inside port of the xgon-sequencer
- x1-json-rpc:9091 #inside port of the x1-json-rpc
- x1-sequencer:9091 #inside port of the x1-sequencer
Loading

0 comments on commit ba6ae61

Please sign in to comment.