fix unit tests

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
pull/6920/head
Karim TAAM 1 year ago
parent d8a411ea3c
commit e9558d3a38
  1. 2
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/RestoreState.java
  2. 16
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/ForestKeyValueStorageWorldStateStorageTest.java
  3. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/FastWorldStateDownloaderTest.java

@ -263,7 +263,7 @@ public class RestoreState implements Runnable {
private void updateCode(final Bytes code) {
maybeCommitUpdater();
updater.putCode(null, code);
updater.putCode(code);
}
private void updateAccountState(final Bytes32 key, final Bytes value) {

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.storage.keyvalue;
package org.hyperledger.besu.ethereum.forest;
import static org.assertj.core.api.Assertions.assertThat;
@ -26,7 +26,7 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256;
import org.junit.jupiter.api.Test;
public class KeyValueStorageWorldStateStorageTest {
public class ForestKeyValueStorageWorldStateStorageTest {
@Test
public void getCode_returnsEmpty() {
@ -64,7 +64,7 @@ public class KeyValueStorageWorldStateStorageTest {
@Test
public void getCode_saveAndGetSpecialValues() {
final ForestWorldStateKeyValueStorage storage = emptyStorage();
storage.updater().putCode(null, MerkleTrie.EMPTY_TRIE_NODE);
storage.updater().putCode(MerkleTrie.EMPTY_TRIE_NODE);
storage.updater().putCode(Bytes.EMPTY).commit();
assertThat(storage.getCode(MerkleTrie.EMPTY_TRIE_NODE_HASH))
@ -76,7 +76,7 @@ public class KeyValueStorageWorldStateStorageTest {
public void getCode_saveAndGetRegularValue() {
final Bytes bytes = Bytes.fromHexString("0x123456");
final ForestWorldStateKeyValueStorage storage = emptyStorage();
storage.updater().putCode(null, bytes).commit();
storage.updater().putCode(bytes).commit();
assertThat(storage.getCode(Hash.hash(bytes))).contains(bytes);
}
@ -162,10 +162,10 @@ public class KeyValueStorageWorldStateStorageTest {
final Updater updaterA = storage.updater();
final Updater updaterB = storage.updater();
updaterA.putCode(null, bytesA);
updaterB.putCode(null, bytesA);
updaterB.putCode(null, bytesB);
updaterA.putCode(null, bytesC);
updaterA.putCode(bytesA);
updaterB.putCode(bytesA);
updaterB.putCode(bytesB);
updaterA.putCode(bytesC);
updaterA.commit();
updaterB.commit();

@ -327,7 +327,7 @@ class FastWorldStateDownloaderTest {
final Map<Bytes32, Bytes> knownCode = new HashMap<>();
accounts.subList(0, 5).forEach(a -> knownCode.put(a.getCodeHash(), a.getCode()));
final ForestWorldStateKeyValueStorage.Updater localStorageUpdater = localStorage.updater();
knownCode.forEach((bytes32, code) -> localStorageUpdater.putCode(null, code));
knownCode.forEach((bytes32, code) -> localStorageUpdater.putCode(code));
localStorageUpdater.commit();
final WorldStateDownloader downloader =

Loading…
Cancel
Save