Skip to content

[BUG] swanky contract test -a not properly resolving different contracts. #173

@chunteng-web3

Description

@chunteng-web3

At the moment, my swanky.config.json contains the following info for contracts:

"contracts": {
    "a_token": {
      "name": "a_token",
      "moduleName": "a_token",
      "deployments": [],
      "language": "ink",
      "build": {
        "timestamp": 1684712710067,
        "artifactsPath": "artifacts/a_token/1684712710067"
      }
    },
    "lending_pool_addresses_provider": {
      "name": "lending_pool_addresses_provider",
      "moduleName": "lending_pool_addresses_provider",
      "language": "ink",
      "deployments": [
        {
          "timestamp": 1685573291597,
          "address": "5FNjWiKJctNaPQvw4EaSmzSZFvZZYNWbKFxyoNBv7EoZb1UJ",
          "networkUrl": "ws://127.0.0.1:9944",
          "deployerAlias": "alice"
        }
      ],
      "build": {
        "timestamp": 1684860280893,
        "artifactsPath": "artifacts/lending_pool_addresses_provider/1684860280893"
      }
    },
    "lending_pool_addresses_provider_registry": {
      "name": "lending_pool_addresses_provider_registry",
      "moduleName": "lending_pool_addresses_provider_registry",
      "language": "ink",
      "deployments": [],
      "build": {
        "timestamp": 1684800160823,
        "artifactsPath": "artifacts/lending_pool_addresses_provider_registry/1684800160823"
      }
    },

When I run swanky contract test a_token and swanky contract test lending_pool_addresses_provider, tests are run properly.

  AToken: Modifiers
    ✔ Tries to invoke mint not being the LendingPool (91ms)
    ✔ Tries to invoke burn not being the LendingPool
    ✔ Tries to invoke transferOnLiquidation not being the LendingPool
    ✔ Tries to invoke transferUnderlyingTo not being the LendingPool


  4 passing (243ms)

  LendingPoolAddressesProvider tests
    ✔ Test the accessibility of the LendingPoolAddressesProvider (191ms)
    ✔ Tests adding  a proxied address with `setAddressAsProxy()` (81ms)
    ✔ Tests adding a non proxied address with `setAddress()`


  3 passing (385ms)

But when I run swanky contract test -a, it prompts errors after running for a_token,

  AToken: Modifiers
    ✔ Tries to invoke mint not being the LendingPool (121ms)
    ✔ Tries to invoke burn not being the LendingPool
    ✔ Tries to invoke transferOnLiquidation not being the LendingPool
    ✔ Tries to invoke transferUnderlyingTo not being the LendingPool


  4 passing (306ms)

All tests passing. Check the report for details: /host-home/sio2-ink-protocol/tests/a_token/testReports
 ›   Error: Path to contract undefined does not exist: /host-home/sio2-ink-protocol/tests/a_token/contracts/lending_pool_addresses_provider

Manual workarounds work, but this is annoying when I want to make sure all the tests written are constantly passing.
As you can see, the path to contracts is not acquired properly.

FYI:

vscode ➜ /host-home/sio2-ink-protocol (chunteng-dev) $ swanky --version
@astar-network/swanky-cli/3.0.3 linux-x64 node-v19.9.0

Description

Tell us what happened. In particular, tell us how and why you are using this project, and describe the bug that you encountered. Please note that we are not able to support all conceivable use cases, but the more information you are able to provide the more equipped we will be to help.

Steps to Reproduce

Replace the example steps below with actual steps to reproduce the bug you're reporting.

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected vs. Actual Behavior

What did you expect to happen after you followed the steps you described in the last section? What actually happened?

Environment

Describe the environment in which you encountered this bug. Use the list below as a starting point and add additional information if you think it's relevant.

  • Operating system:
  • Project version/tag: (run 'swanky version')
  • Rust version (run rustup show):
  • Node version (run node --version)

Logs, Errors or Screenshots

Please provide the text of any logs or errors that you experienced; if applicable, provide screenshots to help illustrate the problem.

Additional Information

Please add any other details that you think may help us solve your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions