Commit Graph
74 Commits
Author SHA1 Message Date
Matt HauffandGitHub a19365ac4e [LABS-394] Add a streamable hack to force ConditionValidTimes serialization order (#20383)
Add a streamable hack to force `ConditionValidTimes` serialization order
2026-01-09 12:08:18 -08:00
Matt HauffandGitHub 40db4635a8 [LABS-245] Enable PEP604 Ruff rules (#20269)
* Enable PEP604 Ruff rules

* Fix harcoded signature in test

* Hack CLVMStreamable test with note to fast follow
2025-11-18 12:34:00 -08:00
Matt HauffandGitHub fcdb8e4925 Manual fixes for upcoming Ruff pyupgrade push (#20213)
* Manual fixes

* Revert back to variable in type expression

* Fix streamable to handle UnionType
2025-11-03 09:16:42 -07:00
Matt HauffandGitHub 0a26924688 [CHIA-3606] Port create_offer_for_ids to @marshal (#20056)
* Port `create_offer_for_ids` to `@marshal`

* Self from typing_extensions

* Fix support for "" in PuzzleInfo/Solver
2025-10-21 11:00:37 -07:00
Matt HauffandGitHub 326b1084ce [CHIA-3729] Fix clvm streamable type analysis (#20031)
* Use fully recursive JSON logic for compound clvm streamable types

* Accomodate rust types

* Accomodate dicts

* Broaden function to handle type[object] instead of type[Streamable] (with a little mypy workaround)

* Whoops, delete that

* Small bug

* Okay a complete rework

* Delete some now unused stuff

* Some edge cases
2025-09-10 12:31:00 -07:00
Matt 4623d0d792 Comments by @altendky 2025-08-26 10:16:12 -07:00
Matt f3e85301c2 stop converting 2025-08-21 15:30:28 -07:00
Matt f2cb6b138b use EnumMeta for python < 3.11 2025-08-21 15:15:28 -07:00
Matt 4b55b7f2d4 make sure to convert to enum on parse 2025-08-21 15:12:29 -07:00
Matt 9af0b7c97c Add Enum support to streamable 2025-08-21 15:03:35 -07:00
Matt HauffandGitHub 55165b1163 [CHIA-3418] Change TransactionRecord to use dict instead of list of tuples for memos (#19846)
* Change `TransactionRecord` to use dict instead of list of tuples for memos

* Update streamable and fix tests

* Update test to accidentally fixed memos generation
2025-07-23 13:17:41 -07:00
Matt HauffandGitHub 0a084139b0 [CHIA-3158] Add dicts to streamable (#19719)
* Add dicts to streamable

* Make sure serialization is detemrinistic

* one more irrelevant test

* whoops fix bug and catch it with test

* Revert "Make sure serialization is detemrinistic"

This reverts commit 1c8f37743a.

* Dont allow duplicate dict keys

* optimize
2025-06-20 08:50:04 -07:00
6050235bdb [CHIA-3043] Add (hopefully) non-controversial ruff rules (#19684)
* Add (hopefully) non-controversial ruff rules

* mypy-exclusions.txt

* PIE

* Fix pre-commit?

* PYI

* RSE

* S + ignores

* Whitespace fix

* Re-add build-init-files.py

* Add comment about security ignores

* Update mypy-exclusions.txt

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Fix the executable status of build-init-files.py

* Set executable bit for tools/run_block.py and readd shebang

* Fix new errors

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-06-11 08:36:08 -07:00
Kyle AltendorfandGitHub 29da4a3b57 put None at the end in Unions - incoming RUF036 (#18905) 2024-11-21 14:56:39 -07:00
Matt HauffandGitHub 604fc1feb0 [CHIA-1732] Add Ruff specific linting rules (#18845)
* Add Ruff specific linting rules

* Further tighten ignore list

* Address comments by @altendky

* One more comment @altendky
2024-11-14 15:58:12 -07:00
6c90a76b56 Tighten up ruff ignore list (#18837)
* Tighten up ruff ignore list

* Okay that fix was indeed unsafe

* enable type-name-incorrect-variance

* enable literal-membership

* enable non-augmented-assignment

* enable useless-return

* enable global-variable-not-assigned

* -

* fixup

* Clean up roff.toml from annotations

* use ignore instead of explicit re-export

* use more descriptive names

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-11-12 12:19:31 -07:00
Matt HauffandGitHub 0e703e48e0 (Mostly) Replace flake8 with Ruff (#18801)
* Get flake8 config partially ready

* Mostly remove flake8 config

* Delete arithmetic whitespace ignore

* Delete unused program strings from tests

* Remove unnecessary noqas

* A couple more flake8 warnings
2024-11-01 09:55:16 -07:00
Kyle AltendorfandGitHub 2588600d1c more lowercase types such as in comments (#18737) 2024-10-24 11:52:10 -07:00
Amine KhaldiandGitHub 6c2c13a2d0 CHIA-1626 Move some modules to the utils virtual project (#18692)
Move some modules to the utils virtual project.
2024-10-18 10:40:49 -07:00
Kyle AltendorfandGitHub 9c8557a1f8 Remove Python 3.8 support and update source to 3.9 standards (#18687)
* manual python 3.8 removals

* poetry

* pyupgrade

* black

* isort

* manually tidy imports

* work around shadowed type

* catch up build network protocol files for pyupgrade changes

* placate pylint

* re-enable 20.04

* placate flake8
2024-10-16 14:21:15 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Earle Lowe
495593089b build(deps): bump mypy from 1.10.0 to 1.11.1 (#18412)
* build(deps): bump mypy from 1.10.0 to 1.11.1

Bumps [mypy](https://github.com/python/mypy) from 1.10.0 to 1.11.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.10.0...v1.11.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Updates for new mypy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
2024-08-11 23:20:56 -07:00
c25eeb08f7 [CHIA-504] Add support for external signers (PLEASE SQUASH) (#18199)
* Repin hsms

* Add to sdist only allowed list

* Signer protocol tweaks

* Convert wallet RPC client to deserialized types

* Introduce @tx_out_cmd decorator

* Make execute_signing_instructions RPC

* Add transport layer support

* Add signer commands

* Rework wallet execute_signing_instructions

* Inadvertent merge changes

* Fix signer command tests

* Try a different approach: recursive flattening

* Bump hsms

* Add comments

* Test coverage

* Coverage ignores

* Remove inadvertent time traveler

* Bring in lost time traveler

* pylint

* Attempt to make qr test less flaky

* Actually test coverage ignore

* Small refactor for test coverage

* transport -> translation

* missed one

* transport -> translation

* Fix asdict error

* coverage

* Forgoe rotation testing for now

* Test coverage

* jsonify_unsigned_txs -> full_jsonify

* Move a class

* Add better type checking to framework

* explicitly state kwargs on _CommandParsingStage

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Address comments by @altendky

* Consolidate add_private_key and add_public_key

* Consolidate get_key_for_fingerprint and get_public_key_for_fingerprint

* Test fix

* Merge fix

* Bad merge

* Bad merge

* oops

* pylint

* Tweak keychain_proxy.get_key_for_fingerprint

* Fix wallet RPC test?

* pragma: no cover

* Redesign clvm_streamable

* Fix test imports

* black

* fix one more test

* Address comments by @altendky

* Test coverage

* bytes32

* Better CLI mnemonic check

* Use functools.partial

* Rename full jsonify to chip 29

* whoops missed a couple

* Better CLI mnemonic check

* black

* pylint

* Missed one

* black

* Farm at least one block

* Revert last change and fix 0 block farming

* black

* bad merge

* Merge fix

* Inadvertent changes

* Inadvertent changes

* Syncronize with quex.tx_out_decorator2

* These are no longer dictionaries.

* Use new clvm_streamable pattern

* Fix offer endpoint

* Add @tx_out_cmd decorator

* Bump ecdsa version

* Fix @marshal util to return proper transactions

* Add get_public_key

* port `chia wallet send` to @tx_out_cmd

* merge fix of puzzle hash derivation

* Port `chia wallet coins` to @tx_out_cmd

* Port chia wallet clawback to @tx_out_cmd

* Port `chia wallet take/cancel_offer` to @tx_out_cmd

* Port `chia wallet did ...` to @tx_out_cmd

* Port `chia wallet nft ...` to @tx_out_cmd

* Port `chia wallet notifications send` to @tx_out_cmd

* Port `chia wallet vcs ...` to @tx_out_cmd

* Port `chia dao ...` to @tx_out_cmd

* Exclude data layer and plotnft functions

* [no ci]

* Address comments by @AmineKhaldi

* Fix rpc util

* add test for BSTLSigningInstructions

* [UNDO] d9c6f54398

* [UNDO] 7fc1d2adfd

* [UNDO] 23c9ee8549

* [UNDO] aacc9f0228

* [UNDO] 548465403b

* Undo unintentional changes

* Stuff that's not part of this

* More stuff that doesn't belong

* One last thing that doesn't belong

* Unintentional change

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2024-06-26 09:21:33 -07:00
Kyle AltendorfandGitHub 3061cd83d7 remove some pylint ignores (#18140) 2024-06-18 14:24:30 -05:00
Matt HauffandGitHub 3637bd33c6 Delete chia.util.misc (#18170)
* Move VersionedBlob to chia.util.streamable

* Move format_bytes to chia.cmds.cmds_util

* Move format_minutes to chia.cmds.cmds_util

* Move prompt_yes_no to chia.cmds.cmds_util

* Move get_list_or_len to from chia.plot_sync.receiver

* Move validate_directory_writable to chia.cmds.cmds_util

* Move *termination_signals to test_services

* Move UInt*Range to chia.util.streamable

* Create chia.util.batches

* Create chia.server.signal_handlers

* Create chia._tests.util.split_managers

* Move ValuedEvent to chia.types.transaction_queue_entry

* Move available_logical_cores to chia.util.cpu

* Move caller_file_and_line to chia._tests.util.misc

* Move satisfies_hint to chia._tests.wallet.test_singleton_lifecycle_fast
2024-06-18 08:27:17 -05:00
Matt HauffandGitHub aefe7fdf28 Observer Mode (#17792)
* Observer Mode

* Address comments by @altendky

* Change RPC default and fix test coverage

* Add test coverage for rpc marshaller

* Fix @marshal util to return proper transactions
2024-05-07 13:39:25 -07:00
Arvid NorbergandGitHub 362414c226 remove old unhashable special case in Streamable (#17561)
remove old unhashable special case in Streamable. This simplifies the streamable implementation
2024-02-15 09:40:30 -08:00
Arvid NorbergandGitHub 95e5b97557 Use bls from chia rs (#16715)
* replace blspy imports with chia_rs imports for BLS types

* remove blspy-stubs, since we're dropping the blspy dependency. chia_rs has type stubs already
2023-11-07 09:06:52 -08:00
Arvid NorbergandGitHub ca85e485e6 transition away from __bytes__ conversion for fixed-size integers (#16701) 2023-10-31 16:57:17 -05:00
Kyle AltendorfandGitHub 90c1441af0 apply pyupgrade --py38-plus --keep-runtime-typing (#14646) 2023-10-24 12:01:23 -05:00
Arvid NorbergandGitHub d022966f6e use unhashable interface before from_json_dict (#16064)
improve test for streamable_from_dict. use unhashable interface before from_json_dict
2023-08-16 11:47:54 -05:00
Arvid NorbergandGitHub 57d1974ef3 fix flake8 warnings (#15897) 2023-07-31 09:46:49 -05:00
Arvid NorbergandGitHub 1625d7aa92 make ConditionOpcodes not streamable (#15858)
ConditionOpcodes can be more than 1 byte now. Make it not streamable, since it doesn't have to be
2023-07-26 11:27:03 -05:00
Kyle AltendorfandGitHub a42bf49050 catch up with mypy 1.1.1 (#14767) 2023-03-07 11:34:07 -06:00
87a3e93cc4 Ms.mypy enable (#13320)
* Remove mempool.additions

* Don't re run the program, and remove program from mempool item

* Removals only stores item ids, and stores a list

* Move pending cache down to prevent cache dos

* Separate validation from adding to pool, and remove mypy exceptions

* Fix bug with replacing

* Add to mypy

* Revert cbgui

* precommit fail

* Properly update the seen dict

* lint error

* Fix mempool bug

* Enable mypy for a bunch of files

* Update after merge with main

* 99/260 remaining

* Address comments

* Enable more mypy

* Merge conflict mypy file

* More fixes

* pytest.ini and cb-gui

* One more flake8 fix

* Flake8 and tests

* More test fixes

* isort

* Make LGTM happy

* Update chia/full_node/block_store.py

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Update chia/full_node/full_node_store.py

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Update chia/wallet/util/peer_request_cache.py

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Apply all suggestions from PR comments

* Revert cb-gui

* 100 back to 1000, minor tweaks

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-09-08 12:57:15 -05:00
dustinfaceandGitHub 4f8c778b84 streamable: Fix the message of ParameterMissingError + Test custom error messages (#12988)
* streamable: Fix the message of `ParameterMissingError`

* Test error messages

* Python 3.10 differs in the output of the `TypeError`
2022-08-17 01:00:58 -05:00
dustinfaceandGitHub 8e0b081fa3 streamable: More custom exceptions (#12316)
* streamable: More custom exceptions

* `Any` -> `object`

* Introduce `UnsupportedType`
2022-08-15 12:22:50 -05:00
Arvid NorbergandGitHub 0a541cc56c Bump chia_rs dependency (#12919)
* bump chia_rs version

* drop use of COND_CANON_INTS, which is always implied (and removed) from the latest version of chia_rs

* use the new parse_rust() API that supports memoryview

* use native hash_tree implementation for SerializedProgram
2022-08-13 17:22:55 -05:00
dustinfaceandGitHub 280f462071 streamable: Improve DefinitionError (#12270) 2022-07-11 14:09:41 -05:00
f0c5a16c30 streamable: Expand Field and introduce Streamable._streamable_fields (#11856)
* Integrate all cached functions into `Field`

* Drop `FIELDS_FOR_STREAMABLE_CLASS`, store them in the class instead

* Use index operator

Co-authored-by: Kyle Altendorf <sda@fstab.net>

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-07-06 21:01:41 -05:00
dustinfaceandGitHub 60a7581df8 streamable: Turn dataclass_from_dict into streamable_from_dict (#11763)
* Restrict `dataclass_from_dict` to valid streamable classes

They need to have the decorator applied for the required cache being populated.

* `dataclass_from_dict` -> `streamable_from_dict`

* `TestDataclassFromDict` -> `StreamableFromDict`
2022-07-01 13:18:57 -05:00
Mariano SorgenteandGitHub 7b84c8e261 Remove double bytes32 conversion (#12161) 2022-06-30 14:53:29 -05:00
dustinfaceandGitHub 82a83b7ebd streamable: Introduce Streamable.__post_init__ processing cache (#11730) 2022-06-28 11:49:41 -05:00
dustinfaceandGitHub 20f5bb22fb streamable: Improve dataclass_from_dict validation, add more tests (#10652)
* Improve and test `dataclass_from_dict` tuple validation

* Improve and test `dataclass_from_dict` list validation

* Introduce `convert_hex_string`

* Improve and test `dataclass_from_dict` byte type validation

* Improve and test `dataclass_from_dict` unhashable validation

* Improve and test `dataclass_from_dict` primitive validation

* Improve `dataclass_from_dict` validation

* `raise TypeError(...) from e`

* Just `raise`, don't `raise e`

* Use `repr` of `item` not `str`

* `type(item) == f_type` -> `isinstance(item, f_type)`
2022-06-14 12:40:33 -05:00
Arvid NorbergandGitHub 5ae87189c4 Rust coin (#11807)
* use rust implementation of Coin class, from chia_rs

* bump chia_rs dependency
2022-06-13 07:21:04 -05:00
dustinfaceandGitHub 504b67ee2c streamable: Move some class methods out of Streamable (#11853)
* Make `function_to_parse_one_item` a free function

* Make `function_to_stream_one_item` a free function
2022-06-09 15:53:45 -05:00
dustinfaceandGitHub 5c5ab111ad streamable: Fix default value assignments for dataclass_from_dict (#11732)
* streamable: Use constructor in `dataclass_from_dict`

This fixes default value assignments after #10561 but also leads to less perfomance due to `__post_init__` being called which at least gets mitigated by #11730.

* tests: Test default values with `from_json_dict`

* Convert to `str`, then compare.
2022-06-03 12:14:57 -05:00
dustinfaceandGitHub 2495e8dfd3 streamable: Introduce streamable.Field (#11745)
* streamable: Cache `dataclasses.Field` objects

* Introduce `streamable.Field`
2022-06-02 13:10:29 -05:00
Mariano SorgenteandGitHub 718b830e61 Optimize get_hash by not double converting (#11668) 2022-06-01 16:10:42 -05:00
Arvid NorbergandGitHub 3c2fc1947d upgrade chia-rs to streamable support (#11503)
* upgrade chia-rs to streamable support

* bump chia_rs dependency
2022-06-01 12:56:11 -05:00
Kyle AltendorfandGitHub 1e7d86e884 remove big_ints list (#11630) 2022-05-31 15:36:49 -05:00