Skip to content

fix[venom]: fuzz venom pass ordering - #5219

Open
HodanPlodky wants to merge 28 commits into
vyperlang:masterfrom
HodanPlodky:fix/venom/pass-disable-testing
Open

HodanPlodky wants to merge 28 commits into
vyperlang:masterfrom
HodanPlodky:fix/venom/pass-disable-testing

Conversation

@HodanPlodky

@HodanPlodky HodanPlodky commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

What I did

Created the fuzz test that showed few error in the implementation. There error are fixed and discuses in the #5231

How I did it

How to verify it

pytest -m "fuzzing" --experimental-codegen tests/functional/examples/thirdparty/test_thirdparty_fuzz.py --optimize O3 -k test_compile_pass_fuzz

Commit message

This commit adds the fuzz test to check the interaction between the passes by disabling the subset of the passes and compiling the thirdparty examples.

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Comment thread tests/functional/examples/thirdparty/test_thirdparty_fuzz.py Fixed
Comment thread tests/functional/examples/thirdparty/test_thirdparty_fuzz.py Fixed
@github-actions

Copy link
Copy Markdown

Gas Changes

No changes detected.

Summary

  • Total tests measured: 560
  • Changed: 0
  • Regressions (gas up): 0
  • Improvements (gas down): 0
  • New tests: 0
  • Deleted tests: 0
  • Newly failing: 0
  • Newly passing: 0

@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

📊 Bytecode Size Changes (venom)

No changes detected.

Full bytecode sizes

Contract legacy-O2 legacy-Os -O2 -O3 -Os
curvefi/legacy/CurveStableSwapMetaNG.vy 24941 23567 19769 19059 18523
curvefi/amm/stableswap/meta_implementation/meta_implementation_v_700.vy 23599 22794 19521 18627 18308
curvefi/amm/stableswap/implementation/implementation_v_700.vy 24951 23758 19139 18363 18013
curvefi/legacy/CurveStableSwapNG.vy 24462 23287 18701 17981 17631
curvefi/amm/tricryptoswap/implementation/implementation_v_200.vy 20724 19959 17175 16689 16325
curvefi/amm/twocryptoswap/implementation/implementation_v_210.vy 17634 16894 14901 14376 14027
yearnfi/VaultV3.vy 19972 19063 14531 13818 13247
curvefi/legacy/CurveCryptoSwap2.vy 18947 18382 14474 14129 13935
yearnfi/VaultV2.vy 16676 15763 13211 12466 12048
curvefi/amm/stableswap/factory/factory_v_100.vy 14558 13978 11724 10780 10855
curvefi/gauge/child_gauge/implementation/implementation_v_110.vy 12338 11561 9774 9184 8795
curvefi/amm/stableswap/views/views_v_120.vy 12784 12368 9663 9059 9294
curvefi/gauge/child_gauge/implementation/implementation_v_100.vy 12017 11249 9507 8924 8538
curvefi/amm/tricryptoswap/math/math_v_200.vy 11189 11126 8923 8144 8150
curvefi/legacy/CurveCryptoMathOptimized3.vy 11188 11125 8922 8144 8150
curvefi/gauge/child_gauge/implementation/implementation_v_020.vy 10665 9947 8606 8100 7714
curvefi/registries/metaregistry/metaregistry_v_110.vy 7590 6732 6481 5710 5603
curvefi/helpers/router/router_v_110.vy 6717 6717 6160 5733 6031
curvefi/amm/tricryptoswap/views/views_v_200.vy 7821 7776 6091 5896 6037
curvefi/helpers/stable_swap_meta_zap/stable_swap_meta_zap_v_100.vy 7302 7067 5877 5350 5610
curvefi/amm/twocryptoswap/views/views_v_200.vy 6991 6946 5660 5479 5606
curvefi/registries/metaregistry/registry_handlers/stableswap/handler_v_110.vy 6633 6259 5533 4695 5238
curvefi/amm/twocryptoswap/math/math_v_210.vy 6800 6800 5501 5012 5039
curvefi/amm/twocryptoswap/factory/factory_v_200.vy 5540 5252 4480 3917 4015
curvefi/amm/tricryptoswap/factory/factory_v_200.vy 5246 5021 4377 3890 3996
curvefi/gauge/child_gauge/factory/factory_v_201.vy 4844 4547 3895 3675 3511
curvefi/registries/metaregistry/registry_handlers/tricryptoswap/handler_v_110.vy 4241 3939 3718 3334 3429
curvefi/registries/metaregistry/registry_handlers/twocryptoswap/handler_v_110.vy 4186 3884 3671 3251 3329
curvefi/gauge/child_gauge/factory/factory_v_100.vy 4183 3914 3408 3144 2971
yearnfi/VaultFactory.vy 3765 3617 2713 2158 2434
curvefi/registries/address_provider/address_provider_v_201.vy 2973 2782 2613 2440 2353
curvefi/helpers/rate_provider/rate_provider_v_101.vy 3260 3260 2535 2263 2296
curvefi/amm/stableswap/math/math_v_100.vy 3067 3046 2453 2253 2310
curvefi/helpers/rate_provider/rate_provider_v_100.vy 2847 2841 2273 1954 1974
curvefi/helpers/deposit_and_stake_zap/deposit_and_stake_zap_v_100.vy 2322 2316 1774 1611 1670
curvefi/governance/relayer/taiko/relayer_v_001.vy 2068 2064 1731 1510 1558
curvefi/governance/relayer/polygon_cdk/relayer_v_101.vy 1556 1523 1530 1324 1347
curvefi/governance/relayer/arb_orbit/relayer_v_101.vy 1266 1262 1242 1066 1115
curvefi/governance/relayer/op_stack/relayer_v_101.vy 1186 1182 1183 1014 1056
curvefi/governance/relayer/not_rollup/relayer_v_100.vy 1168 1153 1174 1011 1037
curvefi/governance/vault/vault_v_100.vy 964 941 862 823 839
curvefi/governance/relayer/relayer_v_100.vy 496 496 593 490 503
curvefi/governance/agent/agent_v_100.vy 541 541 430 402 406
curvefi/governance/agent/agent_v_101.vy 541 541 430 402 406

@HodanPlodky
HodanPlodky marked this pull request as ready for review August 28, 2026 09:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 770ee21f6f

ℹ️ 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".

Comment on lines +70 to +72
if space is None:
# sanity check
assert eff == FMP, eff

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle non-address-space reads without asserting FMP

When a dead balance, selfbalance, extcodesize, extcodehash, or returndatasize instruction reaches this pass, its read effect maps to no address space, but it is not FMP, so this assertion raises and aborts compilation. These instructions are non-volatile and may legitimately have unused outputs; non-memory effects should simply require no alias-analysis invalidation rather than being rejected.

Useful? React with 👍 / 👎.

Comment on lines +78 to +79
if not compiler_settings.experimental_codegen:
pytest.skip()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enable Venom in the fuzz workflow

In the checked fuzzing job at .github/workflows/test.yml:281-290, pytest is invoked with -m "fuzzing" but without --experimental-codegen; that option is store_true and therefore the compiler_settings fixture leaves experimental codegen disabled. Consequently every instance of this newly added test takes this skip, so none of the pass-disable combinations run in CI.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73616d08ee

ℹ️ 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".

Comment thread vyper/venom/passes/function_inliner.py Outdated
for inst in bb.instructions:
if inst.is_param:
if inst.opcode == "retpc_param":
inst.make_nop()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve return-PC aliases when inlining

When a valid callee forwards its retpc_param through an assign or phi before using that alias as the final ret operand, replacing the parameter with a nop leaves the intermediate instruction reading an undefined variable; the later ret rewrite removes only the terminator's operand. This can make code generation fail when RemoveUnusedVariablesPass is disabled, as the new fuzz test permits. Bind the return-PC parameter to the invoke target as before, or rewrite all of its aliases before removing it.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64a85d4228

ℹ️ 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".

Comment on lines +85 to +88
run = []

def temp(*args, **kwargs):
run.append(True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict generated passes to the active optimization pipeline

When this test is invoked with experimental codegen and the default gas/O2 optimization level, generated entries such as AssertEliminationPass, OverflowEliminationPass, ReduceLiteralsCodesize, and TailMergePass are not present in PASSES_O2, so their patched methods are never called. Because the run tracking list is not checked, examples containing only those passes pass vacuously, while mixed examples disable only part of the generated subset; filter the strategy by the selected pipeline or assert that every selected pass actually ran.

Useful? React with 👍 / 👎.

@charles-cooper charles-cooper changed the title fix[venom]: pass disable testing fix[venom]: fuzz test venom pass ordering Sep 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4ba5ba797

ℹ️ 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".

Comment thread vyper/venom/passes/function_inliner.py Outdated
# host's own reclaim governs the inlined data. Whether the
# host publishes is determined solely by the host's own
# terminators (plain `ret` is callee-save).
assert retpc_op in inst.operands, retpc_op

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support raw return-PC forms when inlining

When a valid raw Venom callee represents its return PC as a plain parameter (%retpc = param; ret %retpc) or as a literal label, no retpc_param is encountered and retpc_op remains None, so this assertion aborts compilation whenever the callee is selected for inlining. These forms are accepted by the calling-convention validator and the previous implementation successfully rewrote their ret terminators, so the assertion must account for return PCs discovered through FunctionCallLayout rather than requiring the dedicated opcode.

Useful? React with 👍 / 👎.

@@ -14,9 +14,6 @@ def get_example_vy_filenames():

@pytest.mark.parametrize("vy_filename", get_example_vy_filenames())
def test_compile(vy_filename):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Retain the legacy StackTooDeep xfail

In the regular test matrix where --experimental-codegen is absent, this test compiles through the legacy backend, so implementation_v_700.vy still reaches the documented StackTooDeep: Unsupported dup depth 17 failure. The compiler changes in this commit are confined to the Venom backend and cannot fix that legacy path; removing the filename-specific xfail therefore makes every non-experimental matrix job fail when this parameter is collected.

Useful? React with 👍 / 👎.

@charles-cooper charles-cooper changed the title fix[venom]: fuzz test venom pass ordering fix[venom]: fuzz venom pass ordering Sep 3, 2026

@charles-cooper charles-cooper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm pending #5231 merge and @harkal review

This branch has not been deployed

No deployments
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.

4 participants