Commit Graph

1076 Commits

Author SHA1 Message Date
Sebastjan Trepca
f4204de752
get_wallet_balances (#15367)
* added get_wallet_balances rpc api

* whitespace

* get_wallet_balances for GUI convenience

* test for specified ids

* wait for bundles to get into mempool
2023-05-31 11:28:40 -05:00
dustinface
1141f1cdbd
wallet: Refactor WalletStateManager.get_keys (#15361)
* wallet: Refactor `WalletStateManager.get_keys`

* Test `WalletStateManager.get_private_key`
2023-05-24 16:49:36 -05:00
Arvid Norberg
ff226e8cb7
make sure tests that use BlockTools use a single source of consensus constants (#15364)
make sure tests that use BlockTools use a single source of consensus constants. This is in preparations for being able to run tests with different sets of constants, e.g. the hard-fork constants
2023-05-23 12:02:28 -05:00
dustinface
e9a260f3d9
wallet: Implement /get_coin_records RPC command (#15100)
Implement RPC command `get_coin_records`
2023-05-23 04:45:49 -05:00
dustinface
c5714b1720
wallet: Fix filter imports (#15325) 2023-05-18 13:19:57 -05:00
Matt Hauff
d9aedb5494
Fix flaky VC test (#15289)
* Fix flaky VC test

* mypy

* fix coverage
2023-05-17 10:23:46 -05:00
Matt Hauff
4603b9d768
Decorrelate forwards_compat and reuse_puzhash from trade test params (#15287)
Decorrelate forwards compat and reuse_puzhash from trade test params
2023-05-15 19:50:56 -05:00
Matt Hauff
598450f320
Pass VC fee parameter all the way through and check balances in tests (#15286)
Pass fee all the way through and check balances in tests
2023-05-15 19:49:31 -05:00
Kronus91
d5a56f756e
Add type filter for get_transactions (#15196)
* Add type filter for get_transactions

* Resolve comments

* Improve unit test

* Resolve comments

* Resolve comments
2023-05-15 10:19:06 -05:00
Matt Hauff
c1c4f99f6c
Introduce Verifiable Credentials Primitive (#15059)
* First crack at VC puzzles

* Add p2_puzzle_or_hidden_puzzle

* First crack at drivers

* Basic test infra

* compile clsp and test covenant layer

* lint

* Add test for match_covenant_layer

* Add tests for DID TP

* Add tests for DID backdoor

* Add tests for p2_puzzle_or_hidden_puzzle

* Change DID backdoor -> p2_puzzle_w_auth + did_puzzle_authorizer

* Add a VerifiedCredential class

* Make p2_puz_or_hidden_puz viral

* Add morpher solution to covenant layer

* Add capability to update the proofs of a VC

* update_proofs -> do_spend

* Finish lifecycle of VC

* Make backdoor puzzle, remove p2_puzzle_w_auth from stack

* Extract p2_puzzle_w_auth to its own files

* lint

* rework launch process so it works after revocation

* Add some extra tests for the final state after revocation

* Add cost logging

* slight opimizations

* python comments and ergonomic improvements

* Comments for chialisp

* Add VC wallet and store infra

* Add a negative test for updating proofs w/o DID

* First crack at CR CAT

* Turn two hashes into one

* Extract some shatrees out of puzzle hash creation

* Add a stager function

* Precalculate initial_singleton_inner_puzhash_hash

* Add another stager

* Refine stagers

* Add cost logging and assert provider is authorized

* Add sketched out CRCAT class

* black

* Test most of CRCAT drivers

* lint

* Remove an unnecessary param

* Don't commit to singleton ID in parent morpher

* Extract DID to ownership layer

* lint

* use intitial puzzle hash for covenant as proof to morpher

* Collapse hash of parent morhper

* Remove stagers

* Rename some params

* Use SELF_HASH construct

* remove dependency on shatree

* Minor optimization of curried hashes

* Balance tree

* hint -> remark

* Make a v2 ownership layer for cost-sake

* (WIP) Migrate to tp hash at ownership layer

* (WIP) Return tp_hash from tp

* use a stager again

* use constants for ints

* use more constants

* inline a function, get rid of constant

* Switch to tree metadata on ownership layer

* Impelement wallet launch vc

* Minor fixes and rename a bunch of stuff

* lint

* Fix tests

* First crack at proof checking

* Remove unused imports

* Merge tests to get better coverageg

* Fix is_vc methods

* pre-commit

* pre-commit again

* Implement VC spend

* make sql pre-commit check work with git worktrees

* CRCATWallet

* Comment reasoning in script file

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

* Add a concept of VCProofs

* Show proofs in vc_get_vc_list as well

* Implememnt CRCAT wallet

* Extend lineage store

* Make tests pass

* WalletIdentifier fix

* Add revocation RPC

* forgotten bytes32

* Return coin name with vc record

* First crack at adding VC authorizations to offers

* Add CROuterPuzzle

* Fix wallet_funcs.py

* VCWallet changes only

* Fix wallet db schema test

* Add RPC client methods and tests

* Allow a path for user to clear VC

* Mint VC command

* Get VCs command

* Forgotten hex compilation

* Automatically fetch DID when we have it

* Update Proofs command

* Add Proof Reveal command

* Get Proofs For Root command

* Revoke VC command

* Chialisp pre-commit cleanup

* Deprecate as_python()

* Add a limit to some sql queries

* Fix some bad imports

* Fix changed wallet sync function

* Check for tail condition amounts in CAT spending

* Add RPC docs

* only need one mojo for a singleton

* Fix comment

* remove create_puzhash from add_new_wallet

* Remove create_tandam_xch_tx

* fix wallet_state_manager hinting

* Rename RPCs

* Use streamable classes for RPC request parsing

* add back accidentally deleted method call

* Remove unnecessary copy() call

* Add negative test for using wrong DID to update proofs/revoke vc

* Add negative test for making sure invalid proofs can't be proven

* Add negative test for trying to piggyback on top an unrelated VC spend

* Make output_amount a uint64

* some chialisp bug fixes

* chialisp readability improvements

* Force same provider on provider update of DID

* typo in EML

* Add vc_wallet folders to package list

* mypy

* Increase test coverage a bit

* Add a bit more coverage

* rework wallet creation

* Delete is_addition_relevant

* Coveralls ignores

* remove brick reference

* coveralls-ignore --> pragma: no cover

* Couple more ignores

* typo corrections

---------

Co-authored-by: ytx1991 <t.yu@chia.net>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-05-11 19:09:05 -05:00
dustinface
c20c19387b
wallet: Fix coin state sorting (#15124) 2023-05-11 19:05:50 -05:00
dustinface
951158d7f5
wallet: Implement WalletPuzzleStore.delete_wallet (#15125) 2023-05-11 19:04:31 -05:00
dustinface
0c4222f83e
wallet: Implement WalletCoinStore.delete_wallet (#15127) 2023-05-11 19:04:01 -05:00
Earle Lowe
360bf2d59a
Add basic test for get_farmed_amount wallet RPC (#15208)
* Add basic test for get_farmed_amount RPC

* remove unused line

* simplified test

* add a tx with a fee for get_farmed_amount test

* minor cleanup

* Apply suggestions from code review

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

* Some updates from PR comments

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-05-10 17:59:30 -05:00
dustinface
2983b99590
tests: Fix assert_tx_amounts in test_wallet_rpc.py (#15113)
* Fix `assert_tx_amounts`'s change condition

* Add a test case with `select_coin=True` without change
2023-05-09 15:57:07 -05:00
dustinface
5072f1825f
tests: Simplify block generation in test_did.py (#15122) 2023-05-09 15:56:35 -05:00
Matt Hauff
77ea3cf663
Subscribe to the change children of CATs (#15176)
* Subscribe to the change children of CATs

* Address comments by @xdustinface

* capitalization

* type: ignore specific

* spin up only one wallet
2023-05-08 20:49:11 -05:00
Matt Hauff
0346bddebe
Hint to CAT change (#15179)
* Hint to change

* Change cat test

* fix test_cat_spend test memo check

* Fix memos assertion again
2023-05-04 13:17:20 -05:00
dustinface
67910197eb
wallet: Improve WalletCoinStore.get_coin_records (#15099)
Improve `WalletCoinStore.get_coin_records`
2023-05-03 00:31:52 -05:00
dustinface
994aa24e44
wallet: Give Payment.memos a default value (#15172) 2023-05-03 00:30:53 -05:00
dustinface
f902655efc
wallet: Implement WalletNFTStore.delete_wallet (#15128) 2023-04-27 09:55:53 -05:00
dustinface
aa40fa7f21
wallet: Drop AmountWithPuzzlehHash, use Payment instead (#15019) 2023-04-27 09:52:27 -05:00
Kyle Altendorf
2ed75d47f3
more mypy platforms in ci (#12299)
* more mypy platforms in ci

* check not checks

* oh yeah, activate...

* add 3.11

* adjust job names

* actually use the right python version for install

* adjust for 3.7 hinting support

* exclude macos 3.7 and macos arm 3.8

* back to 3.8 for now

* major_dot_minor

* oops

* move ignore comments for 3.7

* and more
2023-04-27 09:51:18 -05:00
dustinface
4c7f7e7d23
wallet: Implement WalletCoinRecord.to_json_dict_parsed_metadata (#15108) 2023-04-25 11:21:10 -06:00
dustinface
c2fac95aa1
tests: Fix flaky test_long_sync_untrusted_break (#15088) 2023-04-24 12:48:50 -06:00
Amine Khaldi
cf44101bc6
Use "item" instead of "spend" in mempool's items functions names (#15103)
Use "item" instead of "spend" in mempool's items functions names.

With this we're consistent with mempool's internal items map (_items) and _row_to_item as well as the return types.
2023-04-24 12:45:37 -06:00
Kronus91
24019e35bb
Add DID CLI (#15065)
* Add DID CLI

* minor fixes

* build fix

* resolving comments

---------

Co-authored-by: Sebastjan Trepca <trepca@gmail.com>
2023-04-24 12:44:43 -06:00
dustinface
04abd86555
wallet: Fix, simplify and test TransactionRecord.is_valid (#15048)
* Add `minimum_send_attempts`

* Fix `MempoolInclusionStatus` check

* Fix error access

* Fix error check

* Simplify

* Test `TransactionRecord.is_valid`
2023-04-18 11:28:50 -05:00
dustinface
5d514487e3
tests: Drop some unused code in test_puzzle_store.py (#15047) 2023-04-18 11:28:25 -05:00
Matt Hauff
e5b94d34a0
Chialisp file extensions (#14996)
* Rename chialisp file extensions

* Add pre-commit check for .clvm files

* Delete sha256tree files

* remove hash files in favor of central dictionary

* Add check for missing files like hex and hash entries

* Enhance clsp pre-commit check

* Actually check hash matches

* Update tools/manage_clvm.py

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

* Update tools/manage_clvm.py

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

* Fix Windows file writing

* Fix setup.py package_data fields

* Load hash dict at runtime

* Move away from exception pattern

* Bad equality check

* Minor fixes

* remove trailing whitespace fix

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-04-18 11:27:17 -05:00
dustinface
d9be2004c7
wallet: Some cleanup of WalletNode.fetch_puzzle_solution (#14896)
* wallet: Introduce `WalletNode.get_coin_spend_for_coin_state`

* Rename `fetch_puzzle_solution` and `get_coin_spend_for_coin_state`

* Free `fetch_coin_spend` and `fetch_coin_spend_for_coin_state`
2023-04-18 11:26:52 -05:00
dustinface
4f7e2ff8c3
util: Cleanup Tuple[Optional[Err], ..] returns in condition_tools.py (#15009) 2023-04-14 15:20:36 -06:00
dustinface
3cd782be36
wallet: Some rework/cleanup of weight proof validation (#14572)
* Drop unused `List[SubEpochSummary]` return

* Drop unused `SubEpochSummary` return

* Raise in `WalletWeightProofHandler.validate_weight_proof`

* Move validation logs

* Set the new weight proof inside `fetch_and_update_weight_proof`

Which was `fetch_and_validate_the_weight_proof` before.

* Drop `WalletWeightProofHandler._weight_proof_tasks`, just await them

Doesn't seem to make a lot sense to have a list of tasks where we always 
just add a task, await it and remove it after. This happens in the long 
sync so to parent task will cancel the awaited task anyway.
2023-04-14 15:18:25 -06:00
Adam Kelly
4b594637c0
Rename singleton helper functions (#14983)
* Rename singleton helper functions

* Amend abbreviation in Singleton Puzzle creation functions
2023-04-12 11:34:08 -06:00
Kronus91
a998ea48d8
Add new coin_type & metadata to coin_records (#15013)
* Add new coin_type & metadata to coin_records

* Remove unrelated changes

* Fix pre-commit

* Remove unrelated changes

* Fix pre-commit

* Add get_coin_records_between

* Fix field data type

* Resolve comments

* Fix unit test

* Remove unrelated changes

* Remove unrelated changes
2023-04-12 11:30:08 -06:00
dustinface
f3e165fc21
wallet: Enable and fix more mypy in wallet_node.py (#14913) 2023-04-07 05:16:12 -05:00
dustinface
a0659e923e
data_layer: Simplify wallet get and create code (#14878)
* Apply `final` decorator to `DataLayerWallet`

* Simplify `DataLayerWallet.create_new_dl_wallet`

* Simplify `DataLayerWallet.create`

* Improve `WalletStateManager.get_dl_wallet`

* More use of `WalletStateManager.get_dl_wallet`

* Only try `get_dl_wallet`
2023-04-05 12:56:39 -05:00
dustinface
cc6ff836cf
wallet: Introduce WalletIdentifier (#14964) 2023-04-04 00:08:10 -05:00
dustinface
f90de71c9a
wallet: Raise in WalletNode.get_full_node_peer and move some of its calls (#14842)
wallet: Raise in `WalletNode.get_full_node_peer` + move some calls of it
2023-04-03 11:27:38 -05:00
dustinface
4dcbbda01e
wallet: Rename add block/state methods (#14460)
* `WalletBlockchain.receive_block` -> `WalletBlockchain.add_block`

* `receive_state_from_peer` -> `add_states_from_peer`

* `receive_and_validate` -> `validate_and_add`
2023-04-03 09:52:35 -05:00
dustinface
5e3bf65abb
wallet: Improve balance caching (#14631)
* wallet: Improve balance caching

* Fix missing entries in `get_balance` RPC and add a test for it

* Fix comment
2023-04-03 09:52:11 -05:00
dustinface
e8e8e0d709
wallet: Improve coin state retry wait logic and retry store test (#14911)
* wallet: Improve coin state retry wait logic and improve retry store test

* Avoid sleeping after uncatched exceptions

* Sleep only at the beginning since we have reduced timeout now in tests
2023-04-03 09:51:13 -05:00
Sebastjan Trepca
123d695c4e
slightly faster nft complex offer tests (#14847)
* slightly faster nft complex offer tests

* cached bundle, faster offer matching

* nft metadata test fix

* more optimizations

* use get_nft_count method in tests

* use counts in bulk minting, avoid sleep

* flake

* offer cache fix

* forward compat param, max int16

* only parse programs with pairs

* cache offer data on method call, not init

* black
2023-03-28 11:46:09 -05:00
dustinface
5e5395305d
wallet: Drop some parameters from WalletStateManager.add_new_wallet (#14919) 2023-03-27 18:07:19 -05:00
dustinface
d83a6f8d14
consensus: Rename add block method/enum (#14459)
* `ReceiveBlockResult` -> `AddBlockResult`

* `Blockchain.receive_block` -> `Blockchain.add_block`
2023-03-27 12:57:37 -05:00
dustinface
9b608f40f9
wallet: Drop WalletCoinStore.get_multiple_coin_records (#14862) 2023-03-27 10:16:33 -05:00
Amine Khaldi
8afba0814d
Remove no longer needed cost_per_byte cases (#14850)
Remove no longer needed cost_per_byte cases.
2023-03-24 18:29:50 -05:00
Kyle Altendorf
8cdaacf23c
increase wallet.nft_wallet test job timeout to 70 minutes (#14881)
from https://github.com/Chia-Network/chia-blockchain/actions/runs/4455716184/usage i see macos with nominal low 40s runtime and outliers into the low 50s, windows has a wider variance with highs in the low 50s and 8'ish hung runs that timed out at the 75 minute timeout, linux looks like 30'ish with a high of maybe 36.
2023-03-24 02:17:53 -05:00
Arvid Norberg
8dbfc4840a
enable soft-fork2 conditions (incl. ASSERT_BEFORE) (#14733)
* enable soft-fork2

* add blockchain (consensus) test for time-lock conditions (non-ephemeral spend)

* introduce new soft-fork rule to compare ASSERT_SECONDS_* conditions against the previous transaction block's timestamp (to be consistent with ASSERT_HEIGHT_* conditions)

* bump chia_rs. This updates the mempool rules to disallow relative height- and time conditions on ephemeral coin spends

* implement assert_before in mempool_check_time_locks. Extend ephemeral coin test in blockchain with assert_before conditions

* implement support for assert_before conditions in compute_assert_height()

* support assert-before in mempool

* add timelock rule

* address review comments
2023-03-23 11:30:10 -05:00
Adam Kelly
15d338976d
Add placeholders for DAO Wallet directories (#14858) 2023-03-22 04:47:32 -05:00