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

payment failure cases inabox #1035

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

Conversation

hopeyen
Copy link
Contributor

@hopeyen hopeyen commented Dec 19, 2024

Why are these changes needed?

explicitly running out of funds for both payments (will rebase after merging #991, #1033, and #1034 , don't need to review yet)

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@hopeyen hopeyen force-pushed the hope/payments-v2-inabox branch from 1a5854f to ea6fe9b Compare December 20, 2024 03:20
Base automatically changed from hope/payments-v2-inabox to master December 20, 2024 03:37
@hopeyen hopeyen force-pushed the hope/payment-failure-inabox branch 4 times, most recently from 89c84de to d5ce40a Compare December 20, 2024 03:58
@hopeyen hopeyen requested a review from ian-shim December 20, 2024 05:56
@hopeyen hopeyen force-pushed the hope/payment-failure-inabox branch from aea2b8f to 9ee1757 Compare January 7, 2025 20:12
@@ -0,0 +1,94 @@
package integration_test
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if these tests could be moved to unit tests? like in accountant_test.go?
Also, should we also test payment failure cases from disperser server if there isn't already? (to cover the case that user isn't running accountatnt)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I made these tests for the interaction of disperser client and the server, and shows when a blob should be dispersed and when it should fail with respect to payments. I don't think they could be moved to unit test.
Disperser client would build accountant if it wasn't provided with one, so alternatively we could add rogue accountant implementations that makes invalid payment headers

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm I made these tests for the interaction of disperser client and the server

Is the server logic relevant in these tests? It looks like they mostly test the accountant logic (server could have the payment metering disabled and allowed all requests and these tests would still pass)

Disperser client would build accountant if it wasn't provided with one

Yes, but not all requests may originate from the disperser client shipped in this repo. Anyone is free to disperse blobs without running accountant, in which case, API server should enforce correct metering scheme. I was referring to payment failure cases from the API server payment metering, not from the accountant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the server logic relevant in these tests? It looks like they mostly test the accountant logic (server could have the payment metering disabled and allowed all requests and these tests would still pass)

Hmm I understood your concerns. I updated the tests to override the accountant with erroneous payment state so that accountant doesn't account correctly, and focus on testing failures from API server logic. (if payment is disabled, the tests should not pass as the expected failure would instead be nil)

not all requests may originate from the disperser client shipped in this repo. Anyone is free to disperse blobs without running accountant, in which case, API server should enforce correct metering scheme.

by this logic, should we have a set of tests that doesn't use DisperserClient? The existing tests all utilize NewDisperserClient to make API requests

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.

2 participants