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

Split concern for pool benchmark helper #1645

Merged
merged 3 commits into from
Dec 11, 2023
Merged

Conversation

lemunozm
Copy link
Contributor

Description

The previous PoolBenchmarkHelper utility made use of investment utilities. This forces you to track investment bounds through the code, which is ok for parts that will end to use investments, but for cases where you only want to create a pool, it is boilerplate and annoying to use, carrying information out of the problem scope. This PR splits the current trait into 2 depending on the usage you require.

Changes and Descriptions

  • Renamed PoolBenchmarkHelper to FundedPoolBenchmarkHelper, for creating funded pools.
  • New PoolBenchmarkHelper for only creating just pools.

Required for OracleV2. #1629

@lemunozm lemunozm added Q1-easy Can be done by primarily duplicating and adapting code. P7-asap Issue should be addressed in the next days. I6-refactoring Code needs refactoring. labels Dec 11, 2023
@lemunozm lemunozm self-assigned this Dec 11, 2023
Comment on lines -67 to -82

pub fn mock_bench_create_pool(f: impl Fn(T::PoolId, &T::AccountId) + 'static) {
register_call!(move |(a, b)| f(a, b));
}

pub fn mock_bench_investor_setup(
f: impl Fn(T::PoolId, T::AccountId, T::Balance) + 'static,
) {
register_call!(move |(a, b, c)| f(a, b, c));
}

pub fn mock_bench_default_investment_id(
f: impl Fn(T::PoolId) -> T::TrancheCurrency + 'static + 'static,
) {
register_call!(f);
}
Copy link
Contributor Author

@lemunozm lemunozm Dec 11, 2023

Choose a reason for hiding this comment

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

No longer needed if mock implementation for these is empty (which makes sense because you do not want to benchmark in testing)

cdamian
cdamian previously approved these changes Dec 11, 2023
wischli
wischli previously approved these changes Dec 11, 2023
Copy link
Contributor

@wischli wischli 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 untangling! LGTM

@lemunozm lemunozm enabled auto-merge (squash) December 11, 2023 09:39
mustermeiszer
mustermeiszer previously approved these changes Dec 11, 2023
@lemunozm
Copy link
Contributor Author

Can I have a re-approval?

@lemunozm
Copy link
Contributor Author

❤️

@lemunozm lemunozm merged commit 6d6cd79 into main Dec 11, 2023
9 checks passed
@lemunozm lemunozm deleted the pool-bench-utility-split branch December 11, 2023 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I6-refactoring Code needs refactoring. P7-asap Issue should be addressed in the next days. Q1-easy Can be done by primarily duplicating and adapting code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants