Skip to content

Encode dynamic tuple returns as a Solidity parameter list - #1625

Merged
sbillig merged 1 commit into
masterfrom
fix/tuple-return-abi-params
Sep 29, 2026
Merged

sbillig merged 1 commit into
masterfrom
fix/tuple-return-abi-params

Conversation

@cburgdorf

Copy link
Copy Markdown
Collaborator

A msg variant returning a tuple such as -> (DynString, Bytes32, Address) was encoded like abi.encode((string,bytes32,address)), with a leading offset word, and the JSON ABI reported a single tuple output. Solidity functions with multiple return values encode them as a parameter list with no outer offset word.

Add AbiSize::IS_PARAM_LIST (default false, true for tuples) and use it in a new encode_return_alloc helper for ContractHost::return_value, and in std::abi::sol::decode_output_at so typed calls, decode_returndata and CallOutcome::decode decode tuple returns the same way, mirroring how arguments are already decoded. JSON ABI emission lists one output per tuple element. Single dynamic returns keep the single-root layout, which matches Solidity returns (T); static tuples encode the same bytes as before.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T15:13:11.244276Z 85984e1 New commits
🔒 Security Review ✅ Completed 2026-09-29T15:15:30.941632Z 85984e1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cburgdorf
cburgdorf requested a review from sbillig September 29, 2026 14:42
A msg variant returning a tuple such as `-> (DynString, Bytes32, Address)`
was encoded like `abi.encode((string,bytes32,address))`, with a leading
offset word, and the JSON ABI reported a single `tuple` output. Solidity
functions with multiple return values encode them as a parameter list with
no outer offset word.

Add `AbiSize::IS_PARAM_LIST` (default false, true for tuples) and use it in
a new `encode_return_alloc` helper for `ContractHost::return_value`, and in
`std::abi::sol::decode_output_at` so typed calls, `decode_returndata` and
`CallOutcome::decode` decode tuple returns the same way, mirroring how
arguments are already decoded. JSON ABI emission lists one output per tuple
element. Single dynamic returns keep the single-root layout, which matches
Solidity `returns (T)`; static tuples encode the same bytes as before.
@cburgdorf
cburgdorf force-pushed the fix/tuple-return-abi-params branch from 171f29a to 85984e1 Compare September 29, 2026 15:09
@sbillig
sbillig merged commit 4d53a2f into master Sep 29, 2026
9 checks passed
@sbillig
sbillig deleted the fix/tuple-return-abi-params branch September 29, 2026 19:49
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