Commit Graph

94 Commits

Author SHA1 Message Date
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
d952eeca37
wallet: Use fetch_coin_spend_for_coin_state in DIDWallet.coin_added (#15174) 2023-05-09 14:46:08 -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
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
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
ytx1991
31c1ae7324
Fix conflicts 2023-04-10 14:37:36 -07:00
ytx1991
634d19a396
Remove redundant create_tandem_xch_tx 2023-04-10 14:33:57 -07: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
5e5395305d
wallet: Drop some parameters from WalletStateManager.add_new_wallet (#14919) 2023-03-27 18:07:19 -05: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
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
Adam Kelly
0a6856b498
Fix a DID Wallet issue where an old DID coin causes us to assert during wallet creation (#14668)
* wip

* Change test to reflect current DID Wallet operation

* Typecheck case where we do not know parent yet.
2023-02-27 16:48:10 -06:00
Kyle Altendorf
ff5ef6e073
remove leading newlines from indented code blocks (#14653)
* remove leading newlines from indented code blocks

* catch another one
2023-02-23 21:53:48 -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
22dfc83d51
Reorganize reusable singleton wallet code (#14339) 2023-01-27 17:09:13 -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
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
a40f04012b
server: Replace WSChiaConnection.__getattr__ with call_api (#14052) 2022-12-13 00:35:42 -06:00
Kronus91
76ebb08ac8
Fix DID unnecessary wallet deletion (#13925) 2022-11-29 14:22:59 -06:00
dustinface
8412a9928a
isort: Remove all chia.wallet exceptions and sort the related files (#13977) 2022-11-22 15:33:43 -06:00
Kronus91
3879cea12e
Delete DID wallet after transfer (#13389)
* Delete DID wallet after transfer

* Adjust tests

* Fix merge

* Remove rl_wallet

* Fix tests

* Fix DID bugs

* Add tests

* Add additional spend for DID update

* Fix unit test

* Handle bugged DID

* Cover empty hint case

* Fix unnecessary DID deletion
2022-11-14 11:12:28 -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
Geoff Walmsley
76ffd4c2df
Mint from DID (#12736)
* mint from did

* fix did puzzle announcements

* clean up params and test

* mypy

* add RPC endpoint

* use rpc client for test

* test create spends in loop

* transfer to target

* fix lineage proof for transfers

* isolate block timing issue in test

* DID lineage proof

* test transfer to targets

* add exclude list to select_coins RPC

* coin json

* move tests to did wallet

* fix typing royalties

* cleanup tests

* DID_HRP to AddressType

* clvm compilation

* improve checks in rpc api

* move mint_from_did to nft wallet

* reduce number of blocks in tests

* forgot to remove mint function from did_wallet.py

* mypy

* validate NFT metadata and edition numbers in test

* fix puzzle announcements, refactor and comments

* make tests work with new RPC server settings

* create puzzle assertions for eve and transfer spends

* rename vars for mint numbering

* rename more edition -> mint variables

* remove DID owner from eve spend

* make coin announcement from did spend

* make transfer from eve spend

* corrections for address options in RPC

* simplify intermediate launchers

* announcments for xch xpend

* re-order announcements for xch spend

* test with fewer blocks

* skip off chain metadata test with IPFS

* add bulk mint puzzle and methods to nft wallet

* add rpc endpoints

* add tests

* don't skip off chain metadata test

* fix default case for xch_coin_list
2022-09-29 11:23:33 -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
Kyle Altendorf
a20ee08fce
only compile clvm for developers (#13478)
* only compile clvm for developers

* retain existing behavior for backwards compatibility

* tests/check_clvm.py becomes tools/manage_clvm.py check (and add build subcommand)

* trigger recompilation in pytest runs
2022-09-27 11:21: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
Kronus91
b081c208e3
Add DID sign message API (#13269)
* Add DID sign message API

* Resolve comments
2022-09-13 16:08:46 -05:00
Sebastjan Trepca
f4023c47be
did parent check (#13387) 2022-09-11 16:20:39 -05:00
Sebastjan Trepca
19c693ccd4
treehash optimization for DID wallet (#13253)
* only calculate treehash of constants once

* missed one treehash calc
2022-09-02 13:12:00 -05:00
Richard Kiss
18c40d6269
Calculate puzzle hashes directly, as an optimization. (#13034) 2022-08-30 14:25:42 -05:00
Arvid Norberg
af255a0dbf
Rust coin state (#12934)
* use rust types for CoinState and RespondToPhUpdates

* improve test_network_protocol_test to support native types
2022-08-18 12:20:09 -05:00
Arvid Norberg
7afbe266d2
serializing + rust tree_hash() is faster than python tree_hash() (#12923) 2022-08-15 02:51:54 -05:00
Mariano Sorgente
4e548545a1
Ms.peer required + sync speedup (#12889)
* Allow different reject message

* Sync correctly when localhost is not synced

* Remove logs

* Fix getting timestamp when local node is not synced

* Precommit

* Mypy

* Debug logging

* Is trusted

* revert gui

* Remove debug logging

* Force passing in peer when fetching data

* remove debug limit

* Fix did_wallet

* Improve params

* Fix DID wallet again
2022-08-11 16:18:14 -05:00
Arvid Norberg
f562d96535
uncurry the puzzle once instead of 3 times (#12781) 2022-08-04 23:16:04 -05: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
Jeff
0fc63d62d2
Replace NFT_HRP and DID_HRP with AddressType (#12711)
* Replaced DID_HRP with AddressType.DID.hrp()

* Replaced NFT_HRP with AddressType.NFT.hrp()
2022-08-01 11:19:49 -05:00
Mariano Sorgente
2de8f7caac
optimize ph generation (~65% faster) (#12467)
* optimize ph generation

* Remove useless check

* More perf improvements

* G1 Elem not bytes

* Fix test

* Fix more tests

* Fix more more tests
2022-07-22 11:05:35 -05:00
Jack Nelson
d5bf4d8b59
Expand select_coins rpc (#12360)
* change type to uint64, 128 is too big anyway

* add new options to select_coins endpoint

* oops

* add tests and finalize

* oops
2022-07-15 20:50:41 -05:00
Arvid Norberg
8ec56d1901
Wallet dbwrapper 2 (#12234)
* change DBWrapper -> DBWrapper2 in wallet. rip out all transaction tracking threaded through the wallet (because DBWrapper2 uses nested transactions)

* fix logging

* fix pending_changed callback in wallet_node
2022-07-12 19:09:05 -05:00
Jack Nelson
eb0eabaa62
Convert DID Wallet to use the new coin selection algorithm that the normal wallet and the CAT wallet already use (#12063)
* small type change

* use coin_selection.py with DID Wallet

use more efficient coin selection methods.

* Add special DID edgecase + fix int type
2022-07-07 15:35:49 -05:00
Matt Hauff
3ada876718
Refine wallet full node peer selection (#12118)
* Refine wallet full node peer selection

* forgot await

* rework DID wallet loop

* lint?

* Wasn't properly returning untrusted/unsynced
2022-07-02 01:11:16 -05:00
Amine Khaldi
54feb98fe1
Merge release/1.4.0's 136a97d into main 2022-06-27 17:18:36 +01:00
ytx1991
d62d10ff30
Small fix for DID recovery 2022-06-23 21:32:08 -07:00
Amine Khaldi
8c015f7bdb
Merge release/1.4.0's 45377fa into main 2022-06-23 19:51:29 +01:00
ytx1991
a18bcdada6
Fix DID TX fee 2022-06-22 23:25:21 -07:00