Skip to content

Commit

Permalink
update some deprecated references (hyperledger#8314)
Browse files Browse the repository at this point in the history
* update some deprecated references

Signed-off-by: Sally MacFarlane <[email protected]>

* change order of params to eliminate deprecation warning

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>
  • Loading branch information
macfarla authored Feb 18, 2025
1 parent 18e3917 commit 984173e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected static void extract(final Path path, final String destDirectory) throw
new TarArchiveInputStream(
new GzipCompressorInputStream(new FileInputStream(path.toAbsolutePath().toString())))) {
TarArchiveEntry entry;
while ((entry = fin.getNextTarEntry()) != null) {
while ((entry = fin.getNextEntry()) != null) {
if (entry.isDirectory()) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public Stream<GenesisAccount> streamAllocations() {
try {
parser.nextToken();
while (parser.nextToken() != JsonToken.END_OBJECT) {
if (ALLOCATION_FIELD.equals(parser.getCurrentName())) {
if (ALLOCATION_FIELD.equals(parser.currentName())) {
parser.nextToken();
parser.nextToken();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ public void readGenesisFromObjectNode() {
final var configNode = mapper.createObjectNode();
configNode.put("londonBlock", 1);
final var allocNode = mapper.createObjectNode();
allocNode.put(Address.BLS12_G2MULTIEXP.toUnprefixedHexString(), generateAllocation(Wei.ONE));
allocNode.putIfAbsent(
Address.BLS12_G2MULTIEXP.toUnprefixedHexString(), generateAllocation(Wei.ONE));
final var rootNode = mapper.createObjectNode();
rootNode.put("chainId", 12);
rootNode.put(CONFIG_FIELD, configNode);
rootNode.put(ALLOCATION_FIELD, allocNode);
rootNode.putIfAbsent(CONFIG_FIELD, configNode);
rootNode.putIfAbsent(ALLOCATION_FIELD, allocNode);
final var genesisReader = new GenesisReader.FromObjectNode(rootNode);

assertThat(genesisReader.getRoot().get("chainid").asInt()).isEqualTo(12);
Expand All @@ -61,11 +62,12 @@ public void readGenesisFromObjectDoesNotModifyObjectNodeArg() {
final var configNode = mapper.createObjectNode();
configNode.put("londonBlock", 1);
final var allocNode = mapper.createObjectNode();
allocNode.put(Address.BLS12_G2MULTIEXP.toUnprefixedHexString(), generateAllocation(Wei.ONE));
allocNode.putIfAbsent(
Address.BLS12_G2MULTIEXP.toUnprefixedHexString(), generateAllocation(Wei.ONE));
final var rootNode = mapper.createObjectNode();
rootNode.put("chainId", 12);
rootNode.put(CONFIG_FIELD, configNode);
rootNode.put(ALLOCATION_FIELD, allocNode);
rootNode.putIfAbsent(CONFIG_FIELD, configNode);
rootNode.putIfAbsent(ALLOCATION_FIELD, allocNode);
var rootNodeCopy = rootNode.deepCopy();
new GenesisReader.FromObjectNode(rootNode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static GenesisConfigOptions getGenesisConfigOptions(final String genesisC
new JsonFactory().createParser(GenesisConfig.class.getResource(genesisConfig))) {

while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
if ("config".equals(jsonParser.getCurrentName())) {
if ("config".equals(jsonParser.currentName())) {
jsonParser.nextToken();
return JsonGenesisConfigOptions.fromJsonObject(
normalizeKeys(new ObjectMapper().readTree(jsonParser)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.List;
import java.util.NavigableMap;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
Expand All @@ -63,7 +64,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** See https://github.com/ethereum/devp2p/blob/master/caps/snap.md */
/** See <a href="https://github.com/ethereum/devp2p/blob/master/caps/snap.md">snap</a> */
class SnapServer implements BesuEvents.InitialSyncCompletionListener {
private static final Logger LOGGER = LoggerFactory.getLogger(SnapServer.class);
private static final int PRIME_STATE_ROOT_CACHE_LIMIT = 128;
Expand Down Expand Up @@ -524,7 +525,7 @@ MessageData constructGetTrieNodesResponse(final MessageData message) {
var trieNode = optStorage.orElse(Bytes.EMPTY);
if (!trieNodes.isEmpty()
&& (sumListBytes(trieNodes) + trieNode.size() > maxResponseBytes
|| stopWatch.getTime()
|| stopWatch.getTime(TimeUnit.MILLISECONDS)
> ResponseSizePredicate.MAX_MILLIS_PER_REQUEST)) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;

/** The Return data copy operation. */
/** The Return data load operation. */
public class ReturnDataLoadOperation extends AbstractOperation {

/**
* Instantiates a new Return data copy operation.
* Instantiates a new Return data load operation.
*
* @param gasCalculator the gas calculator
*/
Expand All @@ -45,10 +45,10 @@ public OperationResult execute(final MessageFrame frame, final EVM evm) {

final int offset = clampedToInt(frame.popStackItem());
Bytes returnData = frame.getReturnData();
int retunDataSize = returnData.size();
int returnDataSize = returnData.size();

Bytes value;
if (offset > retunDataSize) {
if (offset > returnDataSize) {
value = Bytes.EMPTY;
} else if (offset + 32 >= returnData.size()) {
value = Bytes32.rightPad(returnData.slice(offset));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public Optional<byte[]> get(final SegmentIdentifier segmentId, final byte[] key)
throwIfClosed();

try (final OperationTimer.TimingContext ignored = metrics.getReadLatency().startTimer()) {
return Optional.ofNullable(snapTx.get(columnFamilyMapper.apply(segmentId), readOptions, key));
return Optional.ofNullable(snapTx.get(readOptions, columnFamilyMapper.apply(segmentId), key));
} catch (final RocksDBException e) {
throw new StorageException(e);
}
Expand Down

0 comments on commit 984173e

Please sign in to comment.