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

Contracts: Refactor test builder #4158

Merged
merged 11 commits into from
Apr 17, 2024
Merged

Contracts: Refactor test builder #4158

merged 11 commits into from
Apr 17, 2024

Conversation

pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Apr 16, 2024

  • Moved substrate/frame/contracts/src/tests/builder.rs into a pub test_utils module, so we can use that in the pallet-contracts-mock-network tests
  • Refactor xcm tests to use XCM builders, and simplify the use case for xcm-send

@pgherveou pgherveou requested a review from athei as a code owner April 16, 2024 12:27
@pgherveou pgherveou added R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts. labels Apr 16, 2024
@pgherveou pgherveou enabled auto-merge April 16, 2024 13:34
@pgherveou pgherveou requested a review from xermicus April 16, 2024 15:41
Comment on lines +78 to +81
let message: Xcm<()> = Xcm::builder_unsafe()
.withdraw_asset(assets.clone())
.deposit_asset(assets, beneficiary)
.build();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@franciscoaguirre I have refactored my contracts XCM tests to use the new builders.
I am executing an XCM locally here, so I don't really need to buy_execution, is there a better choice than builder_unsafe here?

substrate/frame/contracts/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/contracts/src/test_utils.rs Show resolved Hide resolved
Copy link
Member

@xermicus xermicus left a comment

Choose a reason for hiding this comment

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

LGTM

@pgherveou pgherveou added this pull request to the merge queue Apr 17, 2024
Merged via the queue into master with commit aa78fe2 Apr 17, 2024
134 of 137 checks passed
@pgherveou pgherveou deleted the pg/refactor_builder branch April 17, 2024 17:35
sandreim pushed a commit that referenced this pull request Apr 18, 2024
- Moved `substrate/frame/contracts/src/tests/builder.rs` into a pub
test_utils module, so we can use that in the
`pallet-contracts-mock-network` tests
- Refactor xcm tests to use XCM builders, and simplify the use case for
xcm-send
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants