Skip to content

Commit

Permalink
Rebranding (#146)
Browse files Browse the repository at this point in the history
* rebranding name

* update

* update

* fix image name

* update

* update

* update

* update

* update

* update
  • Loading branch information
zjg555543 authored Mar 20, 2024
1 parent 4412d8a commit 7cbb58c
Show file tree
Hide file tree
Showing 145 changed files with 1,499 additions and 1,501 deletions.
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 x1-prover call
name: Test from xlayer-prover call
on:
workflow_call:
inputs:
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3
with:
repository: okx/x1-node
repository: okx/xlayer-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.4
COPY --from=build /src/dist/x1-node /app/x1-node
COPY --from=build /src/dist/xlayer-node /app/xlayer-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/x1-node run"]
CMD ["/bin/sh", "-c", "/app/xlayer-node run"]
16 changes: 8 additions & 8 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 := x1-node
GOBINARY := xlayer-node
GOCMD := $(GOBASE)/cmd

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

.PHONY: build-docker
build-docker: ## Builds a docker image with the node binary
docker build -t x1-node -f ./Dockerfile .
docker build -t x1-signer -f ./tools/signer/Dockerfile .
docker build -t xlayer-node -f ./Dockerfile .
docker build -t xlayer-signer -f ./tools/signer/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 x1-node -f ./Dockerfile .
docker build --no-cache=true -t xlayer-node -f ./Dockerfile .

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

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

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

## About the X1 network
## About the XLayer 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 x1 network.
- Batch: a group of transactions that are executed/proved, using the [X1 prover]() and sent to / synchronized from L1
- L2: the rollup network aka the xlayer network.
- Batch: a group of transactions that are executed/proved, using the [XLayer 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 X1 (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 XLayer (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 @@ -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/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:
- 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/xlayer-proverjs) and [C production-ready implementation](https://github.com/okx/xlayer-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

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

### Trusted sequencer

Expand Down
4 changes: 2 additions & 2 deletions ci/e2e-group-dac-1/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"regexp"
"testing"

polygondatacommittee "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee_x1"
polygondatacommittee "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee_xlayer"
"github.com/0xPolygonHermez/zkevm-node/test/operations"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -39,7 +39,7 @@ func TestSetDataAvailabilityProtocol(t *testing.T) {
require.NoError(t, err)

// New DAC Setup
_, tx, newDA, err := polygondatacommittee.DeployPolygondatacommittee(auth, clientL1)
_, tx, newDA, err := polygondatacommittee.DeployPolygondatacommitteeXlayer(auth, clientL1)
require.NoError(t, err)
require.NoError(t, operations.WaitTxToBeMined(ctx, clientL1, tx, operations.DefaultTimeoutTxToBeMined))

Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ func start(cliCtx *cli.Context) error {
go startProfilingHttpServer(c.Metrics)
}

// init for x1
initRunForX1(c, components)
// init for xlayer
initRunForXLayer(c, components)

for _, component := range components {
switch component {
Expand Down Expand Up @@ -187,7 +187,7 @@ func start(cliCtx *cli.Context) error {
if poolInstance == nil {
poolInstance = createPool(c.Pool, c.State.Batch.Constraints, l2ChainID, st, eventLog)
}
seqSender := createSequenceSenderX1(*c, poolInstance, ethTxManagerStorage, st, eventLog)
seqSender := createSequenceSenderXLayer(*c, poolInstance, ethTxManagerStorage, st, eventLog)
go seqSender.Start(cliCtx.Context)
case RPC:
ev.Component = event.Component_RPC
Expand Down Expand Up @@ -311,15 +311,15 @@ func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerS
log.Fatal(err)
}

// X1 handler
setEthermanDaX1(cfg, st, eth, false)
// XLayer handler
setEthermanDaXLayer(cfg, st, eth, false)

etherManForL1 = append(etherManForL1, eth)
}
}

// X1 handler
setEthermanDaX1(cfg, st, etherman, false)
// XLayer handler
setEthermanDaXLayer(cfg, st, etherman, false)

etm := ethtxmanager.New(cfg.EthTxManager, etherman, ethTxManagerStorage, st)
sy, err := synchronizer.NewSynchronizer(
Expand Down
12 changes: 6 additions & 6 deletions cmd/run_x1.go → cmd/run_xlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import (
"github.com/ethereum/go-ethereum/crypto"
)

func createSequenceSenderX1(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender {
func createSequenceSenderXLayer(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender {
etherman, err := newEtherman(cfg)
if err != nil {
log.Fatal(err)
}

da := setEthermanDaX1(cfg, st, etherman, true)
da := setEthermanDaXLayer(cfg, st, etherman, true)

_, privKey, err := etherman.LoadAuthFromKeyStoreX1(cfg.SequenceSender.DAPermitApiPrivateKey.Path, cfg.SequenceSender.DAPermitApiPrivateKey.Password)
_, privKey, err := etherman.LoadAuthFromKeyStoreXLayer(cfg.SequenceSender.DAPermitApiPrivateKey.Path, cfg.SequenceSender.DAPermitApiPrivateKey.Password)
if err != nil {
log.Fatal(err)
}
Expand All @@ -54,7 +54,7 @@ func createSequenceSenderX1(cfg config.Config, pool *pool.Pool, etmStorage *etht
return seqSender
}

func initRunForX1(c *config.Config, components []string) {
func initRunForXLayer(c *config.Config, components []string) {
// Read configure from apollo
apolloClient := apollo.NewClient(c)
if apolloClient.LoadConfig() {
Expand Down Expand Up @@ -103,7 +103,7 @@ func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Cl
err error
)
if isSequenceSender {
_, pk, err = etherman.LoadAuthFromKeyStoreX1(c.SequenceSender.DAPermitApiPrivateKey.Path, c.SequenceSender.DAPermitApiPrivateKey.Password)
_, pk, err = etherman.LoadAuthFromKeyStoreXLayer(c.SequenceSender.DAPermitApiPrivateKey.Path, c.SequenceSender.DAPermitApiPrivateKey.Password)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Cl
)
}

func setEthermanDaX1(c config.Config, st *state.State, etherman *etherman.Client, isSequenceSender bool) *dataavailability.DataAvailability {
func setEthermanDaXLayer(c config.Config, st *state.State, etherman *etherman.Client, isSequenceSender bool) *dataavailability.DataAvailability {
da, err := newDataAvailability(c, st, etherman, isSequenceSender)
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion config/apollo/apollo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestApolloClient_LoadConfig(t *testing.T) {
nc := &nodeConfig.Config{
Apollo: types.ApolloConfig{
IP: "",
AppID: "x1-devnet",
AppID: "xlayer-devnet",
NamespaceName: "jsonrpc-ro.txt,jsonrpc-roHalt.properties",
Enable: true,
},
Expand Down
8 changes: 4 additions & 4 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "MTClient.URI",
expectedValue: "x1-prover:50061",
expectedValue: "xlayer-prover:50061",
},
{
path: "State.DB.User",
Expand All @@ -247,7 +247,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "State.DB.Host",
expectedValue: "x1-state-db",
expectedValue: "xlayer-state-db",
},
{
path: "State.DB.Port",
Expand Down Expand Up @@ -344,7 +344,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Pool.DB.Host",
expectedValue: "x1-pool-db",
expectedValue: "xlayer-pool-db",
},
{
path: "Pool.DB.Port",
Expand Down Expand Up @@ -428,7 +428,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Executor.URI",
expectedValue: "x1-prover:50071",
expectedValue: "xlayer-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 @@ -16,7 +16,7 @@ Outputs = ["stderr"]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "x1-state-db"
Host = "xlayer-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down Expand Up @@ -63,7 +63,7 @@ FreeGasAddress = ["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"]
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "x1-pool-db"
Host = "xlayer-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down Expand Up @@ -213,10 +213,10 @@ CleanHistoryPeriod = "1h"
CleanHistoryTimeRetention = "5m"
[MTClient]
URI = "x1-prover:50061"
URI = "xlayer-prover:50061"
[Executor]
URI = "x1-prover:50071"
URI = "xlayer-prover:50071"
MaxResourceExhaustedAttempts = 3
WaitOnResourceExhaustion = "1s"
MaxGRPCMessageSize = 100000000
Expand All @@ -230,7 +230,7 @@ Enabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "x1-state-db"
Host = "xlayer-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
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:
- x1-json-rpc:9091 #inside port of the zkevm-json-rpc
- x1-sequencer:9091 #inside port of the zkevm-sequencer
- xlayer-json-rpc:9091 #inside port of the zkevm-json-rpc
- xlayer-sequencer:9091 #inside port of the zkevm-sequencer
File renamed without changes.
6 changes: 3 additions & 3 deletions dataavailability/datacommittee/datacommittee.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/0xPolygon/cdk-data-availability/client"
daTypes "github.com/0xPolygon/cdk-data-availability/types"
polygondatacommittee "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee_x1"
polygondatacommittee "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee_xlayer"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
Expand All @@ -37,7 +37,7 @@ type DataCommittee struct {

// DataCommitteeBackend implements the DAC integration
type DataCommitteeBackend struct {
dataCommitteeContract *polygondatacommittee.Polygondatacommittee
dataCommitteeContract *polygondatacommittee.PolygondatacommitteeXlayer
privKey *ecdsa.PrivateKey
dataCommitteeClientFactory client.IClientFactory

Expand All @@ -58,7 +58,7 @@ func New(
log.Errorf("error connecting to %s: %+v", l1RPCURL, err)
return nil, err
}
dataCommittee, err := polygondatacommittee.NewPolygondatacommittee(dataCommitteeAddr, ethClient)
dataCommittee, err := polygondatacommittee.NewPolygondatacommitteeXlayer(dataCommitteeAddr, ethClient)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions dataavailability/datacommittee/datacommittee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"math/big"
"testing"

polygondatacommittee "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee_x1"
polygondatacommittee "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee_xlayer"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
Expand Down Expand Up @@ -65,7 +65,7 @@ func newTestingEnv(t *testing.T) (
dac *DataCommitteeBackend,
ethBackend *backends.SimulatedBackend,
auth *bind.TransactOpts,
da *polygondatacommittee.Polygondatacommittee,
da *polygondatacommittee.PolygondatacommitteeXlayer,
) {
t.Helper()
privateKey, err := crypto.GenerateKey()
Expand All @@ -88,7 +88,7 @@ func newTestingEnv(t *testing.T) (
func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
dacman *DataCommitteeBackend,
ethBackend *backends.SimulatedBackend,
da *polygondatacommittee.Polygondatacommittee,
da *polygondatacommittee.PolygondatacommitteeXlayer,
err error,
) {
t.Helper()
Expand All @@ -108,7 +108,7 @@ func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
client := backends.NewSimulatedBackend(genesisAlloc, uint64(999999999999999999)) //nolint:staticcheck,gomnd

// DAC Setup
_, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client)
_, _, da, err = polygondatacommittee.DeployPolygondatacommitteeXlayer(auth, client)
if err != nil {
return &DataCommitteeBackend{}, nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (

const (
// StateMigrationName is the name of the migration used by packr to pack the migration file
StateMigrationName = "x1-state-db"
StateMigrationName = "xlayer-state-db"
// PoolMigrationName is the name of the migration used by packr to pack the migration file
PoolMigrationName = "x1-pool-db"
PoolMigrationName = "xlayer-pool-db"
)

var packrMigrations = map[string]*packr.Box{
Expand Down
Loading

0 comments on commit 7cbb58c

Please sign in to comment.