前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >常见EVM错误

常见EVM错误

作者头像
天地一小儒
发布2023-12-18 11:33:27
1640
发布2023-12-18 11:33:27
举报
文章被收录于专栏:信且诚心之动

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定价过低,调高定价

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

部署时报错:code=CALL_EXCEPTION

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

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》

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

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

CompilerError: Stack too deep, try removing local variables.

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

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

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

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

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

代码语言:javascript
复制
uint256 size;
assembly {
    size := extcodesize(_addr)
}

Explicit type conversion not allowed from "bytes memory" to "address".solidity(9640)

代码语言:javascript
复制
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;
}

abi: length larger than int64: 48129323291152180489044384789343333891201197466736324414383260238138438582324

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

ProviderError: replacement transaction underpriced

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

代码语言:javascript
复制
const contract = await Contract.deploy({
  gasPrice: ethers.parseUnits("25", "gwei"), // fuji中的 gas 价格最低是25 Gwei
});
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-12-14,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
腾讯云代码分析
腾讯云代码分析(内部代号CodeDog)是集众多代码分析工具的云原生、分布式、高性能的代码综合分析跟踪管理平台,其主要功能是持续跟踪分析代码,观测项目代码质量,支撑团队传承代码文化。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档