Skip to content

Commit

Permalink
Merge standalone wallet into main (#9793)
Browse files Browse the repository at this point in the history
* 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 71da048

* Remove unused ignores

* more unused ignores

* Fix bad merge at 3b143e7

* 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>
  • Loading branch information
4 people committed Jan 13, 2022
1 parent 0ba838b commit 89f15f5
Show file tree
Hide file tree
Showing 128 changed files with 9,536 additions and 6,454 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
name: MacOS wallet-cc_wallet Tests
name: MacOS wallet-cat_wallet Tests

on:
push:
Expand All @@ -15,7 +15,7 @@ on:

jobs:
build:
name: MacOS wallet-cc_wallet Tests
name: MacOS wallet-cat_wallet Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
Expand Down Expand Up @@ -92,10 +92,10 @@ jobs:
sh install-timelord.sh
./vdf_bench square_asm 400000
- name: Test wallet-cc_wallet code with pytest
- name: Test wallet-cat_wallet code with pytest
run: |
. ./activate
./venv/bin/py.test tests/wallet/cc_wallet/test_*.py -s -v --durations 0
./venv/bin/py.test tests/wallet/cat_wallet/test_*.py -s -v --durations 0
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
name: Ubuntu wallet-cc_wallet Test
name: Ubuntu wallet-cat_wallet Test

on:
push:
Expand All @@ -15,7 +15,7 @@ on:

jobs:
build:
name: Ubuntu wallet-cc_wallet Test
name: Ubuntu wallet-cat_wallet Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
sh install-timelord.sh
./vdf_bench square_asm 400000
- name: Test wallet-cc_wallet code with pytest
- name: Test wallet-cat_wallet code with pytest
run: |
. ./activate
./venv/bin/py.test tests/wallet/cc_wallet/test_*.py -s -v --durations 0
./venv/bin/py.test tests/wallet/cat_wallet/test_*.py -s -v --durations 0
#
Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def delete_unconfirmed_transactions(args: dict, wallet_client: WalletRpcCl


def wallet_coin_unit(typ: WalletType, address_prefix: str) -> Tuple[str, int]:
if typ == WalletType.COLOURED_COIN:
if typ == WalletType.CAT:
return "", units["colouredcoin"]
if typ in [WalletType.STANDARD_WALLET, WalletType.POOLING_WALLET, WalletType.MULTI_SIG, WalletType.RATE_LIMITED]:
return address_prefix, units["chia"]
Expand Down
14 changes: 2 additions & 12 deletions chia/consensus/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,22 +848,12 @@ def add_block_record(self, block_record: BlockRecord):
self.__heights_in_cache[block_record.height] = set()
self.__heights_in_cache[block_record.height].add(block_record.header_hash)

# TODO: address hint error and remove ignore
# error: Argument 1 of "persist_sub_epoch_challenge_segments" is incompatible with supertype
# "BlockchainInterface"; supertype defines the argument type as "uint32" [override]
# note: This violates the Liskov substitution principle
# note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
async def persist_sub_epoch_challenge_segments( # type: ignore[override]
async def persist_sub_epoch_challenge_segments(
self, ses_block_hash: bytes32, segments: List[SubEpochChallengeSegment]
):
return await self.block_store.persist_sub_epoch_challenge_segments(ses_block_hash, segments)

# TODO: address hint error and remove ignore
# error: Argument 1 of "get_sub_epoch_challenge_segments" is incompatible with supertype
# "BlockchainInterface"; supertype defines the argument type as "uint32" [override]
# note: This violates the Liskov substitution principle
# note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
async def get_sub_epoch_challenge_segments( # type: ignore[override]
async def get_sub_epoch_challenge_segments(
self,
ses_block_hash: bytes32,
) -> Optional[List[SubEpochChallengeSegment]]:
Expand Down
4 changes: 2 additions & 2 deletions chia/consensus/blockchain_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def try_block_record(self, header_hash: bytes32) -> Optional[BlockRecord]:
return None

async def persist_sub_epoch_challenge_segments(
self, sub_epoch_summary_height: uint32, segments: List[SubEpochChallengeSegment]
self, sub_epoch_summary_height: bytes32, segments: List[SubEpochChallengeSegment]
):
pass

async def get_sub_epoch_challenge_segments(
self,
sub_epoch_summary_height: uint32,
sub_epoch_summary_hash: bytes32,
) -> Optional[List[SubEpochChallengeSegment]]:
pass

Expand Down
8 changes: 5 additions & 3 deletions chia/consensus/full_block_to_block_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def block_to_block_record(
required_iters: uint64,
full_block: Optional[Union[FullBlock, HeaderBlock]],
header_block: Optional[HeaderBlock],
sub_slot_iters: Optional[uint64] = None,
) -> BlockRecord:

if full_block is None:
Expand All @@ -32,9 +33,10 @@ def block_to_block_record(
prev_b = blocks.try_block_record(block.prev_header_hash)
if block.height > 0:
assert prev_b is not None
sub_slot_iters, _ = get_next_sub_slot_iters_and_difficulty(
constants, len(block.finished_sub_slots) > 0, prev_b, blocks
)
if sub_slot_iters is None:
sub_slot_iters, _ = get_next_sub_slot_iters_and_difficulty(
constants, len(block.finished_sub_slots) > 0, prev_b, blocks
)
overflow = is_overflow_block(constants, block.reward_chain_block.signage_point_index)
deficit = calculate_deficit(
constants,
Expand Down
9 changes: 4 additions & 5 deletions chia/full_node/mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ def validate_clvm_and_signature(
return Err(result.error), b"", {}

pks: List[G1Element] = []
msgs: List[bytes32] = []
# TODO: address hint error and remove ignore
# error: Incompatible types in assignment (expression has type "List[bytes]", variable has type
# "List[bytes32]") [assignment]
pks, msgs = pkm_pairs(result.npc_list, additional_data) # type: ignore[assignment]
msgs: List[bytes] = []
pks, msgs = pkm_pairs(result.npc_list, additional_data)

# Verify aggregated signature
cache: LRUCache = LRUCache(10000)
Expand Down Expand Up @@ -249,6 +246,7 @@ async def pre_validate_spendbundle(
start_time = time.time()
if new_spend_bytes is None:
new_spend_bytes = bytes(new_spend)

err, cached_result_bytes, new_cache_entries = await asyncio.get_running_loop().run_in_executor(
self.pool,
validate_clvm_and_signature,
Expand All @@ -257,6 +255,7 @@ async def pre_validate_spendbundle(
self.constants.COST_PER_BYTE,
self.constants.AGG_SIG_ME_ADDITIONAL_DATA,
)

if err is not None:
raise ValidationError(err)
for cache_entry_key, cached_entry_value in new_cache_entries.items():
Expand Down
Loading

0 comments on commit 89f15f5

Please sign in to comment.