Skip to content

Conversation

0x1NotMe
Copy link
Contributor

Summary

  • Escrow: append underlying app revert payload to Atlas error selectors for PreOps/UserOp/AllocateValue failures, sim and non-sim.
  • ExecutionEnvironment: include DApp revert payload after its Atlas error selectors for delegatecall/call failures and balanceOf helper; enables nested bubbling.
  • Atlas._handleErrors: revert with full payload for these selectors (sim + non-sim) so appended app data bubbles while the first 4 bytes stay the Atlas selector.
  • Test: AtlasErrorBubble.t.sol asserts payload layout on preOps failure.

Rationale

  • Minimal invasive change: keeps existing selectors and decoding behavior; adds app context to the tail of revert data.
  • Simulator/clients still match on first 4 bytes; advanced consumers can parse the rest for app-level context.

Notes

  • Base: atlas-v1.6.3
  • Branch: feat/atlas-bubble-app-errors
  • Build/tests: forge build; forge test; new test passes.

…ving 4-byte selector

- Escrow: append app revert to PreOpsFail/SimFail, UserOpFail/SimFail, AllocateValueFail/SimFail
- Atlas._handleErrors: forward full revert payload for these errors (sim + non-sim)
- First 4 bytes remain Atlas error selector to preserve decoding semantics
…or selectors for delegatecall/call failures and helper balanceOf errors
@0x1NotMe 0x1NotMe requested a review from BenSparksCode August 20, 2025 00:58
@0x1NotMe 0x1NotMe requested a review from thogard785 August 20, 2025 01:14
assembly {
mstore(0, _errorSwitch)
revert(0, 4)
revert(add(revertData, 32), mload(revertData))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI these changes push Atlas over the contract size limit by about 185 bytes. If we go with these changes we will need to lower optimizer_runs to get it back under.

But also try to cut down contract size in the modified areas if possible. There might be a Solady lib function that could do this, not sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there's this helper. We should probably use it once we've build the bytes revertData in each case we want to bubble up

https://github.com/Vectorized/solady/blob/main/src/utils/LibCall.sol#L201

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this would actually reduce contract size but I can add the fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

183 bytes without Solady and 209 bytes over the limit using LibCall.bubbleUpRevert

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof okay. Was hoping it would reduce code duplication.

0x1NotMe pushed a commit that referenced this pull request Aug 25, 2025
- Replace confusing variable names (_err2 -> _err, _ret -> _returnData) in ExecutionEnvironment.sol
- Update test naming convention to follow project standards (test_ErrorHandling_*)
- Replace try-catch pattern with low-level call pattern in tests for cleaner code
- Remove console.log statements from tests
- Add comprehensive test coverage for all error bubbling scenarios:
  - PreOps failures
  - UserOp delegatecall and regular call failures
  - AllocateValue failures
  - PreSolver and PostSolver failures
  - Security test for malicious solver error spoofing
- Fix test configuration to include proper gas limits for all UserOperations

These changes address all feedback from PR #500 while maintaining the core functionality
of preserving Atlas error selectors with appended DApp error data.

Co-Authored-By: BenSparksCode <noreply@github.com>
@0x1NotMe 0x1NotMe force-pushed the feat/atlas-bubble-app-errors branch from 0a1429d to b06c22b Compare August 25, 2025 03:40
Copy link
Contributor

@BenSparksCode BenSparksCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even after setting optimizer runs to the lowest (1), Atlas is still 55 bytes over the limit, so I don't think we can merge this change in - no way we can deploy it on most EVM chains without refactoring, or the contract size limit EIP upgrade

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.

2 participants