英文:
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:
- 0x6933D3e699B948ff8cadec1091f25B6C8718E307 (with
500000
gas limit) - 0x08dc70E094C9A7720914D1f2b81b4351686554cA (with
2500000
gas limit)
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
- 0x6933D3e699B948ff8cadec1091f25B6C8718E307(with
500000
gas limit) - 0x08dc70E094C9A7720914D1f2b81b4351686554cA(with
2500000
gas limit)
> 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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论