Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix/uselesspeer-w…
Browse files Browse the repository at this point in the history
…rong-chain-id
  • Loading branch information
Marchhill committed Dec 12, 2024
2 parents c567ccf + e63eac0 commit 1d19713
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Nethermind/Nethermind.AuRa.Test/AuRaBlockProducerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ private async Task<TestResult> StartStop(Context context, bool processingQueueEm
});

context.BlockProducerRunner.Start();
await processedEvent.WaitOneAsync(context.StepDelay * stepDelayMultiplier * 5, CancellationToken.None);
await processedEvent.WaitOneAsync(context.StepDelay * stepDelayMultiplier * 20, CancellationToken.None);
context.BlockTree.ClearReceivedCalls();
await Task.Delay(context.StepDelay);
await Task.Delay(context.StepDelay * 2);
processedEvent.Reset();

try
Expand All @@ -248,7 +248,7 @@ private async Task<TestResult> StartStop(Context context, bool processingQueueEm
processedEvent.Reset();
}

await processedEvent.WaitOneAsync(context.StepDelay * stepDelayMultiplier * 5, CancellationToken.None);
await processedEvent.WaitOneAsync(context.StepDelay * stepDelayMultiplier * 20, CancellationToken.None);

}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Cipher": "test"
},
"JsonRpc": {
"EnabledModules": "Eth,Debug"
"EnabledModules": "Eth,Debug,"
},
"Discovery": {
"Concurrency": "4",
Expand All @@ -14,4 +14,4 @@
{
"IndexLevelBucketSizes" : [16, 16, 16]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void EnableModule<TOther>() where TOther : IRpcModule
{
if (!_jsonRpcConfig.EnabledModules.Contains(rpcModuleAttribute.ModuleType))
{
_jsonRpcConfig.EnabledModules = _jsonRpcConfig.EnabledModules.Union(new[] { rpcModuleAttribute.ModuleType }).ToArray();
_jsonRpcConfig.EnabledModules = _jsonRpcConfig.EnabledModules.Union([rpcModuleAttribute.ModuleType]).ToArray();
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/Nethermind/Nethermind.JsonRpc/JsonRpcConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class JsonRpcConfig : IJsonRpcConfig
{
public static readonly JsonRpcConfig Default = new();
private int? _webSocketsPort;
private string[] _enabledModules = ModuleType.DefaultModules.ToArray();
public bool Enabled { get; set; }
public string Host { get; set; } = "127.0.0.1";
public int Timeout { get; set; } = 20000;
Expand All @@ -29,7 +30,15 @@ public int WebSocketsPort

public string? IpcUnixDomainSocketPath { get; set; } = null;

public string[] EnabledModules { get; set; } = ModuleType.DefaultModules.ToArray();
public string[] EnabledModules
{
get => _enabledModules;
set
{
_enabledModules = value.Where(m => !string.IsNullOrWhiteSpace(m)).ToArray();
}
}

public string[] AdditionalRpcUrls { get; set; } = [];
public long? GasCap { get; set; } = 100000000;
public int ReportIntervalSeconds { get; set; } = 300;
Expand Down
5 changes: 3 additions & 2 deletions src/Nethermind/Nethermind.JsonRpc/JsonRpcUrlCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public JsonRpcUrlCollection(ILogManager logManager, IJsonRpcConfig jsonRpcConfig

private void BuildUrls(bool includeWebSockets)
{
bool HasEngineApi = _jsonRpcConfig.EnabledModules.Any(m => m.Equals(ModuleType.Engine, StringComparison.OrdinalIgnoreCase));
JsonRpcUrl defaultUrl = new(Uri.UriSchemeHttp, _jsonRpcConfig.Host, _jsonRpcConfig.Port, RpcEndpoint.Http, HasEngineApi, _jsonRpcConfig.EnabledModules, HasEngineApi ? SocketClient<WebSocketMessageStream>.MAX_REQUEST_BODY_SIZE_FOR_ENGINE_API : _jsonRpcConfig.MaxRequestBodySize);
bool hasEngineApi = _jsonRpcConfig.EnabledModules.Any(m => m.Equals(ModuleType.Engine, StringComparison.OrdinalIgnoreCase));
long? maxRequestBodySize = hasEngineApi ? SocketClient<WebSocketMessageStream>.MAX_REQUEST_BODY_SIZE_FOR_ENGINE_API : _jsonRpcConfig.MaxRequestBodySize;
JsonRpcUrl defaultUrl = new(Uri.UriSchemeHttp, _jsonRpcConfig.Host, _jsonRpcConfig.Port, RpcEndpoint.Http, hasEngineApi, _jsonRpcConfig.EnabledModules, maxRequestBodySize);

Add(defaultUrl.Port, defaultUrl);

Expand Down

0 comments on commit 1d19713

Please sign in to comment.