diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/storage/BonsaiPreImageProxy.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/storage/BonsaiPreImageProxy.java index 42a86ce36b2..248e5d895fd 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/storage/BonsaiPreImageProxy.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/storage/BonsaiPreImageProxy.java @@ -37,35 +37,11 @@ public interface BonsaiPreImageProxy extends WorldStatePreimageStorage { */ Hash hashAndSavePreImage(Bytes value); - /** PreImageProxy which does not store or cache preImages and only implements hashing. */ - class NoOpPreImageProxy implements BonsaiPreImageProxy { - - @Override - public Hash hashAndSavePreImage(final Bytes value) { - return Hash.hash(value); - } - - @Override - public Optional getStorageTrieKeyPreimage(final Bytes32 trieKey) { - return Optional.empty(); - } - - @Override - public Optional
getAccountTrieKeyPreimage(final Bytes32 trieKey) { - return Optional.empty(); - } - - @Override - public Updater updater() { - throw new UnsupportedOperationException("NoOpPreImageProxy does not implement an updater"); - } - } - /** * A caching PreImageProxy suitable for ReferenceTestWorldState which saves hashes in an unbounded * BiMap. */ - class BonsaiReferenceTestPreImageProxy extends NoOpPreImageProxy { + class BonsaiReferenceTestPreImageProxy implements BonsaiPreImageProxy { BiMap preImageCache = HashBiMap.create(); @Override @@ -82,5 +58,11 @@ public Optional getStorageTrieKeyPreimage(final Bytes32 trieKey) { public Optional
getAccountTrieKeyPreimage(final Bytes32 trieKey) { return Optional.ofNullable(preImageCache.get(trieKey)).map(Address::wrap); } + + @Override + public Updater updater() { + throw new UnsupportedOperationException( + "BonsaiReferenceTestPreImageProxy does not implement an updater"); + } } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/worldview/BonsaiWorldStateUpdateAccumulator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/worldview/BonsaiWorldStateUpdateAccumulator.java index f0348f54325..23fd7625fa3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/worldview/BonsaiWorldStateUpdateAccumulator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/worldview/BonsaiWorldStateUpdateAccumulator.java @@ -128,7 +128,7 @@ public MutableAccount createAccount(final Address address, final long nonce, fin accountsToUpdate.put(address, bonsaiValue); } else if (bonsaiValue.getUpdated() != null) { if (bonsaiValue.getUpdated().isEmpty()) { - return new WrappedEvmAccount(track(new UpdateTrackingAccount<>(bonsaiValue.getUpdated()))); + return track(new UpdateTrackingAccount<>(bonsaiValue.getUpdated())); } else { throw new IllegalStateException("Cannot create an account when one already exists"); } diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index 7aa85e8120c..e544419b8ab 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -69,7 +69,7 @@ Calculated : ${currentHash} tasks.register('checkAPIChanges', FileStateChecker) { description = "Checks that the API for the Plugin-API project does not change without deliberate thought" files = sourceSets.main.allJava.files - knownHash = 'A44Xsq60UEFaeGmScHw+MVOgqWvJanMmEAqDtiaDA8k=' + knownHash = 'tpSnjt4HgqSiOTJhBbYdB0r1nFX4QZbicjfloI71Wf0=' } check.dependsOn('checkAPIChanges') diff --git a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java index 5d058bbaddb..0897493eb19 100644 --- a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java +++ b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBSnapshotTransaction.java @@ -166,7 +166,15 @@ public Stream streamKeys(final SegmentIdentifier segmentId) { rocksIterator.seekToFirst(); return RocksDbIterator.create(rocksIterator).toStreamKeys(); } - + /** + * Returns a stream of key-value pairs starting from the specified key. This method is used to + * retrieve a stream of data reading through the transaction, starting from the given key. If no + * data is available from the specified key onwards, an empty stream is returned. + * + * @param segment The segment identifier whose keys we want to stream. + * @param startKey The key from which the stream should start. + * @return A stream of key-value pairs starting from the specified key. + */ public Stream> streamFromKey( final SegmentIdentifier segment, final byte[] startKey) { throwIfClosed(); @@ -177,6 +185,17 @@ public Stream> streamFromKey( return RocksDbIterator.create(rocksIterator).toStream(); } + /** + * Returns a stream of key-value pairs starting from the specified key, ending at the specified + * key. This method is used to retrieve a stream of data reading through the transaction, starting + * from the given key. If no data is available from the specified key onwards, an empty stream is + * returned. + * + * @param segment The segment identifier whose keys we want to stream. + * @param startKey The key from which the stream should start. + * @param endKey The key at which the stream should stop. + * @return A stream of key-value pairs starting from the specified key. + */ public Stream> streamFromKey( final SegmentIdentifier segment, final byte[] startKey, final byte[] endKey) { throwIfClosed();