Skip to content

Commit

Permalink
Merge pull request #2661 from planetarium/release/231
Browse files Browse the repository at this point in the history
Release/231
  • Loading branch information
U-lis authored Dec 16, 2024
2 parents 604c238 + d4b23cc commit 71d6136
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<LibplanetVersion>5.4.1</LibplanetVersion>
<LibplanetVersion>5.4.2</LibplanetVersion>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Lib9c
Submodule Lib9c updated 41 files
+29 −0 .Lib9c.Tests/Action/ClaimStakeRewardTest.cs
+78 −1 .Lib9c.Tests/Action/StakeTest.cs
+8 −0 .Lib9c.Tests/Action/SynthesizeTest.cs
+1 −1 .Lib9c.Tests/Action/ValidatorDelegation/AllocateGuildRewardTest.cs
+59 −11 .Lib9c.Tests/Action/ValidatorDelegation/SetValidatorCommissionTest.cs
+6 −3 .Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs
+6 −0 .Lib9c.Tests/Delegation/DelegationFixture.cs
+45 −20 .Lib9c.Tests/Delegation/DelegatorTest.cs
+2 −1 .Lib9c.Tests/Delegation/DummyRepository.cs
+0 −221 .Lib9c.Tests/Delegation/Migration/LegacyDelegateeMetadata.cs
+0 −138 .Lib9c.Tests/Delegation/Migration/LegacyLumpSumRewardsRecord.cs
+471 −0 .Lib9c.Tests/Delegation/Migration/LegacyTestDelegatee.cs
+228 −0 .Lib9c.Tests/Delegation/Migration/LegacyTestDelegator.cs
+0 −81 .Lib9c.Tests/Delegation/Migration/MigrateLegacyStateTest.cs
+138 −0 .Lib9c.Tests/Delegation/Migration/RewardBaseMigrationTest.cs
+2 −1 .Lib9c.Tests/Delegation/TestRepository.cs
+1 −1 Directory.Build.props
+12 −0 Lib9c/Action/ClaimStakeReward.cs
+8 −1 Lib9c/Action/Stake.cs
+6 −6 Lib9c/Action/ValidatorDelegation/ReleaseValidatorUnbondings.cs
+7 −9 Lib9c/Action/ValidatorDelegation/SetValidatorCommission.cs
+12 −0 Lib9c/Addresses.cs
+202 −51 Lib9c/Delegation/Delegatee.cs
+95 −8 Lib9c/Delegation/DelegateeMetadata.cs
+93 −9 Lib9c/Delegation/DelegationAddress.cs
+87 −13 Lib9c/Delegation/DelegationRepository.cs
+1 −0 Lib9c/Delegation/Delegator.cs
+19 −0 Lib9c/Delegation/IDelegatee.cs
+46 −1 Lib9c/Delegation/IDelegationRepository.cs
+406 −0 Lib9c/Delegation/RewardBase.cs
+7 −7 Lib9c/Helper/SynthesizeSimulator.cs
+1 −0 Lib9c/Model/Guild/GuildRepository.cs
+7 −6 Lib9c/TableCSV/Item/SynthesizeWeightSheet.csv
+5 −27 Lib9c/TableData/Item/SynthesizeWeightSheet.cs
+4 −1 Lib9c/ValidatorDelegation/AbstainHistory.cs
+6 −0 Lib9c/ValidatorDelegation/ValidatorDelegatee.cs
+1 −0 Lib9c/ValidatorDelegation/ValidatorRepository.cs
+1 −0 integrations/javascript/@planetarium/.npmrc
+7 −7 integrations/javascript/@planetarium/9c-headless-provider/package.json
+1 −1 integrations/javascript/@planetarium/9c-headless-provider/src/index.ts
+17 −3 integrations/javascript/@planetarium/pnpm-lock.yaml
2 changes: 1 addition & 1 deletion Libplanet.Headless/Hosting/LibplanetNodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 6 additions & 3 deletions NineChronicles.Headless.Executable/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -139,7 +140,8 @@ public void Overwrite(
string? consensusPrivateKeyString,
string[]? consensusSeedStrings,
double? consensusTargetBlockIntervalMilliseconds,
int? consensusProposeSecondBase,
int? consensusProposeTimeoutBase,
int? consensusEnterPreCommitDelay,
int? maxTransactionPerBlock,
bool? remoteKeyValueService
)
Expand Down Expand Up @@ -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;
}
Expand Down
65 changes: 54 additions & 11 deletions NineChronicles.Headless.Executable/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -367,7 +409,8 @@ public async Task Run(
consensusPrivateKeyString: headlessConfig.ConsensusPrivateKeyString,
consensusSeedStrings: headlessConfig.ConsensusSeedStrings,
consensusTargetBlockIntervalMilliseconds: headlessConfig.ConsensusTargetBlockIntervalMilliseconds,
consensusProposeSecondBase: headlessConfig.ConsensusProposeSecondBase,
consensusProposeTimeoutBase: headlessConfig.ConsensusProposeTimeoutBase,
consensusEnterPreCommitDelay: headlessConfig.ConsensusEnterPreCommitDelay,
maximumPollPeers: headlessConfig.MaximumPollPeers,
actionEvaluatorConfiguration: actionEvaluatorConfiguration
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
{
Expand Down Expand Up @@ -147,7 +149,7 @@ public static LibplanetNodeServiceProperties
ConsensusSeeds = consensusSeeds,
ConsensusPrivateKey = consensusPrivateKey,
ConsensusTargetBlockIntervalMilliseconds = consensusTargetBlockIntervalMilliseconds,
ContextTimeoutOption = consensusContextTimeoutOption,
ContextOption = consensusContextOption,
ActionEvaluatorConfiguration = actionEvaluatorConfiguration ?? new DefaultActionEvaluatorConfiguration(),
};
}
Expand Down

0 comments on commit 71d6136

Please sign in to comment.