Skip to content

Commit

Permalink
Merge pull request #3048 from planetarium/fix/update-action-to-plugin
Browse files Browse the repository at this point in the history
Fix: Add block actions to PluginActionEvaluator
  • Loading branch information
s2quake authored Nov 27, 2024
2 parents c0819c8 + 491ec2a commit 195cb90
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 195cb90

Please sign in to comment.