Skip to content

Commit

Permalink
Merge branch 'main' into fix-peer-tx-tracker-missing-registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-10 authored Nov 7, 2024
2 parents 59ba97c + deb3fa2 commit cdda04c
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/stale-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 180
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 6 months with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: 30
days-before-pr-close: 14
stale-pr-message: "This pr is stale because it has been open for 30 days with no activity."
close-pr-message: "This pr was closed because it has been inactive for 14 days since being marked as stale."
remove-issue-stale-when-updated: true
remove-pr-stale-when-updated: true
repo-token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ public BesuPluginContextImpl providePluginContext(
final RpcEndpointServiceImpl rpcEndpointServiceImpl,
final BesuConfiguration commonPluginConfiguration,
final PermissioningServiceImpl permissioningService,
final MetricsConfiguration metricsConfiguration,
final MetricCategoryRegistryImpl metricCategoryRegistry,
final MetricsSystem metricsSystem,
final @Named("ExtraCLIOptions") List<String> extraCLIOptions,
Expand All @@ -512,6 +513,7 @@ public BesuPluginContextImpl providePluginContext(
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ protected ProtocolSchedule createProtocolSchedule() {
genesisConfigOptions,
forksSchedule,
nodeKey,
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public Stream<GenesisAccount> streamAllocations() {
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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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;
Expand All @@ -27,6 +28,7 @@
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;
Expand Down Expand Up @@ -111,4 +113,17 @@ private ObjectNode generateAllocation(final Wei balance) {
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");
}
}
11 changes: 10 additions & 1 deletion platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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'

Expand Down

0 comments on commit cdda04c

Please sign in to comment.