diff --git a/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj b/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj
index a10c9fee8b1..d970fbf781b 100644
--- a/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj
+++ b/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj
@@ -117,6 +117,26 @@
<_ContentIncludedByDefault Remove="Contracts\EntryPoint.json" />
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
diff --git a/src/Nethermind/Nethermind.Runner/Program.cs b/src/Nethermind/Nethermind.Runner/Program.cs
index 8a02267bf7d..b6828aad633 100644
--- a/src/Nethermind/Nethermind.Runner/Program.cs
+++ b/src/Nethermind/Nethermind.Runner/Program.cs
@@ -1,16 +1,16 @@
// Copyright (c) 2021 Demerzel Solutions Limited
// This file is part of the Nethermind library.
-//
+//
// The Nethermind library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// The Nethermind library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
-//
+//
// You should have received a copy of the GNU Lesser General Public License
// along with the Nethermind. If not, see .
@@ -21,10 +21,12 @@
using System.IO.Abstractions;
using System.Linq;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils;
+using NativeImport;
using Nethermind.Api;
using Nethermind.Api.Extensions;
using Nethermind.Config;
@@ -142,6 +144,8 @@ private static void Run(string[] args)
Console.CancelKeyPress += ConsoleOnCancelKeyPress;
SetFinalDataDirectory(dataDir.HasValue() ? dataDir.Value() : null, initConfig, keyStoreConfig);
+
+
NLogManager logManager = new(initConfig.LogFileName, initConfig.LogDirectory, initConfig.LogRules);
_logger = logManager.GetClassLogger();
@@ -151,6 +155,8 @@ private static void Run(string[] args)
SetFinalDbPath(dbBasePath.HasValue() ? dbBasePath.Value() : null, initConfig);
LogMemoryConfiguration();
+ PatchRockDbVersion(initConfig.BaseDbPath);
+
EthereumJsonSerializer serializer = new();
if (_logger.IsDebug) _logger.Debug($"Nethermind config:{Environment.NewLine}{serializer.Serialize(initConfig, true)}{Environment.NewLine}");
@@ -196,6 +202,46 @@ await ethereumRunner.Start(_processCloseCancellationSource.Token).ContinueWith(x
_appClosed.Wait();
}
+ private static void PatchRockDbVersion(string baseDbPath)
+ {
+ void CheckAndPatch(string versiontoPatch, string[] versions)
+ {
+ if (!versions.Contains(versiontoPatch))
+ {
+ return;
+ }
+
+ _logger.Info($"Patching RocksDB versions: {string.Join(", ", versions)}");
+ foreach (var file in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "runtimes-1.13.5"), "*", SearchOption.AllDirectories))
+ {
+ File.Copy(file, file.Replace("runtimes-1.13.5", "runtimes"), true);
+ }
+ }
+
+ try
+ {
+ if (!Directory.Exists(baseDbPath))
+ {
+ return;
+ }
+
+ var versions = Directory.GetFiles(baseDbPath, "OPTIONS-*", SearchOption.AllDirectories)
+ .Select(f => File.ReadLines(f).SkipWhile(x => !x.StartsWith(" rocksdb_version=")).First().Replace(" rocksdb_version=", ""))
+ .Distinct()
+ .ToArray();
+
+ _logger.Info($"RocksDB files versions found: {string.Join(", ", versions)}");
+
+ CheckAndPatch("6.15.5", versions);
+ CheckAndPatch("6.26.1", versions); // TODO: check arm
+ }
+ catch(Exception ex)
+ {
+ _logger.Warn($"RocksDB patching failed {ex.Message}\n{ex.StackTrace}");
+ }
+ }
+
+
private static void BuildOptionsFromConfigFiles(CommandLineApplication app)
{
Type configurationType = typeof(IConfig);
@@ -253,7 +299,7 @@ private static string LoadPluginsDirectory(string[] args)
{
string shortCommand = "-pd";
string longCommand = "--pluginsDirectory";
-
+
string[] GetPluginArgs()
{
for (int i = 0; i < args.Length; i++)
@@ -267,7 +313,7 @@ string[] GetPluginArgs()
return Array.Empty();
}
-
+
CommandLineApplication pluginsApp = new() {Name = "Nethermind.Runner.Plugins"};
CommandOption pluginsAppDirectory = pluginsApp.Option($"{shortCommand}|{longCommand} ", "plugins directory", CommandOptionType.SingleValue);
string pluginDirectory = "plugins";
@@ -462,7 +508,7 @@ private static void ConfigureSeqLogger(IConfigProvider configProvider)
ISeqConfig seqConfig = configProvider.GetConfig();
if (seqConfig.MinLevel != "Off")
{
- if (_logger.IsInfo)
+ if (_logger.IsInfo)
_logger.Info($"Seq Logging enabled on host: {seqConfig.ServerUrl} with level: {seqConfig.MinLevel}");
NLogConfigurator.ConfigureSeqBufferTarget(seqConfig.ServerUrl, seqConfig.ApiKey, seqConfig.MinLevel);
}
diff --git a/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-arm/native/librocksdb.so b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-arm/native/librocksdb.so
new file mode 100644
index 00000000000..611aa852571
Binary files /dev/null and b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-arm/native/librocksdb.so differ
diff --git a/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-arm64/native/librocksdb.so b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-arm64/native/librocksdb.so
new file mode 100644
index 00000000000..45acecf7056
Binary files /dev/null and b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-arm64/native/librocksdb.so differ
diff --git a/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-x64/native/librocksdb.so b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-x64/native/librocksdb.so
new file mode 100644
index 00000000000..47a689d7b72
Binary files /dev/null and b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/linux-x64/native/librocksdb.so differ
diff --git a/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/osx-arm64/native/librocksdb.dylib b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/osx-arm64/native/librocksdb.dylib
new file mode 100644
index 00000000000..2b09d3c84a1
Binary files /dev/null and b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/osx-arm64/native/librocksdb.dylib differ
diff --git a/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/osx-x64/native/librocksdb.dylib b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/osx-x64/native/librocksdb.dylib
new file mode 100644
index 00000000000..c7b426fe9f2
Binary files /dev/null and b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/osx-x64/native/librocksdb.dylib differ
diff --git a/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/win-x64/native/rocksdb.dll b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/win-x64/native/rocksdb.dll
new file mode 100644
index 00000000000..d080b690a49
Binary files /dev/null and b/src/Nethermind/Nethermind.Runner/runtimes-1.13.5/win-x64/native/rocksdb.dll differ