Skip to content

Commit

Permalink
fix: Add block actions to PluginActionEvaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake authored and OnedgeLee committed Dec 2, 2024
1 parent 7bee0e5 commit 2101088
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .Lib9c.Plugin/PluginActionEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Libplanet.Store;
using Nekoyume.Action;
using Nekoyume.Action.Loader;
using Nekoyume.Action.ValidatorDelegation;

namespace Lib9c.Plugin
{
Expand All @@ -19,10 +20,23 @@ public PluginActionEvaluator(IPluginKeyValueStore keyValueStore)
var stateStore = new TrieStateStore(new WrappedKeyValueStore(keyValueStore));
_actionEvaluator = new ActionEvaluator(
new PolicyActionsRegistry(
beginBlockActions: ImmutableArray<IAction>.Empty,
endBlockActions: new IAction[] { new RewardGold() }.ToImmutableArray(),
beginTxActions: ImmutableArray<IAction>.Empty,
endTxActions: ImmutableArray<IAction>.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());
}
Expand Down
2 changes: 2 additions & 0 deletions Lib9c.Policy/Policy/BlockPolicySource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down

0 comments on commit 2101088

Please sign in to comment.