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

82 Views Asked by At

I'm trying to run the below mandos test, but when running erdpy contract test, the test fails and returns the following error: FAIL: address in "setState" "newAddresses" field should have SC format: address:the_crowdfunding_contract.

The test code is the one from the elrond smart contract tutorial, part 1.

What is the correct format of the SC address in the setState step?

Versions used:

  • 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"
        }
      }
    }
  ]
}
1

There are 1 best solutions below

1
On BEST ANSWER

SmartContract addresses in mandos should be prefixed using sc:instead of address:

So the correct test would look like this:

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

Also your SmartContract address name might be too long, not sure on the exact limits right now. So if the error persists after the above changes try to shorten the SmartContract name.

Additional note: The documentation is somewhat outdated. For newer informations you can take a look at the templates that can be used with the elrond ide vscode extension. They are also on github