Skip to content

Generalize ABI selectors and typed EVM calls#1427

Draft
g-r-a-n-t wants to merge 1 commit into
argotorg:masterfrom
g-r-a-n-t:custom-selectors
Draft

Generalize ABI selectors and typed EVM calls#1427
g-r-a-n-t wants to merge 1 commit into
argotorg:masterfrom
g-r-a-n-t:custom-selectors

Conversation

@g-r-a-n-t
Copy link
Copy Markdown
Collaborator

No description provided.

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

RuntimeBuiltin::CallDataSelector {
selector_size: abi.selector_size,
class: abi.selector_class.clone(),

P2 Badge Respect ABI selector decoding in dispatch

For custom ABIs where Abi::selector_from_prefix is not exactly a raw high-byte shift, generated contract dispatch now ignores the ABI hook and compares the raw CallDataSelector value instead. I checked ingots/core/src/contracts.fe, where ContractHost::runtime_selector<A> decodes selectors via A::selector_from_prefix(input.word_at(0)), but this runtime root emits a builtin that the code generators lower directly to shr(...) on calldataload(0). That means a contract using such an ABI can have Evm.selector_abi<A>() report the intended selector while the compiler-generated dispatch misses the matching recv arm and falls through to the default path.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@g-r-a-n-t g-r-a-n-t marked this pull request as draft May 6, 2026 15:56
@g-r-a-n-t g-r-a-n-t force-pushed the custom-selectors branch 2 times, most recently from 2981714 to 9c244ed Compare May 9, 2026 01:06
- Treat msg selectors as <A as Abi>::Selector\n- Make EVM call/static/delegate generic over A (inferred from message type)\n- Reuse SolEncoder/SolDecoder for any Abi and require Selector: WordValue\n- Add an end-to-end fe-test fixture for 1- and 2-byte selectors\n- Refresh Sonatina IR snapshots
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