Skip to main content

故障排除

链配置

在您的工作目录中,可能会发现一个包含chains.yaml 文件的 config/文件夹。通过该chains.yaml 配置文件,您可以描述链元数据,以便在Hyperlane部署或应用程序中使用。

您可以在此文件中为任何新链定义完整配置。可配置的元数据在此配置示例中定义。您还可以在 chainMetadataTypes.ts中找到链元数据模式。

下面是两个本地anvil chains的配置示例:

---
anvil1:
chainId: 31337
domainId: 31337
name: anvil1
protocol: ethereum
rpcUrls:
- http: http://localhost:8545
nativeToken:
name: Ether
symbol: ETH
decimals: 18
anvil2:
chainId: 31338
domainId: 31338
name: anvil2
protocol: ethereum
rpcUrls:
- http: http://localhost:8555

您还可以通过提供要重写的字段来扩展核心链配置:

---
sepolia:
blocks:
confirmations: 2

重写 RPC URL

您可以通过扩展核心链配置来覆盖RPC网址。

在下面的示例中,你可以看到如何定义RPC数组,以及如何调整其中任何一个RPC的重试参数。

---
demochain:
name: demochain
chainId: 123456
domainId: 123456
protocol: ethereum
rpcUrls:
- http: https://rpc-testnet.demochain.gg
sepolia:
rpcUrls:
- http: https://rpc2.sepolia.org
- http: https://some-other-sepolia-rpc.gg
retry:
maxRequests: 10

覆盖交易设置

事务重载是在形成事务请求时包含的任何属性。例如:

  • gasPrice: number | string
  • maxFeePerGas: number | string
  • maxPriorityFeePerGas: number | string
  • nonce: number | string
  • type: number
  • ccipReadEnabled: boolean

在下面的示例中,我们使用的燃料价格为7gwei,对nonce进行了硬编码,并为基本费和优先费设置了最大值。

---
sepolia:
transactionOverrides:
gasPrice: 7000000000 # 7 gwei
maxFeePerGas: 150000000000 # 150 gwei
maxPriorityFeePerGas: 40000000000 # 40 gwei
nonce: 1337
warning

如果要覆盖链配置中的 nonce,请确保在交易成功时更新该值。