-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Bridge test env #17941
Bridge test env #17941
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm!
scenario.next_tx(@0xAAAA); | ||
let mut bridge = scenario.take_shared<Bridge>(); | ||
bridge.send_token(target_chain_id, eth_address, coin, scenario.ctx()); | ||
test_scenario::return_shared(bridge); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can check a few things here:
- assert the burn happened
- token_transfer_records has a new entry with correct metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
scenario.next_tx(sender); | ||
let mut bridge = scenario.take_shared<Bridge>(); | ||
bridge.register_foreign_token<T>(treasury_cap, upgrade_cap, &metadata); | ||
test_scenario::return_shared(bridge); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check waiting_room and treasuries have proper changes here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// scenario.end(); | ||
// } | ||
#[test] | ||
fun test_register_foreign_token() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
do we have a test case for
coin::total_supply(&tc) != 0
?
https://github.com/MystenLabs/sui/blob/main/crates/sui-framework/packages/bridge/sources/treasury.move#L103 -
do we have some test cases for
add_new_token
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_register_foreign_token_non_zero_supply
add_default_tokens
to set up the default token does that for the happy path every time you set up the bridge andtest_add_token_price_zero_value
,test_add_token_malformed_1
,test_add_token_malformed_2
,test_add_token_malformed_3
andtest_add_native_token_nop
test the not so happy path
83cb9b3
to
bb1c5da
Compare
thanks @longbowlu for the review and added the |
bb1c5da
to
8efb2cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
8efb2cf
to
3517eb3
Compare
## Description Increase test coverage and create a test environment for the bridge that should make it easier to test. At this point once we have API to sign messages we can reach 100% coverage. All missing tests are related to signature generation, function depending on that, or versioning. API to sign messages and create pub/priv keys are coming that would allow us to create a great testing environment and experience. Current coverage is as follows ``` +-------------------------+ | Move Coverage Summary | +-------------------------+ Module 000000000000000000000000000000000000000000000000000000000000000b::treasury >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::message_types >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::chain_ids >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::message >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::limiter >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::crypto >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::committee >>> % Module coverage: 100.00 Module 000000000000000000000000000000000000000000000000000000000000000b::bridge >>> % Module coverage: 51.21 +-------------------------+ | % Move Coverage: 82.32 | +-------------------------+ ``` The test environment needs more work but it will come in time. For now this work was mostly to reach a good test coverage. It's important to check this in for 2 main reasons: it increases test coverage significantly and allows others to work on it and improve it. ## Test plan This is it --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
Description
Increase test coverage and create a test environment for the bridge that should make it easier to test.
At this point once we have API to sign messages we can reach 100% coverage. All missing tests are related to signature generation, function depending on that, or versioning. API to sign messages and create pub/priv keys are coming that would allow us to create a great testing environment and experience.
Current coverage is as follows
The test environment needs more work but it will come in time. For now this work was mostly to reach a good test coverage.
It's important to check this in for 2 main reasons: it increases test coverage significantly and allows others to work on it and improve it.
Test plan
This is it
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.