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

feat: ✨ add batching to user charging #229

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TDemeco
Copy link
Contributor

@TDemeco TDemeco commented Oct 16, 2024

This PR adds batching to BSPs charging users' payment streams and updates the BSP charge fees task to use the new functionality.

Copy link
Contributor

@ffarall ffarall left a comment

Choose a reason for hiding this comment

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

Great job! Approved with one request for testing.

@@ -1270,6 +1270,136 @@ mod fixed_rate_streams {
});
}

#[test]
fn charge_multiple_users_payment_streams_works() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to see also a test cases for:

  1. Three users charged at once:
    1. Bob: one fixed rate payment stream.
    2. Charlie: one dynamic rate payment stream.
    3. Dave: one fixed and one dynamic rate payment stream.
  2. Three users charged at once, but (for whatever reason) the third user charged should fail. Here check that none of the users end up charged.

@@ -65,3 +65,6 @@ pub type UnitsProvidedFor<T> = <T as Config>::Units;
/// Syntactic sugar for the ProviderId type used in the proofs pallet.
pub type ProviderIdFor<T> =
<<T as crate::Config>::ProvidersPallet as ReadProvidersInterface>::ProviderId;

/// Syntatic sugar for the maximum amount of Users a Provider can charge in a batch.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Syntatic sugar for the maximum amount of Users a Provider can charge in a batch.
/// Syntactic sugar for the maximum amount of Users a Provider can charge in a batch.

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

Successfully merging this pull request may close these issues.

3 participants