cspr-rad / kairos

Apache License 2.0
2 stars 0 forks source link

Final demo contract suggestions #102

Closed koxu1996 closed 3 months ago

koxu1996 commented 3 months ago

Final suggestions before merging demo contract.

Refactor Cargo dependencies

Minor fixes/improvements

Allow running WASM tests without extra setup

_No longer need to set PATH_TO_WASM_BINARIES, install wasm-opt or use Nix :faceexhaling:. Just compile contracts, and run integration tests with cargo test - it will take care of WASM optimization during runtime.

koxu1996 commented 3 months ago

@marijanp It seems that reverting to stable toolchain for non-WASM targets breaks builds. Could you help with making this dual toolchain setup?

Update: I was informed that unstable toolchain will be used in a prover as well, and having 2 different toolchains will be too heavy for CI/CD. So I am reverting my change; will explore how to build contracts with stable toolchain later.

koxu1996 commented 3 months ago

@jonas089 Ready for review, even some tests are failing :thinking:

kairos-tarpaulin> running 6 tests
kairos-tarpaulin> test tests::should_install_contract ... ok
kairos-tarpaulin> test tests::test_deposit_succeeds ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_by_uref_to_user_should_fails ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_by_uref_to_admin_should_fails ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_to_admin_fails ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_to_user_fails ... ok
kairos-tarpaulin> test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s
kairos-tarpaulin> Error: "Test failed during run"
error: builder for '/nix/store/zpxg73h8aa75vbn5yr88n9ml0gg0hy1g-kairos-tarpaulin-0.1.0.drv' failed with exit code 1;

@marijanp It it nix/cachix issue?

github-actions[bot] commented 3 months ago

File Coverage
All files 58% :x:
kairos-server/src/routes/deposit.rs 88% :white_check_mark:
kairos-server/src/routes/transfer.rs 90% :white_check_mark:
kairos-test-utils/src/cctl.rs 90% :white_check_mark:
kairos-crypto/src/implementations/casper.rs 6% :x:
kairos-server/src/config.rs 0% :x:
kairos-server/src/errors.rs 12% :x:
kairos-server/src/lib.rs 95% :white_check_mark:
kairos-server/src/utils.rs 22% :x:
kairos-server/src/state/transactions/batch_state.rs 36% :x:
kairos-server/src/state/transactions.rs 66% :white_check_mark:
kairos-server/src/state/trie.rs 35% :x:
kairos-test-utils/src/cctl/parsers.rs 66% :white_check_mark:
kairos-tx/src/asn.rs 51% :x:
kairos-tx/src/error.rs 0% :x:
kairos-server/tests/transactions.rs 85% :white_check_mark:
demo-contract-tests/tests/test_fixture/mod.rs 97% :white_check_mark:
demo-contract-tests/tests/test_fixture/wasm_helper.rs 68% :white_check_mark:

Minimum allowed coverage is 60%

Generated by :monkey: cobertura-action against 0c3ff1a2346fca741b9b45b0002acbf4286db143

marijanp commented 3 months ago

@jonas089 Ready for review, even some tests are failing 🤔

kairos-tarpaulin> running 6 tests
kairos-tarpaulin> test tests::should_install_contract ... ok
kairos-tarpaulin> test tests::test_deposit_succeeds ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_by_uref_to_user_should_fails ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_by_uref_to_admin_should_fails ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_to_admin_fails ... ok
kairos-tarpaulin> test tests::test_transfer_from_contract_purse_to_user_fails ... ok
kairos-tarpaulin> test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s
kairos-tarpaulin> Error: "Test failed during run"
error: builder for '/nix/store/zpxg73h8aa75vbn5yr88n9ml0gg0hy1g-kairos-tarpaulin-0.1.0.drv' failed with exit code 1;

@marijanp It it nix/cachix issue?

You have to scroll up in the build log, it says that the port is already in use. Current state of investigation: calling bind with port 0 to get any available port by the OS as described here, does not release the port fast enough such that the server can bind to it. What the reason for that is, is unclear. The TcpListener should be dropped right after we access the bind_address's port.

Interestingly if you run it on more powerful machines, the issue does not apper. Thus I believe it has something to do with GHA runners just not having enought computational power.