-
Notifications
You must be signed in to change notification settings - Fork 153
Implementation of service provision to IAction
via ActionContext
.
#3712
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
Implementation of service provision to IAction
via ActionContext
.
#3712
Conversation
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
How do you think |
Note: I suggested https://github.com/riemannulus/ActionEvaluatorExp/blob/main/ActionEvaluatorExp.Modules/Bank/Actions/Transfer.cs before and I think your suggestion is also like this. |
The code below is a simple example of retrieving services from application. sealed class SlashingAction : IAction
{
IWorld IAction.Execute(IActionContext context)
{
var world = context.PreviousState;
if (context.GetService(typeof(IEvidenceContext)) is IEvidenceContext evidenceContext)
{
// Console.WriteLine("SlashingAction executed!");
}
else
{
throw new NotSupportedException();
}
return world;
}
} This PR shows the fundamental way of providing information to |
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
…datorset Introduce `IAccount.SetValidatorSet()` method
Implement Vote Power
e704319
to
6ad6638
Compare
092755a
to
b0e8047
Compare
Action
,BeginAction
,EndAction
is implemented as the sameIAction
,but they have different purposes. Therefore, they have slightly different information and permissions.
Currently,
IActionContext
provides only the same information, so different information and permissions cannot be granted for each Action.IServiceProvider
is an interface that can solve this problem.Each action can use
IServiceProvider.GetService
to get the information it needs.And
ActionEvaluator
has the obligation to provide different information depending on the purpose of the Action.