update some deprecated references (#8314)

* update some deprecated references

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

* change order of params to eliminate deprecation warning

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
Sally MacFarlane
2025-02-19 08:24:39 +10:00
committed by GitHub
parent 18e3917f37
commit 984173e134
7 changed files with 19 additions and 16 deletions

View File

@@ -48,7 +48,7 @@ public class AbstractPreexistingNodeTest extends AcceptanceTestBase {
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;
}

View File

@@ -121,7 +121,7 @@ interface GenesisReader {
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;

View File

@@ -41,11 +41,12 @@ public class GenesisReaderTest {
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);
@@ -61,11 +62,12 @@ public class GenesisReaderTest {
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);

View File

@@ -54,7 +54,7 @@ public class ProtocolScheduleFixture {
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)));

View File

@@ -47,6 +47,7 @@ import java.util.HashMap;
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;
@@ -63,7 +64,7 @@ import org.apache.tuweni.units.bigints.UInt256;
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;
@@ -524,7 +525,7 @@ class SnapServer implements BesuEvents.InitialSyncCompletionListener {
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;
}

View File

@@ -24,11 +24,11 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator;
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
*/
@@ -45,10 +45,10 @@ public class ReturnDataLoadOperation extends AbstractOperation {
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));

View File

@@ -100,7 +100,7 @@ public class RocksDBSnapshotTransaction
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);
}