diff --git a/Circles.Index.CirclesV1/Circles.Index.CirclesV1.csproj b/Circles.Index.CirclesV1/Circles.Index.CirclesV1.csproj index 570bdb8..17cda96 100644 --- a/Circles.Index.CirclesV1/Circles.Index.CirclesV1.csproj +++ b/Circles.Index.CirclesV1/Circles.Index.CirclesV1.csproj @@ -8,7 +8,7 @@ - + diff --git a/Circles.Index.CirclesV2/Circles.Index.CirclesV2.csproj b/Circles.Index.CirclesV2/Circles.Index.CirclesV2.csproj index 27fe4c1..5406e33 100644 --- a/Circles.Index.CirclesV2/Circles.Index.CirclesV2.csproj +++ b/Circles.Index.CirclesV2/Circles.Index.CirclesV2.csproj @@ -13,7 +13,7 @@ - + diff --git a/Circles.Index.Common/Circles.Index.Common.csproj b/Circles.Index.Common/Circles.Index.Common.csproj index db76601..c20eadf 100644 --- a/Circles.Index.Common/Circles.Index.Common.csproj +++ b/Circles.Index.Common/Circles.Index.Common.csproj @@ -8,7 +8,7 @@ - + diff --git a/Circles.Index.Common/Context.cs b/Circles.Index.Common/Context.cs index bc0e325..5989a4d 100644 --- a/Circles.Index.Common/Context.cs +++ b/Circles.Index.Common/Context.cs @@ -5,7 +5,7 @@ namespace Circles.Index.Common; public record Context( INethermindApi NethermindApi, - ILogger Logger, + InterfaceLogger Logger, Settings Settings, IDatabase Database, ILogParser[] LogParsers, diff --git a/Circles.Index.Common/LoggerWithPrefix.cs b/Circles.Index.Common/LoggerWithPrefix.cs index d8131c2..801a60c 100644 --- a/Circles.Index.Common/LoggerWithPrefix.cs +++ b/Circles.Index.Common/LoggerWithPrefix.cs @@ -2,33 +2,33 @@ namespace Circles.Index.Common; -public class LoggerWithPrefix(string prefix, ILogger logger) : ILogger +public class LoggerWithPrefix(string prefix, ILogger logger) : InterfaceLogger { public void Info(string text) { logger.Info($"{prefix} {text}"); } - + public void Warn(string text) { logger.Warn($"{prefix} {text}"); } - + public void Debug(string text) { logger.Debug($"{prefix} {text}"); } - + public void Trace(string text) { logger.Trace($"{prefix} {text}"); } - + public void Error(string text, Exception ex) { logger.Error($"{prefix} {text}", ex); } - + public bool IsInfo { get; } public bool IsWarn { get; } public bool IsDebug { get; } diff --git a/Circles.Index.Query.Tests/Circles.Index.Query.Tests.csproj b/Circles.Index.Query.Tests/Circles.Index.Query.Tests.csproj index 2de7c54..da75901 100644 --- a/Circles.Index.Query.Tests/Circles.Index.Query.Tests.csproj +++ b/Circles.Index.Query.Tests/Circles.Index.Query.Tests.csproj @@ -10,10 +10,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Circles.Index.Query.Tests/Test.cs b/Circles.Index.Query.Tests/Test.cs index e4ba52f..75a88e2 100644 --- a/Circles.Index.Query.Tests/Test.cs +++ b/Circles.Index.Query.Tests/Test.cs @@ -4,6 +4,7 @@ using System.Text.RegularExpressions; using Circles.Index.Common; using Circles.Index.Query.Dto; +using NUnit.Framework.Legacy; namespace Circles.Index.Query.Tests; @@ -91,13 +92,13 @@ public void FilterPredicate_ToSql_Equals() // Use regex to match the uuid part of the parameter name var expectedSql = "\"Name\" = @Name_([0-9a-f]{32})"; var expectedSqlMatch = Regex.Match(generatedSql.Sql, expectedSql); - Assert.IsTrue(expectedSqlMatch.Success); + Assert.That(expectedSqlMatch.Success); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(1)); var expectedParameterName = "Name_([0-9a-f]{32})"; var expectedParameterNameMatch = Regex.Match(generatedSql.Parameters.First().ParameterName, expectedParameterName); - Assert.IsTrue(expectedParameterNameMatch.Success); + Assert.That(expectedParameterNameMatch.Success); Assert.That(generatedSql.Parameters.First().Value, Is.EqualTo("John")); Assert.That(expectedSqlMatch.Groups[1].Value, Is.EqualTo(expectedParameterNameMatch.Groups[1].Value)); @@ -110,7 +111,7 @@ public void FilterPredicate_ToSql_NotEquals() var generatedSql = predicate.ToSql(_database); var expectedSql = "\"Name\" != @Name_[0-9a-f]{32}"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(1)); } @@ -121,7 +122,7 @@ public void FilterPredicate_ToSql_GreaterThan() var generatedSql = predicate.ToSql(_database); var expectedSql = "\"Age\" > @Age_[0-9a-f]{32}"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(1)); } @@ -132,7 +133,7 @@ public void FilterPredicate_ToSql_Like() var generatedSql = predicate.ToSql(_database); var expectedSql = "\"Name\" LIKE @Name_[0-9a-f]{32}"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(1)); } @@ -143,7 +144,7 @@ public void FilterPredicate_ToSql_In() var generatedSql = predicate.ToSql(_database); var expectedSql = "\"Age\" IN \\(@Age_[0-9a-f]{32}_0, @Age_[0-9a-f]{32}_1, @Age_[0-9a-f]{32}_2\\)"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(3)); } @@ -167,7 +168,7 @@ public void Conjunction_ToSql_And() var generatedSql = conjunction.ToSql(_database); var expectedSql = "(\"Name\" = @Name_[0-9a-f]{32} AND \"Age\" > @Age_[0-9a-f]{32})"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(2)); } @@ -181,7 +182,7 @@ public void Conjunction_ToSql_Or() var generatedSql = conjunction.ToSql(_database); var expectedSql = "(\"Name\" = @Name_[0-9a-f]{32} OR \"Age\" > @Age_[0-9a-f]{32})"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(2)); } @@ -201,7 +202,7 @@ public void Conjunction_ToSql_Nested() // (("Name" = @Name_56a4d14bb806402bb324662f75c79c14 OR "Age" > @Age_0f82e44befb94ea78ac8b195483e39ee) AND "Country" = @Country_a98a69fdeead40348065abda5b8d72c2) var expectedSql = "\\(\\(\"Name\" = @Name_[0-9a-f]{32} OR \"Age\" > @Age_[0-9a-f]{32}\\) AND \"Country\" = @Country_[0-9a-f]{32}\\)"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(3)); } @@ -228,7 +229,7 @@ public void Select_ToSql_WithFilter() var generatedSql = select.ToSql(_database); var expectedSql = "SELECT \"Name\", \"Age\" FROM \"public_Users\" WHERE \"Name\" = @Name_[0-9a-f]{32}"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(1)); } @@ -258,7 +259,7 @@ public void Select_ToSql_WithFilterAndOrderBy() var expectedSql = "SELECT \"Name\", \"Age\" FROM \"public_Users\" WHERE \"Name\" = @Name_[0-9a-f]{32} ORDER BY \"Age\" DESC"; - Assert.IsTrue(Regex.IsMatch(generatedSql.Sql, expectedSql)); + Assert.That(Regex.IsMatch(generatedSql.Sql, expectedSql)); Assert.That(generatedSql.Parameters.Count(), Is.EqualTo(1)); } @@ -298,7 +299,7 @@ public void JsonSerialization_Deserialization() Assert.That(deserializedSelect.Namespace, Is.EqualTo(select.Namespace)); Assert.That(deserializedSelect.Table, Is.EqualTo(select.Table)); - CollectionAssert.AreEqual(select.Columns, deserializedSelect.Columns); + Assert.That(deserializedSelect.Columns, Is.EqualTo(select.Columns).AsCollection); Assert.That(deserializedSelect.Distinct, Is.EqualTo(select.Distinct)); var deserializedPredicate = (FilterPredicate)deserializedSelect.Filter.First(); @@ -346,7 +347,7 @@ public void JsonSerialization_Deserialization_Complex() Assert.That(deserializedSelect.Namespace, Is.EqualTo(select.Namespace)); Assert.That(deserializedSelect.Table, Is.EqualTo(select.Table)); - CollectionAssert.AreEqual(select.Columns, deserializedSelect.Columns); + Assert.That(deserializedSelect.Columns, Is.EqualTo(select.Columns).AsCollection); Assert.That(deserializedSelect.Distinct, Is.EqualTo(select.Distinct)); Assert.That(deserializedSelect.Limit, Is.EqualTo(select.Limit)); diff --git a/Circles.Index.Rpc/Circles.Index.Rpc.csproj b/Circles.Index.Rpc/Circles.Index.Rpc.csproj index 71884e0..f2adecb 100644 --- a/Circles.Index.Rpc/Circles.Index.Rpc.csproj +++ b/Circles.Index.Rpc/Circles.Index.Rpc.csproj @@ -8,7 +8,7 @@ - + diff --git a/Circles.Index.Rpc/CirclesRpcModule.cs b/Circles.Index.Rpc/CirclesRpcModule.cs index 53a33b6..7df0c5a 100644 --- a/Circles.Index.Rpc/CirclesRpcModule.cs +++ b/Circles.Index.Rpc/CirclesRpcModule.cs @@ -16,7 +16,7 @@ namespace Circles.Index.Rpc; public class CirclesRpcModule : ICirclesRpcModule { - private readonly ILogger _pluginLogger; + private readonly InterfaceLogger _pluginLogger; private readonly Context _indexerContext; public CirclesRpcModule(Context indexerContext) diff --git a/Circles.Index/Circles.Index.csproj b/Circles.Index/Circles.Index.csproj index f0dfaa7..b0258ec 100644 --- a/Circles.Index/Circles.Index.csproj +++ b/Circles.Index/Circles.Index.csproj @@ -8,8 +8,8 @@ Daniel Janz (Gnosis Service GmbH) Gnosis Service GmbH Circles - 1.3.10 - 1.3.10 + 1.4.0 + 1.4.0 @@ -22,7 +22,7 @@ - + diff --git a/Circles.Index/Plugin.cs b/Circles.Index/Plugin.cs index 4512511..c125907 100644 --- a/Circles.Index/Plugin.cs +++ b/Circles.Index/Plugin.cs @@ -40,7 +40,7 @@ public async Task Init(INethermindApi nethermindApi) IDatabaseSchema databaseSchema = new CompositeDatabaseSchema([common, v1, v2, v2NameRegistry, circlesViews]); ILogger baseLogger = nethermindApi.LogManager.GetClassLogger(); - ILogger pluginLogger = new LoggerWithPrefix($"{Name}: ", baseLogger); + InterfaceLogger pluginLogger = new LoggerWithPrefix($"{Name}: ", baseLogger); Settings settings = new(); IDatabase database = new PostgresDb(settings.IndexDbConnectionString, databaseSchema); @@ -109,7 +109,7 @@ public async Task Init(INethermindApi nethermindApi) }; } - private void LogSettings(ILogger pluginLogger, Settings settings, IDatabase database) + private void LogSettings(InterfaceLogger pluginLogger, Settings settings, IDatabase database) { // Log all indexed events pluginLogger.Info("Indexing events:"); @@ -132,7 +132,7 @@ private void LogSettings(ILogger pluginLogger, Settings settings, IDatabase data // pluginLogger.Info("Start index from: " + settings.StartBlock); } - private static void InitCaches(ILogger logger, IDatabase database) + private static void InitCaches(InterfaceLogger logger, IDatabase database) { logger.Info("Caching Circles token addresses"); diff --git a/arm64.Dockerfile b/arm64.Dockerfile index 3cfed88..0a510cf 100644 --- a/arm64.Dockerfile +++ b/arm64.Dockerfile @@ -6,7 +6,7 @@ COPY . . RUN dotnet restore RUN dotnet publish -c Release -o /circles-nethermind-plugin -FROM nethermind/nethermind:1.25.4 AS base +FROM nethermind/nethermind:1.27.0 AS base # dotnet libs COPY --from=build /circles-nethermind-plugin/Circles.Index.deps.json /nethermind/plugins diff --git a/x64.Dockerfile b/x64.Dockerfile index a2b0a53..57c8ad0 100644 --- a/x64.Dockerfile +++ b/x64.Dockerfile @@ -6,7 +6,7 @@ COPY . . RUN dotnet restore RUN dotnet publish -c Release -o /circles-nethermind-plugin -FROM nethermind/nethermind:1.25.4 AS base +FROM nethermind/nethermind:1.27.0 AS base # dotnet libs COPY --from=build /circles-nethermind-plugin/Circles.Index.deps.json /nethermind/plugins diff --git a/x64.debug.Dockerfile b/x64.debug.Dockerfile index 8cd62e6..1d8b6a7 100644 --- a/x64.debug.Dockerfile +++ b/x64.debug.Dockerfile @@ -6,7 +6,7 @@ COPY . . RUN dotnet restore RUN dotnet publish -c Debug -o /circles-nethermind-plugin -FROM nethermind/nethermind:1.25.4 AS base +FROM nethermind/nethermind:1.27.0 AS base # dotnet libs COPY --from=build /circles-nethermind-plugin/Circles.Index.deps.json /nethermind/plugins diff --git a/x64.debug.spaceneth.Dockerfile b/x64.debug.spaceneth.Dockerfile index a3ee178..cd2c480 100644 --- a/x64.debug.spaceneth.Dockerfile +++ b/x64.debug.spaceneth.Dockerfile @@ -6,7 +6,7 @@ COPY . . RUN dotnet restore RUN dotnet publish -c Debug -o /circles-nethermind-plugin -FROM nethermind/nethermind:1.25.4 AS base +FROM nethermind/nethermind:1.27.0 AS base # dotnet libs COPY --from=build /circles-nethermind-plugin/Circles.Index.deps.json /nethermind/plugins