Show / Hide Table of Contents

Class ActionEvaluator

Class responsible for handling of IAction evaluations.

Inheritance
System.Object
ActionEvaluator
Implements
IActionEvaluator
Namespace: Libplanet.Action
Assembly: Libplanet.Action.dll
Syntax
public class ActionEvaluator : object, IActionEvaluator

Constructors

| Improve this Doc View Source

ActionEvaluator(IPolicyActionsRegistry, IStateStore, IActionLoader)

Creates a new ActionEvaluator.

Declaration
public ActionEvaluator(IPolicyActionsRegistry policyActionsRegistry, IStateStore stateStore, IActionLoader actionTypeLoader)
Parameters
Type Name Description
IPolicyActionsRegistry policyActionsRegistry

A PolicyActionsRegistry containing delegators to get policy actions to evaluate at each situation.

IStateStore stateStore

The IStateStore to use to retrieve the states for a provided HashDigest<T>.

IActionLoader actionTypeLoader

A IActionLoader implementation using action type lookup.

Properties

| Improve this Doc View Source

ActionLoader

The IActionLoader used by this IActionEvaluator when evaluating Blocks.

Declaration
public IActionLoader ActionLoader { get; }
Property Value
Type Description
IActionLoader

Methods

| Improve this Doc View Source

Evaluate(IPreEvaluationBlock, Nullable<HashDigest<SHA256>>)

The main entry point for evaluating a IPreEvaluationBlock.

Declaration
public IReadOnlyList<ICommittedActionEvaluation> Evaluate(IPreEvaluationBlock block, HashDigest<SHA256>? baseStateRootHash)
Parameters
Type Name Description
IPreEvaluationBlock block

The block to evaluate.

System.Nullable<HashDigest<SHA256>> baseStateRootHash

The base state to use when evaluating block.

Returns
Type Description
IReadOnlyList<ICommittedActionEvaluation>

The result of evaluating every IAction related to block as an of ICommittedActionEvaluations.

Remarks

This has a side-effect of writing data to internally held IStateStore.

First evaluates all IActions in Transactions of block and appends the evaluation of the held by the instance at the end.

Exceptions
Type Condition
BlockProtocolVersionNotSupportedException

Thrown when block has a that is not supported by an implementation of IActionEvaluator.

| Improve this Doc View Source

GenerateRandomSeed(Byte[], Byte[], Int32)

Creates a random seed.

Declaration
public static int GenerateRandomSeed(byte[] preEvaluationHashBytes, byte[] signature, int actionOffset)
Parameters
Type Name Description
System.Byte[] preEvaluationHashBytes

The pre-evaluation hash as bytes.

System.Byte[] signature

The signature of the Transaction the target IAction belongs to. Must be empty if the target IAction is a block action.

System.Int32 actionOffset

The offset of the target IAction.

Returns
Type Description
System.Int32

An integer of the random seed.

Implements

IActionEvaluator
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium