-
Notifications
You must be signed in to change notification settings - Fork 2k
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
create_block_generator
refactor
#19207
base: main
Are you sure you want to change the base?
Conversation
f4c2342
to
6909222
Compare
6909222
to
3d9f473
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left some suggestions.
for add in additions: | ||
assert add in expected_additions | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're checking the length as well, so here we can simply:
for add in additions: | |
assert add in expected_additions | |
assert set(additions) == expected_additions |
spends = [(cs.coin, bytes(cs.puzzle_reveal), bytes(cs.solution)) for cs in spend_bundle.coin_spends] | ||
block_program = solution_generator_backrefs(spends) | ||
|
||
duration = monotonic() - start_time | ||
log.log( | ||
logging.INFO if duration < 1 else logging.WARNING, | ||
f"serializing block generator took {duration:0.2f} seconds", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to continue measuring the block generator serialization duration accurately, we need to keep using simple_solution_generator_backrefs
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behavior tracks the duration of calling simple_solution_generator_backrefs
which contains the deserialization step and the construction of BlockGenerator, but with this, we're tracking the duration of one less step which got moved to the return step: BlockGenerator(SerializedProgram.from_bytes(block_program), [])
.
3d9f473
to
f225f82
Compare
This PR is best reviewed one commit at a time.
Purpose:
Change the mempool interface to create a block generator, rather than a large spend bundle (to then be turned into a block generator)
The main reason for this is to prepare for changing the implementation of the block generator creation to use an incrementally compressed block creator, to fill block more effectively.
It has some other benefits I think:
full_node_api
, and probably requires a full simulation environment.The first commit is only tangentially related, and simplifies the function interface related to mempool item inclusion.
Current Behavior:
The mempool has a method:
create_bundle_from_mempool_items()
New Behavior:
The mempool has a method:
create_block_generator