livepeer / livepeer/livepeer-python-gateway

Enable on-chain payments for single-shot streaming (SSE) sessions

Aperta
#42 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Python
Stelle
1
Fork
7
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## What

Wire the session payment streamer (livepeer/livepeer-python-gateway#30 / livepeer/livepeer-python-gateway#31) onto the single-shot streaming path so a **held-open SSE** single-shot call keeps paying for the duration of the stream, not just an upfront 402.

The pieces exist but aren't connected for single-shot:

* `call_runner(stream=True)` → `LiveRunnerCallStream` gives an open, non-blocking stream + **one upfront** 402 payment (livepeer/livepeer-python-gateway#26 / livepeer/livepeer-python-gateway#25).
* `run_session_payments` / `start_payments()` (livepeer/livepeer-python-gateway#30 / livepeer/livepeer-python-gateway#31) is the interval payment loop, but it's scoped to the `reserve_session` **/** `LiveRunnerSession` flow.

Single-shot has no `reserve_session`, so the loop must be drivable off the call's challenge/stream.

## Scope

* Drive the payment streamer off `call_runner`'s 402 challenge / `LiveRunnerCallStream` (session id = `manifest_id`), **not** a reserved `LiveRunnerSession`.
* POST to the **session-scoped** endpoint `…/apps/{runner}/session/{id}/payment` (fix the current `{origin}/payment` target in `send_payment`).
* Run the loop as a **background** `asyncio` **task** started after `call_runner(stream=True)` opens the stream; drain the stream concurrently (the `async for` yields so the loop ticks).
* Drive cadence from the challenge's `payment_interval` (requires go-livepeer to surface it in the 402 challenge).
* End-to-end **paid-SSE test**: 402 → open stream → concurrent interval payments → stream completes past the upfront amount.

## Depends on / relates to

* livepeer/livepeer-python-gateway#26 (SSE streaming read) — livepeer/livepeer-python-gateway#25
* livepeer/livepeer-python-gateway#30 (session payment streamer) — livepeer/livepeer-python-gateway#31 (needs to be drivable off a challenge + session-scoped URL)
* go-livepeer [#3955]() single-shot on-chain billing (PR [#3975]()), with the `ModifyResponse` headers removed and `payment_interval` added to the 402 challenge

Part of the **Live Runner: Single-Shot Pipelines** project.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia leggendo call_runner(stream=True) e LiveRunnerCallStream, poi confronta run_session_payments/start_payments nel flusso di reserved-session. Traccia i campi della challenge 402 e l’endpoint send_payment, quindi esegui i test SSE e di pagamento esistenti prima di aggiungere il caso end-to-end di SSE a pagamento. Il lavoro è completo quando uno stream single-shot riceve pagamenti concorrenti a intervalli con la cadenza della challenge e termina oltre l’importo anticipato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, backend, payments
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.