From 4acd9810fc30d49c766ff693b51340ceb6a84bf4 Mon Sep 17 00:00:00 2001 From: s2quake Date: Wed, 27 Nov 2024 16:23:46 +0900 Subject: [PATCH] fix: Add block actions to PluginActionEvaluator --- .Lib9c.Plugin/PluginActionEvaluator.cs | 22 ++++++++++++++++++---- Lib9c.Policy/Policy/BlockPolicySource.cs | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.Lib9c.Plugin/PluginActionEvaluator.cs b/.Lib9c.Plugin/PluginActionEvaluator.cs index 961d1cab36..3f92335f0b 100644 --- a/.Lib9c.Plugin/PluginActionEvaluator.cs +++ b/.Lib9c.Plugin/PluginActionEvaluator.cs @@ -7,6 +7,7 @@ using Libplanet.Store; using Nekoyume.Action; using Nekoyume.Action.Loader; +using Nekoyume.Action.ValidatorDelegation; namespace Lib9c.Plugin { @@ -19,10 +20,23 @@ public PluginActionEvaluator(IPluginKeyValueStore keyValueStore) var stateStore = new TrieStateStore(new WrappedKeyValueStore(keyValueStore)); _actionEvaluator = new ActionEvaluator( new PolicyActionsRegistry( - beginBlockActions: ImmutableArray.Empty, - endBlockActions: new IAction[] { new RewardGold() }.ToImmutableArray(), - beginTxActions: ImmutableArray.Empty, - endTxActions: ImmutableArray.Empty), + beginBlockActions: new IAction[] { + new SlashValidator(), + new AllocateGuildReward(), + new AllocateReward(), + }.ToImmutableArray(), + endBlockActions: new IAction[] { + new UpdateValidators(), + new RecordProposer(), + new RewardGold(), + new ReleaseValidatorUnbondings(), + }.ToImmutableArray(), + beginTxActions: new IAction[] { + new Mortgage(), + }.ToImmutableArray(), + endTxActions: new IAction[] { + new Reward(), new Refund(), + }.ToImmutableArray()), stateStore, new NCActionLoader()); } diff --git a/Lib9c.Policy/Policy/BlockPolicySource.cs b/Lib9c.Policy/Policy/BlockPolicySource.cs index 17cb854389..5fead8e122 100644 --- a/Lib9c.Policy/Policy/BlockPolicySource.cs +++ b/Lib9c.Policy/Policy/BlockPolicySource.cs @@ -143,6 +143,8 @@ internal IBlockPolicy GetPolicy( maxTransactionsPerSignerPerBlockPolicy); // FIXME: Slight inconsistency due to pre-existing delegate. + // WARNING: If the block actions in the policyActionsRegistry have been modified, + // the constructor of the PluginActionEvaluator must be modified as well. return new BlockPolicy( policyActionsRegistry: new PolicyActionsRegistry( beginBlockActions: new IAction[] {