You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Solidity Lottery合约部署报错:callbackGasLimit值越界修复

问题背景

基于Chainlink VRF和Keepers开发了Solidity Lottery合约,配套部署脚本、Mock脚本及网络配置。执行yarn hardhat deploy部署到本地网络时,触发错误:

Error: value out-of-bounds on callbackGasLimit variable

尝试修改callbackGasLimit数值后,问题仍未解决。

错误根源

合约构造函数的参数顺序定义为:

constructor(
    address vrfCoordinatorV2,
    uint256 entranceFee,
    uint32 callbackGasLimit,
    uint256 interval,
    bytes32 gasLane,
    uint64 subscriptionId
)

但部署脚本的args数组参数顺序错误,将bytes32类型的gasLane值传入了uint32类型的callbackGasLimit参数位置,因类型不匹配导致数值越界。

修复方案

调整部署脚本中args数组的参数顺序,使其与合约构造函数定义完全一致:

const args = [
    vrfCoordinatorV2Address,
    entranceFee,
    callbackGasLimit,
    interval,
    gasLane,
    subscriptionId
]

内容的提问来源于stack exchange,提问作者Edward Kelley

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 12:10:58