Skip to content

Commit 3cc1953

Browse files
committed
Setup basic structure for smart contract search
1 parent 7bf2899 commit 3cc1953

File tree

6 files changed

+105
-0
lines changed

6 files changed

+105
-0
lines changed

src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<ProjectReference Include="..\Nethermind.Specs\Nethermind.Specs.csproj" />
6363
<ProjectReference Include="..\Nethermind.Synchronization\Nethermind.Synchronization.csproj" />
6464
<ProjectReference Include="..\Nethermind.UPnP.Plugin\Nethermind.UPnP.Plugin.csproj" />
65+
<ProjectReference Include="..\Nethermind.Search.Plugin\Nethermind.Search.Plugin.csproj" />
6566
</ItemGroup>
6667

6768
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Nethermind.Config;
2+
using Nethermind.Evm;
3+
4+
namespace Nethermind.Search.Plugin
5+
{
6+
public interface ISearchConfig : IConfig
7+
{
8+
[ConfigItem(
9+
Description = "Activates or Deactivates Search Plugin",
10+
DefaultValue = "false")]
11+
bool Enabled { get; set; }
12+
13+
[ConfigItem(
14+
Description = "Sets the file to which the search results are dumped",
15+
DefaultValue = "null")]
16+
string? File { get; set; }
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
<Nullable>enable</Nullable>
6+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\Nethermind.Api\Nethermind.Api.csproj" />
11+
<ProjectReference Include="..\Nethermind.Config\Nethermind.Config.csproj" />
12+
</ItemGroup>
13+
14+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Nethermind.Config;
2+
using Nethermind.Evm;
3+
4+
namespace Nethermind.Search.Plugin
5+
{
6+
public class SearchConfig : ISearchConfig
7+
{
8+
public bool Enabled { get; set; }
9+
public string? File { get; set; }
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
3+
// SPDX-License-Identifier: LGPL-3.0-only
4+
using System;
5+
using System.Threading.Tasks;
6+
using Nethermind.Api;
7+
using Nethermind.Api.Extensions;
8+
using Nethermind.Core;
9+
using Nethermind.JsonRpc.Client;
10+
using Nethermind.JsonRpc;
11+
using Nethermind.Network;
12+
using Nethermind.Consensus;
13+
using Nethermind.KeyStore.Config;
14+
using System.Configuration;
15+
using Nethermind.Logging;
16+
using System.IO.Abstractions;
17+
18+
namespace Nethermind.Search.Plugin;
19+
public class SearchPlugin : INethermindPlugin
20+
{
21+
public string Name => "Search";
22+
public string Description => "";
23+
public string Author => "Nethermind";
24+
private INethermindApi _api = null!;
25+
private ISearchConfig _config = null!;
26+
private ILogManager _logManager = null!;
27+
private ILogger _logger;
28+
private bool Enabled => _config?.Enabled == true;
29+
30+
public Task Init(INethermindApi nethermindApi)
31+
{
32+
_api = nethermindApi;
33+
_logManager = _api.LogManager;
34+
_config = _api.Config<ISearchConfig>();
35+
_logger = _logManager.GetClassLogger<SearchPlugin>();
36+
return Task.CompletedTask;
37+
}
38+
39+
public Task InitNetworkProtocol()
40+
{
41+
if (Enabled)
42+
{
43+
if (_logger.IsInfo) _logger.Info($"Setting up search plugin");
44+
45+
// Setup Search
46+
}
47+
48+
return Task.CompletedTask;
49+
}
50+
51+
ValueTask IAsyncDisposable.DisposeAsync()
52+
{
53+
return ValueTask.CompletedTask;
54+
}
55+
}

src/Nethermind/Nethermind.sln

+6
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethermind.Serialization.Ss
230230
EndProject
231231
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethermind.Serialization.SszGenerator.Test", "Nethermind.Serialization.SszGenerator.Test\Nethermind.Serialization.SszGenerator.Test.csproj", "{E11DA65F-7F52-40DA-BBF4-E6E90932EB68}"
232232
EndProject
233+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethermind.Search.Plugin", "Nethermind.Search.Plugin\Nethermind.Search.Plugin.csproj", "{E4451E87-5A91-4108-94B2-24CA837CD8DE}"
234+
EndProject
233235
Global
234236
GlobalSection(SolutionConfigurationPlatforms) = preSolution
235237
Debug|Any CPU = Debug|Any CPU
@@ -636,6 +638,10 @@ Global
636638
{E11DA65F-7F52-40DA-BBF4-E6E90932EB68}.Debug|Any CPU.Build.0 = Debug|Any CPU
637639
{E11DA65F-7F52-40DA-BBF4-E6E90932EB68}.Release|Any CPU.ActiveCfg = Release|Any CPU
638640
{E11DA65F-7F52-40DA-BBF4-E6E90932EB68}.Release|Any CPU.Build.0 = Release|Any CPU
641+
{E4451E87-5A91-4108-94B2-24CA837CD8DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
642+
{E4451E87-5A91-4108-94B2-24CA837CD8DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
643+
{E4451E87-5A91-4108-94B2-24CA837CD8DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
644+
{E4451E87-5A91-4108-94B2-24CA837CD8DE}.Release|Any CPU.Build.0 = Release|Any CPU
639645
EndGlobalSection
640646
GlobalSection(SolutionProperties) = preSolution
641647
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)