Commit Graph

183 Commits

Author SHA1 Message Date
Arvid Norberg
1bcf409ee1
single thread executor (#10919)
* add inline executor and an option to run single-threaded

* add option to run test_full_sync in single-thread mode, to include block validation in profiles. Also attempt to speed it up by disabling db_sync
2022-03-28 12:47:46 -07:00
Arvid Norberg
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
Arvid Norberg
ba6eb6af3d
when creating a new blockchain database implicitly, make it v2 (#10498)
* when creating a new blockchain database implicitly, make it v2

* fix config deadlock
2022-03-17 09:09:26 -07:00
arty
4bd8498e5a
Enable clvm_tools_rs by default (#10554)
* Enable clvm_tools_rs by default

* Re-add clvm_tools dep for now as it provides python idioms for interacting with clvm data

* Take lint formatting

* Adam: Try making this non-parallel

* Try fix for threading issue in tests

* Test whether turning off parallel runs causes things to work (temp)

* Test use of temp files in clvm_tools_rs as a candidate solution for atomic replacement of hex output

* Use proper git+https url scheme (oops)

* Update to candidate 0.1.6 so we can test

* Revert version bump to re-test

* Test whether we can re-enable parallelism

* Attempt to mitigate concurrent test running: return own conception of the compiled output.  This will work if the failing path is downstream of recompilation

* fix path to hex file

* Probe for source of 0-length data

* Further exploration: more assertions, hopefully to trigger in the test on ci

* Do an even more paranoid check to verify that we observe a file whose filesystem reported size is much smaller than expected

* Try a heavier handed approach, using heavyweight lockfiles on the filesystem

* Import a simple lockfile implementation and use it to enforce mutual exclusion.  Simplify it and remove the unwanted os traffic

* Take lint, precommit advice, bump to clvm_tools_rs 0.1.6 now that it's released

* Fix lint

* While i was working on this, -n auto was on the command line so i think this didn't actually do anything, but reverting my change just in case

* Lint

* label the hashes re: pr

* Add a lock.py for spot exclusivity using the filesystem (re: adam in the pr) and a convenience wrapper that hides the details

* Formatting warning

* Ensure type info is present and do the obvious return of the inner function's result

* Use double quotes (lint)

* Properly balance blank lines

* Lint: alphabetize imports

* One line is required here (lint)

* Remove unnecessary assignment
2022-03-17 09:08:36 -07:00
Kyle Altendorf
dbeff36ae0
Add configuration locking (#10680)
* Add configuration locking

Extracted from https://github.com/Chia-Network/chia-blockchain/pull/10631

* note that fasteners will likely be replaced by filelock

* Fix test_multiple_writers on macOS

* create_all_ssl() doesn't need to be inside the config access lock

* add warnings about not using async within get_config_lock() get lock contexts

* no need to pre-touch the lock file

* .yaml.lock instead of just .lock

* test_multiple_writers() is sync

* Revert "add warnings about not using async within get_config_lock() get lock contexts"

This reverts commit 681af3835b.

* reduce lock context size in chia_init()

* use an exit stack in load_config()

* avoid config existence precheck

* only lock around the read in load_config()

* do not raise e, just raise

* tidy new imports

* fix queue empty check in test_config.py

* remove commented out code in test_config.py

* remove unused import

Co-authored-by: Jeff Cruikshank <jeff@chia.net>
2022-03-12 06:52:47 -08:00
Jeff
75ed1307e5
Fix exception when chia keys migrate is run without needing migration (#10655)
* Fix exception when `chia keys migrate` is run without needing migration

* Linter fixes
2022-03-11 16:23:24 -08:00
Johannes Tysiak
e8ff5a32a7
fix initial-config typo - log_maxbytesrotation (#10598) 2022-03-10 11:10:28 -08:00
Juraj Oršulić
05f9667018
Allow CAT autodiscovery, refactor CAT default naming (#10308)
* Allow CAT autodiscovery

* Add wallet autodiscovery test

* Use dict get for automatically_add_unknown_cats with default false

* Refactor name generation for new CATs into one place

* Remove hardcoded default cat wallet name from wallet rpc test

* initial-config.yaml comment nit
2022-03-04 08:27:15 -08:00
Kyle Altendorf
c6978f07b1
correct multiprocessing start method logging, add python_default (#10547)
* correct multiprocessing start method logging, add python_default

* todo -> regular comment
2022-03-04 07:46:54 -08:00
Kyle Altendorf
50857caf8c
make multiprocessing start method configurable (#10528)
* make multiprocessing start method configurable

* forkserver

* corrections

* fixup

* optional

* more optional

* stop attempting anchors in the yaml

* rework config handling

* comment
2022-03-03 10:27:36 -08:00
dustinface
fdb993cb10
streamable: Cache stream functions (#10419)
Apply the same pattern as we have for deserialization to serialization.

This avoids all those recursive runtime lookups for "how to stream this
object" which brings a nice speedup:

```
compare: benchmark
mode         | µs/iteration old | µs/iteration new | diff %
to_bytes     | 447.57           | 193.56           | -56.75

compare: full_block
mode         | µs/iteration old | µs/iteration new | diff %
to_bytes     | 110.32           | 61.09            | -44.62
```
2022-02-25 08:07:24 -08:00
Arvid Norberg
874cc23c71
add db validate function to check consistency of blockchain database (#10398) 2022-02-25 08:00:16 -08:00
Kyle Altendorf
89740234e7
spawn (not fork) for multiprocessing (#10322)
* spawn (not fork) for multiprocessing

* just append _worker to existing process names

* return properly in getproctitle()

* black

* ignore for unhinted getproctitle()

* Add comments about the setting of the multiprocessing start method
2022-02-24 20:08:06 -08:00
dustinface
8eb2a29834
streamable: Enable flake8 and pylint (#10355) 2022-02-22 12:42:05 -08:00
Arvid Norberg
58019afd5b
chunk coin_store request into smaller sql queries (#10359)
* chunk coin_store request into smaller sql queries, to not exceed the limit of 999 on old versions of sqlite

* extend tests for chunks
2022-02-21 20:07:05 -08:00
Patrick Maslana
e35174c268
Fixed two typos in the initial-config.yaml (#10357)
* Fixed two typos in the initial-config.yaml

* Changed the letter case for a word.
2022-02-21 09:19:47 -08:00
Kyle Altendorf
e3fb3ce96e
Move black from SuperLinter to upload workflow, use 21.12b0 in pre-commit (#10103)
* black==21.12b0 in pre-commit

Match `setup.py`.

* move black from super linter to upload workflow

* black (updated)

* configure so black . works

* --check --diff for black
2022-02-20 21:33:09 -08:00
dustinface
3608d25c80
type_checking: Drop some redundant None checks (#10334) 2022-02-20 21:30:57 -08:00
Amine Khaldi
b544e75cd7
Align the wallet node's weight proof timeout with the full node's value. (#10341)
* Align the wallet node's weight proof timeout with the full node's value.

* Give the wallet config its own weight_proof_timeout value.

* Apply Kyle's cleaner version.

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

* Apply Kyle's anchors suggestion.

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-02-20 21:28:43 -08:00
Chris Marslender
5e4c1a1f62
Timelord RPC + Misc Metrics Updates/Fixes (#10255)
* Add mempool_max_total_cost to RPC

* Add signage_point event

* Fix incorrect crawler RPC port lookup

* Set up initial timelord RPC server + finished_pot_challenge event

* Add new compact proof event

* Add skipping/new_peak to track when fastest or not

* Check for None on change_data

* Add skipping_peak + new_peak to changes for metrics

* Convert chain to value

* Rename iters

* Timelord RPC to 8557 - 8556 is used in simulation tests

* Make tests work with RPC server on timelord

* Change event name to finished_pot

* Use broadcast_farmer object

* Move state changed for `finished_pot` after proofs_finished.append

* Fix type on ips var + add vdf_info and vdf_proof

* fix event name on the state_changed function
2022-02-18 07:43:52 -08:00
Kyle Altendorf
47a0a9101c
apply isort (#10280) 2022-02-17 19:46:51 -08:00
Kyle Altendorf
f6e479cc07
Improve StructStream hints to support decimal and other parameters like int itself (#9949)
* Improve StructStream hints to support decimal and other parameters like int itself

* get SupportsIndex from typing_extensions
2022-02-17 07:35:13 -08:00
Arvid Norberg
34159d3529
optimize get_block_generator() (#10104)
* optimize get_block_generator()

* add a v1 compatible get_generator() to speed up get_block_generator() with v1 databases. Add test. Add error log in case generator_from_block() fails.

* speed up test_full_block_utils
2022-02-17 07:32:29 -08:00
Kyle Altendorf
cc63c7017b
Remove deprecated initial_num_public_keys_new_wallet from initial-config.yaml (#10221)
231ef6faf2/CHANGELOG.md
> Fixed issues where the wallet code would not generate enough addresses when looking for coins, which can result in missed coins due to the address not being checked. Deprecated the config setting initial_num_public_keys_new_wallet. The config setting initial_num_public_keys is now used in all cases.
2022-02-14 12:53:47 -08:00
Kyle Altendorf
884ebd902b
remove chia.util.clvm pass-through file (#10130)
* remove chia.util.clvm pass-through file

* in tests too
2022-02-14 12:52:14 -08:00
Chris Marslender
eb3ed142e0
Crawler RPC (#10141)
* Add crawler RPC server

* Generate private keypair for crawler

* Bring over cleanup changes from the last closed PR

* Update the crawler RPC information to be its own subsection within seeder

* Add sleep before crawling to let the daemon connection get set up

* Wait for the actual callback to not be None, instead of just a random sleep interval

* Rework crawler/dns seeder to use the daemon + normal chia start process rather than the old system intended for the standalone repo

* Update configure testnet to work with seeder config

* Add back the crawler/seeder options from the standalone version

* Remove the check for none/sleep. Not needed when this is started by the daemon

* Add real data to the get_peer_counts endpoint

* Lint

* Fix calls to configure from init

* Turns out we still might sometimes move too quick before daemon/state changed callback is ready

* Add peer counts in the state_changed callback method

* Add a setting for peer_connect_timeout in the seeder: section so we can control it just for crawler

* start_seeder

* Pass config/root_path to the DNSServer so it can also use the configured crawler DB Path

* change in () instead of if/or

* Remove unnecessary return
2022-02-14 11:48:35 -08:00
Mariano Sorgente
7fa1861def
Ms.wallet refactor (#10146)
* wallet fixes

* Don't show false positive synched

* Code cleanup and lint

* Fixes

* Revert issue

* Fix reorg issue

* WIP wallet node

* More wallet refactor

* More wallet changes

* More

* Fix subscription bugs

* Fix some tests

* Fix pool tests

* More tweaks

* Lint and small issues

* call update_ui at the correct points

* Small changes

* new peak queue

* Fix peer height issue

* Rollback more for safety, and tweak logging

* Small WSM style fixes

* Change fork point in long_sync

* More fixes with real world testing

* Fix reversed filter

* Fix function name

* Fix coin store bug properly

* Raise CancelledError

* Fix rollback issue

* Lint

* Small fix

* Fix CAT issue

* Fix test trades race condition

* Fix test trades race condition

* Try to reduce flakiness

* Test coin store and fix additional method

* Improve flakiness
2022-02-14 11:28:36 -08:00
Kyle Altendorf
b5f3122fc6
import ConsensusConstants from actual definition (#10131) 2022-02-07 13:15:35 -08:00
Jeff
f67ca2c5a3
STANDALONE_ROOT_PATH now expands to a different env variable to avoid (#10114)
conflicting with DEFAULT_ROOT_PATH when CHIA_ROOT is set. When the GUI
launches chia services, CHIA_ROOT is set, which was preventing the
wallet backend from copying existing DBs from the standalone_wallet.
2022-02-07 11:06:36 -08:00
Jeff
f2fe1dca62
Support for performing incremental legacy key migration. (#10085)
* CLI support for performing an incremental keyring migration. This handles the case where new keys were created by an older client or the light wallet, and those keys then need to be moved to keyring.yaml.

* Opportunistically perform a silent incremental keyring migration when the GUI unlocks the keyring.

Track when keyring migration occurs so that we don't needlessly attempt on each GUI launch. ~/.chia_keys/.last_legacy_migration will contain the app version that last attempted migration.

* Formatting & linter fixes

* Tests for `chia keys migrate`. Missing a test for incremental migration.

* Additional keyring migration tests

* Formatting updates from black in files unrelated to this branch.

* Revert "Formatting updates from black in files unrelated to this branch."

This reverts commit a85030e8e0ea7406683efd8ae41e224c861e08ff.

* Exit loop if remaining_keys <= 0

* Linter fix? Manually making this change as black doesn't identify any issues locally.

* Linter fix again...
2022-02-04 16:43:51 -08:00
Jeff
eaa6b8beab
Rename migrated standalone_wallet wallet DB to v2 (#10086)
* Rename migrated standalone_wallet wallet db to use '_new.sqlite' suffix

* Removed unnecessary format string

* Wallet DB is now named "v2" instead of "_new"
2022-02-04 09:49:20 -08:00
Chris Marslender
677e25fd02
Add data to wallet RPCs to support metrics (+ update log_exceptions helper) (#9996)
* Send coin_added event to metrics

* Add fingerprint to balance response

* Don't consume the exception by default, but enable for the metrics data usecases

* Pass sync_changed event to metrics

* bare raise
2022-01-31 18:53:43 -08:00
wjblanke
442a83e968
change lite wallet peers from 5 to 3 (#9994) 2022-01-28 19:17:14 -08:00
Yostra
ca84fa9f8d
Sync improvements (#9974)
* stash

* change log level

* stash changes

* cat tests

* add node id chia show

* make max sibscribe items configurable

* lint

* add logs for limits

* paralelize incluzion valdiation, don't diconnet from remote peers until local peer in synced

* wallet rate limit

* test log lvl, trusted, black

* only validation under semaphore

* flake mypy trade test

* reduce flakyness

* merge fix

* rename

* linting

* validate parallel, apply serial

* reduce falkyness

* lint

* Fix CAT tests

* black

* flaky test, total amount

* fix cat test

* skip existing state

* skip existing

* try other caches

* flake8

Co-authored-by: Matt Hauff <quexington@gmail.com>
Co-authored-by: William Blanke <wjb98672@gmail.com>
2022-01-28 19:16:47 -08:00
Chris Marslender
cbbdb6510a
Adding additional data to RPCs for metrics (#9945)
* Add "metrics" as an additional destination for get_blockchain_state changes

* Add compact/uncompact blocks to get_blockchain_state

* Add total mempool cost to blockchain state

* Add hint count to blockchain state

* Add info about max cost, block_cost, and block_fees

* Add mempool min fee to blockchain state

* Add dict for mempool fee estimates

* dont start key with number

* Move max block cost to blockchain state

* Add generic exception logging util

* Catch/log any exceptions in counting hints

* Fix inconsistent key

* Assert row is not none

* Move block count metrics to a new endpoint

* report on block instead of unfinished_block for metrics

* Mark the block event with bool for if transaction block or not

* Add some basic tests for counting hints

* Add some basic tests on counting compact/uncompact blocks

* Fix lint

* Add k-size

* Add timestamp

* Add header_hash + height
2022-01-27 18:42:49 -08:00
Arvid Norberg
2bb591c681
default log rotation to 50 MB (instead of 20) and make it configurable (#9986) 2022-01-27 15:54:20 -08:00
Matt Hauff
0c8727f469
Remove wallet-only as a service group (#9935) 2022-01-26 17:21:08 -08:00
Yostra
b08c904ebf
migration (#9948) 2022-01-26 17:19:42 -08:00
Arvid Norberg
a501c53228
default new installs to use v2 blockchain database schema (#9951)
* default new installs to use v2 blockchain database schema. Leave an option to initialize a v1 database

* rename default database file to say v2
2022-01-26 17:14:05 -08:00
Mariano Sorgente
4708db1b2c
Set reserved cores to 0 (#9790)
* Set reserved cores to 0

* Change reserved cores to 0.

* Remove wallet config since it's unused
2022-01-23 21:52:10 -08:00
Kyle Altendorf
5f4e39480e
Fix streamable for Python 3.10 (#9918) 2022-01-23 21:44:51 -08:00
Mariano Sorgente
f0a6189f2d
Move BLS validation to other processes during sync (#9746)
* Try putting BLS in multiprocess

* Fix test

* Fix test again

* Fix test again ^ 2

* Don't use cache unless necessary, cleanup of unused code.

* WIP fixing tests

* Blockchain tests passing

* Remaining tests and lint

* More test fixes

* Fix full_node_rpc test

* Fix remaining tests

* Correct boolean

* Don't validate sig if CLVM fails. Also testing signature validation properly

* Simplify block prevalidation API and improve tests

* Fix logic error and remaining tests

* Update comments and change to AssertionError

* Try to improve CI performance

* Fix mempool test, try to fix test_blockchain performance

* Set default argument to fix test

* Fix DB conversion test

* Use cache for validating signatures (#9859)

* Use cache for validating signatures

* comments: fix typo

* Don't rerun the super slow part of the test (#9887)
2022-01-20 14:50:41 -08:00
Matt Hauff
2e3c054c3a
Add remaining offer code to main (#9886)
* Add remaining offer code to main

* Fix compression test

Co-authored-by: Jeff <paninaro@gmail.com>
2022-01-20 14:49:31 -08:00
Kyle Altendorf
2acf03e850
Default connect_to_unknown_peers to True (#9864) 2022-01-18 20:17:44 -08:00
Arvid Norberg
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
Chris Marslender
516f5639db
Add testnet10 config (#9805)
* Add testnet10 config

* Add testnet10 to missed files

Co-authored-by: Jack Nelson <jack@jacknelson.xyz>
2022-01-13 13:13:05 -08:00
Yostra
89f15f591c
Merge standalone wallet into main (#9793)
* wallet changes from pac

* cat changes

* pool tests

* pooling tests passing

* offers

* lint

* mempool_mode

* black

* linting

* workflow files

* flake8

* more cleanup

* renamed

* remove obsolete test, don't cast announcement

* memos are not only bytes32

* trade renames

* fix rpcs, block_record

* wallet rpc, recompile settlement clvm

* key derivation

* clvm tests

* lgtm issues and wallet peers

* stash

* rename

* mypy linting

* flake8

* bad initializer

* flaky tests

* Make CAT wallets only create on verified hints (#9651)

* fix clvm tests

* return to log lvl warn

* check puzzle unhardened

* public key, not bytes. api caching change

* precommit changes

* remove unused import

* mypy ci file, tests

* ensure balance before creating a tx

* Remove CAT logic from full node test (#9741)

* Add confirmations and sleeps for wallet (#9742)

* use pool executor

* rever merge mistakes/cleanup

* Fix trade test flakiness (#9751)

* remove precommit

* older version of black

* lint only in super linter

* Make announcements in RPC be objects instead of bytes (#9752)

* Make announcements in RPC be objects instead of bytes

* Lint

* misc hint'ish cleanup (#9753)

* misc hint'ish cleanup

* unremove some ci bits

* Use main cached_bls.py

* Fix bad merge in main_pac (#9774)

* Fix bad merge at 71da0487b9

* Remove unused ignores

* more unused ignores

* Fix bad merge at 3b143e7050

* One more byte32.from_hexstr

* Remove obsolete test

* remove commented out

* remove duplicate payment object

* remove long sync

* remove unused test, noise

* memos type

* bytes32

* make it clear it's a single state at a time

* copy over asset ids from pacr

* file endl linter

* Update chia/server/ws_connection.py

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: Matt Hauff <quexington@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-01-13 12:08:32 -08:00
Arvid Norberg
c143b71c22
log the synchronous mode used to open the blockchain database in (#9781) 2022-01-11 15:32:05 -08:00
Kyle Altendorf
e498a406a0
Make the hard coded 2 reserved cores configurable (#9709)
* Make the hard coded 2 reserved cores configurable

* add missing reserved_cores parameters

* add missing reserved_cores parameters
2022-01-10 20:58:29 -08:00
Kyle Altendorf
7af4a58b63
DaemonProxy request IDs should be hinted as strings (#9584) 2021-12-16 15:13:41 -08:00