Skip to content

Conversation

@Budalebah
Copy link

Summary

Resolves the TODO on line 709 of IthacaAccount.sol regarding where to add keyHash stack push/pop operations after delegate call removal.

Analysis

After analyzing all execution paths in _execute(), determined that push/pop operations are only needed in paths 1 and 3:

  • Path 1 (Orchestrator workflow, lines 679-689): ✅ Already has push/pop
  • Path 2 (Self-call without opData, lines 692-696): ✅ Correctly does NOT need push/pop
  • Path 3 (Simple workflow with opData, lines 698-716): ✅ Already has push/pop

Why Path 2 Doesn't Need Push/Pop

Path 2 uses EOA key (keyHash = bytes32(0)) for admin self-calls:

  • Empty stack already returns bytes32(0) via getContextKeyHash()
  • Pushing bytes32(0) explicitly would be redundant
  • Saves gas on admin operations
  • Maintains correct context semantics

Changes

  1. Removed TODO and added clarifying comment explaining why path 2 doesn't need these operations
  2. Added test file (test/TODO_Resolution_Test.t.sol) demonstrating:
    • Behavior of getContextKeyHash() in all execution paths
    • Why path 2 correctly omits push/pop
    • That current implementation is correct

Testing

forge test --match-contract TODO_ResolutionTest -vv

Results:

  • ✅ 2/2 tests passing
  • ✅ All existing Account tests passing
  • ✅ No breaking changes

Related

Checklist

  • TODO resolved with documentation
  • Test added demonstrating correctness
  • All existing tests passing
  • No functional changes
  • Comments explain reasoning

Resolves TODO on line 709 of IthacaAccount.sol regarding
where to add keyHash stack push/pop operations after delegate
call removal.

Analysis shows that push/pop is only needed in execution
paths 1 and 3:
- Path 1 (Orchestrator workflow): Already has push/pop (lines 685-687)
- Path 3 (Simple workflow with opData): Already has push/pop (lines 710-712)

Path 2 (Simple workflow without opData) correctly does NOT need
push/pop because:
- Used for EOA key self-calls (keyHash = bytes32(0))
- Empty stack returns bytes32(0) via getContextKeyHash()
- Pushing bytes32(0) explicitly would be redundant

Added clarifying comment and test demonstrating correctness.

Test: test/TODO_Resolution_Test.t.sol
- Validates getContextKeyHash() behavior across paths
- Confirms path 2 behavior is correct without push/pop
- All existing tests still passing
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