BCSkill (Block chain skill )
区块链中文技术社区

只讨论区块链底层技术
遵守一切相关法律政策!

docker-compose启动时创建网络失败问题解决方法

在同一套环境中跑了很多个项目都是用 docker-compose的方式启动的,导致创建的自定义网络过多出现下面的报错

Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
查看自定义网络

[root@lyj ~]# docker network ls |wc -l
31
这是因为 Docker 默认支持 30 个不同的自定义 bridge 网络,如果超过这个限制,就会提示上面的错误。你可以使用命令docker network ls来查看你创建的网络,然后通过命令docker network prune来移除没有使用的网络。

解决

docker network ls
docker network prune

参考
https://blog.csdn.net/L13763338360/article/details/112250564
https://www.cnblogs.com/liyongjian5179/archive/2019/03/19/10559289.html

Git 修改.Submodule文件 url 生效

  1. 修改 .gitmodules 文件中对应模块的url属性;
  2. 使用 git submodule sync 命令,将新的URL更新到文件.git/config;
  3. 再使用命令初始化子模块:git submodule init
  4. 最后使用命令更新子模块:git submodule update

zkSync 根据l2到l1跨链hash查询CommitBlocks,PublishProofBlocksOnchain,ExecuteBlocks各个L1层交易hash

跨链交易发起:0x0bbbcf153f17ec0e1f12d698bbc64f9d242bc1cd1312dd5f34febf0e6cb6601a

  1. 根据tx_hash查看表l2_to_l1_logs,得到所在的miniblock_number15841
  2. 根据上面的miniblock_number,根据number查看表miniblocks
    select * from miniblocks where number=15841;
  3. 得到当前跨链交易所在l1_batch_number为7670
  4. 根据l1_batch_number,以number查看l1_batches
    select number,is_finished,eth_commit_tx_id,eth_prove_tx_id,eth_execute_tx_id from l1_batches where number=7670;

    得到

    number | is_finished | eth_commit_tx_id | eth_prove_tx_id | eth_execute_tx_id 
    --------+-------------+------------------+-----------------+-------------------
    7670 | t           |            41073 |           41148 |             41151
  5. 根据eth_commit_tx_id查询eth_txs,得到CommitBlocks对应交易信息
    select nonce,contract_address,tx_type,has_failed,sent_at_block,tx_status,confirmed_eth_tx_history_id from eth_txs where id=41073 ORDER BY updated_at DESC limit 1;
    nonce |              contract_address              |   tx_type    | has_failed | sent_at_block | tx_status | confirmed_eth_tx_history_id 
     -------+--------------------------------------------+--------------+------------+---------------+-----------+-----------------------------
      41091 | 0x5e3e5f6ef0e21f0cf5b4c3acd3cf29740b1cbbd8 | CommitBlocks | f          |               | Done      |                       43194
  6. 根据confirmed_eth_tx_history_id得到CommitBlocks对应交易hash
    select eth_tx_id,tx_hash,confirmed_at from eth_txs_history where id=43194  ORDER BY updated_at DESC limit 10;
    eth_tx_id |                              tx_hash                               |        confirmed_at        
     -----------+--------------------------------------------------------------------+----------------------------
          41073 | 0x0b01e199877faef52b95477119f53bf546a2915bc903132331f41542e58da53d | 2023-09-18 03:50:19.059576
  7. 同理查询eth_prove_tx_ideth_execute_tx_id得到对应的交易hash

zkSync Era宕机问题排查

问题背景

从一些外部消息得知

9月12日消息,据zkSync Era区块链浏览器显示,zkSync Era主网疑似出现宕机情况,zkSync Era提交给以太坊的最新批次为#208455,时间为14:14,区块高度已暂停于#13641404,已暂停出块37分钟。

跟进缘由

由于现有部分项目基于zkSync Era,所以需要确认下问题起因是什么,是否存在官方新版修复,目前现有版本会不会同样存在问题

确认问题

先从浏览器数据,确认下,是否存在消息描述问题,以及分析下问题位置(区块浏览器/链节点)

确认下Batch高度时间

Batch高度 区块时间 链接 位置
208455 2023-09-12 14:14 https://explorer.zksync.io/batch/208455
208456 2023-09-12 14:14 https://explorer.zksync.io/batch/208456
208457 2023-09-12 14:15 https://explorer.zksync.io/batch/208457 后+1

208455 与 208456 相差时间符合预期

确认下Block高度时间

Block高度 Batch高度 Committed时间 链接 位置
13641404 208456 2023-09-12 14:14 https://explorer.zksync.io/block/13641404
13641405 208456 2023-09-12 14:14 https://explorer.zksync.io/block/13641405
13641406 208456 2023-09-12 14:14 https://explorer.zksync.io/block/13641406 后+1

确认下Batch Commit时间

Batch高度 Commit时间 Commit tx hash 位置
208455 Sep-12-2023 06:15:59 AM +UTC https://etherscan.io/tx/0x369446bc9d99087aa1160d426b7af372dce91bb7d372724b7c529f2e3ff30ecd
208456 Sep-12-2023 06:16:35 AM +UTC https://etherscan.io/tx/0x902b3b0eee2e82ef048e8de8ec0417d7875c0930b5b0b893de48f8b5b59f8944
208457 Sep-12-2023 06:17:59 AM +UTC https://etherscan.io/tx/0x7ce6d03ead9117a0a7268042c6e19637c702df2382070f04442df75602461661 后+1

分析结果

从节点Batch和Block生成时间,以及Batch Commit,对比消息中的#208455前后时间差,综合来看,链方面数据无宕机,
大概率是当时区块浏览器服务方面,或者连接的某些提供数据RPC节点,出现了区块同步不及时问题。

如何避免

浏览器和提供查询的RPC节点做多个主备灾备, 实时高度状态检查和线路自动切换

显卡驱动与CUDA版本对照

Driver Version CUDA Version docker image
510 11.6 docker pull nvidia/cuda:11.6.2-runtime-ubuntu20.04
525 12.0 docker pull nvidia/cuda:12.0.0-runtime-ubuntu20.04
530 12.1 docker pull nvidia/cuda:12.1.0-runtime-ubuntu20.04
535 12.2 docker pull nvidia/cuda:12.2.0-runtime-ubuntu20.04

所在服务器安装对应的显卡驱动(一般都有了),需要使用对应的 cuda image与其对应

对外prover docker统一使用ubuntu 20.04

  • base:从 CUDA 9.0 开始,包含部署预构建 CUDA 应用程序的最低限度(libcudart)。如果您想手动选择要安装的 CUDA 软件包,请使用此映像。
  • runtime:通过添加 CUDA 工具包中的所有共享库来扩展基础映像。如果您有使用多个 CUDA 库的预构建应用程序,请使用此映像。
  • devel:通过添加编译器工具链、调试工具、标头和静态库来扩展运行时映像。使用此映像从源代码编译 CUDA 应用程序

数据来源:https://hub.docker.com/r/nvidia/cuda/tags