繁体   English   中英

在 Remix 中部署 solidity 合约时如何修复/调试错误(无效的 arrayify 值)

[英]How to fix / debug errors (invalid arrayify value) when deploying a solidity contract in Remix

问题

我正在尝试通过Remix部署智能合约。 不幸的是,它失败了,并显示了一条非常无用的错误消息。

错误信息

创建 MyContract 出错:错误编码 arguments:错误:无效的 arrayify 值 (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.5.0)

代码

这是contract使用的构造函数:

struct RRSet {
    uint32 inception;
    uint32 expiration;
    bytes20 hash;
}

constructor(bytes memory _anchors) {
    // Insert the 'trust anchors' - the key hashes that start the chain
    // of trust for all other records.
    anchors = _anchors;
    rrsets[keccak256(hex"00")][DNSTYPE_DS] = RRSet({
        inception: uint32(0),
        expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this
        hash: bytes20(keccak256(anchors))
    });
    emit RRSetUpdated(hex"00", anchors);
}

一些想法

我的合同使用is从抽象合同和常规合同继承。 有没有办法查看错误或来源的位置,或者是否有可能对其进行调试?

构造函数将字节数组作为参数。

当您传递一个空值时,它会导致您的问题中提到的错误消息。 这是因为您有效地传递了“无价值” - 而不是“空字节数组”。

空值

创建 MyContract 错误:编码 arguments 错误:错误:无效的数组化值(argument="value",value="",code=INVALID_ARGUMENT,version=bytes/5.5.0)

如果要传递一个空字节数组,则需要使用[]0x表达式(这两个选项都有效):

空数组

空数组

它可以输入“[]”或“0x”,我理解的“数据”应该具有类似“[xxx]”的格式,我建议持有者可以更新描述以澄清它。 谢谢 Petr 回答了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM