Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Myriad Social Milestone 2 Deliverables Submission #1078

Merged
merged 5 commits into from
Jan 15, 2024

Conversation

gilangbh
Copy link
Contributor

@gilangbh gilangbh commented Dec 8, 2023

Milestone Delivery Checklist

  • The milestone-delivery-template.md has been copied and updated.
  • This pull request is being made by the same account as the accepted application.
  • I have disclosed any and all sources of reused code in the submitted repositories and have done my due diligence to meet its license requirements.
  • In case of acceptance, an invoice must be submitted and the payment will be transferred to the Polkadot/fiat account provided in the application.
  • The delivery is according to the Guidelines for Milestone Deliverables.

Link to the application pull request: w3f/Grants-Program#1795 < please fill this in with the PR number of your application.

@semuelle semuelle self-assigned this Dec 20, 2023
@semuelle
Copy link
Member

Hey @gilangbh. Thanks for the delivery, but both the documentation doc and testing guide seem empty. Could you have a look?

@agustinustheo
Copy link
Contributor

Reference in

I'll have a look, give me a minute.

@agustinustheo
Copy link
Contributor

Hey @gilangbh. Thanks for the delivery, but both the documentation doc and testing guide seem empty. Could you have a look?

Hey @semuelle, apologies for the inconvenience. We've resolved the issue. The docs are online now.

@semuelle
Copy link
Member

@gilangbh, could you send some MYRIAr to 5DyWMh8kskJeHTTYsU4aWeqoNdtpMidikk4kBeGmhooqkP81 for testing?

@gilangbh
Copy link
Contributor Author

@gilangbh, could you send some MYRIAr to 5DyWMh8kskJeHTTYsU4aWeqoNdtpMidikk4kBeGmhooqkP81 for testing?

@agustinustheo will send you some soon

@agustinustheo
Copy link
Contributor

5DyWMh8kskJeHTTYsU4aWeqoNdtpMidikk4kBeGmhooqkP81

Hey @semuelle happy new year.

I've sent you 100,000 MYRIA.

image

Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tokens, @agustinustheo & @gilangbh. I was able to test everything on the testnet, including the tipping feature. I just have one request: according to deliverable 0c in the grant agreement, "Core functions will be fully covered by comprehensive unit tests to ensure functionality and robustness. In the guide, we will describe how to run these tests." Can you point me to these tests and how to run them?

@agustinustheo
Copy link
Contributor

Thanks for the tokens, @agustinustheo & @gilangbh. I was able to test everything on the testnet, including the tipping feature. I just have one request: according to deliverable 0c in the grant agreement, "Core functions will be fully covered by comprehensive unit tests to ensure functionality and robustness. In the guide, we will describe how to run these tests." Can you point me to these tests and how to run them?

Hi @semuelle we've added tests to the core functions of the app. Since the Myriad UI directly connects to the blockchain for all the features mentioned above, you can run the tests by running the tests here: https://github.com/myriadsocial/myriad-node-parachain?tab=readme-ov-file#guide-to-testing-the-project-using-docker

All the features mentioned in the current milestone are tested, and it's all covered here: https://github.com/myriadsocial/myriad-node-parachain/blob/main/pallets/tipping/src/tests.rs

We directly test the blockchain pallet instead of the Myriad UI, since testing the frontend application will be tedious because a slight change will result in the breaking of the test thus making it useless for us. So the scope of our testing is done on the blockchain.

I've updated the Milestone 2 testing guide to include a section about the automated unit tests: https://github.com/myriadsocial/myriad-web/blob/main/docs/milestone-2-testing-guide.md#automated-tests

@semuelle
Copy link
Member

@agustinustheo, thanks for the update. Unfortunately, both docker build -t substrate-test . and cargo test on the parachain and tipping pallet result in the same compilation error:

error[E0603]: enum `DispatchError` is private
  --> pallets/tipping/src/tests.rs:2:55
   |
2  | use frame_support::{assert_noop, assert_ok, dispatch::DispatchError};
   |                                                       ^^^^^^^^^^^^^ private enum
   |

Could you verify that the current version compiles on your end and let me know what toolchain and Rust versions you are using?

@agustinustheo
Copy link
Contributor

@agustinustheo, thanks for the update. Unfortunately, both docker build -t substrate-test . and cargo test on the parachain and tipping pallet result in the same compilation error:

error[E0603]: enum `DispatchError` is private
  --> pallets/tipping/src/tests.rs:2:55
   |
2  | use frame_support::{assert_noop, assert_ok, dispatch::DispatchError};
   |                                                       ^^^^^^^^^^^^^ private enum
   |

Could you verify that the current version compiles on your end and let me know what toolchain and Rust versions you are using?

Okay, let me check.

@agustinustheo
Copy link
Contributor

@agustinustheo, thanks for the update. Unfortunately, both docker build -t substrate-test . and cargo test on the parachain and tipping pallet result in the same compilation error:

error[E0603]: enum `DispatchError` is private
  --> pallets/tipping/src/tests.rs:2:55
   |
2  | use frame_support::{assert_noop, assert_ok, dispatch::DispatchError};
   |                                                       ^^^^^^^^^^^^^ private enum
   |

Could you verify that the current version compiles on your end and let me know what toolchain and Rust versions you are using?

Hi @semuelle apologies it took a while, I updated a couple of things so the tests can run in the most recent nightly version 1.77.0-nightly. Here is the commit where I did that you can see the changes there.

I've run the tests again, and here are the results:

cargo test in the root directory result:

    Finished test [unoptimized + debuginfo] target(s) in 3m 19s
     Running unittests src/main.rs (target/debug/deps/myriad-cff53edd154b7de1)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/myriad_runtime-21a1ec4217bdd1ff)

running 5 tests
test weights::block_weights::constants::test_weights::sane ... ok
test weights::paritydb_weights::constants::test_db_weights::sane ... ok
test weights::rocksdb_weights::constants::test_db_weights::sane ... ok
test weights::extrinsic_weights::constants::test_weights::sane ... ok
test __construct_runtime_integrity_test::runtime_integrity_tests ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

     Running unittests src/lib.rs (target/debug/deps/pallet_access_token-bd669c1c6a0d417b)

running 2 tests
test mock::__construct_runtime_integrity_test::runtime_integrity_tests ... ok
test tests::create_works ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.73s

     Running unittests src/lib.rs (target/debug/deps/pallet_server-5919515a86111eb5)

running 23 tests
test mock::__construct_runtime_integrity_test::runtime_integrity_tests ... ok
test tests::cant_cancel_deregister_when_server_id_not_exists ... ok
test tests::cant_deregister_when_max_scheduled_per_block_over_limit ... ok
test tests::cant_change_api_url_when_server_id_not_exist ... ok
test tests::cant_cancel_deregister_when_not_unstaked ... ok
test tests::cant_change_api_url_when_not_owner ... ok
test tests::cant_cancel_deregister_when_unauthorized ... ok
test tests::cancel_deregister_works ... ok
test tests::cant_change_api_url_when_api_url_exist ... ok
test tests::cant_increase_stake_amount_when_server_id_not_exist ... ok
test tests::cant_deregister_when_server_id_not_exist ... ok
test tests::cant_increase_stake_amount_when_not_owner ... ok
test tests::cant_deregister_when_not_owner ... ok
test tests::cant_transfer_owner_when_server_id_not_exist ... ok
test tests::cant_register_when_api_url_exist ... ok
test tests::cant_update_server_where_already_deregister ... ok
test tests::cant_transfer_owner_when_not_owner ... ok
test tests::change_api_url_works ... ok
test tests::decrease_stake_amount_works ... ok
test tests::deregister_works ... ok
test tests::increase_stake_amount_works ... ok
test tests::register_works ... ok
test tests::transfer_owner_works ... ok

test result: ok. 23 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.73s

     Running unittests src/lib.rs (target/debug/deps/pallet_tipping-280ce08ee48d22dc)

running 12 tests
test mock::__construct_runtime_integrity_test::runtime_integrity_tests ... ok
Jan 15 11:46:03.363 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
test tests::pay_content_to_escrow_works ... ok
Jan 15 11:46:03.582 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
test tests::pay_content_with_myria_works ... ok
test tests::cant_pay_content_when_insufficient_balance ... ok
test tests::send_tip_assets_works ... ok
Jan 15 11:46:03.715 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
test tests::pay_content_with_assets_works ... ok
test tests::claim_reference_works ... ok
test tests::send_tip_myria_works ... ok
test tests::claim_tip_works ... ok
Jan 15 11:46:06.817 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
Jan 15 11:46:06.822 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
Jan 15 11:46:06.944 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
Jan 15 11:46:06.949 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
test tests::withdrawal_reward_works ... ok
test tests::withdrawal_fee_works ... ok
test tests::cant_claim_reference ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.64s

   Doc-tests myriad-runtime

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests pallet-access-token

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests pallet-server

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests pallet-tipping

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

docker build -t substrate test . result:

[+] Building 4619.2s (28/28) FINISHED                                                                    docker:default
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 555B                                                                                  0.0s
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 1.12kB                                                                             0.0s
 => [internal] load metadata for docker.io/paritytech/ci-linux:61d4fd50-20230713                                   2.4s
 => [chef 1/9] FROM docker.io/paritytech/ci-linux:61d4fd50-20230713@sha256:dc9abf9e877c5bad94828245406dac8a186530  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 3.56kB                                                                                0.0s
 => CACHED [chef 2/9] RUN rustup toolchain list | xargs rustup toolchain uninstall                                 0.0s
 => CACHED [chef 3/9] RUN rustup install nightly                                                                   0.0s
 => CACHED [chef 4/9] RUN rustup install stable                                                                    0.0s
 => CACHED [chef 5/9] RUN rustup target add wasm32-unknown-unknown                                                 0.0s
 => CACHED [chef 6/9] RUN rustup target add wasm32-unknown-unknown --toolchain nightly                             0.0s
 => CACHED [chef 7/9] RUN command -v wasm-gc || cargo +nightly install --git https://github.com/alexcrichton/wasm  0.0s
 => CACHED [chef 8/9] RUN cargo install cargo-chef --version 0.1.31                                                0.0s
 => CACHED [chef 9/9] WORKDIR /app                                                                                 0.0s
 => CACHED [planner 1/6] COPY ./node /app/node                                                                     0.0s
 => CACHED [planner 2/6] COPY ./pallets /app/pallets                                                               0.0s
 => CACHED [planner 3/6] COPY ./runtime /app/runtime                                                               0.0s
 => CACHED [planner 4/6] COPY ./Cargo.lock /app/Cargo.lock                                                         0.0s
 => CACHED [planner 5/6] COPY ./Cargo.toml /app/Cargo.toml                                                         0.0s
 => CACHED [planner 6/6] RUN cargo chef prepare --recipe-path recipe.json                                          0.0s
 => CACHED [builder 1/8] COPY --from=planner /app/recipe.json recipe.json                                          0.0s
 => [builder 2/8] RUN cargo chef cook --release --recipe-path recipe.json                                       2864.7s
 => [builder 3/8] COPY ./node /app/node                                                                            0.1s
 => [builder 4/8] COPY ./pallets /app/pallets                                                                      0.1s
 => [builder 5/8] COPY ./runtime /app/runtime                                                                      0.1s
 => [builder 6/8] COPY ./Cargo.lock /app/Cargo.lock                                                                0.1s
 => [builder 7/8] COPY ./Cargo.toml /app/Cargo.toml                                                                0.1s
 => [builder 8/8] RUN cargo test                                                                                1535.4s
 => exporting to image                                                                                           214.9s
 => => exporting layers                                                                                          214.9s
 => => writing image sha256:78a8e28178205961522829337ca43fc2c908a40ebb04033fcd396af338307762                       0.0s
 => => naming to docker.io/library/substrate-test

Please review again at your latest convinience!

Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, @agustinustheo. I can confirm that compilation and the tests are working now. Your milestone is hereby accepted. I would suggest to clean up the code a bit, as cargo shows a lot of warnings still. See my evaluation notes here.

@semuelle semuelle merged commit cebd475 into w3f:master Jan 15, 2024
3 checks passed
Copy link

🪙 Please fill out the invoice form in order to initiate the payment process. Thank you!

@agustinustheo
Copy link
Contributor

Thanks for the update, @agustinustheo. I can confirm that compilation and the tests are working now. Your milestone is hereby accepted. I would suggest to clean up the code a bit, as cargo shows a lot of warnings still. See my evaluation notes here.

Thank you @semuelle !

@semuelle
Copy link
Member

Hey @gilangbh & @agustinustheo, the payment address on your invoice doesn't match the one in the grant agreement. Could you update either one to match the other?

@gilangbh
Copy link
Contributor Author

gilangbh commented Jan 19, 2024 via email

@RouvenP
Copy link

RouvenP commented Feb 2, 2024

hi @gilangbh we sent the payment today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants