Commit Graph
44 Commits
Author SHA1 Message Date
Earle LoweandGitHub 581aa707a8 Make sure to close DB connection when getting DB limit info (#20344)
make sure to close DB
2025-12-15 09:47:32 -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 a803dc0fa6 [CHIA-3633] August 2025 pass of Ruff linting rules (#19929)
* Enable Ruff `PLR1704` (`redefined-argument-from-local`)

* Enable Ruff `PLR5501` (`collapsible-else-if`)

* Enable Ruff `PLW2901` (`redefined-loop-name`)

* bad change

* Enable Ruff `RUF043` (`pytest-raises-ambiguous-pattern`)

* Enable Ruff `RUF046` (`unnecessary-cast-to-int`)

* Enable Ruff `RUF052` (`used-dummy-variable`)

* Remove unused ignore `UP006`

* One mis-signaled regex

* Comments by @altendky

* bad change, my bad
2025-08-11 14:39:12 -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
Matt HauffandGitHub ad46ee2301 [CHIA-2546] Refactor and add test for WSM puzzle hash endpoints (#19385)
refactor puzzle hash requests
2025-03-26 13:08:00 -07:00
William Blanke 31f48b9153 sqlite cached_statements workaround 2025-01-08 20:52:11 -08: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
Matt HauffandGitHub 6084112d48 [CHIA-1553] Replace pylint with ruff (#18759)
* Replace pylint with ruff

* poetry

* remove pylint

* Address comments by @altendky

* Undo formatting

* actually undo formatting
2024-10-25 15:55:37 -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
Amine KhaldiandGitHub 442bad9f27 Increase in-memory DB URI randomness (#17822)
Increase in-memory DB URI randomness.
2024-04-05 09:29:15 -07:00
Kyle AltendorfandGitHub ed786e2f61 add foreign key delay (#17709)
* add foreign key delay

* handle non-`Row` foreign key error reports

* todos

* coverage

* rename to `foreign_key_enforcement_enabled=`
2024-03-27 09:14:57 -07:00
Kyle AltendorfandGitHub 3caa0754cc add DBWrapper2.managed() (#16880) 2023-11-22 13:48:01 -06:00
Amine KhaldiandGitHub d054314a18 Move generate_in_memory_db_uri to the chia/util to avoid importing tests from the chia package (#16752)
Move generate_in_memory_db_uri to the chia/util to avoid importing tests from the chia package.
2023-11-09 09:04:03 -08:00
Kyle AltendorfandGitHub d82876d47d hint chia.util and remove from exclusions (#16521) 2023-10-10 13:45:20 -05:00
Kyle AltendorfandGitHub ca34240b43 add sql logging config for DataLayer (#15690)
* add sql logging config for DataLayer

* add test

* data_sql.log
2023-07-17 13:15:22 -05:00
Kyle AltendorfandGitHub 2d28d62ab2 move sqlite host parameter limit to db wrapper (#15755)
* move sqlite host parameter limit to db wrapper

* pylint

* E

* oops

* fixup
2023-07-14 19:38:36 -05:00
Kyle AltendorfandGitHub 7c9b3a25c1 Correct SQLite logging when using db_wrapper.manage_connection() (#14866)
* Correct SQLite log file handling in db_wrapper.manage_connection()

* simplify and fixup

* black

* fix/simplify

* just try/finally
2023-04-03 13:33:04 -05:00
Arvid NorbergandGitHub c7301693e1 sqlite-backed mempool (#14657)
* implement Mempool using an in-memory sqlite database

* remove_from_pool with empty list is a no-op

* the order is not important in get_coin_records_by_puzzle_hash() or get_block_spends()

* use format string in log statement

* make MempoolItem not streamable, to improve performance of creating objects
2023-03-03 15:04:21 -06:00
Kyle AltendorfandGitHub 7897c80ed1 only open SQLite log file once per db wrapper (#13754)
* only open SQLite log file once per db wrapper

* actually remember the log file

* actually remember to close the connections...
2022-11-01 15:43:19 -05:00
Kyle AltendorfandGitHub 5b39550f73 convert datalayer to DBWrapper2 (#13582)
* convert datalayer to DBWrapper2 (all write)

* more read, less write

* remove unneeded connection managers

* and...  close it

* data store now creates its own wrapper

* Drop unused hint DataLayer.batch_update_db_wrapper

* require named arguments for most of `DBWrapper2.create()`
2022-10-03 17:50:12 -05:00
Kyle AltendorfandGitHub 61b497a701 add a transactional reader as DBWrapper2.reader() (#13468)
* add a transactional reader as `DBWrapper2.reader()`

* contextlib.AbstractAsyncContextManager

* try a minimal test

* rework test to allow the read to finish so the write can finish the commit after that

* pylint disable

* WAL!!!

* more tests

* if TYPE_CHECKING for typing variable assignments

* future

* cover some more test cases
2022-09-30 17:41:33 -05:00
Gene HoffmanandGitHub 1224ef924f Use codespell to catch some typos (#13557) 2022-09-28 04:27:34 -05:00
Kyle AltendorfandGitHub 8ed283a821 make DBWrapper2 handle more connection setup (#13510)
* make DBWrapper2 handle more connection setup

* fixup

* make create_connection() both await'able and async with'able

* recover logging
2022-09-26 11:17:20 -05:00
Amine Khaldi 4c8c945c3d Merge commit '1fddb7aef13198e5f87102b48f4592f68f6fa248' into checkpoint/long_lived_atari_from_main_1fddb7aef13198e5f87102b48f4592f68f6fa248 2022-08-11 11:53:51 +01:00
Amine Khaldi 71753fd840 Merge commit 'f49777885da4924362493ac1ca69003720d28365' into checkpoint/long_lived_atari_from_main_f49777885da4924362493ac1ca69003720d28365 2022-08-09 14:25:07 +01:00
Arvid NorbergandGitHub 1fddb7aef1 add new_transaction() to DBWrapper2 which creates a nested transaction, and make write_db() just add writes to the existing transaction (#12275) 2022-07-15 21:07:43 -05:00
Arvid NorbergandGitHub f49777885d use execute_fetchall() instead of execute(), fetchall(), close() in wallet DB queries (#12335) 2022-07-15 03:14:22 -05:00
Amine Khaldi a007cbda69 Merge commit '569d610238ae8096853d0d2bb55c4ba098bf162e' into checkpoint/long_lived_atari_from_main_569d610238ae8096853d0d2bb55c4ba098bf162e 2022-07-12 23:05:58 +01:00
neurosis69andGitHub 569d610238 allow bigger chunks of bind variables per SQL statement (#11596)
* changes for testscenario

* revert change

* implement sqlite version dependent variable

* use parameter at module level, not as instance var

* linefix

* isort, black
2022-05-24 16:18:28 -07:00
Kyle Altendorf b6c5babba3 Merge commit 'd154105a6b35f94649f15bca4e3fb8a11a39e70e' into atari-merge_main_d154105a6b35f94649f15bca4e3fb8a11a39e70e 2022-04-19 22:44:02 -04:00
Arvid NorbergandGitHub a100dda37e new DBWrapper supporting concurrent readers (#10166)
* new DBWrapper supporting concurrent readers

* adress review comments

* fixup default database version, when file doesn't exist

* remove unused argument
2022-03-28 11:58:00 -07:00
Kyle Altendorf 6e93b5a225 Merge commit '05f96670181654415b1ad219d38463228f30b0ce' into atari-merge_main_05f96670181654415b1ad219d38463228f30b0ce 2022-03-16 15:45:37 -04:00
Arvid NorbergandGitHub 874cc23c71 add db validate function to check consistency of blockchain database (#10398) 2022-02-25 08:00:16 -08:00
Kyle Altendorf 4453f32363 Merge commit '2acf03e850fb883dc6ca5a554f5f827097157ac1' (latest main) into atari-merge_main_2acf03e850fb883dc6ca5a554f5f827097157ac1 2022-01-19 10:37:04 -05:00
Arvid NorbergandGitHub 93d967525b revert allow-upgrades configuration option. It makes it significantly more complicated to do proper database migrations (#9768) 2022-01-13 14:53:27 -08:00
Kyle Altendorf d17ce9efab Merge branch 'main' into atari 2021-12-07 21:39:10 -05:00
Arvid NorbergandGitHub 70d31a8c68 V2 database framework (#9442)
* fix block_store benchmark linting issues

* basic support for database versioning

* update benchmark to run v1 and v2
2021-12-03 13:52:10 -08:00
Kyle Altendorf b1abc3df26 Merge branch 'main' into atari 2021-11-27 19:43:42 -05:00
aacdc03188 Sql index changes (#9349)
* make the is_peak index smaller

* condition database updates on a configuration option

* drop unused coin_spent index

* drop redundant index on primary key

Co-authored-by: neurosis69 <83925572+neurosis69@users.noreply.github.com>
2021-11-23 13:23:07 -08:00
Kyle Altendorf 6fdfa59486 add lock parameter to DbWrapper.locked_transaction() 2021-10-12 18:14:04 -04:00
Kyle Altendorf 17228d393a flake8 2021-09-30 19:39:23 -04:00
Kyle Altendorf 1956340484 add DBWrapper.locked_transaction(), use in data store 2021-09-30 18:41:37 -04:00
YostraandGitHub 773adfade5 Lock for all writes (#1758)
* lock for all writes

* use async  with where convinant

* wrapper

* more

* lint

* update wallet

* rl wallet

* indentation

* fix tests

* bad path merged into main

* wallet lock

* refacoted by mistake

* re-raise

* memory/disk inconsistency

* more inconsitency

* asyncio.cancelled is baseexception in 3.8 and 3.9
2021-04-10 19:07:02 -07:00