Skip to content

Commit

Permalink
fix bonsai isolation test assertions, workaround
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <garyschulte@gmail.com>
  • Loading branch information
garyschulte committed Apr 16, 2024
1 parent 49faeb7 commit 7c12480
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Expand Up @@ -40,6 +40,13 @@ public interface DataStorageConfiguration {
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.build();

DataStorageConfiguration DEFAULT_BONSAI_PARTIAL_DB_CONFIG =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.unstable(Unstable.DEFAULT_PARTIAL)
.build();

DataStorageConfiguration DEFAULT_FOREST_CONFIG =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.FOREST)
Expand Down Expand Up @@ -73,6 +80,9 @@ interface Unstable {
DataStorageConfiguration.Unstable DEFAULT =
ImmutableDataStorageConfiguration.Unstable.builder().build();

DataStorageConfiguration.Unstable DEFAULT_PARTIAL =
ImmutableDataStorageConfiguration.Unstable.builder().bonsaiFullFlatDbEnabled(false).build();

@Value.Default
default boolean getBonsaiLimitTrieLogsEnabled() {
return DEFAULT_BONSAI_LIMIT_TRIE_LOGS_ENABLED;
Expand Down
Expand Up @@ -153,8 +153,9 @@ public abstract class AbstractIsolationTests {
@BeforeEach
public void createStorage() {
worldStateKeyValueStorage =
// TODO: this is a temporary fix for BonsaiSnapShotIsolationTests assertions
createKeyValueStorageProvider()
.createWorldStateStorage(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
.createWorldStateStorage(DataStorageConfiguration.DEFAULT_BONSAI_PARTIAL_DB_CONFIG);
archive =
new BonsaiWorldStateProvider(
(BonsaiWorldStateKeyValueStorage) worldStateKeyValueStorage,
Expand Down
Expand Up @@ -152,6 +152,8 @@ public void assertCloseDisposesOfStateWithoutCommitting() {
assertThat(res.isSuccessful()).isTrue();
shouldCloseSnapshot.persist(oneTx.getHeader());

// TODO: full flat strategy will not be updated with these values, only the trie
// determine how we want to make this assertion for full flat
assertThat(shouldCloseSnapshot.get(testAddress)).isNotNull();
assertThat(shouldCloseSnapshot.get(testAddress).getBalance())
.isEqualTo(Wei.of(1_000_000_000_000_000_000L));
Expand Down

0 comments on commit 7c12480

Please sign in to comment.