Commit Graph

123 Commits

Author SHA1 Message Date
Matt Hauff
000499484d
Add the option for arbitrary conditions to make_solution (#15888)
* Add the option for arbitrary conditions to make_solution

* Unknown conditions should come first

* Fix related VC driver bug
2023-08-18 14:04:27 -05:00
Matt Hauff
a545e6a8a7
Introduce TXConfig and CoinSelectionConfig (#15666)
* Explore TXConfig

* test fixes

* more test fixs

* more test fixs

* Make TXConfig a CoinSelectionConfig subclass

* Move RPC config loading into decorator

* Fix mempool performance test

* Fix wallet sync test

* Fix streamable

* Forgot send_transaction_multi

* Remove potentially_inside_lock change

* Add .override to config object

* A few fixes from review

* Get create_message_spend working with tx_config.reuse_puzhash

* pylint and rebase fixes

* Add tests for CMD loaders

* Add RPC client and tests for cancel_offers endpoint

* Add some coverage

* Fix did test

* Add DID test coverage

* add tests for TXConfig & CoinSelectionConfig

* Add reuse_puzhash to dl wallet test

* Add reuse puzhash to dl_wallet test

* Add test coverage to wallet sync test

* Add more tests for TXConfig

* Add tests for coin_funcs.py

* Add some wallet_funcs tests

* Bad merge

* Fix bad test

* condense cmd tests

* test coverage ignore

* merge fix

* Undo GUI change

* Remove a couple of unused tx_endpoints

* Changes due to (#15846)

* Merge fixes

* new=True

* Fix the coins tests

* Fix DID tests

* Fix NFT tests

* Fix VC tests

* Fix wallet tests

* Delete now uneccessary tests

* Fix bad change
2023-08-18 14:03:37 -05:00
Matt Hauff
5ee19ea053
Simplify get_max_send_amount for XCH and CATs (#15859)
* Simplify get_max_send_amount for XCH and CATs

* Update crcat wallet
2023-08-08 20:38:29 -05:00
Matt Hauff
289260c374
Credential Restricted CATs (#15411)
* Allow create_tandem_xch_tx to take a set of announcements

* Create potential announcement in correct arm of create_tandem_xch_tx

* Make does_coin_belong_to_wallet more robust

* Add match_hinted_coin to wallet protocol

* Add CROuterPuzzle

* Add conditions with fee announce.clsp

* Add CRCATWallet

* Add CLI support for CR-CATs

* Fix bug in CATOuterPuzzle

* Add SOFTFORK_HEIGHTS as an exportable variable from conftest

* Allow specifying num of blocks to farm to wallets_prefarm_services

* Add potential subclasses to cat wallet creation

* Integrate CR-CATs into offers

* Address comments by @geoffwalmsley

* Add CRCAT info to get_wallets

* Changes due to (#15846)
2023-08-03 19:36:21 -05:00
Matt Hauff
226c601764
Remove hack_populate'ing secret keys (#15846)
* Remove hack_populate'ing secret keys

* Add an optional version of get_private_key

* test fixes

* remove pool wallet's sign method

* Move sign_transaction to wallet_state_manager

* Add test coverage

* Fix PoolWallet

* Test coverage

* remove e_msg
2023-07-31 11:16:21 -05:00
Arvid Norberg
1e534d0281
pass consensus constants into get_name_puzzle_conditions(). (#15736)
pass consensus constants into get_name_puzzle_conditions(). This is required for tests that use alternate constants, such as fork activation heights
2023-07-11 09:52:49 -05:00
Matt Hauff
79bf694800
Add **kwargs to all generate_signed_transaction definitions (#15240)
* Add **kwargs to all generate_signed_transaction definitions

* Add support for VC wallet too

* attempt to hint kwargs

* Import TypedDict from typing_extensions instead

* Fix tail driver call to generate_signed_transaction
2023-06-13 17:24:17 -05:00
Matt Hauff
cf15c0fcb9
rename exclude_coin_* -> excluded_coin_* for consistency (#15460)
* exclude -> excluded

* Add a bit of test coverage

* fix bad change

* Add test coverage

* Add a little more test coverage
2023-06-09 16:35:53 -05:00
dustinface
a93a85e639
wallet: Hint wallet.py (#15362) 2023-06-09 05:11:23 -05:00
Amine Khaldi
c8ee474583
Merge commit 'f0071358bf9a226af8adb2ad12105b3e3d015515' into checkpoint/main_from_release_1.8.2_f0071358bf9a226af8adb2ad12105b3e3d015515 2023-06-07 15:20:23 +01:00
Kronus91
f0071358bf
Clawback Integration (#14348)
* Clawback integration draft

* Add unit test

* Clawback rework

* Fix unit test

* Fix coin type

* Add tx fee & bulk clawback

* Add manual claim

* Add get_clawback_coins API

* Fix unit test

* Fix unit test

* Resolve comments

* Fix unit test

* remove erroneous comment from p2_1_of_n.clvm

* Resolve comments

* use full puzzle instead of hash in augmented_condition.clvm

* Fix pre-commit

* Add set auto claim api

* Resolve comments

* Fix precommit

* Add get auto claim config api

* Fix pre-commit

* Fix mypy and unit tests

* Switch to reuse coin store solution

* Fix unit tests

* Fix pylint

* Resolve comments

* Fix rename

* Revert puzzle_decorator_type since circular import

* Resolve comments

* 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

* Improve unit tests

* Resolve comments

* Fix clvm hex

* Fix unit tests

* Fix API router

* Update rpc client

* Fix pre-commit

* Remove unrelated changes

* Fix set/get auto claim

* Force populate secret key for clawback

* optimizations

* added clawback puzzle hashes

* update drivers and add lifecycle tests

* Fix driver Program types

* avoid redundant uncurry in clawback

* simplify deserialize_coin_metadata()

* run clawback puzzles with a lower cost limit

* Update chia/wallet/wallet_state_manager.py

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>

* Add tx records for Clawback

* Add clawback coin id

* Add type filter for get_transactions

* Modify clawback tx types

* Resolve comments

* Resolve comments

* Fix unit tests

* Resolve comments

* Improve unit test

* Use merkle tree class

* Resolve comments

* Resolve comments

* Fix curry tree hash

* Improve coverage

* Improve coverage

* Fix unit test

* Fix test

* Improve coverage

* Fix pre-commit

* Resolve comments

* Handle invalid clawback metadata

* Fix unit tests

* Improve coverage

* Handle empty byte issue

* Forward memo

* Fix unit test

* Resolve comments

* Rework Clawback TX management

* Add confirmed filter

* Resolve comments

* Fix unit test

* Fix pre-commit

* Improve coverage

* Fix unit test

* Handle missing auto_claim config

* Fix pre-commit

* Revert tx confirmed change

* Drop unused `deserialize_coin_metadata`

* Parse clawback metadata in `WalletCoinRecord.parsed_metadata`

* Use `WalletCoinRecord.parsed_metadata`

* Avoid querying low amount coins with the `amount_range` parameter

* Drop unused `to_puzhash`

* Drop `print("Ping")`

* Drop outdated assert

* Resolve comments

* Fix coverage

---------

Co-authored-by: geoffwalmsley <geoffwalmsley@gmail.com>
Co-authored-by: Sebastjan Trepca <trepca@gmail.com>
Co-authored-by: arvidn <arvid@libtorrent.org>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2023-06-05 10:53:34 -05:00
dustinface
93af781b4e
wallet: Drop unused conditions helper/parameter (#15421) 2023-06-01 14:27:35 -05:00
Matt Hauff
1fa1f52c11
Use spendable instead of confirmed balance for offers (#15352) 2023-05-24 16:51:07 -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
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
994aa24e44
wallet: Give Payment.memos a default value (#15172) 2023-05-03 00:30:53 -05:00
Kyle Altendorf
322c54f6e3
rework class protocol check pattern (#15134) 2023-04-27 09:56:37 -05:00
dustinface
aa40fa7f21
wallet: Drop AmountWithPuzzlehHash, use Payment instead (#15019) 2023-04-27 09:52:27 -05:00
dustinface
c9f9dbd4f9
wallet: Select enough XCH to cover the fee when creating an offer (#15051)
* Partially revert 6d09a06

* Include fee amount when selecting XCH coins for offers

* Rename `get_coin_amount` -> `amount_to_select`

* Adjust comment

* No need to create a list first
2023-04-17 15:42:27 -05:00
dustinface
d128c44079
wallet: Drop unused Wallet.create_spend_bundle_relative_chia (#15017) 2023-04-14 15:22:43 -06:00
ytx1991
634d19a396
Remove redundant create_tandem_xch_tx 2023-04-10 14:33:57 -07:00
dustinface
170bd986fe
wallet: Some WalletType cleanup (#14897)
* Return `WalletTye` in `WalletProtocol.type`

* Compare to `WalletType` in `WalletStateManager.create`
2023-03-27 10:18:36 -05:00
dustinface
5a25241ffa
wallet: Add WalletProtocol.wallet_info (#14895) 2023-03-27 10:18:12 -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
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
Sebastjan Trepca
6d09a06037
better handling of offer status and failed txs (#14812)
* better handling of offer status and failed txs

* 5 retries before tx is marked failed

* increase test timeouts

* fixed test

* require only difference vs whole fee

* polish + fee coins kick in only if we're missing fee
2023-03-15 20:50:25 -05:00
Kronus91
95d05b72c4
Stop sending change to a new address (#14422)
* Stop sending change to a new address

* Fix bug

* Add config & unit tests

* Resolve comments

* Refine based on the requirements

* Change config to str

* Disable addr reuse for unit test since the hardcode offer doesn't compatible with it

* Cover offer trade

* Add unit test and RPC support

* Add reuse option for cli

* Enhance unit test

* Fix unit test
2023-03-09 18:32:21 -06:00
Kronus91
9dcba09dda
Extend sign API to support hex string (#14448)
* Extend sign API to support hex string

* handle string input

* Resolve comments

* Fix pre-commit
2023-02-23 21:52:57 -06:00
Adam Kelly
446a6f9888
Don't print entire TransactionRecord to log file (#14456) 2023-02-07 18:18:29 -06:00
Arvid Norberg
68c9aafc0a
move SerializedProgram to its own file (#14391)
* move SerializedProgram into its own file (to fixup type annotations)

* fix type annotations for SerializedProgram

* fixup import statements for new SerializedProgram module
2023-01-27 17:20:23 -06:00
Jeff
c107001334
Add SigningMode and update verify_signature RPC to work with sign_message_by_* RPCs (#14213)
* Updated `verify_signature` RPC to support signatures made by `sign_message_by_*` RPCs

* Updated RPC to use "signing_mode" param name with value "chip_0002"
Added CHIP_0002_SIGN_MESSAGE_PREFIX string constant

* Tests for verify_signature

* Update chia/wallet/wallet.py

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

* Adds SigningMode enum with CHIP-0002 and BLS message augmentation schemes
chia keys sign/verify support JSON output
chia keys verify now accepts the -b as_bytes option

* Fix a mypy warning

* Updated link to CHIP-0002

* isort

* Fix tests

* improve error handling

* comment how test data was generated

* Update chia/rpc/wallet_rpc_api.py

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

* Update chia/rpc/wallet_rpc_api.py

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

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-01-25 12:44:37 -06:00
Sebastjan Trepca
c7eeaa64e6
fix offer cancel balance (#14342) 2023-01-13 18:47:07 -06:00
Earle Lowe
3140c223bd
TechDebt: add get_name to WalletProtocol (#13995)
* add get_name to WalletProtocol

* remove async from did_wallet::get_name

* Return "Standard Wallet" for get_name
2022-12-20 13:26:06 -06:00
dustinface
8412a9928a
isort: Remove all chia.wallet exceptions and sort the related files (#13977) 2022-11-22 15:33:43 -06:00
Sebastjan Trepca
962ad8abeb
[#13737] added total balance check, updated error messages (#13866)
added total balance check, updated messages
2022-11-08 21:52:32 -06:00
Jack Nelson
e8ff7ea9a4
Coin Selection CLI / RPC Expansion (#13325)
* add max coin amount everywhere

* add excluded amounts to bare minimum

offers really does not need it passed.

* add excluded coin ids

* finish rpc stuff

* finalize commands

add coins command group & expand various coin selection methods

* fix argument processing & clean up code

* fix grammer

* small miss

* Update wallet_rpc_api.py

* fix test

* add combination command

* fix error

* move command group

* add new built in funcs for direct wallet coin searches.

* add get coin rpc

* add last command

* switch to pageable function

* fix args

* expand multi rpc call and tests

+ fix other things

* da lint

* add reverse coin sorting and ability to select coins

* Update wallet_state_manager.py

* fix types

* align with protocol

* fix asserts

* fix imports

* isort

* Update wallet_coin_store.py

* Update wallet_rpc_api.py
2022-10-24 14:03:53 -05:00
Icer
23f87d5fef
Fix typo in wallet: puzzle (#13621) 2022-10-08 02:59:16 -05:00
Kronus91
137e61d68a
Add Signing message APIs (#13491)
* Add sign APIs

* Add sign APIs

* Resolve comment

* Resolve comment & Add CLI

* Fix pre-commit

* Refine

* Fix unit tests

* Resolve comments
2022-09-28 04:26:54 -05:00
Arvid Norberg
e4df3f9bf4
make a WalletProtocol, defining the shared API of all wallets (#13437)
* make a WalletProtocol, defining the shared API of all wallets and fix type checking

* add protocol check for DataLayerWallet. remove outdated comment
2022-09-15 20:16:01 -05:00
Amine Khaldi
78a3c9c83a
Merge main into checkpoint/main_from_release_1.6.0_12fcaf0e982590efcf26a954c67cd760035d9e6e 2022-08-30 21:29:45 +01:00
Richard Kiss
18c40d6269
Calculate puzzle hashes directly, as an optimization. (#13034) 2022-08-30 14:25:42 -05:00
Amine Khaldi
2f37c141ac
Merge commit '3a403f504733ca5ce6913c87ccd75c774d33a86e' into checkpoint/long_lived_atari_from_main_3a403f504733ca5ce6913c87ccd75c774d33a86e 2022-08-18 13:42:03 +01:00
Amine Khaldi
e3fc8e4e05
Merge commit '2de8f7caac47fef5385031db777390f6e77b8862' into checkpoint/long_lived_atari_from_main_2de8f7caac47fef5385031db777390f6e77b8862 2022-08-14 13:21:00 +01:00
Amine Khaldi
90a29e6b84
Merge commit 'f527926f6044b1fe618b2b80faddd2f16e1d077b' into checkpoint/long_lived_atari_from_main_f527926f6044b1fe618b2b80faddd2f16e1d077b 2022-08-13 20:36:28 +01:00
Amine Khaldi
032bae7460
Merge commit 'd5bf4d8b59e3f0757f046ff6c9b7b2fd878920b4' into checkpoint/long_lived_atari_from_main_d5bf4d8b59e3f0757f046ff6c9b7b2fd878920b4 2022-08-11 11:47:10 +01:00
Amine Khaldi
d6aa113cf5
Reflect the change on datalayer related code. 2022-08-04 21:40:16 +01:00
Amine Khaldi
90331f39e0
Merge commit '8ec56d1901315a5efb13202023e15930349ae504' into checkpoint/long_lived_atari_from_main_8ec56d1901315a5efb13202023e15930349ae504 2022-08-04 20:55:51 +01:00
Amine Khaldi
18f5e8e751
Merge commit 'eb0eabaa62be3cebf8c3f3b20446caeb2c410c7b' into checkpoint/long_lived_atari_from_main_eb0eabaa62be3cebf8c3f3b20446caeb2c410c7b 2022-08-02 17:48:57 +01:00
Jack Nelson
3a403f5047
Add small coin selection improvements (#12682)
* clean up existing test to align with our standards

* add zero amount test

it is failing

* 0 amount fix

* max_coin_amount type change

it should have been uint64

* add max_coin_amount logic for future use

* add slightly more logic

* forgot to include edgecase

* clarify comment
2022-08-01 18:15:47 -05:00
Amine Khaldi
90d96467ab
Merge commit '383326c3b7fcd0d899950697e0766e11a2ce8c8b' into checkpoint/long_lived_atari_from_main_383326c3b7fcd0d899950697e0766e11a2ce8c8b 2022-08-01 16:56:07 +01:00