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

New RPC block_spends - Get spends for block using transaction generator #10446

Merged
merged 24 commits into from
Jun 24, 2022
Merged

New RPC block_spends - Get spends for block using transaction generator #10446

merged 24 commits into from
Jun 24, 2022

Conversation

freddiecoleman
Copy link
Contributor

Currently if you want to get all the spends for a block you have two options:

  • Call the get_additions_and_removals RPC followed by potentially thousands of calls to get_puzzle_and_solution (one for each removal)
  • Call the get_block endpoint and run the transaction generator. This is a bit better but can be slow depending on the environment in which your CLVM implementation is running.

By adding this RPC we can benefit from the speed of the Rust CLVM implementation and it also means less code for anybody who needs this data.

@lgtm-com
Copy link

lgtm-com bot commented Feb 26, 2022

This pull request introduces 1 alert when merging d0460c6cd09f1515fc6d3eeca4d3cf81e114fe41 into bf4a632 - view on LGTM.com

new alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Feb 26, 2022

This pull request introduces 1 alert when merging c69f96f into bf4a632 - view on LGTM.com

new alerts:

  • 1 for Unreachable code

Copy link
Contributor

@mariano54 mariano54 left a comment

Choose a reason for hiding this comment

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

Thank you for making this PR! How is the performance?

chia/rpc/full_node_rpc_api.py Outdated Show resolved Hide resolved
chia/rpc/full_node_rpc_api.py Outdated Show resolved Hide resolved
chia/rpc/full_node_rpc_api.py Outdated Show resolved Hide resolved
chia/rpc/full_node_rpc_api.py Outdated Show resolved Hide resolved
tests/core/test_full_node_rpc.py Outdated Show resolved Hide resolved
chia/rpc/full_node_rpc_client.py Show resolved Hide resolved
chia/rpc/full_node_rpc_client.py Outdated Show resolved Hide resolved
chia/rpc/full_node_rpc_client.py Outdated Show resolved Hide resolved
mariano54
mariano54 previously approved these changes Feb 27, 2022
Copy link
Contributor

@mariano54 mariano54 left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the PR!

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.

I think there are some opportunities for simplifications. I'm also not convinced the test covers an interesting case (just by looking at it)

chia/rpc/full_node_rpc_api.py Outdated Show resolved Hide resolved
flags = 0

args = create_generator_args(block_generator.generator_refs).first()
_, block_result = block_generator.program.run_with_cost(
Copy link
Contributor

Choose a reason for hiding this comment

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

program is a SerializedProgram, right?
Getting the generator arguments right here is non trivial. Are you confident the test covers this properly?

chia/rpc/full_node_rpc_api.py Outdated Show resolved Hide resolved
tests/core/test_full_node_rpc.py Outdated Show resolved Hide resolved
@wjblanke
Copy link
Contributor

wjblanke commented Mar 4, 2022

would like to get this in, please see Qs. thanks freddy!

@lgtm-com
Copy link

lgtm-com bot commented Mar 13, 2022

This pull request introduces 2 alerts when merging ae579aa into 773d692 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 13, 2022

This pull request introduces 2 alerts when merging 5e857ff into 773d692 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 13, 2022

This pull request introduces 2 alerts when merging 58baa04 into 773d692 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 13, 2022

This pull request introduces 2 alerts when merging 0c32c227c163c0caa5a835d622a4fd2609e5ca33 into 773d692 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 2 alerts when merging ac72f8e1fbba94806b61712bf02480f928fd0016 into 9db85f3 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 2 alerts when merging 4a2909a into 9db85f3 - view on LGTM.com

new alerts:

  • 2 for Unused import

1 similar comment
@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 2 alerts when merging 4a2909a into 9db85f3 - view on LGTM.com

new alerts:

  • 2 for Unused import

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2022

This PR has been flagged as stale due to no activity for over 60 days. It will not be automatically closed, but it has been given a stale-pr label and should be manually reviewed by the relevant parties.

@github-actions github-actions bot added the stale-pr Flagged as stale and in need of manual review label May 3, 2022
@lgtm-com
Copy link

lgtm-com bot commented May 14, 2022

This pull request introduces 1 alert when merging b7b4f7e into 0e41982 - view on LGTM.com

new alerts:

  • 1 for Unused import

@freddiecoleman
Copy link
Contributor Author

Currently think the test fails due to how the tests simulate farming blocks and how block_generator defaults to None here https://github.com/Chia-Network/chia-blockchain/blob/main/tests/block_tools.py#L1892

@github-actions github-actions bot removed the stale-pr Flagged as stale and in need of manual review label May 15, 2022
@jack60612 jack60612 self-assigned this Jun 16, 2022
@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Jun 21, 2022
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@jack60612 jack60612 changed the base branch from main to fco.block_spends June 24, 2022 18:01
@jack60612 jack60612 merged commit 8673b69 into Chia-Network:fco.block_spends Jun 24, 2022
@jack60612 jack60612 removed the merge_conflict Branch has conflicts that prevent merge to main label Jun 24, 2022
wallentx pushed a commit that referenced this pull request Jul 25, 2022
…or (#12062)

* New RPC block_spends - Get spends for block using transaction generator (#10446)

* get spends for block using transaction generator

* type annotations and use existing function

* return None on exception

* parse to CoinSpend

* specify return type of get_block_spends in rpc client

* see what can be asserted

* test fix

* flags not necessary as we don't validate

* simplifying as cost is not required as we are not validating

* improve test to cover transaction generator ref_list

* simplify test

* remove unused import

* slight change and cleanup

* lint cleanup

* clean up

* wait until transaction is in mempool

* fix lint

Co-authored-by: Jack Nelson <jack@jacknelson.xyz>

* fix lint

Correct type and run lint checker

* switch to custom clvm

* add new puzzle

* curry and make better

* forgot to set linter to tools dir

* undo run_block changes

* Revert "curry and make better"

The tests do not like it

* correct tests

Co-authored-by: Jack Nelson <jack@jacknelson.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants