首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >部署到Goerli测试网后出错

部署到Goerli测试网后出错
EN

Ethereum用户
提问于 2022-10-08 06:56:12
回答 3查看 627关注 0票数 0

我在fleek.co上托管了我的彩票网站,一切都很好,而在草帽本地网络上。所以我决定在Goerli上测试它,我面临着一个又一个错误。

首先,我得到了下面的错误1,并手动添加了一个气体限制在硬帽子配置文件。在重新部署合同并在fleek上发布之后,最初,enterRaffle可以正常工作。

当我第二次尝试enterRaffle时,它失败了。其他时候是成功的。但即便如此,它也不会像预期的那样更新球员的数量。

我错过了什么?

错误1

代码语言:javascript
复制
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"code":-32603,"message":"execution reverted","data":{"originalError":{"code":3,"data":"0x1425571c","message":"execution reverted"}}}, method="estimateGas", transaction={"from":"0x13A19933267ec307c96f3dE8Ff8A2392C39263EB","to":"0x5507C7e274B5201a98141cCd0507cF6e4416Be30","value":{"type":"BigNumber","hex":"0x2386f26fc10000"},"data":"0x2cfcc539","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.6.0)
    at su.makeError (_app-3ca186e4a2557e86.js:1:1975135)
    at su.throwError (_app-3ca186e4a2557e86.js:1:1975255)
    at yh (_app-3ca186e4a2557e86.js:1:2115696)
    at Ad.<anonymous> (_app-3ca186e4a2557e86.js:1:2123240)
    at Generator.throw (<anonymous>)
    at s (_app-3ca186e4a2557e86.js:1:2114235)

然后在像这样手动添加气体之后,就会出现错误2。

代码语言:javascript
复制
        goerli: {
            url: GOERLI_RPC_URL,
            accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
            //   accounts: {
            //     mnemonic: MNEMONIC,
            //   },
            saveDeployments: true,
            chainId: 5,
            gas: 6000000,
        },

误差2

代码语言:javascript
复制
_app-3ca186e4a2557e86.js:1 Uncaught (in promise) Error: transaction failed [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (transactionHash="0x1c28a6b2bfb02f23f443a854c998bec3d965a6beff525f0431480d063e5214c2", transaction={"hash":"0x1c28a6b2bfb02f23f443a854c998bec3d965a6beff525f0431480d063e5214c2","type":2,"accessList":null,"blockHash":null,"blockNumber":null,"transactionIndex":null,"confirmations":0,"from":"0x13A19933267ec307c96f3dE8Ff8A2392C39263EB","gasPrice":{"type":"BigNumber","hex":"0x6bc0e597"},"maxPriorityFeePerGas":{"type":"BigNumber","hex":"0x59682f00"},"maxFeePerGas":{"type":"BigNumber","hex":"0x6bc0e597"},"gasLimit":{"type":"BigNumber","hex":"0x4c9e58"},"to":"0x5507C7e274B5201a98141cCd0507cF6e4416Be30","value":{"type":"BigNumber","hex":"0x2386f26fc10000"},"nonce":49,"data":"0x2cfcc539","r":"0x3869c8f2e2ecaa492c528f2065d156cdb855a6f2af9669a5472c97473f6f5d74","s":"0x1ae3086d065b24e61c4a01ea1a25a4e1109a809e8a5e8c40fba7a58d8c8e05b2","v":0,"creates":null,"chainId":0}, receipt={"to":"0x5507C7e274B5201a98141cCd0507cF6e4416Be30","from":"0x13A19933267ec307c96f3dE8Ff8A2392C39263EB","contractAddress":null,"transactionIndex":18,"gasUsed":{"type":"BigNumber","hex":"0x6448"},"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","blockHash":"0x4cc5aa906cc1a68ef49ade23bec8f679abeb0c2439cc2798d9f5244550bcb8a4","transactionHash":"0x1c28a6b2bfb02f23f443a854c998bec3d965a6beff525f0431480d063e5214c2","logs":[],"blockNumber":7723284,"confirmations":2,"cumulativeGasUsed":{"type":"BigNumber","hex":"0x28a252"},"effectiveGasPrice":{"type":"BigNumber","hex":"0x67d1c29b"},"status":0,"type":2,"byzantium":true}, code=CALL_EXCEPTION, version=providers/5.6.0)
    at su.makeError (_app-3ca186e4a2557e86.js:1:1975135)
    at su.throwError (_app-3ca186e4a2557e86.js:1:1975255)
    at Ad.<anonymous> (_app-3ca186e4a2557e86.js:1:2091815)
    at Generator.next (<anonymous>)
    at a (_app-3ca186e4a2557e86.js:1:2072233)

站点url

前端回购

后端回购

EN

回答 3

Ethereum用户

回答已采纳

发布于 2022-11-17 10:59:38

忘了在这里写更新。所以,我注意到了一些事情

问题在于ABI。

当我部署时,hh deploy --network goerli abi如下所示(这很好)

代码语言:javascript
复制
{
        "type": "function",
        "name": "getNumWords",
        "constant": true,
        "stateMutability": "pure",
        "payable": false,
        "inputs": [],
        "outputs": [{ "type": "uint256" }]
    },

当我退出我的本地草帽节点,并再次旋转它,‘hh node abi (在常量文件夹中),更新到这个;(这是加注气田的地方);

代码语言:javascript
复制
{
        "type": "function",
        "name": "getLastestTimeStamp",
        "constant": true,
        "stateMutability": "view",
        "payable": false,
        "gas": 29000000,           // here
        "inputs": [],
        "outputs": [{ "type": "uint256" }]
    },

我不知道为什么重新运行节点会改变abi,但是在使用正确的ABI运行之后,一切都正常。

票数 0
EN

Ethereum用户

发布于 2022-10-08 10:34:42

在我看来,它与枚举有关-它不会将其状态重置为OPEN (我看到这发生在实际的随机词()函数中)。

我的两个建议:

  1. 确保合同链接到有足够测试链接的订阅。
  2. 在第154行,您也可以尝试将randomWords号与modulo.In fullfillRandomWords()函数相舍五入,将其更改为:
代码语言:javascript
复制
       uint256 indexOfWinner = (randomWords[0] % s_players.length)*1 ;

我希望这能帮上忙。

票数 0
EN

Ethereum用户

发布于 2022-10-08 11:15:55

气体估计是通过实际运行代码来完成的。如果代码出现错误,应用程序就无法估计气体。即使您手动设置gas并仍然调用该函数,这一次它也将在evm上工作,并且仍然是一个失败的事务。

在您的情况下,如果应用程序在调用enterRaffle时给出“错误:无法估计气体”,那么如果RaffleState在调用时没有打开,或者数量小于i_enteranceFee。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/137073

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档