go-livepeer icon indicating copy to clipboard operation
go-livepeer copied to clipboard

fix(ai): prevent insufficient capacity payments

Open rickstaa opened this issue 1 year ago • 1 comments

[!WARNING] Depends on https://github.com/livepeer/ai-worker/pull/73 to be merged. Additionally the mod.go file should be updated to poitn to the right worker commit.

What does this pull request do? Explain your changes. (required)

This commit enhances the Orchestrator's capacity handling by returningan error prior to processing payments when capacity is insufficient. This prevents that the Gateway overpays for requests.

Specific updates (required)

  • A new CheckAICapacity was added to the core/orchestrator.go file.
  • The AI handleAIRequest method was changed so that the O first checks whether it can process a request before processing a payment.

How did you test each of these updates (required)

Does this pull request close any open issues?

https://linear.app/livepeer-ai-spe/issue/LIV-175/orchestrators-get-paid-for-unsuccessful-jobs

Checklist:

  • [x] Read the contribution guide
  • [x] make runs successfully
  • [ ] All tests in ./test.sh pass
  • [x] README and other documentation updated
  • [ ] Pending changelog updated

rickstaa avatar Apr 29 '24 12:04 rickstaa

@yondonfu, I've reviewed the payment workflow and it appears to be functioning as expected. Could you quickly confirm if you see any issues with this fix?

rickstaa avatar Apr 29 '24 19:04 rickstaa

@yondonfu, I've reviewed the payment workflow and it appears to be functioning as expected. Could you quickly confirm if you see any issues with this fix?

Looks reasonable!

yondonfu avatar May 02 '24 22:05 yondonfu