8000 Support for Anchor 0.32.1 by markovejnovic · Pull Request #166 · kevinheavey/anchorpy · GitHub
[go: up one dir, main page]

Skip to content

Support for Anchor 0.32.1 - #166

Open
markovejnovic wants to merge 11 commits into
kevinheavey:mainfrom
plocca-inc:anchor-0.32.1
Open

markovejnovic wants to merge 11 commits into
kevinheavey:mainfrom
plocca-inc:anchor-0.32.1

Conversation

@markovejnovic
@markovejnovic markovejnovic commented Feb 1, 2026 •
Copy link
Copy Markdown

Hey all.

This PR adds support for Anchor 0.32.1. I mostly based my work off of #163 but I tried to improve the code quality a little bit and also ensure all tests pass.

Note: I was unable to find the source/IDLs for a lot of the existing test IDLs. Consequently, I have deleted some test IDLs. I would urge you figure out how to find those source files again, and drop the relevant commit (read further).

Prior to merge:

Validation

Type Checks

$ make lint
uv run ruff src tests
uv run mypy src tests
Success: no issues found in 115 source files

Tests

I had a little bit of trouble running make test since solana-test-validator wasn't properly cleaned up on my machine so I ran the tests manually, pkilling the validator. I didn't bother to investigate the validator persiting after test execution. The warnings I got probably hint at the issue, but that's way beyond the scope of this PR.

$ pkill -f solana-test-validator; rm -rf .pytest_cache/d/.x
process/localnet
$ uv run --all-extras pytest tests/unit
=================== test session starts ===================
platform darwin -- Python 3.11.14, pytest-7.4.4, pluggy-1.5
.0
rootdir: /Users/marko/Desktop/anchorpy
configfile: pytest.ini
plugins: xprocess-0.18.1, anyio-4.3.0, asyncio-0.21.2, anch
orpy-0.32.1
asyncio: mode=Mode.STRICT
collected 11 items                                        

tests/unit/test_accounts_array.py .                 [  9%]
tests/unit/test_accounts_coder.py .                 [ 18%]
tests/unit/test_clientgen.py .                      [ 27%]
tests/unit/test_event_parser.py .                   [ 36%]
tests/unit/test_idl.py ..                           [ 54%]
tests/unit/test_instruction_coder.py .              [ 63%]
tests/unit/test_transaction.py ..                   [ 81%]
tests/unit/test_types_coder.py ..                   [100%]

=================== 11 passed in 0.17s ====================
pytest-xprocess reminder::Be sure to terminate the started 
process by running 'pytest --xkill' if you have not explici
tly done so in your fixture with 'xprocess.getinfo(<process
_name>).terminate()'.
$ pkill -f solana-test-validator; rm -rf .pytest_cache/d/.x
process/localnet
$ uv run --all-extras pytest tests/client_gen
=================== test session starts ===================
platform darwin -- Python 3.11.14, pytest-7.4.4, pluggy-1.5
.0
rootdir: /Users/marko/Desktop/anchorpy
configfile: pytest.ini
plugins: xprocess-0.18.1, anyio-4.3.0, asyncio-0.21.2, anch
orpy-0.32.1
asyncio: mode=Mode.STRICT
collected 9 items                                         

tests/client_gen/test_client_gen.py .....           [ 55%]
tests/client_gen/test_functional.py ....            [100%]

==================== 9 passed in 6.12s ====================
pytest-xprocess reminder::Be sure to terminate the started 
process by running 'pytest --xkill' if you have not explici
tly done so in your fixture with 'xprocess.getinfo(<process
_name>).terminate()'.
$ pkill -f solana-test-validator; rm -rf .pytest_cache/d/.x
process/localnet
$ uv run --all-extras pytest tests/test_cli.py 
=================== test session starts ===================
platform darwin -- Python 3.11.14, pytest-7.4.4, pluggy-1.5
.0
rootdir: /Users/marko/Desktop/anchorpy
configfile: pytest.ini
plugins: xprocess-0.18.1, anyio-4.3.0, asyncio-0.21.2, anch
orpy-0.32.1
asyncio: mode=Mode.STRICT
collected 1 item                                          

tests/test_cli.py .                                 [100%]

==================== warnings summary =====================
tests/test_cli.py::test_shell
  /Users/marko/Desktop/anchorpy/.venv/lib/python3.11/site-p
ackages/traitlets/traitlets.py:1385: DeprecationWarning: Pa
ssing unrecognized arguments to super(InteractiveShellEmbed
).__init__(using='asyncio').
  object.__init__() takes exactly one argument (the instanc
e to initialize)
  This is deprecated in traitlets 4.2.This error will be ra
ised in a future release of traitlets.
    warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-w
arnings.html
============== 1 passed, 1 warning in 2.66s ===============
pytest-xprocess reminder::Be sure to terminate the started 
process by running 'pytest --xkill' if you have not explici
tly done so in your fixture with 'xprocess.getinfo(<process
_name>).terminate()'.

kevinheavey/anchorpy-idl#5 changes

Three key changes:

  • Exposed some python types that look like they were intended to be public anyways.
  • Added IdlTypeDefined::defined which was declared as public in the .pyi
  • Made IdlDefinedFieldsNamed iterable in the python code, so that the legacy API could still be used in anchorpy. My reasoning was that doing this minimizes the blast radius in this repo.
  • Changed the docs constructors to accept None where the .pyi specified.

@markovejnovic
markovejnovic force-pushed the anchor-0.32.1 branch 3 times, most recently from a231fde to f2cc5b7 Compare February 1, 2026 03:55
@markovejnovic
markovejnovic force-pushed the anchor-0.32.1 branch 6 times, most recently from 773bf1e to 00ce459 Compare February 1, 2026 05:18
@markovejnovic
markovejnovic marked this pull request as ready for review February 1, 2026 05:18
@markovejnovic
Copy link
Copy Markdown
Author

Btw, if you want to hop on a quick call to review this PR (and/or help me understand what other things need to be built), feel free to DM me @suis_siva

@ss1738
ss1738 commented Nov 16, 2026
Copy link
Copy Markdown
< 8000 tr class="d-block">

MEASURED: I have a one-commit discriminator follow-up based on this PR's current head, 78198b6. It builds on your IDL migration rather than repeating it.

The diff uses explicit IDL bytes in instruction/account/event coders, account fetches and filters, and generated clients. It handles variable-length tags and rejects empty, duplicate or prefix-ambiguous tags before dispatch. Two existing fixtures replace empty discriminator placeholders with the conventional initialize bytes; their original assertions remain.

MEASURED: On a clean archive of 78198b6 plus that commit, the unit suite passes on Python 3.12 / macOS arm64:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=src python3 -m pytest -p pytest_asyncio.plugin -q tests/unit --disable-warnings
58 passed, 491 warnings in 0.34s

The added cases exercise 1-, 2-, 8- and 12-byte tags, mixed lengths, generated-code execution, account fetching/filtering, and malformed payloads. See the regression tests.

MEASURED: The binding also needs a small stub-only correction for the discriminator API already exposed at runtime. This does not resolve the dependency release prerequisites listed above.

Would you prefer to fold this commit into this PR, or keep it as a follow-up after the IDL dependency lands?

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.

3 participants

0