Skip to content

Commit

Permalink
Merge pull request #14 from aboutcircles/feat/nethermind-1.27.0
Browse files Browse the repository at this point in the history
Feat/nethermind 1.27.0
  • Loading branch information
jaensen authored Jul 19, 2024
2 parents 1908c36 + b52f8b0 commit 481493e
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Circles.Index.CirclesV1/Circles.Index.CirclesV1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Nethermind.Numerics.Int256" Version="1.2.0" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.25.4" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.27.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Circles.Index.CirclesV2/Circles.Index.CirclesV2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Nethermind.Numerics.Int256" Version="1.2.0" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.25.4" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.27.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Circles.Index.Common/Circles.Index.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Nethermind.Numerics.Int256" Version="1.2.0" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.25.4" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.27.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Circles.Index.Common/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Circles.Index.Common;

public record Context(
INethermindApi NethermindApi,
ILogger Logger,
InterfaceLogger Logger,
Settings Settings,
IDatabase Database,
ILogParser[] LogParsers,
Expand Down
12 changes: 6 additions & 6 deletions Circles.Index.Common/LoggerWithPrefix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
14 changes: 10 additions & 4 deletions Circles.Index.Query.Tests/Circles.Index.Query.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="NUnit" Version="3.14.0"/>
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"/>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
</ItemGroup>

Expand Down
27 changes: 14 additions & 13 deletions Circles.Index.Query.Tests/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion Circles.Index.Rpc/Circles.Index.Rpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.25.4" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.27.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Circles.Index.Rpc/CirclesRpcModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Circles.Index/Circles.Index.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<Authors>Daniel Janz (Gnosis Service GmbH)</Authors>
<Copyright>Gnosis Service GmbH</Copyright>
<Product>Circles</Product>
<AssemblyVersion>1.3.10</AssemblyVersion>
<FileVersion>1.3.10</FileVersion>
<AssemblyVersion>1.4.0</AssemblyVersion>
<FileVersion>1.4.0</FileVersion>
</PropertyGroup>


Expand All @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="Nethermind.Numerics.Int256" Version="1.2.0" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.25.4" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.27.0" />
</ItemGroup>


Expand Down
6 changes: 3 additions & 3 deletions Circles.Index/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:");
Expand All @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion arm64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x64.debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x64.debug.spaceneth.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 481493e

Please sign in to comment.