Starcoin v1.12.3 Released with Improved Integration Testing for Complex Move SmartContract

scene one

  1. Project B needs to be able to test the environment locally and deploy the Move contract of project A to the account address of project A. or
  2. Project B forks a branch from the test network or the main network as a test environment, so that project B can directly test based on the contracts and states that have been deployed on the network.

scene two

  1. Call chain related APIs.
  2. The post-test depends on the output of the pre-test.
  1. Command output and template variables, support for both integration testing and command line tools.
  2. Use arbitrary addresses in integration tests for testing.
  3. Enhanced integration testing capabilities of fork mode, developers can test locally based on a certain high state of the mainnet or testnet.
  4. Added package and deploy integration testing support to facilitate integration testing through two-phase upgrades and DAO upgrades.

Detailed description and usage scenarios

mpm integration-test

1. Command output and template variables

  • The --debug option can display the command output on the command line for easy debugging.
  • $.faucet[0], $.call[0], $.call-api[0] The array index in the command is the call number of the corresponding command in the entire test file, starting from 0.
  • faucet
  1. Get the address of the faucet target account: {{$.faucet[0].txn.raw_txn.decoded_payload.ScriptFunction.args[0]}}
  2. Get the amount of faucet: {{$.faucet[0].txn.raw_txn.decoded_payload.ScriptFunction.args[1]}}
  • call
  1. Get the result of the call command
  • call-api
  1. Get the result of the call-api command
  • block
  1. Get block height: {{$.block[0].number}}
  2. get block parent_hash: {{$.block[0].parent_hash}}
  • package
  1. Get the package file path: {{$.package[0].file}}
  2. Get the package hash: {{$.package[0].package_hash}}
  • call-api parameter exception:
  1. Check whether the parameters conform to the interface definition;
  2. The call-api data parameter is a json list, and there can be no spaces between list elements

2. Test with arbitrary address

3. Support call-api calls in fork mode from remote nodes

  • During initialization, the state tree will be updated, and dozens of state tree nodes need to be read. These nodes must be obtained remotely through rpc. If the network is slow, the initialization process will be longer, up to 2–3 minutes.

4. Added package and deploy commands

CLI

1. Command output and template variables

2. dry-run mode

3. Resource paging query and filtering

  • Paging query:
    state list resource <address> -i <start index> -s <number of resources>
  • Filter based on resource_type:
    state list resource <address> -t <resouce type>

Major Changes Pull Request

  • Change the default devnet data dir by @YusongWang in #3570
  • cli: dev get-coin don’t check account by @YusongWang in #3589
  • [cli] dry run at cli side and print warn log when transaction execute failed by @jolestar in #3597
  • [scmd]Support jpst template expression in command line and starcoin testsuit by @jolestar in #3583
  • provide install script for the latest starcoin and mpm by @yuliyu123 in #3610
  • [cli]list resource support filter struct_type and start_idx max_size by @YusongWang in #3639

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Starcoin

Starcoin

Starcoin is a proof-of-work blockchain that enables secure smart contracts based on Move to power services in Web 3.0