Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add block actions to PluginActionEvaluator #3048

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading