From 10986d1ca73c76959331ea870f217356fbc84be9 Mon Sep 17 00:00:00 2001 From: uink45 <79078981+uink45@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:14:44 +1000 Subject: [PATCH] Improve connection behaviour; --- src/Lantern.Beacon.Console/Program.cs | 20 +- src/Lantern.Beacon/BeaconClientManager.cs | 73 ++++++-- src/Lantern.Beacon/BeaconClientOptions.cs | 177 +++++++++++++++++- .../BeaconClientServiceBuilder.cs | 15 +- .../BeaconClientServiceConfiguration.cs | 4 +- .../IBeaconClientServiceBuilder.cs | 4 - src/Lantern.Beacon/Storage/LiteDbService.cs | 16 +- .../BeaconClientManagerTests.cs | 4 +- .../BeaconClientServiceBuilderTests.cs | 19 -- 9 files changed, 255 insertions(+), 77 deletions(-) diff --git a/src/Lantern.Beacon.Console/Program.cs b/src/Lantern.Beacon.Console/Program.cs index ea4512a..b8fdbeb 100644 --- a/src/Lantern.Beacon.Console/Program.cs +++ b/src/Lantern.Beacon.Console/Program.cs @@ -41,14 +41,6 @@ public static async Task Main() .WithEntry(EnrEntryKey.Secp256K1, new EntrySecp256K1(sessionOptions.Signer.PublicKey)); var discv5LoggerFactory = LoggerFactory.Create(builder => builder.SetMinimumLevel(LogLevel.None)); // Beacon client options - var syncProtocolOptions = new SyncProtocolOptions - { - Preset = SizePreset.MainnetPreset, - GenesisValidatorsRoot = Convert.FromHexString("4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"), - GenesisTime = 1606824023, - TrustedBlockRoot = Convert.FromHexString("b170fd52257200a0bc86f896ee9b688e9022f93e70810aa90e779a7bc1683a7f"), - Network = NetworkType.Mainnet - }; var beaconClientOptions = new BeaconClientOptions { TcpPort = 9005, @@ -60,7 +52,16 @@ public static async Task Main() //"/ip4/162.19.222.38/tcp/15401/p2p/16Uiu2HAmLA7eWnZUnjFQNR7sa8uZumNGA5hPvW6wiWoW1cT2Xkgg" //"/ip4/116.202.215.20/tcp/9000/p2p/16Uiu2HAmB8gmsy3QGaLcL8gQHF5TUAn6fhQNzNT522xArY2tMhKr" //"/ip4/88.99.208.221/tcp/9105/p2p/16Uiu2HAkvSit4sbSkr6AdiEzUcHFv7KQrssV1y4QVsDt4EVpVTYU" - ] + ], + SyncProtocolOptions = new SyncProtocolOptions + { + Preset = SizePreset.MainnetPreset, + GenesisValidatorsRoot = Convert.FromHexString("4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"), + GenesisTime = 1606824023, + TrustedBlockRoot = Convert.FromHexString("b170fd52257200a0bc86f896ee9b688e9022f93e70810aa90e779a7bc1683a7f"), + Network = NetworkType.Mainnet + } + //Bootnodes = ["/ip4/162.19.222.38/tcp/15401/p2p/16Uiu2HAmLA7eWnZUnjFQNR7sa8uZumNGA5hPvW6wiWoW1cT2Xkgg"] // Good peer //Bootnodes = ["/ip4/194.33.40.78/tcp/9001/p2p/16Uiu2HAky7NHnmvJcE2Kq459qNrgczXvfqjdFtsAJ6HyAoZpP4zw"] //Bootnodes = ["/ip4/145.239.161.11/tcp/15401/p2p/16Uiu2HAkvcYHu3rHkJqs7VQyyHsdFq5fFyjKNR9VJnLDrFs93sb6"] @@ -112,7 +113,6 @@ public static async Task Main() }); beaconClientBuilder.WithBeaconClientOptions(beaconClientOptions); - beaconClientBuilder.WithSyncProtocolOptions(syncProtocolOptions); beaconClientBuilder.AddLibp2pProtocol(libp2PBuilder => libp2PBuilder); beaconClientBuilder.WithLoggerFactory(loggerFactory); }); diff --git a/src/Lantern.Beacon/BeaconClientManager.cs b/src/Lantern.Beacon/BeaconClientManager.cs index ac91067..3ceb410 100644 --- a/src/Lantern.Beacon/BeaconClientManager.cs +++ b/src/Lantern.Beacon/BeaconClientManager.cs @@ -52,7 +52,7 @@ public async Task InitAsync() LocalPeer.Address.ReplaceOrAdd(identityManager.Record.GetEntry(EnrEntryKey.Tcp).Value); LocalPeer.Address.ReplaceOrAdd(identityManager.Record.ToPeerId()); - if (clientOptions.Bootnodes.Length > 0) + if (clientOptions.Bootnodes.Count > 0) { foreach (var bootnode in clientOptions.Bootnodes) { @@ -60,7 +60,7 @@ public async Task InitAsync() _peersToDial.Enqueue(peerAddress); } - _logger.LogInformation("Added {Count} bootnodes for dialing", clientOptions.Bootnodes.Length); + _logger.LogInformation("Added {Count} bootnodes for dialing", clientOptions.Bootnodes.Count); } var storedPeers = liteDbService.FetchAll(nameof(MultiAddressStore)); @@ -386,7 +386,7 @@ private async Task MonitorSyncStatus(CancellationToken token) { var peer = peerState.BootstrapPeers.Values.ElementAt( new Random().Next(peerState.BootstrapPeers.Count)); - + if (!syncProtocol.IsInitialised) { _logger.LogInformation( @@ -395,9 +395,12 @@ private async Task MonitorSyncStatus(CancellationToken token) peer.Address.Get().Value.ToString(), peer.Address.Get().Value.ToString()); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } - + if (!syncProtocol.IsInitialised) { _logger.LogWarning( @@ -407,7 +410,11 @@ private async Task MonitorSyncStatus(CancellationToken token) peer.Address.Get().Value.ToString()); peerState.BootstrapPeers.TryRemove(peer.Address.GetPeerId()!, out _); - await peer.DialAsync(token); + + var goodbyeTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(goodbyeTask, timeoutTask); } else { @@ -447,7 +454,7 @@ private async Task MonitorSyncStatus(CancellationToken token) } } } - + private async Task SyncDenebForkAsync(IRemotePeer peer, CancellationToken token = default) { if (!clientOptions.GossipSubEnabled) @@ -475,7 +482,10 @@ private async Task SyncDenebForkAsync(IRemotePeer peer, CancellationToken token denebOptimisticPeriod ); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } if (denebFinalizedPeriod + 1 < denebCurrentPeriod) @@ -491,10 +501,13 @@ private async Task SyncDenebForkAsync(IRemotePeer peer, CancellationToken token count ); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } } - + private async Task SyncCapellaForkAsync(IRemotePeer peer, CancellationToken token = default) { if (!clientOptions.GossipSubEnabled) @@ -529,7 +542,10 @@ private async Task SyncCapellaForkAsync(IRemotePeer peer, CancellationToken toke capellaOptimisticPeriod ); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } if (capellaFinalizedPeriod + 1 < capellaCurrentPeriod) @@ -546,7 +562,10 @@ private async Task SyncCapellaForkAsync(IRemotePeer peer, CancellationToken toke count ); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } } @@ -584,7 +603,10 @@ private async Task SyncAltairForkAsync(IRemotePeer peer, CancellationToken token altairOptimisticPeriod ); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } if (altairFinalizedPeriod + 1 < altairCurrentPeriod) @@ -601,7 +623,10 @@ private async Task SyncAltairForkAsync(IRemotePeer peer, CancellationToken token count ); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + + await Task.WhenAny(dialTask, timeoutTask); } } @@ -643,7 +668,15 @@ private async Task RunOptimisticUpdateLoopAsync(IRemotePeer peer, CancellationTo _logger.LogInformation("Requesting optimistic update..."); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + var completedTask = await Task.WhenAny(dialTask, timeoutTask); + + if (completedTask == timeoutTask) + { + break; + } + await Task.Delay(Config.SecondsPerSlot * 1000, token); } catch (TaskCanceledException) @@ -695,7 +728,15 @@ private async Task RunFinalityUpdateLoopAsync(IRemotePeer peer, CancellationToke _logger.LogInformation("Requesting finality update..."); - await peer.DialAsync(token); + var dialTask = peer.DialAsync(token); + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(clientOptions.DialTimeoutSeconds), token); + var completedTask = await Task.WhenAny(dialTask, timeoutTask); + + if (completedTask == timeoutTask) + { + break; + } + await Task.Delay(Config.SecondsPerSlot * 32 * 1000, token); } catch (TaskCanceledException) diff --git a/src/Lantern.Beacon/BeaconClientOptions.cs b/src/Lantern.Beacon/BeaconClientOptions.cs index 210ba23..c187ab7 100644 --- a/src/Lantern.Beacon/BeaconClientOptions.cs +++ b/src/Lantern.Beacon/BeaconClientOptions.cs @@ -1,3 +1,6 @@ +using Lantern.Beacon.Sync; +using Lantern.Beacon.Sync.Types; + namespace Lantern.Beacon; public class BeaconClientOptions @@ -16,12 +19,178 @@ public class BeaconClientOptions public string DataDirectoryPath { get; set; } = Path.Combine( - Environment.OSVersion.Platform == PlatformID.Win32NT - ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "lantern", "lantern.db") - : Path.Combine(Environment.GetEnvironmentVariable("HOME") ?? string.Empty, ".lantern", "lantern.db") + Environment.OSVersion.Platform == PlatformID.Win32NT + ? Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + : Environment.GetEnvironmentVariable("HOME") ?? string.Empty ); - public string[] Bootnodes { get; set; } = []; + public List Bootnodes { get; set; } = []; public bool EnableDiscovery { get; set; } = true; + + public SyncProtocolOptions SyncProtocolOptions { get; set; } = new(); + + public static BeaconClientOptions Parse(string[] args) + { + var argsList = args.ToList(); + var options = new BeaconClientOptions(); + + for (var i = 0; i < argsList.Count; i++) + { + var arg = argsList[i].ToLowerInvariant(); + + switch (arg) + { + case "--network": + if (i + 1 < argsList.Count) + { + options.SyncProtocolOptions.Network = GetNetworkType(argsList[++i]); + } + else + { + throw new ArgumentException("Missing value for --network"); + } + break; + + case "--block-root": + if (i + 1 < argsList.Count) + { + options.SyncProtocolOptions.TrustedBlockRoot = GetTrustedBlockRootBytes(argsList[++i]); + } + else + { + throw new ArgumentException("Missing value for --block-root"); + } + break; + + case "--datadir": + if (i + 1 < argsList.Count) + { + var providedPath = argsList[++i]; + options.DataDirectoryPath = Path.Combine(providedPath, "lantern", "lantern.db"); + } + else + { + throw new ArgumentException("Missing value for --datadir"); + } + break; + + case "--peer-count": + if (i + 1 < argsList.Count && int.TryParse(argsList[++i], out int peerCount)) + { + options.TargetPeerCount = peerCount; + } + else + { + throw new ArgumentException("Invalid or missing value for --peer-count"); + } + break; + + case "--discovery-peer-count": + if (i + 1 < argsList.Count && int.TryParse(argsList[++i], out var discoveryPeerCount)) + { + options.TargetNodesToFind = discoveryPeerCount; + } + else + { + throw new ArgumentException("Invalid or missing value for --discovery-peer-count"); + } + break; + + case "--dial-parallelism": + if (i + 1 < argsList.Count && int.TryParse(argsList[++i], out var dialParallelism)) + { + options.MaxParallelDials = dialParallelism; + } + else + { + throw new ArgumentException("Invalid or missing value for --dial-parallelism"); + } + break; + + case "--dial-timeout": + if (i + 1 < argsList.Count && int.TryParse(argsList[++i], out var dialTimeout)) + { + options.DialTimeoutSeconds = dialTimeout; + } + else + { + throw new ArgumentException("Invalid or missing value for --dial-timeout"); + } + break; + + case "--tcp-port": + if (i + 1 < argsList.Count && int.TryParse(argsList[++i], out var tcpPort)) + { + options.TcpPort = tcpPort; + } + else + { + throw new ArgumentException("Invalid or missing value for --tcp-port"); + } + break; + + case "--gossip-sub-enabled": + if (i + 1 < argsList.Count && bool.TryParse(argsList[++i], out var gossipEnabled)) + { + options.GossipSubEnabled = gossipEnabled; + } + else + { + throw new ArgumentException("Invalid or missing value for --gossip-sub-enabled"); + } + break; + + case "--bootnodes": + // Collect all bootnodes until the next argument starting with -- + while (i + 1 < argsList.Count && !argsList[i + 1].StartsWith("--")) + { + options.Bootnodes.Add(argsList[++i]); + } + break; + case "--enable-discovery": + if (i + 1 < argsList.Count && bool.TryParse(argsList[++i], out var enableDiscovery)) + { + options.EnableDiscovery = enableDiscovery; + } + else + { + throw new ArgumentException("Invalid or missing value for --enable-discovery"); + } + break; + + default: + throw new ArgumentException($"Unknown argument: {argsList[i]}"); + } + } + + return options; + } + + private static NetworkType GetNetworkType(string network) + { + return network.ToLower() switch + { + "mainnet" => NetworkType.Mainnet, + "holesky" => NetworkType.Holesky, + _ => throw new ArgumentException($"Unsupported network type: {network}") + }; + } + + private static byte[] GetTrustedBlockRootBytes(string trustedBlockRoot) + { + try + { + if(trustedBlockRoot.StartsWith("0x")) + { + trustedBlockRoot = trustedBlockRoot[2..]; + } + + return Convert.FromHexString(trustedBlockRoot); + } + catch (FormatException) + { + throw new ArgumentException("Invalid hex string for --block-root"); + } + } } \ No newline at end of file diff --git a/src/Lantern.Beacon/BeaconClientServiceBuilder.cs b/src/Lantern.Beacon/BeaconClientServiceBuilder.cs index b5ca7f9..1708b1d 100644 --- a/src/Lantern.Beacon/BeaconClientServiceBuilder.cs +++ b/src/Lantern.Beacon/BeaconClientServiceBuilder.cs @@ -14,7 +14,6 @@ namespace Lantern.Beacon; public class BeaconClientServiceBuilder(IServiceCollection services) : IBeaconClientServiceBuilder { - private SyncProtocolOptions _syncProtocolOptions = new(); private BeaconClientOptions _beaconClientOptions = new(); private IDiscv5ProtocolBuilder _discv5ProtocolBuilder = new Discv5ProtocolBuilder(services); private IServiceProvider? _serviceProvider; @@ -41,18 +40,6 @@ public IBeaconClientServiceBuilder AddLibp2pProtocol(Func configure) - { - configure(_syncProtocolOptions); - return this; - } - - public IBeaconClientServiceBuilder WithSyncProtocolOptions(SyncProtocolOptions options) - { - _syncProtocolOptions = options ?? throw new ArgumentNullException(nameof(options)); - return this; - } - public IBeaconClientServiceBuilder WithBeaconClientOptions(Action configure) { configure(_beaconClientOptions); @@ -73,7 +60,7 @@ public IBeaconClientServiceBuilder WithLoggerFactory(ILoggerFactory loggerFactor public IBeaconClient Build() { - services.AddBeaconClient(_discv5ProtocolBuilder.Build(), _beaconClientOptions, _syncProtocolOptions, _loggerFactory); + services.AddBeaconClient(_discv5ProtocolBuilder.Build(), _beaconClientOptions, _loggerFactory); _serviceProvider = services.BuildServiceProvider(); return _serviceProvider.GetRequiredService(); diff --git a/src/Lantern.Beacon/BeaconClientServiceConfiguration.cs b/src/Lantern.Beacon/BeaconClientServiceConfiguration.cs index d4f9b95..6721c82 100644 --- a/src/Lantern.Beacon/BeaconClientServiceConfiguration.cs +++ b/src/Lantern.Beacon/BeaconClientServiceConfiguration.cs @@ -12,11 +12,11 @@ namespace Lantern.Beacon; public static class BeaconClientServiceConfiguration { - internal static IServiceCollection AddBeaconClient(this IServiceCollection services, IDiscv5Protocol discv5, BeaconClientOptions beaconClientOptions, SyncProtocolOptions syncProtocolOptions, ILoggerFactory loggerFactory) + internal static IServiceCollection AddBeaconClient(this IServiceCollection services, IDiscv5Protocol discv5, BeaconClientOptions beaconClientOptions, ILoggerFactory loggerFactory) { services.AddSingleton(discv5); services.AddSingleton(beaconClientOptions); - services.AddSingleton(syncProtocolOptions); + services.AddSingleton(beaconClientOptions.SyncProtocolOptions); services.AddSingleton(loggerFactory); services.AddSingleton(); services.AddSingleton(); diff --git a/src/Lantern.Beacon/IBeaconClientServiceBuilder.cs b/src/Lantern.Beacon/IBeaconClientServiceBuilder.cs index 2d27413..0b0d67c 100644 --- a/src/Lantern.Beacon/IBeaconClientServiceBuilder.cs +++ b/src/Lantern.Beacon/IBeaconClientServiceBuilder.cs @@ -13,10 +13,6 @@ public interface IBeaconClientServiceBuilder IBeaconClientServiceBuilder AddLibp2pProtocol( Func factorySetup); - IBeaconClientServiceBuilder WithSyncProtocolOptions(Action configure); - - IBeaconClientServiceBuilder WithSyncProtocolOptions(SyncProtocolOptions options); - IBeaconClientServiceBuilder WithBeaconClientOptions(Action configure); IBeaconClientServiceBuilder WithBeaconClientOptions(BeaconClientOptions options); diff --git a/src/Lantern.Beacon/Storage/LiteDbService.cs b/src/Lantern.Beacon/Storage/LiteDbService.cs index efbc7c9..2f1e2da 100644 --- a/src/Lantern.Beacon/Storage/LiteDbService.cs +++ b/src/Lantern.Beacon/Storage/LiteDbService.cs @@ -7,6 +7,8 @@ namespace Lantern.Beacon.Storage; public sealed class LiteDbService(BeaconClientOptions beaconClientOptions, SyncProtocolOptions syncProtocolOptions, ILoggerFactory loggerFactory) : ILiteDbService, IDisposable { + private readonly string _dbName = "lantern.db"; + private readonly string _baseDirectory = "lantern"; private LiteDatabase? _liteDatabase; private readonly object _lock = new(); private readonly ILogger _logger = loggerFactory.CreateLogger(); @@ -26,18 +28,20 @@ public void Init() } var directoryPath = Path.Combine( - Path.GetDirectoryName(beaconClientOptions.DataDirectoryPath)!, - syncProtocolOptions.Network.ToString(), - Path.GetFileName(beaconClientOptions.DataDirectoryPath) + beaconClientOptions.DataDirectoryPath, + _baseDirectory, + syncProtocolOptions.Network.ToString() ); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } - - _liteDatabase = new LiteDatabase(beaconClientOptions.DataDirectoryPath); - _logger.LogInformation("Using data directory with path: {Path}", directoryPath); + + var databaseFilePath = Path.Combine(directoryPath, _dbName); + + _liteDatabase = new LiteDatabase(databaseFilePath); + _logger.LogInformation("Using data directory with path: {Path}", databaseFilePath); } } diff --git a/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs b/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs index 906d5b4..a43ce6d 100644 --- a/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs +++ b/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs @@ -80,7 +80,7 @@ public async Task InitAsync_ShouldInitializeCorrectly() public async Task InitAsync_ShouldAddBootnodesToQueue_WhenBootnodesProvided() { var bootnodes = new[] { "/ip4/69.175.102.62/tcp/31018/p2p/16Uiu2HAm2FWXMoKEsshxjXNsXmFwxPAm4eaWmcffFTGgNs3gi4Ww", "/ip4/73.186.232.187/tcp/9105/p2p/16Uiu2HAm37UA7fk8r2AnYtGLbddwkS2WEeSPTsjNDGh3gDW7VUBQ" }; - var clientOptions = new BeaconClientOptions { Bootnodes = bootnodes }; + var clientOptions = new BeaconClientOptions { Bootnodes = bootnodes.ToList() }; var multiAddress = new Multiaddress().Add("0.0.0.0").Add(0); _beaconClientManager = new BeaconClientManager(clientOptions, _mockManualDiscoveryProtocol.Object, _mockLiteDbService.Object, _mockCustomDiscoveryProtocol.Object, _mockPeerState.Object, _mockSyncProtocol.Object, _mockPeerFactory.Object, _mockIdentityManager.Object, _mockLoggerFactory.Object); @@ -172,7 +172,7 @@ public async Task StartAsync_ShouldStartWithSuccessfulInitialization() public async Task DisplaySyncStatus_ShouldLogInformation() { var bootnodes = new[] { "/ip4/69.175.102.62/tcp/31018/p2p/16Uiu2HAm2FWXMoKEsshxjXNsXmFwxPAm4eaWmcffFTGgNs3gi4Ww", "/ip4/73.186.232.187/tcp/9105/p2p/16Uiu2HAm37UA7fk8r2AnYtGLbddwkS2WEeSPTsjNDGh3gDW7VUBQ" }; - var clientOptions = new BeaconClientOptions { Bootnodes = bootnodes }; + var clientOptions = new BeaconClientOptions { Bootnodes = bootnodes.ToList() }; var multiAddress = new Multiaddress().Add("0.0.0.0").Add(0); _beaconClientManager = new BeaconClientManager(clientOptions, _mockManualDiscoveryProtocol.Object, _mockLiteDbService.Object, _mockCustomDiscoveryProtocol.Object, _mockPeerState.Object, _mockSyncProtocol.Object, _mockPeerFactory.Object, _mockIdentityManager.Object, _mockLoggerFactory.Object); diff --git a/test/Lantern.Beacon.Tests/BeaconClientServiceBuilderTests.cs b/test/Lantern.Beacon.Tests/BeaconClientServiceBuilderTests.cs index 68e6730..4ad9ea7 100644 --- a/test/Lantern.Beacon.Tests/BeaconClientServiceBuilderTests.cs +++ b/test/Lantern.Beacon.Tests/BeaconClientServiceBuilderTests.cs @@ -85,25 +85,6 @@ public void AddLibp2pProtocol_WhenCalled_ShouldAddLibp2pProtocolToServices() IPeerFactoryBuilder FactorySetup(ILibp2pPeerFactoryBuilder _) => mockPeerFactoryBuilder.Object; } - [Test] - public void WithSyncProtocolOptions_WhenCalled_ShouldConfigureSyncProtocolOptions() - { - var syncProtocolOptions = new SyncProtocolOptions - { - GenesisTime = 200 - }; - - _builder.WithSyncProtocolOptions(syncProtocolOptions); - - var actualOptions = typeof(BeaconClientServiceBuilder) - .GetField("_syncProtocolOptions", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) - ?.GetValue(_builder) as SyncProtocolOptions; - - Assert.That(actualOptions, Is.Not.Null); - Assert.That(actualOptions, Is.EqualTo(syncProtocolOptions)); - Assert.That(actualOptions!.GenesisTime, Is.EqualTo(200)); - } - [Test] public void WithBeaconClientOptions_WhenCalled_ShouldConfigureBeaconClientOptions() {