-
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
CHIA-2378: Add CLI commands to import, export, and benchmark the mempool #19271
base: main
Are you sure you want to change the base?
Conversation
from chia.cmds.cmds_util import get_any_service_client | ||
|
||
async with get_any_service_client(FullNodeRpcClient, root_path, rpc_port) as (node_client, _): | ||
start = time.time() |
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.
start = time.time() | |
start = time.monotonic() |
async with get_any_service_client(FullNodeRpcClient, root_path, rpc_port) as (node_client, _): | ||
start = time.time() | ||
bundle = await node_client.create_block_bundle_from_mempool() | ||
end = time.time() |
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.
end = time.time() | |
end = time.monotonic() |
curr_l_tb = self.service.blockchain.block_record(curr_l_tb.prev_hash) | ||
|
||
self.service.log.info("Beginning simulated block construction from mempool") | ||
start_time = time.time() |
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.
start_time = time.time() | |
start_time = time.monotonic() |
self.service.log.error(f"Traceback: {traceback.format_exc()}") | ||
self.service.log.error(f"Error making spend bundle {e} peak: {peak}") | ||
mempool_bundle = None | ||
self.service.log.info(f"Simulated block constructed in {time.time() - start_time} 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.
self.service.log.info(f"Simulated block constructed in {time.time() - start_time} seconds") | |
self.service.log.info(f"Simulated block constructed in {time.monotonic() - start_time} 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.
looks good! One thing that's a bit unexpected is that the import and export RPCs load and save to a file on the nodes machine (not the client's), however, creating the block returns it back to the client
start_time = time.time() | ||
|
||
try: | ||
result = await self.service.mempool_manager.create_bundle_from_mempool( |
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.
I think it would be better to call create_block_generator()
, to also include the time it takes to serialize/compress the block
@@ -835,6 +838,38 @@ async def get_mempool_items_by_coin_name(self, request: dict[str, Any]) -> Endpo | |||
|
|||
return {"mempool_items": [item.to_json_dict() for item in items]} | |||
|
|||
async def create_block_bundle_from_mempool(self, _: dict[str, Any]) -> EndpointResult: |
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.
I think the "from mempool" part of this name is implied
Adds a new
chia dev mempool
CLI group withimport
,export
, andcreate_block
commands.