-
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
add test for a 1-block reorg in short_sync_backtrack() #18966
base: short_sync_backtrack_fix
Are you sure you want to change the base?
Conversation
|
||
# validate reward coins | ||
for reward in rewards: | ||
rec = records.pop(reward.name()) |
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.
what was the purpose of moving this 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.
I remove the records from the database that has been accounted for from the actual block in order to ensure the list is empty at the end. Otherwise I couldn't detect additional coin entries in the database, that don't exist in the block.
) | ||
|
||
print(f"chain A: {chain_a[-1].header_hash.hex()}") | ||
await add_blocks_in_batches(chain_a[-1:], full_node_1.full_node, chain[-1].header_hash) |
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 chain_a[-1] instead of chain_a[-1:] since the intention is to only add one block 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.
but add_blocks_in_batches
takes a list of blocks, not just a single one
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.
oh right, ok i think [chain_a[-1]] would maybe be more clear for someone who is not familiar with what we are doing
chain_b = bt.get_consecutive_blocks( | ||
1, | ||
chain, | ||
guarantee_transaction_block=False, |
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.
theres a better way to do this instead of randomly trying, you can enforce the sp the block would be created after, so you can make sure the chain_a would be infused after the chain_b block, you can also farm it on a new slot entirely that would have the same effect
check out
# make two new blocks on tip, block_2 has higher total iterations |
e0a0f75
to
a275a82
Compare
|
a275a82
to
9f94652
Compare
Purpose:
Add test coverage for the fixed bug. This test fails when run on top of main, but passes with Almog's fix.
Current Behavior:
1-block reorg in
short_sync_backtrack()
is not covered by a test.New Behavior:
1-block reorg in
short_sync_backtrack()
is covered by a test.