From 9c89039d02d4000eb8d609ad7aec37b13bcd6474 Mon Sep 17 00:00:00 2001 From: Chanhyuck Ko Date: Fri, 6 Dec 2024 19:12:03 +0900 Subject: [PATCH 1/3] bump: libplanet --- Libplanet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libplanet b/Libplanet index cbd535232..cd60cf1a4 160000 --- a/Libplanet +++ b/Libplanet @@ -1 +1 @@ -Subproject commit cbd535232b827f1e7dd367a5063a2aded938fdd3 +Subproject commit cd60cf1a4a53da7d0e90c16c4efe9949c841034b From c0928ba4d9c5ecd32cef8beac14d3d27a2858469 Mon Sep 17 00:00:00 2001 From: Chanhyuck Ko Date: Sun, 8 Dec 2024 15:33:01 +0900 Subject: [PATCH 2/3] bump: libplanet --- Libplanet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libplanet b/Libplanet index cd60cf1a4..611edf443 160000 --- a/Libplanet +++ b/Libplanet @@ -1 +1 @@ -Subproject commit cd60cf1a4a53da7d0e90c16c4efe9949c841034b +Subproject commit 611edf443e1eb2c1703d360689f141598fedf0b1 From d4efac73e6d66a24bb94c8f7296fff5afd5b91de Mon Sep 17 00:00:00 2001 From: Chanhyuck Ko Date: Sun, 8 Dec 2024 15:34:02 +0900 Subject: [PATCH 3/3] feat: delay precommit option --- .../Hosting/LibplanetNodeService.cs | 2 +- .../Hosting/LibplanetNodeServiceProperties.cs | 2 +- .../Configuration.cs | 9 ++- NineChronicles.Headless.Executable/Program.cs | 64 +++++++++++++++---- .../NineChroniclesNodeServiceProperties.cs | 12 ++-- 5 files changed, 68 insertions(+), 21 deletions(-) diff --git a/Libplanet.Headless/Hosting/LibplanetNodeService.cs b/Libplanet.Headless/Hosting/LibplanetNodeService.cs index c0b0c3f46..d9b353f56 100644 --- a/Libplanet.Headless/Hosting/LibplanetNodeService.cs +++ b/Libplanet.Headless/Hosting/LibplanetNodeService.cs @@ -238,7 +238,7 @@ IActionEvaluator BuildActionEvaluator(IActionEvaluatorConfiguration actionEvalua ConsensusPrivateKey = Properties.ConsensusPrivateKey, ConsensusWorkers = 500, TargetBlockInterval = TimeSpan.FromMilliseconds(Properties.ConsensusTargetBlockIntervalMilliseconds ?? 7000), - ContextTimeoutOptions = Properties.ContextTimeoutOption, + ContextOption = Properties.ContextOption, }; } diff --git a/Libplanet.Headless/Hosting/LibplanetNodeServiceProperties.cs b/Libplanet.Headless/Hosting/LibplanetNodeServiceProperties.cs index b174f398c..5d93d6a0c 100644 --- a/Libplanet.Headless/Hosting/LibplanetNodeServiceProperties.cs +++ b/Libplanet.Headless/Hosting/LibplanetNodeServiceProperties.cs @@ -68,7 +68,7 @@ public class LibplanetNodeServiceProperties public TimeSpan TipTimeout { get; set; } = TimeSpan.FromSeconds(60); - public ContextTimeoutOption ContextTimeoutOption { get; set; } + public ContextOption ContextOption { get; set; } public int DemandBuffer { get; set; } = 1150; diff --git a/NineChronicles.Headless.Executable/Configuration.cs b/NineChronicles.Headless.Executable/Configuration.cs index 0f0d9c6f2..2606e8363 100644 --- a/NineChronicles.Headless.Executable/Configuration.cs +++ b/NineChronicles.Headless.Executable/Configuration.cs @@ -87,7 +87,8 @@ public class Configuration public string[]? ConsensusSeedStrings { get; set; } public ushort? ConsensusPort { get; set; } public double? ConsensusTargetBlockIntervalMilliseconds { get; set; } - public int? ConsensusProposeSecondBase { get; set; } + public int? ConsensusProposeTimeoutBase { get; set; } + public int? ConsensusEnterPreCommitDelay { get; set; } public int? MaxTransactionPerBlock { get; set; } @@ -139,7 +140,8 @@ public void Overwrite( string? consensusPrivateKeyString, string[]? consensusSeedStrings, double? consensusTargetBlockIntervalMilliseconds, - int? consensusProposeSecondBase, + int? consensusProposeTimeoutBase, + int? consensusEnterPreCommitDelay, int? maxTransactionPerBlock, bool? remoteKeyValueService ) @@ -190,7 +192,8 @@ public void Overwrite( ConsensusSeedStrings = consensusSeedStrings ?? ConsensusSeedStrings; ConsensusPrivateKeyString = consensusPrivateKeyString ?? ConsensusPrivateKeyString; ConsensusTargetBlockIntervalMilliseconds = consensusTargetBlockIntervalMilliseconds ?? ConsensusTargetBlockIntervalMilliseconds; - ConsensusProposeSecondBase = consensusProposeSecondBase ?? ConsensusProposeSecondBase; + ConsensusProposeTimeoutBase = consensusProposeTimeoutBase ?? ConsensusProposeTimeoutBase; + ConsensusEnterPreCommitDelay = consensusEnterPreCommitDelay ?? ConsensusEnterPreCommitDelay; MaxTransactionPerBlock = maxTransactionPerBlock ?? MaxTransactionPerBlock; RemoteKeyValueService = remoteKeyValueService ?? RemoteKeyValueService; } diff --git a/NineChronicles.Headless.Executable/Program.cs b/NineChronicles.Headless.Executable/Program.cs index 8caff2e51..4eb2f01c6 100644 --- a/NineChronicles.Headless.Executable/Program.cs +++ b/NineChronicles.Headless.Executable/Program.cs @@ -209,6 +209,9 @@ public async Task Run( [Option("consensus-propose-second-base", Description = "A propose second base for consensus context timeout. The unit is second.")] int? consensusProposeSecondBase = null, + [Option("consensus-enter-precommit-delay", + Description = "A precommit delay manually set. The unit is millisecond.")] + int? consensusEnterPreCommitDelay = null, [Option("maximum-transaction-per-block", Description = "Maximum transactions allowed in a block. null by default.")] int? maxTransactionPerBlock = null, @@ -290,16 +293,55 @@ public async Task Run( GetActionEvaluatorConfiguration(configuration.GetSection("Headless").GetSection("ActionEvaluator")); headlessConfig.Overwrite( - appProtocolVersionToken, trustedAppProtocolVersionSigners, genesisBlockPath, host, port, - swarmPrivateKeyString, storeType, storePath, noReduceStore, noMiner, minerCount, - minerPrivateKeyString, minerBlockIntervalMilliseconds, planet, iceServerStrings, peerStrings, rpcServer, rpcListenHost, - rpcListenPort, rpcRemoteServer, rpcHttpServer, graphQLServer, graphQLHost, graphQLPort, - graphQLSecretTokenPath, noCors, nonblockRenderer, nonblockRendererQueue, strictRendering, - logActionRenders, confirmations, - txLifeTime, messageTimeout, tipTimeout, demandBuffer, skipPreload, - minimumBroadcastTarget, bucketSize, chainTipStaleBehaviorType, txQuotaPerSigner, maximumPollPeers, - consensusPort, consensusPrivateKeyString, consensusSeedStrings, consensusTargetBlockIntervalMilliseconds, consensusProposeSecondBase, - maxTransactionPerBlock, remoteKeyValueService + appProtocolVersionToken, + trustedAppProtocolVersionSigners, + genesisBlockPath, + host, + port, + swarmPrivateKeyString, + storeType, + storePath, + noReduceStore, + noMiner, + minerCount, + minerPrivateKeyString, + minerBlockIntervalMilliseconds, + planet, + iceServerStrings, + peerStrings, + rpcServer, + rpcListenHost, + rpcListenPort, + rpcRemoteServer, + rpcHttpServer, + graphQLServer, + graphQLHost, + graphQLPort, + graphQLSecretTokenPath, + noCors, + nonblockRenderer, + nonblockRendererQueue, + strictRendering, + logActionRenders, + confirmations, + txLifeTime, + messageTimeout, + tipTimeout, + demandBuffer, + skipPreload, + minimumBroadcastTarget, + bucketSize, + chainTipStaleBehaviorType, + txQuotaPerSigner, + maximumPollPeers, + consensusPort, + consensusPrivateKeyString, + consensusSeedStrings, + consensusTargetBlockIntervalMilliseconds, + consensusProposeSecondBase * 1_000, + consensusEnterPreCommitDelay, + maxTransactionPerBlock, + remoteKeyValueService ); // Clean-up previous temporary log files. @@ -367,7 +409,7 @@ public async Task Run( consensusPrivateKeyString: headlessConfig.ConsensusPrivateKeyString, consensusSeedStrings: headlessConfig.ConsensusSeedStrings, consensusTargetBlockIntervalMilliseconds: headlessConfig.ConsensusTargetBlockIntervalMilliseconds, - consensusProposeSecondBase: headlessConfig.ConsensusProposeSecondBase, + consensusProposeTimeoutBase: headlessConfig.ConsensusProposeTimeoutBase, maximumPollPeers: headlessConfig.MaximumPollPeers, actionEvaluatorConfiguration: actionEvaluatorConfiguration ); diff --git a/NineChronicles.Headless/Properties/NineChroniclesNodeServiceProperties.cs b/NineChronicles.Headless/Properties/NineChroniclesNodeServiceProperties.cs index f60740a03..edb306290 100644 --- a/NineChronicles.Headless/Properties/NineChroniclesNodeServiceProperties.cs +++ b/NineChronicles.Headless/Properties/NineChroniclesNodeServiceProperties.cs @@ -91,7 +91,8 @@ public static LibplanetNodeServiceProperties string? consensusPrivateKeyString = null, string[]? consensusSeedStrings = null, double? consensusTargetBlockIntervalMilliseconds = null, - int? consensusProposeSecondBase = null, + int? consensusProposeTimeoutBase = null, + int? consensusEnterPreCommitDelay = null, IActionEvaluatorConfiguration? actionEvaluatorConfiguration = null) { var swarmPrivateKey = string.IsNullOrEmpty(swarmPrivateKeyString) @@ -108,9 +109,10 @@ public static LibplanetNodeServiceProperties var peers = peerStrings.Select(PropertyParser.ParsePeer).ToImmutableArray(); var consensusSeeds = consensusSeedStrings?.Select(PropertyParser.ParsePeer).ToImmutableList(); - var consensusContextTimeoutOption = consensusProposeSecondBase.HasValue - ? new ContextTimeoutOption(consensusProposeSecondBase.Value) - : new ContextTimeoutOption(); + var defaultContextOption = new ContextOption(); + var consensusContextOption = new ContextOption( + proposeTimeoutBase: consensusProposeTimeoutBase ?? defaultContextOption.ProposeTimeoutBase, + enterPreCommitDelay: consensusEnterPreCommitDelay ?? defaultContextOption.EnterPreCommitDelay); return new LibplanetNodeServiceProperties { @@ -147,7 +149,7 @@ public static LibplanetNodeServiceProperties ConsensusSeeds = consensusSeeds, ConsensusPrivateKey = consensusPrivateKey, ConsensusTargetBlockIntervalMilliseconds = consensusTargetBlockIntervalMilliseconds, - ContextTimeoutOption = consensusContextTimeoutOption, + ContextOption = consensusContextOption, ActionEvaluatorConfiguration = actionEvaluatorConfiguration ?? new DefaultActionEvaluatorConfiguration(), }; }