Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify transaction pushing #17458

Merged
merged 38 commits into from
Feb 5, 2024
Merged

Unify transaction pushing #17458

merged 38 commits into from
Feb 5, 2024

Conversation

Quexington
Copy link
Contributor

Recreation of #16346 @ main

Source hash: 3b1fcf2
Remaining commits: 14

This is a very old parameter that we've been propogating through new
version of generate signed transaction for (it seems to me) no reason.
The only instances in which this parameter is actually set to `True` we
manually specify the set of coins anyway. Perhaps the idea is to prevent
choosing coins that won't fit in a block, but such an unlikely error
will still get caught by the mempool and there's a million other similar
errors that would behave that way as well. I think more likely the
intention was simply for testing in tests that have since been
re-written or deleted.
This PR is a step in the direction of a more observer-style wallet.

Currently, most of our wallet functions just push directly to the
network as a matter of course when creating a transaction. While this is
convenient (especially in tests) it will be impossible should we get to
a wallet design that does not contain the private key as a key component
to wallet operations.

For now, the wallet still signs the transaction and has it ready to be
pushed to the network should the user specify that. But all of the
pushing logic has been migrated to the top-most layer available (usually
the RPC) so that the user always has control over whether or not they
would like to immediately push the transaction.

In addition, any transaction method in the RPC now returns a
`"transactions"` key so that it is easy for a front-end client to have
everything they need to push the transaction as if the wallet was doing
it (using the `push_transactions` endpoint).
…end_clawback_coins (#16354)

Previously, this logic depended on pushing clawback transactions to the
wallet DB to be submitted so that on further transaction generations,
the same coins would not be selected. With the change to make all
transaction pushing optional, this logic no longer functioned correctly.
This change leverages the `excluded_coin_ids` key in the `TXConfig` to
exclude coins between transaction batches instead, resulting in a
stateless generation of these transactions (fitting the new pattern).
The main section of this change is here:
https://github.com/Chia-Network/chia-blockchain/pull/16346/files#diff-a367f650aed3b60eba2c253ce15852630c1baf5e9891223d1557ac9cb3333d20L1995

Right now, there exists two different ways of pushing transactions and
wallets seem to use either almost arbitrarily. This change combines the
`Wallet.push_transaction` and
`WalletStateManager.add_pending_transaction` into a single method that
includes the union of their two functionalities.

In addition, this method now takes a list of transactions by default and
will consolidate the spend bundles of all of transactions onto the first
transaction in the list to ensure that all transactions make it into the
mempool at the same time. Most wallets already do this manually and I
have not refactored them not to do so (yet) but this gives the option
for wallets going forward to not have to worry about that particular
aspect.
…long_lived_vault_from_main_e986d1e3eead6badf43dc7fdd54292f8a43fde18
@Quexington Quexington added the Changed Required label for PR that categorizes merge commit message as "Changed" for changelog label Feb 1, 2024
@Quexington Quexington marked this pull request as ready for review February 1, 2024 18:41
@Quexington Quexington requested a review from a team as a code owner February 1, 2024 18:41
@emlowe
Copy link
Contributor

emlowe commented Feb 1, 2024

this seems ok to me - probably could use a second look from Arvid or Amine

Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a really nice improvement!
I had a few comments of things that look a bit suspicious

chia/pools/pool_wallet.py Show resolved Hide resolved
chia/wallet/wallet_state_manager.py Show resolved Hide resolved
tests/wallet/sync/test_wallet_sync.py Show resolved Hide resolved
tests/wallet/nft_wallet/test_nft_wallet.py Show resolved Hide resolved
tests/wallet/did_wallet/test_did.py Show resolved Hide resolved
tests/wallet/dao_wallet/test_dao_wallets.py Show resolved Hide resolved
tests/wallet/dao_wallet/test_dao_wallets.py Show resolved Hide resolved
tests/wallet/dao_wallet/test_dao_wallets.py Show resolved Hide resolved
tests/wallet/dao_wallet/test_dao_wallets.py Show resolved Hide resolved
tests/wallet/dao_wallet/test_dao_wallets.py Show resolved Hide resolved
matt-o-how
matt-o-how previously approved these changes Feb 2, 2024
Copy link
Contributor

@matt-o-how matt-o-how left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice!

@Quexington Quexington added ready_to_merge Submitter and reviewers think this is ready and removed ready_to_merge Submitter and reviewers think this is ready labels Feb 2, 2024
@Quexington Quexington closed this Feb 5, 2024
@Quexington Quexington reopened this Feb 5, 2024
Copy link

Pull Request Test Coverage Report for Build 7787191505

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 285 (100.0%) changed or added relevant lines in 27 files are covered.
  • 71 unchanged lines in 24 files lost coverage.
  • Overall coverage decreased (-0.08%) to 90.829%

Files with Coverage Reduction New Missed Lines %
chia/data_layer/dl_wallet_store.py 1 95.74%
chia/data_layer/download_data.py 1 71.04%
chia/full_node/full_node_api.py 1 79.33%
chia/server/server.py 1 80.0%
chia/wallet/util/wallet_sync_utils.py 1 78.14%
tests/core/util/test_file_keyring_synchronization.py 1 97.1%
tests/fee_estimation/test_fee_estimation_unit_tests.py 1 99.06%
tests/simulation/test_simulation.py 1 96.52%
tests/util/full_sync.py 1 88.89%
tests/util/setup_nodes.py 1 98.35%
Totals Coverage Status
Change from base Build 7767087636: -0.08%
Covered Lines: 96255
Relevant Lines: 105936

💛 - Coveralls

@Quexington Quexington added the ready_to_merge Submitter and reviewers think this is ready label Feb 5, 2024
@Quexington Quexington removed the request for review from AmineKhaldi February 5, 2024 18:33
@Starttoaster Starttoaster merged commit c6f1a57 into main Feb 5, 2024
523 checks passed
@Starttoaster Starttoaster deleted the quex.unify_tx_pushing branch February 5, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changed Required label for PR that categorizes merge commit message as "Changed" for changelog ready_to_merge Submitter and reviewers think this is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants