私有链POW转POS失败:Lighthouse未激活问题求助
私有网络PoW转PoS合并失败排查与解决
问题概述
私有网络部署Geth作为执行层(EL)、Lighthouse作为共识层(CL),已配置Terminal Total Difficulty(TTD)。当链上难度达到TTD后,Geth日志显示进入post-merge状态等待信标客户端同步切换,但Lighthouse未激活,网络无法完成PoS升级。
关键日志
Geth日志(达到TTD后)
WARN [08-23|12:38:19.605] Local chain is post-merge, waiting for beacon client sync switch-over...
Lighthouse日志
lighthouse-beacon | Aug 23 12:45:19.002 INFO Ready for the merge current_difficulty: 5425003009187, terminal_total_difficulty: 5425000000000, service: slot_notifier lighthouse-beacon | Aug 23 12:45:26.796 WARN Execution endpoint is not synced action: trying fallback, last_seen_block_unix_timestamp: 1724357260, endpoint: http://geth-rpc:8551/, auth=true, service: deposit_contract_rpc lighthouse-beacon | Aug 23 12:45:26.796 ERRO No synced execution endpoint advice: ensure you have an execution node configured via --execution-endpoint or if pre-merge, --eth1-endpoints, service: deposit_contract_rpc lighthouse-beacon | Aug 23 12:45:26.796 ERRO Error updating deposit contract cache error: "All fallbacks errored: http://geth-rpc:8551/, auth=true => EndpointError(FarBehind)", retry_millis: 60000, service: deposit_contract_rpc lighthouse-beacon | Aug 23 12:45:31.000 WARN Low peer count peer_count: 0, service: slot_notifier lighthouse-beacon | Aug 23 12:45:31.000 INFO Searching for peers current_slot: 71786, head_slot: 0, finalized_epoch: 0, finalized_root: 0x980e…b4f6, peers: 0, service: slot_notifier lighthouse-beacon | Aug 23 12:45:31.000 WARN Syncing deposit contract block cache est_blocks_remaining: initializing deposits, service: slot_notifier lighthouse-beacon | Aug 23 12:45:31.002 INFO Ready for the merge current_difficulty: 5425003009187, terminal_total_difficulty: 5425000000000, service: slot_notifier lighthouse-beacon | Aug 23 12:45:43.001 WARN Low peer count peer_count: 0, service: slot_notifier lighthouse-beacon | Aug 23 12:45:43.001 INFO Searching for peers current_slot: 71787, head_slot: 0, finalized_epoch: 0, finalized_root: 0x980e…b4f6, peers: 0, service: slot_notifier lighthouse-beacon | Aug 23 12:45:43.001 WARN Syncing deposit contract block cache est_blocks_remaining: initializing deposits, service: slot_notifier lighthouse-beacon | Aug 23 12:45:43.004 INFO Ready for the merge current_difficulty: 5425003009187, terminal_total_difficulty: 5425000000000, service: slot_notifier
配置详情
Docker Compose配置
geth-bootnode: hostname: geth-bootnode container_name: geth-bootnode env_file: - .env build: context: . dockerfile: Dockerfile.geth args: - ACCOUNT_PASSWORD="${ACCOUNT_PASSWORD}" command: - --bootnodes=enode://XXX - --networkid=${NETWORK_ID} volumes: - geth-bootnode:/root/.ethereum ports: - '30303:30303/tcp' - '30303:30303/udp' geth-rpc: hostname: geth-rpc container_name: geth-rpc env_file: - .env build: context: . dockerfile: Dockerfile.geth args: - ACCOUNT_PASSWORD="${ACCOUNT_PASSWORD}" depends_on: - geth-bootnode command: - --bootnodes=enode://4244b36585419268be23058d4a879fd2842545ce6bb971027841f52e816418625bcc0e725820bfebfee0cee6607a3e7fb049a58448b90df76a47508d9455dcbe@geth-bootnode:30303 - --allow-insecure-unlock - --http - --http.addr=0.0.0.0 - --http.api=admin,debug,eth,miner,net,personal,txpool,web3 - --http.corsdomain=* - --http.vhosts=* - --ws - --ws.origins=* - --ws.addr=0.0.0.0 - --authrpc.jwtsecret=/secrets/secret.hex - --authrpc.addr=0.0.0.0 - --authrpc.port=8551 - --authrpc.vhosts=* - --ws.api=eth - --syncmode=full - --gcmode=archive - --networkid=${NETWORK_ID} ports: - '8545:8545' - '8546:8546' volumes: - geth-rpc:/root/.ethereum restart: always lighthouse-beacon: hostname: lighthouse-beacon container_name: lighthouse-beacon build: context: . dockerfile: Dockerfile.lighthouse command: - beacon_node - --datadir=/lighthouse/node1 - --testnet-dir=/consensus - --execution-endpoint=http://geth-rpc:8551 - --execution-jwt=/secrets/secret.hex - --enable-private-discovery - --staking - --enr-address=127.0.0.1 - --enr-udp-port=9000 - --enr-tcp-port=9000 - --port=9000 - --http - --http-port=4000 - --disable-packet-filter - --eth1 ports: - '5052:5052' volumes: - ./consensus:/consensus - lighthouse-beacon:/lighthouse
自定义镜像配置
Dockerfile.lighthouse
FROM sigp/lighthouse:v3.1.2 ADD ./secrets /secrets ENTRYPOINT ["lighthouse"]
Dockerfile.geth
FROM ethereum/client-go:v1.11.6 ARG ACCOUNT_PASSWORD WORKDIR /eth ADD ./genesis.json /eth ADD ./secrets /secrets RUN geth init /eth/genesis.json \ && rm -f ~/.ethereum/geth/nodekey \ && echo ${ACCOUNT_PASSWORD} > /eth/password \ && geth account new --password /eth/password \ && rm -f /eth/password ENTRYPOINT ["geth"]
共识层测试网配置
PRESET_BASE: mainnet TERMINAL_TOTAL_DIFFICULTY: '5425000000000' TERMINAL_BLOCK_HASH: '0x0000000000000000000000000000000000000000000000000000000000000000' TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: '18446744073709551615' SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY: '128' MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: '192' MIN_GENESIS_TIME: '1722859200' GENESIS_FORK_VERSION: '0x70000069' GENESIS_DELAY: '120' ALTAIR_FORK_VERSION: '0x01000001' ALTAIR_FORK_EPOCH: '1' BELLATRIX_FORK_VERSION: '0x02000001' BELLATRIX_FORK_EPOCH: '2' CAPELLA_FORK_VERSION: '0xffffffff' CAPELLA_FORK_EPOCH: '18446744073709551615' DENEB_FORK_VERSION: '0xffffffff' DENEB_FORK_EPOCH: '18446744073709551615' SECONDS_PER_SLOT: '12' SECONDS_PER_ETH1_BLOCK: '12' MIN_VALIDATOR_WITHDRAWABILITY_DELAY: '256' SHARD_COMMITTEE_PERIOD: '256' ETH1_FOLLOW_DISTANCE: '1' SUBNETS_PER_NODE: '2' INACTIVITY_SCORE_BIAS: '4' INACTIVITY_SCORE_RECOVERY_RATE: '16' EJECTION_BALANCE: '16000000000' MIN_PER_EPOCH_CHURN_LIMIT: '4' MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: '8' CHURN_LIMIT_QUOTIENT: '32' PROPOSER_SCORE_BOOST: '40' DEPOSIT_CHAIN_ID: '12020498' DEPOSIT_NETWORK_ID: '12020498' DEPOSIT_CONTRACT_ADDRESS: 0xc4648117106a08c3040b8573eb3d8e242c9726be GOSSIP_MAX_SIZE: '10485760' MAX_REQUEST_BLOCKS: '1024' EPOCHS_PER_SUBNET_SUBSCRIPTION: '256' MIN_EPOCHS_FOR_BLOCK_REQUESTS: '33024' MAX_CHUNK_SIZE: '10485760' TTFB_TIMEOUT: '5' RESP_TIMEOUT: '10' ATTESTATION_PROPAGATION_SLOT_RANGE: '32' MAXIMUM_GOSSIP_CLOCK_DISPARITY_MILLIS: '500' MESSAGE_DOMAIN_INVALID_SNAPPY: '0x00000000' MESSAGE_DOMAIN_VALID_SNAPPY: '0x01000000' ATTESTATION_SUBNET_EXTRA_BITS: '0' ATTESTATION_SUBNET_PREFIX_BITS: '6' MAX_REQUEST_BLOCKS_DENEB: '128' MAX_REQUEST_BLOB_SIDECARS: '768' MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: '4096' BLOB_SIDECAR_SUBNET_COUNT: '6'
Geth创世块配置
{ "config": { "chainId": 12020498, "homesteadBlock": 0, "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "istanbulBlock": 0, "berlinBlock": 0, "londonBlock": 4033065, "arrowGlacierBlock": 4033065, "terminalTotalDifficulty": 5425000000000, "ethash": {} }, "nonce": "0x0", "difficulty": "0x0", "timestamp": "0x63690E50", "gasLimit": "0x8000000", "alloc": { "0x65490838F9d353246Da7C16D358AEf5bddf5c0bc": { "balance": "1000000000000000000000000000000" } }, "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }
已完成排查
- 确认Lighthouse容器可访问Geth端点,通过
geth attach http://geth-rpc:8545验证Geth已同步完成 - 向Lighthouse官方GitHub提交问题,得到回复称不再支持合并相关问题
解决方案建议
1. 修复Lighthouse节点发现问题
Lighthouse日志显示peer_count: 0,说明共识层节点未找到任何对等节点,无法同步信标链数据。
- 调整
--enr-address配置:当前设置为127.0.0.1,Docker环境下仅能访问容器内部,改为容器所在主机IP或0.0.0.0,确保节点可被其他共识节点发现 - 验证端口映射:确认Lighthouse的9000端口(TCP/UDP)已正确映射到主机,且防火墙未拦截该端口
- 添加静态节点:私有网络环境下,手动添加其他Lighthouse节点的ENR到启动参数中,使用
--boot-nodes指定
2. 解决Deposit Contract缓存同步问题
Lighthouse报错Error updating deposit contract cache且提示执行节点FarBehind,需针对post-merge状态调整配置:
- 给Geth添加
--merge启动参数,显式启用合并模式,确保执行层正确处理post-merge请求 - 验证Deposit Contract状态:确认创世块配置中
DEPOSIT_CONTRACT_ADDRESS对应的合约已在PoW阶段部署,且存款验证者数量满足MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 192的要求 - 临时跳过缓存检查:若私有网络无需存款合约验证,可给Lighthouse添加
--eth1-deposit-contract-max-requests=0参数,避免缓存同步阻塞节点启动
3. 版本兼容性调整
当前使用的Geth v1.11.6和Lighthouse v3.1.2均为旧版本,可能存在合并相关兼容性问题:
- 升级Geth至支持合并的稳定版本(如v1.12.x及以上),确保与Lighthouse的交互逻辑匹配
- 升级Lighthouse至最新稳定版本,新版本可能修复旧版本的已知合并相关bug
4. 重置共识层数据
若Lighthouse节点数据存在损坏,尝试重置后重新启动:
- 停止Lighthouse容器,删除
lighthouse-beacon卷中的数据 - 重新启动节点,让其重新同步共识链数据
内容的提问来源于stack exchange,提问作者Yehor Sereda
相关产品推荐
相关产品推荐

