Chainlink VRF回调的燃气限制设置得太低。

huangapple go评论49阅读模式
英文:

Chainlink VRF callback gas limit set too low

问题

I'm writing an integration test of my NFT practice project using Chainlink VRF v2 subscription method, but keep getting callback gas limit set too low error.

My contract is deployed on sepolia testnet with the following settings:

  • Gas Lane: 0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c
  • Gas Limit: 500000
  • VRF Coordinator Address: 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625

The account I use for testing also has enough sepoliaETH.

You can find the full implementation of my practice project at https://github.com/ambersun1234/nft and the deployed contract addresses:

The subscription of Chainlink VRF that I created currently has 18 Link, and the contract will spend 0.2 Link per call.

The file for the integration test is located at:

To reproduce the issue, follow these steps:

$ git clone https://github.com/ambersun1234/nft
$ cd nft
$ yarn install
$ yarn hardhat test --network sepolia

You mentioned that you've checked all the settings, including gas limit and subscription ID, and even increased the gas limit to 2500000, but the issue persists. Additionally, you confirmed that Chainlink works on the goerli testnet of your other project.

英文:

I'm writing an integration test of my NFT practice project using Chainlink VRF v2 subscription method, but keep getting callback gas limit set too low error

My contract is deployed on sepolia testnet with following settings

  • gas lane: 0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c
  • gas limit: 500000
  • vrfcoordinator address: 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625

and the account I use for testing also have enough sepoliaETH

You can find the full implementation of my practice project at https://github.com/ambersun1234/nft and the deployed contract

> The subscription of Chainlink VRF that I created currently have 18 Link
> The contract will spend 0.2 Link per call

The file for integration test is

Step to reproduce

$ git clone https://github.com/ambersun1234/nft
$ cd nft
$ yarn install
$ yarn hardhat test --network sepolia

I've checked all of the settings correct or not(gas lane, subscription id ... etc.)
and even change the gas limit up to 2500000 but all in vain

To check if Chainlink works on other network, I also checked goerli testnet of my another project and it works

答案1

得分: 0

你尝试增加回调的 gas 限制了吗?你的操作可能使用以太燃料(gwei),而不仅仅是 LINK。错误提示是指燃料不足是问题的原因。

对于 Sepolia VRF2 协调器,最大 gas 限制指定为 2,500,000(请参见 https://docs.chain.link/vrf/v2/subscription/supported-networks/#sepolia-testnet)。

英文:

Have you tried increasing the callbackGasLimit? Your operations could be using ether gas (gwei) (not just LINK). The error is saying that insufficient gas is the problem.

For the sepolia VRF2 coordinator, the max gas limit specified is 2,500,000
(see https://docs.chain.link/vrf/v2/subscription/supported-networks/#sepolia-testnet)

答案2

得分: 0

确保在 _setTokenURI 之前使用 _safeMint,否则你将遇到这个奇怪的问题。

英文:

Ok so the issue is simple
make sure you put _safeMint before _setTokenURI
otherwise you'll encounter with this weird issue

huangapple
  • 本文由 发表于 2023年4月11日 14:21:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/75982920.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定