forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TrieLogFactory plugin support (hyperledger#5440)
* TrieLogs in plugin data * adds dagger-wired plugincontext and TrieLogService * add getTrieLogByRange, TrieLogRangeTuple composition --------- Signed-off-by: garyschulte <garyschulte@gmail.com>
- Loading branch information
1 parent
d73e894
commit b515a09
Showing
46 changed files
with
1,040 additions
and
318 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
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
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
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
55 changes: 55 additions & 0 deletions
55
datatypes/src/main/java/org/hyperledger/besu/datatypes/AccountValue.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,55 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu | ||
* | ||
* 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.datatypes; | ||
|
||
import org.hyperledger.besu.ethereum.rlp.RLPOutput; | ||
|
||
/** The values of an account in the world state trie. */ | ||
public interface AccountValue { | ||
/** | ||
* The nonce of the account. | ||
* | ||
* @return the nonce of the account. | ||
*/ | ||
long getNonce(); | ||
|
||
/** | ||
* The available balance of that account. | ||
* | ||
* @return the balance, in Wei, of the account. | ||
*/ | ||
Wei getBalance(); | ||
|
||
/** | ||
* The hash of the root of the storage trie associated with this account. | ||
* | ||
* @return the hash of the root node of the storage trie. | ||
*/ | ||
Hash getStorageRoot(); | ||
|
||
/** | ||
* The hash of the EVM bytecode associated with this account. | ||
* | ||
* @return the hash of the account code (which may be {@link Hash#EMPTY}). | ||
*/ | ||
Hash getCodeHash(); | ||
|
||
/** | ||
* Writes the account value to the provided {@link RLPOutput}. | ||
* | ||
* @param out the {@link RLPOutput} to write to. | ||
*/ | ||
void writeTo(final RLPOutput out); | ||
} |
111 changes: 111 additions & 0 deletions
111
datatypes/src/main/java/org/hyperledger/besu/datatypes/StorageSlotKey.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,111 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu | ||
* | ||
* 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.datatypes; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
import org.apache.tuweni.units.bigints.UInt256; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* StorageSlotKey represents a key used for storage slots in Ethereum. It contains the hash of the | ||
* slot key and an optional representation of the key itself. | ||
* | ||
* <p>The class provides methods for accessing the hash and key, as well as methods for equality, | ||
* hashcode, and comparison. | ||
* | ||
* <p>StorageSlotKey is used to uniquely identify storage slots within the Ethereum state. | ||
*/ | ||
public class StorageSlotKey implements Comparable<StorageSlotKey> { | ||
|
||
private final Hash slotHash; | ||
private final Optional<UInt256> slotKey; | ||
|
||
/** | ||
* Creates a StorageSlotKey. | ||
* | ||
* @param slotHash Hashed storage slot key. | ||
* @param slotKey Optional UInt256 storage slot key. | ||
*/ | ||
public StorageSlotKey(final Hash slotHash, final Optional<UInt256> slotKey) { | ||
this.slotHash = slotHash; | ||
this.slotKey = slotKey; | ||
} | ||
|
||
/** | ||
* Creates a StorageSlotKey, hashing the slotKey. | ||
* | ||
* @param slotKey the UInt256 storage slot key. | ||
*/ | ||
public StorageSlotKey(final UInt256 slotKey) { | ||
this(Hash.hash(slotKey), Optional.of(slotKey)); | ||
} | ||
|
||
/** | ||
* Gets the hash representation of the storage slot key. | ||
* | ||
* @return the hash of the storage slot key. | ||
*/ | ||
public Hash getSlotHash() { | ||
return slotHash; | ||
} | ||
|
||
/** | ||
* Gets the optional UInt256 representation of the storage slot key. | ||
* | ||
* @return an Optional containing the UInt256 storage slot key if present, otherwise an empty | ||
* Optional. | ||
*/ | ||
public Optional<UInt256> getSlotKey() { | ||
return slotKey; | ||
} | ||
|
||
/** | ||
* Indicates whether some other object is "equal to" this one. Two StorageSlotKey objects are | ||
* considered equal if their slot hash values are equal. | ||
* | ||
* @param o the reference object with which to compare. | ||
* @return true if this object is the same as the obj argument; false otherwise. | ||
*/ | ||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
StorageSlotKey that = (StorageSlotKey) o; | ||
return Objects.equals(slotHash, that.slotHash); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(slotHash.hashCode()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format( | ||
"StorageSlotKey{slotHash=%s, slotKey=%s}", | ||
slotHash, slotKey.map(UInt256::toString).orElse("null")); | ||
} | ||
|
||
@Override | ||
public int compareTo(@NotNull final StorageSlotKey other) { | ||
return this.slotHash.compareTo(other.slotHash); | ||
} | ||
} |
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
Oops, something went wrong.