Skip to content

Commit

Permalink
close worldstate clone correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
  • Loading branch information
matkt committed Jul 12, 2024
1 parent ed0a683 commit b4f58e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ public void runTransaction(
final BlockHashOperation.BlockHashLookup blockHashLookup,
final Wei blobGasPrice,
final PrivateMetadataUpdater privateMetadataUpdater) {
try {
final DiffBasedWorldState roundWorldState =
new BonsaiWorldState((BonsaiWorldState) worldState, new NoopBonsaiCachedMerkleTrieLoader());

try (final DiffBasedWorldState roundWorldState =
new BonsaiWorldState(
(BonsaiWorldState) worldState, new NoopBonsaiCachedMerkleTrieLoader())) {
roundWorldState.freeze(); // make the clone frozen
final ParallelizedTransactionContext.Builder contextBuilder =
new ParallelizedTransactionContext.Builder();
final DiffBasedWorldStateUpdateAccumulator<?> roundWorldStateUpdater =
Expand Down Expand Up @@ -195,9 +195,6 @@ public void traceBeforeRewardTransaction(
}
parallelizedTransactionContextByLocation.put(
transactionLocation, parallelizedTransactionContext);
roundWorldState.close();
} catch (Exception exception) {
// no-op
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ public BonsaiWorldState(
diffBasedWorldStateConfig);
}

public BonsaiWorldState(
final BonsaiWorldState worldState,
final DiffBasedWorldStateConfig diffBasedWorldStateConfig) {
this(
new BonsaiWorldStateLayerStorage(worldState.getWorldStateStorage()),
worldState.bonsaiCachedMerkleTrieLoader,
worldState.cachedWorldStorageManager,
worldState.trieLogManager,
worldState.accumulator.getEvmConfiguration(),
diffBasedWorldStateConfig);
}

public BonsaiWorldState(
final BonsaiWorldState worldState,
final BonsaiCachedMerkleTrieLoader cachedMerkleTrieLoader) {
Expand Down

0 comments on commit b4f58e4

Please sign in to comment.