MemoryStore should evict claims once their challenge expires

Aperta
#25 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
java

Direzione di ricerca

Esamina l’interfaccia Store e l’implementazione di MemoryStore, quindi segui TempoChargeIntent.matchTransferLogs e il relativo flusso di challenge verificato. Verifica come i memo delle transazioni possano associare un pagamento a un solo challenge prima di modificare la gestione dei claim. Il lavoro è completato quando i claim scaduti possono essere eliminati senza consentire attacchi di replay, mantenendo coerenti l’interfaccia e il flusso di pagamento.

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

Descrizione

Bind replay claims to challenge expiry. Ex. tryClaim(key, expiresAt).

Background

Store.tryClaim(key) (added in #24) retains transaction-hash claims forever. Every verified payment leaves a permanent entry, so any durable store grows without bound.

The typescript mppx SDK solved this by storing a marker that lapses at the challenge's expiry. One a challenge has expired, there's no reason to keep a cache entry for its associated transaction as it can no longer be claimed by an agent.

Using an expiry/TTL is safe in the typescript SDK because it cryptographically binds on-chain transaction memos to to a specific challenge. Therefore, a settled transaction can only satisfy exactly one challenge.

The mpp-java SDK has no such binding. TempoChargeIntent.matchTransferLogs compares only
currency, recipient, amount, and sender. Adding claim expiry would be a regression and make servers susceptible to replay attacks.

Proposed change

Implement memo binding between on-chain transactions and challenges. Then, once memo binding is in place, update the Store interface:

@FunctionalInterface
public interface Store {
    boolean tryClaim(String key);

    /** Claims {@code key} until {@code expiresAt}, after which the claim may be dropped. */
    default boolean tryClaim(String key, Instant expiresAt) {
        return tryClaim(key);
    }
}

TempoChargeIntent should pass the verified challenge's expires as expiresAt.

Why?

  • Prevents unbound growth in MemoryStore
  • Achieves parity with other SDKs
Lingua principale
Java
Stelle
7
Fork
8
Merge medio
18h 11m
PR unite (30g)
4

Guida per i contributori

Apri la guida per i contributori

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.

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.