[英]How to fix / debug errors (invalid arrayify value) when deploying a solidity contract in Remix
I am trying to deploy a smart contract via Remix .我正在尝试通过Remix部署智能合约。 Unfortunately, it fails with a very unhelpful error message.不幸的是,它失败了,并显示了一条非常无用的错误消息。
creation of MyContract errored: Error encoding arguments: Error: invalid arrayify value (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.5.0)创建 MyContract 出错:错误编码 arguments:错误:无效的 arrayify 值 (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.5.0)
Here is the constructor the contract
uses:这是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);
}
My contract uses is
to inherit from an abstract contract as wells as from a regular contract.我的合同使用is
从抽象合同和常规合同继承。 Is there a way to see where to error or originates from or is there a possiblity to debug it?有没有办法查看错误或来源的位置,或者是否有可能对其进行调试?
The constructor takes a byte array as an argument.构造函数将字节数组作为参数。
When you pass an empty value, it results in the error message mentioned in your question.当您传递一个空值时,它会导致您的问题中提到的错误消息。 It's because you're effectively passing "no value" - not "empty byte array".这是因为您有效地传递了“无价值” - 而不是“空字节数组”。
creation of MyContract errored: Error encoding arguments: Error: invalid arrayify value (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.5.0)创建 MyContract 错误:编码 arguments 错误:错误:无效的数组化值(argument="value",value="",code=INVALID_ARGUMENT,version=bytes/5.5.0)
If you want to pass an empty byte array, you need to use the []
or 0x
expression (both options work):如果要传递一个空字节数组,则需要使用[]
或0x
表达式(这两个选项都有效):
It works to input "[]" or "0x", what I understand the "data" which should has a format like "[xxx]", I suggest holders can update a description to clarify it.它可以输入“[]”或“0x”,我理解的“数据”应该具有类似“[xxx]”的格式,我建议持有者可以更新描述以澄清它。 Thank you Petr answers this question.谢谢 Petr 回答了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.