美文网首页
常见EVM错误

常见EVM错误

作者: 天地一小儒 | 来源:发表于2023-12-13 11:29 被阅读0次
  1. Returned error: {"jsonrpc":"2.0","error":"[ethjs-query] while formatting outputs from RPC '{\"value\":{\"code\":-32603,\"data\":{\"code\":-32000,\"message\":\"transaction underpriced\"}}}'","id":4815365370376783}

    gasprice定价过低,调高定价

  2. Remix上合约调试时不能仅依赖事件是否发出为成功依据,而应该以状态变量为准,因为事件有可能不发!

  3. 部署时报错:code=CALL_EXCEPTION

    检查gaslimit:5b8d80==6000000 ⇒contracts/src.ts/deploy.ts 6000000改8000000

  4. Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fail if the current network has activated the eip 170.

    合约过大,需要拆分。参考另一篇《delegatecall》

  5. ProviderError: sender doesn't have enough funds to send tx. The max upfront cost is: 4845817880859375 and the sender's account only has: 0

    合约部署账户没有钱,打点原生币过去就行了

  6. CompilerError: Stack too deep, try removing local variables.

    变量声明太多了,可以用结构体封装一些,或者把部分代码挪出去变成函数

  7. Error: Transaction reverted: function call to a non-contract account

    接口正在尝试调用一个不存在的合约。检查合约确实是否存在,或者在合约中增加代码检查如果是合约地址就调用,否则就不调用。

  8. Explicit type conversion not allowed from "address" to "uint256".solidity(9640)

    在 Solidity 0.8.0 版本中,引入了一个更为安全的类型系统,不再允许直接将 address 类型转换为 uint256 类型。因此,你需要使用 type 关键字进行显式类型转换。

    uint256 size;
    assembly {
        size := extcodesize(_addr)
    }
    
  9. Explicit type conversion not allowed from "bytes memory" to "address".solidity(9640)

    function bytesToAddress(bytes memory data) internal pure returns (address) {
        require(data.length == 20, "Invalid address length");
        address result;
        assembly {
            result := mload(add(data, 32))
        }
        return result;
    }
    
  10. abi: length larger than int64: 48129323291152180489044384789343333891201197466736324414383260238138438582324

    合约有bug,检查是否修改了合约但忘记重新部署

  11. ProviderError: replacement transaction underpriced

    gasprice过低,hardhat可以设置如下代码修复:

    const contract = await Contract.deploy({
      gasPrice: ethers.parseUnits("25", "gwei"), // fuji中的 gas 价格最低是25 Gwei
    });
    

相关文章

  • solidity 智能合约编译成wasm 和wast

    摘要 1、用solc 将solidity 代码编译成evm 字节码2、用evm2wasm 将evm 转化成wasm...

  • eth solidity简单部署合约合约调用

    EVM 的作用是什么EVM 就是执行智能合约字节码指令的地方。通过 EVM 执行智能合约来完成符合约束条件的交易,...

  • 常见错误

    1、spring默认只会扫描resources下的属性文件,而对于java包下的属性文件会被忽略。如果想要编译ja...

  • 常见错误

    错误1 导致原因 解决办法 错误二: library not found for - 参考 解决方法:获取 库...

  • 常见错误

    微信自定义菜单 EasyWechat :4.0最新版本 1.微信公众号配置网页授权域名微信报无法访问xxx.com...

  • 常见错误

    Test is not an annotation type描述:在使用junit进行单元测试时,在方法前声明@T...

  • 常见错误

    1、phpmyadmin 登录失败#1045无法登录MySQL服务器解决:(两种情况) 配置文件权限错误:修改ph...

  • 常见错误

    Permission Denial: opening provider 隐藏的android:exported属性...

  • 常见错误

    Xcode 7 创建新项目用到 UIWebView 发送请求时,报下面的错: “App Transport Sec...

  • 常见错误!

    命令行error(命令行中 xxx命令) solution(npm bin -g=>string expor...

网友评论

      本文标题:常见EVM错误

      本文链接:https://www.haomeiwen.com/subject/udvbgdtx.html