Repository navigation
fix(llm): decode Yearn Executor execute(bytes) scripts - #443
Merged
Merged
Conversation
The Executor's `_script` is packed (32-byte `target | size` header per call, then calldata), not ABI-encoded, so it reached the prompt as raw hex. On yChad nonce 2299 the model sliced it one hex digit off, reported a nonexistent selector 0x4759be10 instead of six accept_management() calls, and rated the batch HIGH for "unresolved downstream calls". - wrappers: split_packed_script mirrors Executor.execute; execute(bytes) is registered as an executing wrapper (proxy-upgrade detection, protocol context) - decoder: DecodedCall.script_calls holds each inner call, decoded against its own target's ABI (offline-only when no chain id) - prompt + report: render each script call with its target; script targets feed labels, address links and risk anchors - system prompt: never derive selectors/targets by slicing raw hex - known selectors: Executor execute/set_operator and set/accept_management Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 1-3 byte script call is forwarded unchanged and can reach a different fallback path than an empty call; render it as an undecoded short payload in both the prompt and the report, matching _decode_status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
yChad nonce 2299 was rated HIGH by our AI explainer (gist), while Govlens rated it MEDIUM (gist). The main driver: the governance Executor's
execute(bytes)_scriptis a packed script (target(160) | size(96)header + calldata per call, per the verifiedExecutor.vy), not ABI calldata.try_decode_inner_calldatacan't read it, so it went to the prompt as raw hex. The model sliced it one hex digit off, reported a nonexistent selector0x4759be10, and treated the six calls as "unresolved downstream effects". That was a main stated reason for HIGH.In fact the script makes six
accept_management()calls: the Executor accepts management of five reward distributors and the Funding Distributor.Changes
utils/calldata/wrappers.py:split_packed_scriptmirrorsExecutor.execute(requires exact consumption, a non-zero target, and ≤64 calls).execute(bytes)is registered as an executing wrapper, so proxy-upgrade detection and protocol context see the inner calls.utils/calldata/decoder.py:DecodedCall.script_callsholds each inner call, decoded against its own target's ABI when the chain is known. Without a chain id, only selectors resolvable offline are decoded.utils/llm/ai_explainer.py/utils/llm/report.py: the prompt and the gist Call Flow list each script call with its target. Script targets feed labels, address links, references and risk anchors.known_selectors.py: Executorexecute/set_operatorandset_management/accept_management.Rendered prompt for the nonce 2299 script:
Not in scope
protocol_context.py.Testing
tests/test_executor_script.py(14 tests): split / malformed scripts, unwrap, decoder with ABI and offline paths, prompt and report rendering, label and reference collection. Uses the real nonce 2299 script.ruff check/ruff formatclean.🤖 Generated with Claude Code