Commit Graph

4978 Commits

Author SHA1 Message Date
Chris Marslender
745ad49f7d
Random bluebox proofs (#8280)
* get random uncompact proofs from instead of always starting at the earliest uncompact

* Broadcast the messages from full_node to bluebox all at once instead of in multiple requests

* Fix lint issues

* Log when proof replacement is successful

* Remove old "batches_finished" logic
2021-08-31 12:42:06 -07:00
Jeff Cruikshank
5587375c03
RPC updates to support keyring migration and passphrase requirements (#8059)
* Added migrate_keyring daemon RPC support.
Passphrase requirements (min length, empty allowed) are now communicated to callers of the keyring_status RPC.
Refactored the keyring migration code to support interactive and non-interactive modes.

* Minor fixes for error handling during migration

* Cleaned up checking passphrase requirements

* Added a comment explaining why a failure is returned early in migrate_keyring if the keyring is already migrated

* Support for notifying the GUI and daemon when keyring status changes occur, including migration
2021-08-31 10:24:45 -07:00
Gene Hoffman
f18b217e5e
Search for python newest to oldest (#8244)
See https://github.com/Chia-Network/chia-blockchain/issues/8135
2021-08-31 10:22:27 -07:00
Michael Graczyk
461fe82587
Fix type of FileKeyring.keyring_path (#8258)
This type is always non-None as it is assigned in __init__ from a call that returns non-None Path
2021-08-31 10:21:34 -07:00
Arvid Norberg
e32ddb765b
calling SpendBundle.additions() or CoinSpend.additions() runs the CLVM program and parses the conditions outputs. It can be expensive and should not be done willy nilly (#8221) 2021-08-31 08:03:14 -07:00
Arvid Norberg
463b971613
break problematic dependency where the streamable infrastructure depends on Program, G1Element, G2Element and PrivateKey. (#8237) 2021-08-31 08:02:40 -07:00
Arvid Norberg
3f67425d06
simplify the block_tools test facility. We don't need to parse out the full conditions, just know what the total cost of the generator is (#8236) 2021-08-31 08:01:35 -07:00
Arvid Norberg
70fb97c986
make TestCostCalculation deterministic and check against a specific cost (#8274) 2021-08-31 08:01:03 -07:00
paulhainsworth-chia
39ab18cb90
changelog1.2.5 (#8245) 2021-08-27 12:20:50 -07:00
Kyle Altendorf
f3be3897e9
only use the last line of chia version output in installhelper.py (#8239)
https://github.com/Chia-Network/chia-blockchain/issues/8234

The warning that is being output by `chia version` is causing confusion
when trying to parse the version.  This change ignores the warning by
only trying to parse the last line of the output as the version.  Other
changes should be considered such as not outputting the warning for
small commands like `--help` and `version`.

```
$ chia version
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@             WARNING: UNPROTECTED SSL FILE!              @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for '/home/altendky/repos/chia-blockchain/mozilla-ca/cacert.pem' are too open. Expected 0644
One or more SSL files were found with permission issues.
Run `chia init --fix-ssl-permissions` to fix issues.
1.2.5.dev0
```
2021-08-27 10:42:07 -07:00
Chris Marslender
64ba38f3b7
Test install/install-gui scripts (#8241) 2021-08-27 09:27:12 -07:00
Chris Marslender
86fbcf8249
Clean up a few more potential leftover files in chia-blockchain-gui (#8230)
* Clean up a few more potential leftover files in chia-blockchain-gui

* Make shellcheck happy
2021-08-26 20:22:05 -07:00
paulhainsworth-chia
4f8ab5a92b
changelog 1.2.4 (#8229)
* changelog 1.2.4
2021-08-26 16:23:02 -07:00
Chris Marslender
aa68ec2e05
Update chiavdf to 1.0.3 (#8228) 2021-08-26 16:17:24 -07:00
dustinface
4130551b23
cmds|server|util: Fix, refactor and improve SSL permission checks (#8211)
* server|util: Refactor `verify_ssl_certs_and_keys`

Let it take two lists instead of one with an tuple holding optional
paths.

* util: Introduce `get_ssl_perm_warning`

* util: Drop some redundant brackets

* util: Introduce `get_all_ssl_file_paths`

* util: Print warnings for CLI only

* cmds|util: Call `check_ssl` for all CLI commands
2021-08-25 15:32:17 -07:00
wjblanke
a2de2d8f30
up request block rate limit for faster sync (#8204) 2021-08-25 10:25:40 -07:00
Chris Marslender
63860ee467
Update configure testnet commands to set dns introducer (#8205) 2021-08-25 09:23:51 -07:00
Chris Marslender
9c91f9ae5c
Swap back to non-chia notarize-cli (#8199)
* Swap back to non-chia notarize-cli

* Update node for mac to 14.x - newer syntax in PRs on notarize-cli require the new version

* Have cleanup script get rid of our other global node packages so that 12->14 transition works
2021-08-24 14:04:14 -07:00
Kyle Altendorf
a72995495e
Correct * to ** kwargs unpacking in time_out_assert() (#8160) 2021-08-24 10:56:42 -07:00
Arvid Norberg
98b001682f
enable the rust condition checker unconditionally in testnet (#8122) 2021-08-24 10:53:46 -07:00
Yostra
f918669f32
Fix single coin generator (#8185)
* fix single coin generator

* add sha256tree file

* add test for single

* pass it as array

* remove breakpoint
2021-08-24 10:50:40 -07:00
Chris Marslender
f43aa739af
Clean up the GHA mac build to just build and upload to GHA (azure deals with s3 + release workflows) (#8178) 2021-08-23 11:42:10 -07:00
William Blanke
ddf8b0b9ff
updated gui to 80a41d8161 2021-08-23 10:50:02 -07:00
Earle Lowe
a119cd7328
Check AttributeError for non-Optional members during node shutdown (#8109)
* Check AttributeError for non-Optional elements

* Changed to use hasattr
2021-08-20 11:41:34 -07:00
Arvid Norberg
1cc047df1d
tolerate fields replacing network constants in config.yaml that don't exist, but print warning (#8121) 2021-08-19 11:14:42 -07:00
Almog De Paz
c4c14939a5
Sync faster (#7665)
* better concurrency for sync_from_fork_point

* dedup code in wallet

* revert

* lint

* lint

* logs

* lint

* lint

* error handling, async bug fix

* lint

* break fetch if bath failed coroutine

* remove outdated comment

* consolidate duplicate code

* consolidate duplicate code

* notify wallet after each batch

* typo

* add try/catch/finally

* typing, check stale peer

* comment on worker shutdown
2021-08-18 18:26:38 -07:00
Earle Lowe
da5df49f39
New call for logging peer_host (#8108) 2021-08-18 13:02:30 -07:00
Kyle Altendorf
2183709f06
add --paginate/--no-paginate to chia wallet get_transactions (#7977)
* add --paginate/--no-paginate to chia wallet get_transactions

The default remains to paginate if sys.stdout.isatty(), otherwise it
defaults to not paginating.  This addresses cases such as piping and
output redirection to a file where the command previously just hung
while waiting for the user to press c for the next page.

* shorten lines for linting

* avoid BrokenPipeError such as with head

* stop using click's undocumented PacifyFlushWrapper
2021-08-18 10:59:58 -07:00
Arvid Norberg
cd2f9d9d00
remove commented-out debug breakpoint()s (#8114) 2021-08-18 10:13:03 -07:00
Arvid Norberg
d81198384f
fix mempool TX cache cost (#8054)
* fix issue where the cost of the mempool TX cache (for spend bundles that can't be included in a block yet) would not be reset when the cache was emptied

* factor out the Pending TX cache from mempool, to allow unit testing
2021-08-17 23:09:15 -07:00
Chris Marslender
00af150e00
Increase timeout (#8111)
* Increase timeout

* increase timeout to 30
2021-08-17 19:54:50 -07:00
Arvid Norberg
5ee182932e
Rust conditions (#7167)
* use rust implementation of condition checker

* enable rust condition checker at specific block height

* bump switch-over height
2021-08-17 14:57:41 -07:00
arty
2ea15bbda3
Add documentation for treehash params (#8092) 2021-08-17 10:53:49 -07:00
Matt Hauff
1e18dc65fc
Added a py.typed file in the chia directory for pep-561 compliance (#8014) 2021-08-17 10:53:25 -07:00
Matt Hauff
90313d9205
Added an RPC for coin records by multiple coin names (#7920) 2021-08-17 10:52:51 -07:00
Florin Chirica
2ce7c5950c
Use ip.chia.net (#8039)
* Use ip.chia.net

* oops...
2021-08-16 14:12:43 -07:00
Florin Chirica
639d5ee1f6
Enable querying AAAA records for DNS Introducer. (#8008)
* Initial commit DNS ipv6.

* Fix pyblack.

* nit.
2021-08-16 11:35:37 -07:00
Earle Lowe
e4a802da04
Manually update version in package.json (#8057) 2021-08-15 20:32:20 -07:00
Jeff Cruikshank
39fbe2aa17
Create SSL keys/certs with proper permissions, also verify/fix existing installs (#7972)
* Create directories with 755 permissions, SSL certs with 644, and keys with 600.

* Check SSL file permissions during chia_init(). Exits if permissions are incorrect.

* Overwrite certs/keys instead of failing to write

* Skip SSL file permission checks on Windows (requires checking ACLs)

* Check SSL file permissions when creating an ssl_context

* Skip check_ssl on Windows.
Handle some SSLInvalidPermissions exceptions.

* Added a few comments

* Added chia init --fix-ssl-permissions option to attempt to fix SSL file permission issues.
Update imported cert permissions when using chia init -c.
Code cleanup/restructuring.

* Return a tuple instead of a list

* LGTM and other minor fixes

* Fixed SSL test breakage when calling ssl_context_for_client. The ca_crt param was being passed in as both the cert and private key, triggering the permission check failure.

* Don't exit if SSL file permissions issues are found

* Tweak the exception types that are raised from traverse_dict
2021-08-15 15:53:54 -07:00
Matt Hauff
950e78e1f2
Added some new class methods to the Program objects (#8041) 2021-08-13 10:15:25 -07:00
Rostislav Skudnov
7b2aab99c8
Add test of pairing cache for BLS signature verification (#8028)
Co-authored-by: Rostislav <rostislav@users.noreply.github.com>
2021-08-12 12:00:22 -07:00
dependabot[bot]
ab102bb4d9
Bump github/super-linter from 4.5.1 to 4.6.1 (#8015)
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.5.1 to 4.6.1.
- [Release notes](https://github.com/github/super-linter/releases)
- [Commits](https://github.com/github/super-linter/compare/v4.5.1...v4.6.1)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-12 10:34:37 -07:00
dependabot[bot]
b06568a74d
Bump actions/setup-node from 2.3.0 to 2.4.0 (#8016) 2021-08-10 16:06:33 -07:00
dependabot[bot]
ed66c57ced
Bump watchdog from 2.1.2 to 2.1.3 (#8017) 2021-08-10 15:59:35 -07:00
Arvid Norberg
750a2759a3
test agg sig conditions (#7962)
* agg sig conditions always take two args

* extend test a bit, add comment

* unit test agg sig parser where args list is not null terminated

* fix formatting
2021-08-10 15:26:29 -07:00
dustinface
53149f2e57
chia|tests: Introduce PlotManager + some plot loading improvements and fixes (#7848)
* harvester|plotting|tests: Introduce `PlotManager` class

This moves all plots related and plot-directory related stuff from the
harvester into the class `PlotManager`, adjusts all related code
accordingly and adds some extra wrappers there.

* harvester|plotting|tests: Return how many new plots were loaded

* plotting: Fix `failed_to_open_filenames` re-try interval

With `< 1200` it just tries it on the next refresh.

* plotting: Fix and improve duplicates handling

* harvester|plotting: Thread locks for `PlotManager.plots`

* chia|tests: Load plots in batches

* chia|tests: Move plot refreshing into a separate thread

* plotting: Properly handle removed plots

And fix tests accordingly. It seems like this fix https://github.com/Chia-Network/chia-blockchain/pull/3350 wasn't really a fix, rather adjusting to allow for a bug?

* plotting|harvester|tests: Introduce `PlotRefreshResult`

* tests: Expand `test_farmer_harvester_rpc.py`

* chia|tests: Move some stuff from `plot_tools.py` into new file `util.py`

* refactor: Rename `plot_tools.py` to `manager.py`

* chia|tests: Use pure dataclass for `PlotsRefreshParameter`

With `uint16` as type saving to config doesn't work, this is a
preparation for the next commit.

* harvester: Adjust deprecation message, use `info` instead of `warning`

* plotting: Fix typo

* refactor: Rename `filename` to `file_path`

Fits better and does avoid shadowing with filename from outer scope.

* chia|tests: Move some methods from `plotting.manager` to `plotting.util`

* plotting: Make `refresh_callback` mandatory
2021-08-09 10:25:15 -07:00
dustinface
b1ade3ad81
refactor: Introduce write_uint32 and parse_uint32 in streamable.py (#7932)
* refactor: Introduce `parse_uint32` in `streamable.py`

* refactor: Introduce `write_uint32` in `streamable.py`

* tests: Add `test_uint32` in `test_streamable.py`

Adds tests for `write_uint32` and `parse_uint32`
2021-08-09 10:23:44 -07:00
Jeff Cruikshank
a957d660d1
When proxying to a local keychain, don't attempt to communicate over the websocket. (#7949) 2021-08-05 09:45:31 -07:00
dependabot[bot]
fa71f91f4c
Bump bitstring from 3.1.7 to 3.1.9 (#7676)
Bumps [bitstring](https://github.com/scott-griffiths/bitstring) from 3.1.7 to 3.1.9.
- [Release notes](https://github.com/scott-griffiths/bitstring/releases)
- [Changelog](https://github.com/scott-griffiths/bitstring/blob/master/release_notes.txt)
- [Commits](https://github.com/scott-griffiths/bitstring/commits)

---
updated-dependencies:
- dependency-name: bitstring
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-04 13:49:34 -07:00
Jeff Cruikshank
325d7f8245
Keyring passphrase protection (#7249)
* Moved keyring handling into a KeyringWrapper class

* Update click to 8.0.x for prompt_required support

* Renamed KeyringWrapper to _KeyringWrapper

* Expose password management options on Linux

* CLI support for setting/removing a password

* Global option for specifying the master password

* Cache the password instead of setting on the context

* Password bootstrapping during chia init

* Tidying up _KeyringWraper's interface

* Initial pass migrating the legacy keyring contents

* Encryption/decryption of keyring.yaml contents

* FileKeyring backend encrypts with ChaCha20Poly1305

* Tightened up keyring migration and initialization

* Fixed issues identified by linters

* Remove root_path from Keychain

* Prevent double-migration if setting master passwd

* KeyringWrapper tests are mostly complete

* FileKeyring will now honor the service param

* Tests for get/set/delete password

* Formatting/commenting updates

* Writer lock support with tests - WIP

* keyring.yaml is now watched for modifications

* Reader/Writer lock for get/delete password

* Fixed linter issues

* Reader lock tests

* Formatting update

* Hook up CHIA_ROOT support for KeychainWrapper

* Quick fix to address test failures

* Fixed failures when existing legacy keyring exists

* Fixed test failures caused by reusing the same temp dir

* keyring.yaml now lives in ~/.chia_keys by default. Can be overridden with CHIA_KEYS_ROOT or --keys-root-path

* Fixed migration failure when setting a password (not using the default)

* KeyringWrapper now uses supports_keyring_password to determine if a FileKeyring should be used. Patched tests to work regardless of whether supports_keyring_password return False

* The daemon now takes a --have-gui option that will prevent calling check_keys() during startup. If the keyring is locked, we want the GUI to prompt for the password.

* Added is_keyring_locked RPC call

* Added 'unlock_keyring' RPC command

* Added KeychainProxy and KeychainServer to handle RPC messages related to keyring operations. WalletNode no longer directly accesses the Keychain class.

* Turn on macOS support for testing keyring passwords

* Fixed get_key_for_fingerprint to use the ocal keychain if the platform doesn't need to remotely access the daemon's keychain.

Fixed key reconstruction when sent over RPC.

* Farmer now accesses the keychain over RPC

* Fixes for linter issues and some restructuring to support tests that use setup_nodes.py

* Couple of fixes to unblock the GUI from launching when a keyring password is set

* Added a keychain RPC call for add_private_key()

* Added remaining keychain proxy RPC calls for delete_key_by_fingerprint and delete_all_keys

* Check for None when inspecting request arguments

* Run check_keys after unlocking the keyring when the daemon is launched via GUI

* Added check_keys RPC method.
Fixed deserialization of key entropy in get_all_private_keys. This was preventing the GUI from being able to show key details.

* Added get_first_private_key to keychain_server/proxy.
create_plots now uses the keychain proxy when launched from the daemon.

* Added a comment about KeychainProxy in chia plots check

* Workaround import conflict  when importing from 'tests.*' due to fasteners name conflict

* Simulator now uses KeychainProxy if launched by the daemon.
KeychainServer/Proxy now takes keychain user/testing params for testing scenarios.

* Added "set_keyring_passphrase" RPC message

* Reworking KeychainProxy usage to handle local keychain tests and RPC keychain tests.

* Replace my prior usage of asyncio.run() with asyncio.get_event_loop().run_until_complete()

* Silencing file_keyring logging for the moment.

* Updated tests to use test keychains and appropriate BlockTools construction

BlockTools should now be created with create_block_tools(_async) to handle async scenarios.

Updated block_tools to be async compatible

Updated fasteners to fix installation of top-level 'tests' in site-packages

* Added 'remove_keyring_passphrase' RPC message to the daemon

Minor tweak to TempKeyring to default to some test params

* Fixed linter issues

* Remove flake8 ignore statement now that the fasteners module has been updated

* Some initial renaming changes: password -> passphrase

* Fixed wallet RPC issue where get_key_for_fingerprint wasn't awaited-upon.

Fixed legacy keyring initialization (for migration scenarios)

* Fixed improperly merged file

* Fixed linter issues.
More renaming.

* Updated spots that were still using an incorrect keychain call

* Renamed use_password_cache, obtain_current_password

* Renamed supports_keyring_password

* Renamed has_master_password

* Renamed has_cached_password, get_cached_master_password

* Linter fixes

* Renamed master_password_is_valid

* Renamed set_cached_master_password

* Renamed set_master_password

* Renamed remove_master_password

* Renamed has_cached_master_password

* Renaming in file_keyring and keyring_wrapper

Updated default keyring payload used for tests

* Renamed get_password
Other renaming updates

* Renamed set_password
Other renaming updates

* Renamed remaining password occurrences (where appropriate)

* password -> passphrase

* Added tests for setting an emoji and Japanese master passphrase

* Attempt to notify the daemon when a keyring passphrase is set/updated/removed

* Missed one password -> passphrase replacement.

* Fixed some file synchronization issues found when running tests on macOS

* Adjusted timeout values for test_writer_lock_reacquisition_failure for macOS.

* Removed logging statements previously added for debugging

* Prompt for keyring passphrase up-front when launching a service.

Changed --have-gui flag to --wait-for-unlock

* Updated set_keyring_passphrase RPC message to fix optional current_passphrase param when the keyring is using the default passphrase.

* Minor test cleanup to deduplicate some code.

* Fixed regression when setting a new master passphrase

* Minor refactoring and docs/commenting updates

* Renaming password -> passphrase went too far. Keyring backends use password terminology for compatibility with third party backends.

* Disabling macOS support (previously added for testing only)

* Disabling passphrase support in preparation for sending out the PR

* Fixed improper merge (vscode didn't save changes during rebase)

* Update chia/cmds/init_funcs.py

Co-authored-by: Adam Kelly <338792+aqk@users.noreply.github.com>

* skip_check_keys -> should_check_keys

* Shuffling some imports around to break cycles reported by LGTM

* Handle unlocking the daemon if it's already launched and waiting for unlock.

* Replaced uses_keychain_proxy decorator in farmer.py. Fixed async usage of get_reward_targets.

Linter/reformatting fixes

* Replaced uses_keychain_proxy decorator with a clearer method.

* Cleanup the temp keyring dir using shutil.rmtree()

* Restored self._root_path (had been changed to self.root_path)

* Minor cleanup

* ensure_keychain_proxy() now throws if connect_to_keychain_and_validate() fails

* Plot key resolution now yields a PlotKeys object which can be passed into create_plots.

De-indented test_invalid_icc_sub_slot_vdf to keep git blame tidy.

* Added 'keyring_status' daemon RPC message to support the GUI

* Minor changes relating to PR feedback

* Addressed more PR feedback (mostly type annotations)

* Commented-out macOS file keyring usage. This can be re-enabled for testing purposes.

* Addressed test failures that require multiple keyrings in the same process. Each TempKeyring will now set a custom KeyringWrapper instance.

* Fixed logic for communicating user_passphrase_is_set in the keyring_status RPC response.

* Updated type annotations and method signature for set_passphrase to expect a string instead of bytes.

* Fixed Wallet RPC tests

* Fixed full_node_store tests. BlockTools should be created using the create_block_tools(_async) function(s)

* Fixed test failures in test_pool_rpc

* Fixed test_daemon. After BlockTools.setup_plots is run, the config file needs to be re-read to refresh stale plot_directories.

* Suppressing LGTM false positives regarding passphrase leakage in CLI error output. Seems that LGTM sees MIN_PASSPHRASE_LEN as sensitive data.

* Second attempt at suppressing LGTM false positives

* Third attempt at addressing LGTM false positives

* Removed test_keyring_wrapper param from Keychain ctor. Test setup now sets the keyring_wrapper property directly.

* Reformatting

* More targeted update of the test config to refresh just the "plot_directories" value

* More LGTM suppressions

Co-authored-by: Adam Kelly <338792+aqk@users.noreply.github.com>
Co-authored-by: wjblanke <wjb98672@gmail.com>
2021-08-04 12:46:55 -07:00