Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

ProveReplicaUpdate messages fail when they include sectors from multiple deadlines #1577

Closed
Stebalien opened this issue Mar 2, 2022 · 0 comments
Assignees
Labels
bug Something isn't working change-behaviour Changes behaviour or state interpretation, necessitating a network version upgrade P1 High priority, required for basic network functionality and growth
Milestone

Comments

@Stebalien
Copy link
Member

The new actors version introduced in the OhSnap upgrade (network version 14) has a bug that prevents "batched" ProveReplicaUpdate messages from succeeding if these batches span multiple deadlines.

Impact

At the moment, no known Filecoin client proves multiple replica updates in a single message so this bug should not have any impact. Furthermore, "problematic" update batches will fail cleanly so this bug cannot be used to corrupt network state.

Details

  1. Specs-actors iterates over all "snap" declarations in
    for i, updateWithDetails := range declsByDeadline[dlIdx] {
    .
  2. It then inserts new sectors into a newSectors array in
    newSectors[i] = &newSectorInfo
    .

Unfortunately, the index (i) into the newSectors array is from the inner loop. If the message updates a sectors in a single deadline, everything will just "work". However, if a message updates sectors in multiple deadlines, subsequent iterations of the outer loop will overwrite sectors in the newSectors array instead of extending it.

Fortunately, any such message will fail cleanly when it hits

err = sectors.Store(newSectors...)
because:

  1. The newSectors array is pre-filled with nil.
  2. If multiple deadlines are updated in a single message, each deadline's sub-batch will be strictly smaller than the newSectors array. This means the final element in this array will always be nil.
  3. sectors.Store will return an error if any "sector info" in the passed array is nil.

Therefore, any message that attempts to prove replica updates update across multiple deadlines will fail cleanly when it attempts to "write back" the updated sectors.

@Stebalien Stebalien added bug Something isn't working P1 High priority, required for basic network functionality and growth change-behaviour Changes behaviour or state interpretation, necessitating a network version upgrade labels Mar 2, 2022
@Stebalien Stebalien added this to the Phase 1 milestone Mar 2, 2022
Repository owner moved this from In Progress to Done in Network v16 (Skyr) - FVM M1 Upgrade Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working change-behaviour Changes behaviour or state interpretation, necessitating a network version upgrade P1 High priority, required for basic network functionality and growth
Projects
No open projects
Development

No branches or pull requests

2 participants