From 9c3c2849c0f7ed763416964f536ea2328b7f4d0d Mon Sep 17 00:00:00 2001 From: goldsquid Date: Sat, 8 Nov 2025 05:03:09 +0700 Subject: [PATCH] xlayer migrated to op-stack --- ...yer-mainnet-op-geth-pruned-pebble-path.yml | 149 ++++++++++++++++++ ...yer-testnet-op-geth-pruned-pebble-path.yml | 148 +++++++++++++++++ op/xlayer/geth.toml | 24 +++ op/xlayer/mainnet/rollup.json | 45 ++++++ op/xlayer/testnet/rollup.json | 45 ++++++ 5 files changed, 411 insertions(+) create mode 100644 op/geth/xlayer-mainnet-op-geth-pruned-pebble-path.yml create mode 100644 op/geth/xlayer-testnet-op-geth-pruned-pebble-path.yml create mode 100644 op/xlayer/geth.toml create mode 100644 op/xlayer/mainnet/rollup.json create mode 100644 op/xlayer/testnet/rollup.json diff --git a/op/geth/xlayer-mainnet-op-geth-pruned-pebble-path.yml b/op/geth/xlayer-mainnet-op-geth-pruned-pebble-path.yml new file mode 100644 index 00000000..85566569 --- /dev/null +++ b/op/geth/xlayer-mainnet-op-geth-pruned-pebble-path.yml @@ -0,0 +1,149 @@ +--- +x-logging-defaults: &logging-defaults + driver: json-file + options: + max-size: "10m" + max-file: "3" + +# Usage: +# +# mkdir rpc && cd rpc +# +# git init +# git remote add origin https://github.com/StakeSquid/ethereum-rpc-docker.git +# git fetch origin vibe +# git checkout origin/vibe +# +# docker run --rm alpine sh -c "printf '0x'; head -c32 /dev/urandom | xxd -p -c 64" > .jwtsecret +# +# env +# ... +# IP=$(curl ipinfo.io/ip) +# DOMAIN=${IP}.traefik.me +# COMPOSE_FILE=base.yml:rpc.yml:op/geth/xlayer-mainnet-op-geth-pruned-pebble-path.yml +# +# docker compose up -d +# +# curl -X POST https://${IP}.traefik.me/xlayer-mainnet \ +# -H "Content-Type: application/json" \ +# --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' + +services: + xlayer-mainnet: + image: ${XLAYER_GETH_IMAGE:-xlayer/op-geth}:${XLAYER_MAINNET_GETH_VERSION:-0.0.6} + sysctls: + # TCP Performance + net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle + net.ipv4.tcp_no_metrics_save: 1 # Disable metrics cache + net.ipv4.tcp_rmem: 4096 87380 16777216 # Increase TCP read buffers + net.ipv4.tcp_wmem: 4096 87380 16777216 # Increase TCP write buffers + net.core.somaxconn: 32768 # Higher connection queue + # Memory/Connection Management + # net.core.netdev_max_backlog: 50000 # Increase network buffer + net.ipv4.tcp_max_syn_backlog: 30000 # More SYN requests + net.ipv4.tcp_max_tw_buckets: 2000000 # Allow more TIME_WAIT sockets + ulimits: + nofile: 1048576 # Max open files (for RPC/WS connections) + user: root + ports: + - 14389:14389 + - 14389:14389/udp + expose: + - 8545 + - 6060 + environment: + - GENESIS_URL=https://okg-pub-hk.oss-cn-hongkong.aliyuncs.com/cdn/chain/xlayer/snapshot/merged.genesis.json.mainnet.tar.gz + - GETH_OP_NETWORK=xlayer-mainnet + - GETH_ROLLUP_DISABLETXPOOLGOSSIP=true + - GETH_ROLLUP_SEQUENCERHTTP=https://rpc.xlayer.tech + entrypoint: /bin/sh -c '[ ! -f /config/genesis.json ] && (wget -qO- "$GENESIS_URL" | tar -xzf - -C /config && mv /config/*.json /config/genesis.json); [ ! -d /data/geth ] && geth init --datadir /data /config/genesis.json; exec geth "$@"' -- + command: + - --config=/config/geth.toml + - --datadir=/data + - --db.engine=pebble + - --gcmode=full + - --http + - --http.addr=0.0.0.0 + - --http.api=eth,net,web3,debug,admin,txpool,engine + - --http.port=8545 + - --http.vhosts=* + - --maxpeers=50 + - --metrics + - --metrics.addr=0.0.0.0 + - --metrics.port=6060 + - --nat=extip:${IP} + - --port=14389 + - --rpc.gascap=600000000 + - --rpc.txfeecap=0 + - --state.scheme=path + - --syncmode=snap + - --ws + - --ws.addr=0.0.0.0 + - --ws.api=eth,net,web3,debug,admin,txpool,engine + - --ws.origins=* + - --ws.port=8545 + restart: unless-stopped + stop_grace_period: 5m + networks: + - chains + volumes: + - ${XLAYER_MAINNET_OP_GETH_PRUNED_PEBBLE_PATH_DATA:-xlayer-mainnet-op-geth-pruned-pebble-path}:/data + - ./op/xlayer/mainnet:/config + - /slowdisk:/slowdisk + logging: *logging-defaults + labels: + - prometheus-scrape.enabled=true + - prometheus-scrape.port=6060 + - prometheus-scrape.path=/debug/metrics/prometheus + - traefik.enable=true + - traefik.http.middlewares.xlayer-mainnet-op-geth-pruned-pebble-path-stripprefix.stripprefix.prefixes=/xlayer-mainnet + - traefik.http.services.xlayer-mainnet-op-geth-pruned-pebble-path.loadbalancer.server.port=8545 + - ${NO_SSL:-traefik.http.routers.xlayer-mainnet-op-geth-pruned-pebble-path.entrypoints=websecure} + - ${NO_SSL:-traefik.http.routers.xlayer-mainnet-op-geth-pruned-pebble-path.tls.certresolver=myresolver} + - ${NO_SSL:-traefik.http.routers.xlayer-mainnet-op-geth-pruned-pebble-path.rule=Host(`$DOMAIN`) && (Path(`/xlayer-mainnet`) || Path(`/xlayer-mainnet/`))} + - ${NO_SSL:+traefik.http.routers.xlayer-mainnet-op-geth-pruned-pebble-path.rule=Path(`/xlayer-mainnet`) || Path(`/xlayer-mainnet/`)} + - traefik.http.routers.xlayer-mainnet-op-geth-pruned-pebble-path.middlewares=xlayer-mainnet-op-geth-pruned-pebble-path-stripprefix, ipallowlist + +volumes: + xlayer-mainnet-op-geth-pruned-pebble-path: + +x-upstreams: + - id: $${ID} + labels: + provider: $${PROVIDER} + connection: + generic: + rpc: + url: $${RPC_URL} + ws: + frameSize: 20Mb + msgSize: 50Mb + url: $${WS_URL} + chain: xlayer + method-groups: + enabled: + - debug + - filter + methods: + disabled: + # not compatible with path state scheme + - name: debug_traceBlockByHash + enabled: + - name: txpool_content # TODO: should be disabled for rollup nodes + # standard geth only + - name: debug_getRawBlock + - name: debug_getRawTransaction + - name: debug_getRawReceipts + - name: debug_getRawHeader + - name: debug_getBadBlocks + # non standard geth only slightly dangerous + - name: debug_intermediateRoots + - name: debug_dumpBlock + # standard geth and erigon + - name: debug_accountRange + - name: debug_getModifiedAccountsByNumber + - name: debug_getModifiedAccountsByHash + # non standard geth and erigon + - name: eth_getRawTransactionByHash + - name: eth_getRawTransactionByBlockHashAndIndex +... \ No newline at end of file diff --git a/op/geth/xlayer-testnet-op-geth-pruned-pebble-path.yml b/op/geth/xlayer-testnet-op-geth-pruned-pebble-path.yml new file mode 100644 index 00000000..3d060948 --- /dev/null +++ b/op/geth/xlayer-testnet-op-geth-pruned-pebble-path.yml @@ -0,0 +1,148 @@ +--- +x-logging-defaults: &logging-defaults + driver: json-file + options: + max-size: "10m" + max-file: "3" + +# Usage: +# +# mkdir rpc && cd rpc +# +# git init +# git remote add origin https://github.com/StakeSquid/ethereum-rpc-docker.git +# git fetch origin vibe +# git checkout origin/vibe +# +# docker run --rm alpine sh -c "printf '0x'; head -c32 /dev/urandom | xxd -p -c 64" > .jwtsecret +# +# env +# ... +# IP=$(curl ipinfo.io/ip) +# DOMAIN=${IP}.traefik.me +# COMPOSE_FILE=base.yml:rpc.yml:op/geth/xlayer-testnet-op-geth-pruned-pebble-path.yml +# +# docker compose up -d +# +# curl -X POST https://${IP}.traefik.me/xlayer-testnet \ +# -H "Content-Type: application/json" \ +# --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' + +services: + xlayer-testnet: + image: ${XLAYER_GETH_IMAGE:-xlayer/op-geth}:${XLAYER_TESTNET_GETH_VERSION:-0.0.6} + sysctls: + # TCP Performance + net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle + net.ipv4.tcp_no_metrics_save: 1 # Disable metrics cache + net.ipv4.tcp_rmem: 4096 87380 16777216 # Increase TCP read buffers + net.ipv4.tcp_wmem: 4096 87380 16777216 # Increase TCP write buffers + net.core.somaxconn: 32768 # Higher connection queue + # Memory/Connection Management + # net.core.netdev_max_backlog: 50000 # Increase network buffer + net.ipv4.tcp_max_syn_backlog: 30000 # More SYN requests + net.ipv4.tcp_max_tw_buckets: 2000000 # Allow more TIME_WAIT sockets + ulimits: + nofile: 1048576 # Max open files (for RPC/WS connections) + user: root + ports: + - 13528:13528 + - 13528:13528/udp + expose: + - 8545 + - 6060 + environment: + - GENESIS_URL=https://okg-pub-hk.oss-cn-hongkong.aliyuncs.com/cdn/chain/xlayer/snapshot/merged.genesis.json.tar.gz + - GETH_OP_NETWORK=xlayer-testnet + - GETH_ROLLUP_DISABLETXPOOLGOSSIP=true + entrypoint: /bin/sh -c '[ ! -f /config/genesis.json ] && (wget -qO- "$GENESIS_URL" | tar -xzf - -C /config && mv /config/*.json /config/genesis.json); [ ! -d /data/geth ] && geth init --datadir /data /config/genesis.json; exec geth "$@"' -- + command: + - --config=/config/geth.toml + - --datadir=/data + - --db.engine=pebble + - --gcmode=full + - --http + - --http.addr=0.0.0.0 + - --http.api=eth,net,web3,debug,admin,txpool,engine + - --http.port=8545 + - --http.vhosts=* + - --maxpeers=50 + - --metrics + - --metrics.addr=0.0.0.0 + - --metrics.port=6060 + - --nat=extip:${IP} + - --port=13528 + - --rpc.gascap=600000000 + - --rpc.txfeecap=0 + - --state.scheme=path + - --syncmode=snap + - --ws + - --ws.addr=0.0.0.0 + - --ws.api=eth,net,web3,debug,admin,txpool,engine + - --ws.origins=* + - --ws.port=8545 + restart: unless-stopped + stop_grace_period: 5m + networks: + - chains + volumes: + - ${XLAYER_TESTNET_OP_GETH_PRUNED_PEBBLE_PATH_DATA:-xlayer-testnet-op-geth-pruned-pebble-path}:/data + - ./op/xlayer/testnet:/config + - /slowdisk:/slowdisk + logging: *logging-defaults + labels: + - prometheus-scrape.enabled=true + - prometheus-scrape.port=6060 + - prometheus-scrape.path=/debug/metrics/prometheus + - traefik.enable=true + - traefik.http.middlewares.xlayer-testnet-op-geth-pruned-pebble-path-stripprefix.stripprefix.prefixes=/xlayer-testnet + - traefik.http.services.xlayer-testnet-op-geth-pruned-pebble-path.loadbalancer.server.port=8545 + - ${NO_SSL:-traefik.http.routers.xlayer-testnet-op-geth-pruned-pebble-path.entrypoints=websecure} + - ${NO_SSL:-traefik.http.routers.xlayer-testnet-op-geth-pruned-pebble-path.tls.certresolver=myresolver} + - ${NO_SSL:-traefik.http.routers.xlayer-testnet-op-geth-pruned-pebble-path.rule=Host(`$DOMAIN`) && (Path(`/xlayer-testnet`) || Path(`/xlayer-testnet/`))} + - ${NO_SSL:+traefik.http.routers.xlayer-testnet-op-geth-pruned-pebble-path.rule=Path(`/xlayer-testnet`) || Path(`/xlayer-testnet/`)} + - traefik.http.routers.xlayer-testnet-op-geth-pruned-pebble-path.middlewares=xlayer-testnet-op-geth-pruned-pebble-path-stripprefix, ipallowlist + +volumes: + xlayer-testnet-op-geth-pruned-pebble-path: + +x-upstreams: + - id: $${ID} + labels: + provider: $${PROVIDER} + connection: + generic: + rpc: + url: $${RPC_URL} + ws: + frameSize: 20Mb + msgSize: 50Mb + url: $${WS_URL} + chain: + method-groups: + enabled: + - debug + - filter + methods: + disabled: + # not compatible with path state scheme + - name: debug_traceBlockByHash + enabled: + - name: txpool_content # TODO: should be disabled for rollup nodes + # standard geth only + - name: debug_getRawBlock + - name: debug_getRawTransaction + - name: debug_getRawReceipts + - name: debug_getRawHeader + - name: debug_getBadBlocks + # non standard geth only slightly dangerous + - name: debug_intermediateRoots + - name: debug_dumpBlock + # standard geth and erigon + - name: debug_accountRange + - name: debug_getModifiedAccountsByNumber + - name: debug_getModifiedAccountsByHash + # non standard geth and erigon + - name: eth_getRawTransactionByHash + - name: eth_getRawTransactionByBlockHashAndIndex +... \ No newline at end of file diff --git a/op/xlayer/geth.toml b/op/xlayer/geth.toml new file mode 100644 index 00000000..603630c0 --- /dev/null +++ b/op/xlayer/geth.toml @@ -0,0 +1,24 @@ +[Node.P2P] +DiscoveryV5 = true + +[Eth.GPO] +Blocks = 20 +Percentile = 60 +MaxHeaderHistory = 1024 +MaxBlockHistory = 1024 +MaxPrice = "5000000000000000000000" +IgnorePrice = "2000000000000000000" + +[Eth.GPO.XLayer] +Type = "follower" +UpdatePeriod = 100000000000 +Default = "100000000" +KafkaURL = "localhost:9092" +Topic = "middle_coinPrice_push" +GroupID = "geth-consumer" +L1CoinId = 15756 +L2CoinId = 7184 +DefaultL1CoinPrice = 2000.0 +DefaultL2CoinPrice = 0.5 +Factor = 0.1 + diff --git a/op/xlayer/mainnet/rollup.json b/op/xlayer/mainnet/rollup.json new file mode 100644 index 00000000..c96100fa --- /dev/null +++ b/op/xlayer/mainnet/rollup.json @@ -0,0 +1,45 @@ +{ + "genesis": { + "l1": { + "hash": "0xd6058858cd52906bf6025167275128e1b37627dfb25e84165a1e7dacab6b1a48", + "number": 23668700 + }, + "l2": { + "hash": "0xdc33d8c0ec9de14fc2c21bd6077309a0a856df22821bd092a2513426e096a789", + "number": 42810021 + }, + "l2_time": 1761567143, + "system_config": { + "batcherAddr": "0xdfd6c636dcb5a013c2431316c4a0762b84e70a5d", + "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", + "scalar": "0x010000000000000000000000000000000000000000000000000c3c9d00000558", + "gasLimit": 50000000, + "eip1559Params": "0x0000000000000000", + "operatorFeeParams": "0x0000000000000000000000000000000000000000000000000000000000000000", + "minBaseFee": 0 + } + }, + "block_time": 1, + "max_sequencer_drift": 600, + "seq_window_size": 7200, + "channel_timeout": 300, + "l1_chain_id": 1, + "l2_chain_id": 196, + "regolith_time": 0, + "canyon_time": 0, + "delta_time": 0, + "ecotone_time": 0, + "fjord_time": 0, + "granite_time": 0, + "holocene_time": 0, + "isthmus_time": 0, + "batch_inbox_address": "0x002bde9b0c0857aee2cffdea6b8723eaf5989449", + "deposit_contract_address": "0x64057ad1ddac804d0d26a7275b193d9daca19993", + "l1_system_config_address": "0x5065809af286321a05fbf85713b5d5de7c8f0433", + "protocol_versions_address": "0xc1fb115d8249a7e6b27c8bc6914cab7edf0b0f7e", + "chain_op_config": { + "eip1559Elasticity": 1, + "eip1559Denominator": 100000000, + "eip1559DenominatorCanyon": 100000000 + } + } \ No newline at end of file diff --git a/op/xlayer/testnet/rollup.json b/op/xlayer/testnet/rollup.json new file mode 100644 index 00000000..dab29799 --- /dev/null +++ b/op/xlayer/testnet/rollup.json @@ -0,0 +1,45 @@ +{ + "genesis": { + "l1": { + "hash": "0x0ec957b104f8125b88f874dde8d8f236e9f952eb941102076406b108afaafc6e", + "number": 9430730 + }, + "l2": { + "hash": "0xccb16eb07b7a718c2ee374df57b0e28c9ac9d8d18ca6d3204cfbba661067855a", + "number": 12241700 + }, + "l2_time": 1760699568, + "system_config": { + "batcherAddr": "0x8edf9b54e1c693b7b0caea85e6a005c35e229124", + "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", + "scalar": "0x010000000000000000000000000000000000000000000000000c3c9d00000558", + "gasLimit": 30000000, + "eip1559Params": "0x0000000000000000", + "operatorFeeParams": "0x0000000000000000000000000000000000000000000000000000000000000000", + "minBaseFee": 0 + } + }, + "block_time": 1, + "max_sequencer_drift": 600, + "seq_window_size": 3600, + "channel_timeout": 300, + "l1_chain_id": 11155111, + "l2_chain_id": 1952, + "regolith_time": 0, + "canyon_time": 0, + "delta_time": 0, + "ecotone_time": 0, + "fjord_time": 0, + "granite_time": 0, + "holocene_time": 0, + "isthmus_time": 0, + "batch_inbox_address": "0x006737cc6980a7786a477ce46b491845509b19dc", + "deposit_contract_address": "0x1529a34331d7d85c8868fc88ec730ae56d3ec9c0", + "l1_system_config_address": "0x06be4b4a9a28ff8eed6da09447bc5daa676efac3", + "protocol_versions_address": "0x4e753a62ad7da17508dbc54a58e1e231c152baa2", + "chain_op_config": { + "eip1559Elasticity": 1, + "eip1559Denominator": 100000000, + "eip1559DenominatorCanyon": 250 + } + } \ No newline at end of file