Summary
Currently, StateTree::for_each_cacheless in src/shim/state_tree.rs falls back to the caching for_each for FvmV2 and FvmV3 variants, because those upstream crates do not yet expose a cacheless iteration API. Only FvmV4 has a native for_each_cacheless.
Required Changes
- Contribute
for_each_cacheless upstream to the fvm2 and fvm3 crates (or, if upstream is not feasible, implement a workaround in the shim layer that avoids caching HAMT nodes during iteration).
- Once available, update
StateTree::for_each_cacheless in src/shim/state_tree.rs to call the native cacheless method for FvmV2 and FvmV3 variants instead of falling back to for_each.
Affected Files
src/shim/state_tree.rs — StateTree::for_each_cacheless implementation for FvmV2 and FvmV3 arms.
Context
Acceptance Criteria
StateTree::for_each_cacheless for FvmV2 and FvmV3 no longer caches HAMT nodes during iteration.
- Memory usage during state-tree iteration on older network versions is comparable to
FvmV4.
Summary
Currently,
StateTree::for_each_cachelessinsrc/shim/state_tree.rsfalls back to the cachingfor_eachforFvmV2andFvmV3variants, because those upstream crates do not yet expose a cacheless iteration API. OnlyFvmV4has a nativefor_each_cacheless.Required Changes
for_each_cachelessupstream to thefvm2andfvm3crates (or, if upstream is not feasible, implement a workaround in the shim layer that avoids caching HAMT nodes during iteration).StateTree::for_each_cachelessinsrc/shim/state_tree.rsto call the native cacheless method forFvmV2andFvmV3variants instead of falling back tofor_each.Affected Files
src/shim/state_tree.rs—StateTree::for_each_cachelessimplementation forFvmV2andFvmV3arms.Context
StateTree::for_each_cachelessoverStateTree::for_each#7237StateTree::for_each_cachelessoverStateTree::for_each#7237 (comment)Acceptance Criteria
StateTree::for_each_cachelessforFvmV2andFvmV3no longer caches HAMT nodes during iteration.FvmV4.