Skip to content

fix: passing in user call info from wallet#21937

Merged
Thunkar merged 9 commits into
merge-train/fairiesfrom
be/refactor-user-call-offset-v2
Apr 10, 2026
Merged

fix: passing in user call info from wallet#21937
Thunkar merged 9 commits into
merge-train/fairiesfrom
be/refactor-user-call-offset-v2

Conversation

@benesjan

@benesjan benesjan commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Robustly handles selection of return value when simulating private function by passing in the information of which call corresponds to the return value "user intends to get" from the wallet.

I am not super sure this is the best way to go because it seems messy that we have that info bolted on TxSimulationResult when TxSimulationResult is more of a lower-level thing that doesn't care about what is a user call and what is a fee call. If we don't do it like that then this PR would need to become much bigger as we need to somehow forward that information.

Happy to redo this if we come up with a better approach.

Closes https://linear.app/aztec-labs/issue/F-483/handle-simulation-with-nested-calls-and-without-account-contract

@benesjan benesjan marked this pull request as draft March 24, 2026 13:21
@benesjan benesjan force-pushed the be/refactor-user-call-offset-v2 branch from 7ce723f to e122c43 Compare March 24, 2026 13:28

benesjan commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan force-pushed the be/refactor-user-call-offset-v2 branch from e122c43 to da82dbb Compare March 24, 2026 13:53
@benesjan benesjan marked this pull request as ready for review March 24, 2026 13:56
@benesjan benesjan force-pushed the be/refactor-user-call-offset-v2 branch from da82dbb to 914e6ae Compare March 25, 2026 02:59
@benesjan benesjan changed the title refactor: decouple userCallOffset from TxExecutionRequest creation fix: passing in user call info from wallet Mar 25, 2026
@benesjan benesjan requested a review from Thunkar March 25, 2026 04:14
Comment thread yarn-project/aztec.js/src/contract/batch_call.test.ts Outdated
@benesjan benesjan marked this pull request as draft March 25, 2026 05:21
@benesjan benesjan force-pushed the be/refactor-user-call-offset-v2 branch from bfdd6d6 to 4a099a6 Compare March 25, 2026 06:49
@benesjan benesjan marked this pull request as ready for review March 25, 2026 07:02
Comment thread yarn-project/wallet-sdk/src/base-wallet/base_wallet.ts Outdated
Comment thread yarn-project/wallet-sdk/src/base-wallet/utils.ts
Comment thread yarn-project/stdlib/src/tx/simulated_tx.ts Outdated
Comment thread yarn-project/stdlib/src/tx/simulated_tx.ts Outdated
@benesjan benesjan marked this pull request as draft March 25, 2026 08:18
@benesjan benesjan force-pushed the be/refactor-user-call-offset-v2 branch from 6040aa9 to 23d0f75 Compare March 25, 2026 13:39
@benesjan benesjan marked this pull request as ready for review March 25, 2026 15:01
@benesjan benesjan requested a review from Thunkar March 25, 2026 15:29
Base automatically changed from merge-train/fairies to next March 26, 2026 04:08
Comment thread yarn-project/aztec.js/src/wallet/tx_simulation_result_with_app_offset.ts Outdated
benesjan and others added 6 commits March 27, 2026 15:05
Adds `getUserPrivateReturnValues(callIndex)` to `TxSimulationResult`
so callers no longer need to branch on `userCallOffset` being defined
or not. Also moves the offset calculation into
`createTxExecutionRequestFromPayloadAndFee` so it returns
`{ txRequest, userCallOffset }` instead of `{ txRequest, feeCallCount }`,
removing the leaky abstraction.

Closes F-483

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@benesjan benesjan changed the base branch from next to merge-train/fairies March 27, 2026 15:08
@benesjan benesjan marked this pull request as draft March 27, 2026 15:08
@benesjan benesjan force-pushed the be/refactor-user-call-offset-v2 branch from 799fc41 to 3f5ec7f Compare March 27, 2026 15:08
Base automatically changed from merge-train/fairies to next March 27, 2026 15:50
@nventuro nventuro requested a review from Thunkar March 31, 2026 19:51
@Thunkar Thunkar changed the base branch from next to merge-train/fairies April 10, 2026 05:52
@Thunkar Thunkar self-assigned this Apr 10, 2026
@Thunkar Thunkar marked this pull request as ready for review April 10, 2026 07:23

@benesjan benesjan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Thunkar Nice approach 👍

I cannot approve this since this is my PR so feel free to approve and merge.

@Thunkar Thunkar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

obama giving himself a medal meme

@Thunkar Thunkar merged commit a186a55 into merge-train/fairies Apr 10, 2026
13 checks passed
@Thunkar Thunkar deleted the be/refactor-user-call-offset-v2 branch April 10, 2026 09:24
@AztecBot

Copy link
Copy Markdown
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

AztecBot pushed a commit that referenced this pull request Apr 10, 2026
Cherry-pick of a186a55 with conflict markers preserved.
github-merge-queue Bot pushed a commit that referenced this pull request Apr 10, 2026
BEGIN_COMMIT_OVERRIDE
fix: passing in user call info from wallet (#21937)
feat: add RPC endpoints to manipulate time (#22084)
END_COMMIT_OVERRIDE
Thunkar added a commit that referenced this pull request Apr 10, 2026
## Summary
Backport of #21937
to v4-next.

Robustly handles selection of return value when simulating private
function by passing in the information of which call corresponds to the
return value "user intends to get" from the wallet via
`TxSimulationResultWithAppOffset`.

## Cherry-pick conflicts resolved
- `batch_call.ts`: Removed stale `TxSimulationResult` import, used
`TxSimulationResultWithAppOffset`, added non-null assertions for the
now-optional `simulatedTx` variable
- `batch_call.test.ts`: Added `NestedProcessReturnValues` import (needed
by test), removed unused `HashedValues`

## Commit structure
1. Cherry-pick with conflict markers preserved
2. Conflict resolution
3. Build fix (non-null assertions)

Original PR by @benesjan.

ClaudeBox log: https://claudebox.work/s/c28e647e71336658?run=2
Thunkar added a commit that referenced this pull request Apr 10, 2026
BEGIN_COMMIT_OVERRIDE
cherry-pick: fix: passing in user call info from wallet (#21937)
fix: passing in user call info from wallet (backport #21937) (#22459)
fix: prepopulated scopes in simulateviaentrypoint (#22464)
chore: backport #22464 (fix: prepopulated scopes in
simulateviaentrypoint) to v4-next (#22470)
docs: add macOS prerequisites and improve Node.js version guidance
(#22408)
END_COMMIT_OVERRIDE
critesjosh pushed a commit that referenced this pull request Apr 14, 2026
Robustly handles selection of return value when simulating private
function by passing in the information of which call corresponds to the
return value "user intends to get" from the wallet.

I am not super sure this is the best way to go because it seems messy
that we have that info bolted on `TxSimulationResult` when
`TxSimulationResult` is more of a lower-level thing that doesn't care
about what is a user call and what is a fee call. If we don't do it like
that then this PR would need to become much bigger as we need to somehow
forward that information.

Happy to redo this if we come up with a better approach.

Closes
https://linear.app/aztec-labs/issue/F-483/handle-simulation-with-nested-calls-and-without-account-contract

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: thunkar <gregojquiros@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants