Skip to content

Conversation

@GarmashAlex
Copy link

Re-enables the previously disabled test testGetMutableWithRollbackNotOverrideTrieLogLayer by refactoring it to properly verify that saveTrieLog is not called when a trie log already exists for a block.

The test now correctly checks that the TrieLogManager never attempts to save a trie log for a block that already has one, which was the original intent of the test. The issue was that the previous implementation was trying to trigger saveTrieLog through getWorldState, but that method doesn't directly trigger the saving process.

The refactored test now properly mocks the dependencies and verifies the correct behavior using withBlockHeaderAndNoUpdateNodeHead instead of withStateRootAndBlockHashAndUpdateNodeHead.

Re-enables the previously disabled test testGetMutableWithRollbackNotOverrideTrieLogLayer
by refactoring it to properly verify that saveTrieLog is not called when a trie log already
exists for a block.

The test now correctly checks that the TrieLogManager never attempts to save a trie log
for a block that already has one, which was the original intent of the test. The issue was
that the previous implementation was trying to trigger saveTrieLog through getWorldState,
but that method doesn't directly trigger the saving process.

The refactored test now properly mocks the dependencies and verifies the correct behavior
using withBlockHeaderAndNoUpdateNodeHead instead of withStateRootAndBlockHashAndUpdateNodeHead.

Signed-off-by: GarmashAlex <[email protected]>
bonsaiWorldStateArchive.getWorldState(
withStateRootAndBlockHashAndUpdateNodeHead(null, blockHeaderChainB.getHash())))
.containsInstanceOf(BonsaiWorldState.class);
withBlockHeaderAndNoUpdateNodeHead(blockHeaderChainB)))
Copy link
Contributor

Choose a reason for hiding this comment

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

could you do the test with withBlockHeaderAndUpdateNodeHead and not withBlockHeaderAnd_No_UpdateNodeHead

Copy link
Author

Choose a reason for hiding this comment

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

could you do the test with withBlockHeaderAndUpdateNodeHead and not withBlockHeaderAnd_No_UpdateNodeHead

done

Copy link
Contributor

Choose a reason for hiding this comment

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

tried on my side and the test is not working

@matkt matkt mentioned this pull request Apr 17, 2025
9 tasks
@matkt
Copy link
Contributor

matkt commented Apr 17, 2025

I removed this test and added a new tests in the trielog manager tests. Seems to be more coherent to move it and it will also simplify the logic of the test #8561 . I think we can close this one

@matkt matkt closed this Apr 17, 2025
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.

2 participants