patractlabs / redspot

Redspot is an Substrate pallet-contracts (ink!) development environment. Compile your contracts and run them on a different networks. Redspot's core forks from Hardhat but changed a lot to suit substrate.
https://redspot.patract.io/
Other
67 stars 22 forks source link

missing error reporting when a smart contract fails to compile #64

Closed RoyTimes closed 3 years ago

RoyTimes commented 3 years ago

To reproduce: compile your smart contract with either yarn build. Then, change the smart contract to cause some compile errors and run yarn build or yarn test again. Redspot will fail to stop the workflow and proceed with the outdated output files.

cargo +nightly contract generate-metadata
  Generating metadata
 [1/3] Building cargo project
   Compiling some-smart-contract v3.0.0-rc2 (/var/folders/t9/lknsxzq17............)
error: expected `;`, found `var2`
   --> /dir-to-project/lib.rs:126:14
    |
126 |             }
    |              ^ help: add `;` here
127 |             var2.get_mut().push(new_vault_id);
    |             ------------ unexpected token

error: expected `;`
   --> /dir-to-project/lib.rs:127:13
    |
127 |             var2.get_mut().push(new_vault_id);
    |             ^^^^^^^^^^^^

error: aborting due to 2 previous errors

error: could not compile `some-smart-contract`

To learn more, run the command again with --verbose.
ERROR: xbuild failed with status exit code: 101
error: aborting due to 2 previous errors

error: could not compile `some-smart-contract`

To learn more, run the command again with --verbose.
ERROR: xbuild failed with status exit code: 101

🚚  Copy wasm files: some-smart-contract.wasm
🚚  Copy abi files: /dir-to-project/some-smart-contract.json
🎉  Compile successfully! You can find them at /dir-to-project/artifacts

When the cargo cmd throws error, Redspot does not detect the errors thrown. Instead, it tries to copy the .wasm and .json files and throw errors when these files fail to be generated. However, if there are previously successful builds that have generated these files but the current build fails, Redspot will have no trouble copying these output to the artifacts folder and, therefore, fail to stop the rest of the workflow and proceed with the outdated compiled smart contract files.

atenjin commented 3 years ago

Thanks reporting, we just came back from vacation, would solve it soon.

ii-ii-ii commented 3 years ago

The latest version should now have solved this problem and support multi-contract compilation. See this example at https://github.com/patractlabs/redspot/blob/master/examples/multi-contract/redspot.config.ts. Documentation will be added when the official version is released.