Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

lastSelectedRound in /redistributionstate API is misleading for unstaked nodes

Aperta
#5,333 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
api

Direzione di ricerca

Start with pkg/storageincentives/agent.go around the IsPlaying() check and SetLastSelectedRound, then inspect openapi/SwarmCommon.yaml for the four round-tracking fields. Determine whether the API should describe participation or track neighborhood selection separately, and check whether the contract exposes that distinction. Done means the field behavior or naming is accurate and the OpenAPI fields explain their meanings and population conditions.

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

Descrizione

accepted needs-discussion seen

Summary

The lastSelectedRound field in the /redistributionstate API endpoint is misleading. It implies "the last round in which the node's neighborhood was selected," but it actually means "the last round in which the node was both selected AND staked." For unstaked nodes, this field is always 0 regardless of whether their neighborhood was selected.

Problem

The field is set in pkg/storageincentives/agent.go at line 410, after the IsPlaying() check at line 401:

isPlaying, err := a.contract.IsPlaying(ctx, committedDepth)
if !isPlaying {
    return false, nil  // exits before SetLastSelectedRound
}
a.state.SetLastSelectedRound(round + 1)  // only reached if staked + selected

IsPlaying() calls the smart contract's isParticipatingInUpcomingRound, which bundles neighborhood selection and stake verification into a single boolean. When a node is not staked, IsPlaying returns false and SetLastSelectedRound is never called.

This means an unstaked operator seeing lastSelectedRound: 0 cannot distinguish between:

  • "My neighborhood was never selected" (bad location)
  • "My neighborhood was selected but I'm not staked" (worth staking)

This could lead operators to incorrectly conclude their neighborhood is inactive.

Additionally

None of the four round-tracking fields (lastWonRound, lastPlayedRound, lastFrozenRound, lastSelectedRound) have any description in the OpenAPI spec (openapi/SwarmCommon.yaml). They are listed only as type: integer with no explanation of their meaning or the conditions under which they are populated.

Suggested Fix

Either:

  1. Rename lastSelectedRound to lastParticipatingRound or lastEligibleRound to accurately reflect that it requires both selection and stake.
  2. Or add a separate field (e.g., lastNeighborhoodSelectedRound) that tracks neighborhood selection independently of stake status, if the contract supports it.
  3. Add descriptions to all four fields in the OpenAPI spec explaining what each field means and when it gets populated.
Lingua principale
Go
Stelle
1.5k
Fork
390
Merge medio
2g 23h
PR unite (30g)
24

Preparare l'ambiente

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.

Altre issue di ethersphere/bee

Tutte le issue di ethersphere/bee

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.