Merge branch 'main' into zkbesu

This commit is contained in:
Fabio Di Fabio
2024-11-06 09:16:45 +01:00
5 changed files with 31 additions and 2 deletions

View File

@@ -494,6 +494,7 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
final RpcEndpointServiceImpl rpcEndpointServiceImpl,
final BesuConfiguration commonPluginConfiguration,
final PermissioningServiceImpl permissioningService,
final MetricsConfiguration metricsConfiguration,
final MetricCategoryRegistryImpl metricCategoryRegistry,
final MetricsSystem metricsSystem,
final @Named("ExtraCLIOptions") List<String> extraCLIOptions,
@@ -512,6 +513,7 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
TransactionSimulationService.class, transactionSimulationServiceImpl);
besuPluginContext.addService(BlockchainService.class, blockchainServiceImpl);
besuPluginContext.addService(BesuConfiguration.class, commonPluginConfiguration);
metricCategoryRegistry.setMetricsConfiguration(metricsConfiguration);
besuPluginContext.addService(MetricCategoryRegistry.class, metricCategoryRegistry);
besuPluginContext.addService(MetricsSystem.class, metricsSystem);

View File

@@ -132,6 +132,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder {
genesisConfigOptions,
forksSchedule,
nodeKey,
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningConfiguration,

View File

@@ -80,7 +80,9 @@ interface GenesisReader {
final var on = normalizeKeys((ObjectNode) entry.getValue());
return new GenesisAccount(
Address.fromHexString(entry.getKey()),
JsonUtil.getString(on, "nonce").map(ParserUtils::parseUnsignedLong).orElse(0L),
JsonUtil.getValueAsString(on, "nonce")
.map(ParserUtils::parseUnsignedLong)
.orElse(0L),
JsonUtil.getString(on, "balance")
.map(ParserUtils::parseBalance)
.orElse(Wei.ZERO),

View File

@@ -17,6 +17,7 @@ package org.hyperledger.besu.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.config.GenesisReader.ALLOCATION_FIELD;
import static org.hyperledger.besu.config.GenesisReader.CONFIG_FIELD;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
@@ -27,6 +28,7 @@ import java.nio.file.Path;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -111,4 +113,17 @@ public class GenesisReaderTest {
entry.put("balance", balance.toShortHexString());
return entry;
}
@Test
void testNonceHandlingAsStringAndInteger() {
ObjectNode accountNode = JsonNodeFactory.instance.objectNode();
accountNode.put("nonce", 10);
String nonceAsStringFromInt = JsonUtil.getValueAsString(accountNode, "nonce").orElse("");
assertEquals("10", nonceAsStringFromInt, "Nonce should convert integer to string correctly");
accountNode.put("nonce", "20");
String nonceAsStringDirect = JsonUtil.getValueAsString(accountNode, "nonce").orElse("");
assertEquals("20", nonceAsStringDirect, "Nonce should keep string as string correctly");
}
}

View File

@@ -43,8 +43,14 @@ dependencies {
api project(':acceptance-tests:dsl')
api project(':besu')
api project(':config')
api project(':consensus:clique')
api project(':consensus:common')
api project(':consensus:ibft')
api project(':consensus:merge')
api project(':consensus:qbft')
api project(':crypto:algorithms')
api project(':crypto:services')
api project(':datatypes')
api project(':ethereum:api')
api project(':ethereum:blockcreation')
api project(':ethereum:core')
@@ -53,9 +59,12 @@ dependencies {
api project(':ethereum:permissioning')
api project(':ethereum:referencetests')
api project(':ethereum:rlp')
api project(':ethereum:trie')
api project(':evm')
api project(':datatypes')
api project(':metrics:core')
api project(':plugin-api')
api project(':testutil')
api project(':util')
api 'com.github.ben-manes.caffeine:caffeine:3.1.8'