失败:"setState" "newAddresses" 字段中的地址应具有 SC 格式:address:the_crowdfunding_contract

FAIL: address in "setState" "newAddresses" field should have SC format: address:the_crowdfunding_contract

我正在尝试 运行 下面的 mandos 测试,但是当 运行 宁 erdpy contract test 时,测试失败并且 returns 出现以下错误:FAIL: address in "setState" "newAddresses" field should have SC format: address:the_crowdfunding_contract.

测试代码来自elrond smart contract tutorial, part 1.

setState步骤中SC地址的正确格式是什么?

使用的版本:

{
  "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