forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update genesis root hash generation logic
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
- Loading branch information
Showing
6 changed files
with
235 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...n/java/org/hyperledger/besu/ethereum/trie/bonsai/cache/NoOpCachedWorldStorageManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.trie.bonsai.cache; | ||
|
||
import org.hyperledger.besu.datatypes.Hash; | ||
import org.hyperledger.besu.ethereum.core.BlockHeader; | ||
import org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateKeyValueStorage; | ||
import org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldState; | ||
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Function; | ||
|
||
public class NoOpCachedWorldStorageManager extends CachedWorldStorageManager { | ||
|
||
public NoOpCachedWorldStorageManager( | ||
final BonsaiWorldStateKeyValueStorage bonsaiWorldStateKeyValueStorage) { | ||
super(null, bonsaiWorldStateKeyValueStorage, new NoOpMetricsSystem()); | ||
} | ||
|
||
@Override | ||
public synchronized void addCachedLayer( | ||
final BlockHeader blockHeader, | ||
final Hash worldStateRootHash, | ||
final BonsaiWorldState forWorldState) { | ||
// no cache | ||
} | ||
|
||
@Override | ||
public boolean containWorldStateStorage(final Hash blockHash) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Optional<BonsaiWorldState> getWorldState(final Hash blockHash) { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<BonsaiWorldState> getNearestWorldState(final BlockHeader blockHeader) { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<BonsaiWorldState> getHeadWorldState( | ||
final Function<Hash, Optional<BlockHeader>> hashBlockHeaderFunction) { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
// world states are not re-used | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...e/src/main/java/org/hyperledger/besu/ethereum/trie/bonsai/trielog/NoOpTrieLogManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.trie.bonsai.trielog; | ||
|
||
import org.hyperledger.besu.datatypes.Hash; | ||
import org.hyperledger.besu.ethereum.core.BlockHeader; | ||
import org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldState; | ||
import org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldStateUpdateAccumulator; | ||
import org.hyperledger.besu.plugin.services.trielogs.TrieLog; | ||
|
||
import java.util.Optional; | ||
|
||
public class NoOpTrieLogManager extends TrieLogManager { | ||
|
||
public NoOpTrieLogManager() { | ||
super(null, null, 0, null, TrieLogPruner.noOpTrieLogPruner()); | ||
} | ||
|
||
@SuppressWarnings({"UnsynchronizedOverridesSynchronized", "squid:S3551"}) | ||
@Override | ||
public void saveTrieLog( | ||
final BonsaiWorldStateUpdateAccumulator localUpdater, | ||
final Hash forWorldStateRootHash, | ||
final BlockHeader forBlockHeader, | ||
final BonsaiWorldState forWorldState) { | ||
// notify trie log added observers, synchronously | ||
TrieLog trieLog = trieLogFactory.create(localUpdater, forBlockHeader); | ||
trieLogObservers.forEach(o -> o.onTrieLogAdded(new TrieLogAddedEvent(trieLog))); | ||
} | ||
|
||
@Override | ||
public long getMaxLayersToLoad() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public Optional<TrieLog> getTrieLogLayer(final Hash blockHash) { | ||
return Optional.empty(); | ||
} | ||
} |
Oops, something went wrong.