Skip to content

fix(rt-data): handle singleton-array projection traversal#976

Closed
Stevengre wants to merge 2 commits intomasterfrom
codex/upstream/issue-021-singleton-array-projection
Closed

fix(rt-data): handle singleton-array projection traversal#976
Stevengre wants to merge 2 commits intomasterfrom
codex/upstream/issue-021-singleton-array-projection

Conversation

@Stevengre
Copy link
Contributor

@Stevengre Stevengre commented Mar 6, 2026

Summary

This adds singleton-array runtime projection support in rt/data.md and a minimal prove-rs reproducer for pointer-cast writes through *mut [u8; 1].

Context

The runtime already had type/projection plumbing for projectionElemSingletonArray, but write paths still had no #traverseProjection rule for that projection. When a pointer is cast to a singleton array pointer and then written through, execution reaches #traverseProjection(..., projectionElemSingletonArray ...) and stops.

Red vs Green

Red:

  • singleton-array-pointer-cast-fail.rs got stuck at #traverseProjection(..., projectionElemSingletonArray .ProjectionElems, .Contexts).
  • The same family shows up downstream in close_account_multisig through std::ptr::write_volatile::<[u8; 32]>.

Green:

  • #traverseProjection wraps the value in a singleton array context.
  • #buildUpdate unwraps that singleton array on the way back out.
  • #projectionsFor reconstructs the projection path correctly, so the reproducer now runs as the passing fixture singleton-array-pointer-cast.rs and reaches #EndProgram instead of stopping at projection traversal.

References

@Stevengre Stevengre force-pushed the codex/upstream/issue-021-singleton-array-projection branch from 6c2fa5b to 826b671 Compare March 16, 2026 13:32
@Stevengre
Copy link
Contributor Author

Closing: reproducer passes on current master without any rule changes. The consP cancellation rules already handle SingletonArray + ConstantIndex(0) during projection construction. For pre-built projection chains (like write_volatile), PR #988 covers the fix.

@Stevengre Stevengre closed this Mar 16, 2026
@Stevengre Stevengre reopened this Mar 17, 2026
@Stevengre Stevengre closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant