elrond - 失败:“setState”“newAddresses”字段中的地址应具有 SC 格式:地址:the_crowdfunding_contract
问题描述
我正在尝试运行以下 mandos 测试,但是在运行时erdpy contract test
,测试失败并返回以下错误:FAIL: address in "setState" "newAddresses" field should have SC format: address:the_crowdfunding_contract
.
测试代码来自 elrond智能合约教程,第 1 部分。
步骤中 SC 地址的正确格式是什么setState
?
使用的版本:
- erdpy:1.0.21
- elrod-wasm:0.22.9
{
"name": "tutorial_crowdfunding",
"steps": [
{
"step": "setState",
"accounts": {
"address:my_address": {
"nonce": "0",
"balance": "1,000,000"
}
},
"newAddresses": [
{
"creatorAddress": "address:my_address",
"creatorNonce": "0",
"newAddress": "address:the_crowdfunding_contract"
}
]
},
{
"step": "scDeploy",
"tx": {
"from": "address:my_address",
"contractCode": "file:../output/tutorial_crowdfunding.wasm",
"value": "0",
"gasLimit": "1,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"gas": "*",
"refund": "*"
}
},
{
"step": "checkState",
"accounts": {
"address:my_address": {
"nonce": "1",
"balance": "1,000,000"
},
"address:the_crowdfunding_contract": {
"nonce": "0",
"balance": "0",
"storage": {
"''owner": "address:my_address"
},
"code": "file:../output/tutorial_crowdfunding.wasm"
}
}
}
]
}
解决方案
mandos 中的 SmartContract 地址应使用前缀sc:
代替address:
所以正确的测试应该是这样的:
{
"name": "tutorial_crowdfunding",
"steps": [
{
"step": "setState",
"accounts": {
"address:my_address": {
"nonce": "0",
"balance": "1,000,000"
}
},
"newAddresses": [
{
"creatorAddress": "address:my_address",
"creatorNonce": "0",
"newAddress": "sc:the_crowdfunding_contract"
}
]
},
{
"step": "scDeploy",
"tx": {
"from": "address:my_address",
"contractCode": "file:../output/tutorial_crowdfunding.wasm",
"value": "0",
"gasLimit": "1,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"gas": "*",
"refund": "*"
}
},
{
"step": "checkState",
"accounts": {
"address:my_address": {
"nonce": "1",
"balance": "1,000,000"
},
"sc:the_crowdfunding_contract": {
"nonce": "0",
"balance": "0",
"storage": {
"''owner": "address:my_address"
},
"code": "file:../output/tutorial_crowdfunding.wasm"
}
}
}
]
}
此外,您的 SmartContract 地址名称可能太长,目前不确定确切的限制。因此,如果在上述更改后错误仍然存在,请尝试缩短 SmartContract 名称。
附加说明:文档有些过时。有关更新的信息,您可以查看可与 elrond ide vscode 扩展一起使用的模板。他们也在github上
推荐阅读
- javascript - 在课堂上链接承诺
- html - Bootstrap 折叠面板在展开时不会向下推页脚
- apache - 连接到上游时连接被拒绝 - Docker
- ios - Network.Framework的iOS后台使用
- angular - 使用 Angular 在 AspnetBoilerplate 中从客户端更新/更改设置
- c# - 指定动作
回调作为带有 xml 的数据,可能带有 cref 属性? - azure-devops - 如何将本地 VS 项目添加到现有的非空 Azure DevOps Repo
- angular - Angular 6 - 在单击的项目上切换类别并在其他项目上切换类别
- laravel - 无法将 str_random() 生成的数字存储到 MySQL
- bash - 将文本文件集的内容复制到其他文本文件集