Skip to content

Docstrings clarification#466

Merged
liquid-8 merged 2 commits into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC
Jun 4, 2026
Merged

Docstrings clarification#466
liquid-8 merged 2 commits into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC

Conversation

@liquid-8

@liquid-8 liquid-8 commented Jun 4, 2026

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a single docstring note to encode_path_keys_output in uniswap4.py to clarify the expected argument ordering for multi-hop ExactOutput quotes. Unfortunately the note contradicts the implementation: the function uses reversed() on both path and hook_data_list and then rebuilds the list with insert(0, …), a double-reversal that produces the same forward ordering as the ExactInput variant. Callers should pass the pools in the same forward order (first pool → last pool) as they do for encode_path_keys_input.

  • The added NOTE on line 3060 says to pass inputs in reverse order, but the code on line 3068 (reversed(path) + insert(0, path_key)) makes this unnecessary — forward order is correct and expected.
  • No runtime logic was changed; the risk is that library consumers who read and trust the docstring will pass a pre-reversed path, resulting in an incorrect or failing quote.

Confidence Score: 3/5

The only change is a docstring note that contradicts the actual implementation — merging it would publish incorrect usage guidance to library consumers.

The added NOTE tells callers to pass path in reverse order, but the function already reverses both inputs internally and re-inserts at index 0, so forward order is what the implementation actually expects. A developer who reads and follows this note will produce a misordered path and receive wrong or failed quotes.

uniswap/uniswap4.py — specifically the new NOTE in the encode_path_keys_output docstring at line 3060

Important Files Changed

Filename Overview
uniswap/uniswap4.py Adds a NOTE to the encode_path_keys_output docstring, but the note incorrectly claims the caller must supply path/hook_data_list in reverse order; the implementation already reverses both lists internally and re-inserts at index 0, so the expected call convention is forward order.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Caller passes path=[A,B,C] (forward order)"]
    B["encode_path_keys_output"]
    C["reversed(path) → [C,B,A]\nreversed(hook_data_list)"]
    D["Per iteration: compute currency_in\nbuild PathKey\ninsert at index 0"]
    E["encoded_path = [PathKey_A, PathKey_B, PathKey_C]\n(forward order restored)"]
    F["Returned to quoter"]

    A --> B --> C --> D --> E --> F

    note1["⚠️ Docstring NOTE claims caller must pass\npath in REVERSE order — this is incorrect.\nDouble-reversal means forward order is correct."]
    D -.-> note1
Loading

Reviews (1): Last reviewed commit: "Docstrings clarification" | Re-trigger Greptile

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.76%. Comparing base (1eccd7a) to head (f249a3c).
⚠️ Report is 32 commits behind head on dev/v4-fin.

Additional details and impacted files
@@               Coverage Diff               @@
##           dev/v4-fin     #466       +/-   ##
===============================================
- Coverage       76.83%   39.76%   -37.07%     
===============================================
  Files              12       12               
  Lines            2253     2253               
===============================================
- Hits             1731      896      -835     
- Misses            522     1357      +835     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread uniswap/uniswap4.py Outdated
@liquid-8 liquid-8 merged commit ce76683 into uniswap-python:dev/v4-fin Jun 4, 2026
4 of 5 checks passed
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