Skip to content

Commit

Permalink
bugfix: fix error where txaction signer is not tx's signer
Browse files Browse the repository at this point in the history
  • Loading branch information
limebell committed Apr 22, 2024
1 parent a57ed11 commit d902057
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Libplanet.Action/ActionEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
beginTxActions.Length > 0)
{
evaluations = evaluations.AddRange(
EvaluatePolicyBeginTxActions(blockHeader, previousState));
EvaluatePolicyBeginTxActions(blockHeader, tx, previousState));
previousState = evaluations.Last().OutputState;
}

Expand All @@ -519,7 +519,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
? evaluations.Last().OutputState
: previousState;
evaluations = evaluations.AddRange(
EvaluatePolicyEndTxActions(blockHeader, previousState));
EvaluatePolicyEndTxActions(blockHeader, tx, previousState));
}

return evaluations;
Expand Down Expand Up @@ -591,6 +591,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
/// <see cref="IPreEvaluationBlockHeader"/>.
/// </summary>
/// <param name="blockHeader">The header of the block to evaluate.</param>
/// <param name="transaction">The transaction that the tx action belongs to.</param>
/// <param name="previousState">The states immediately before the evaluation of
/// the <see cref="IBlockPolicy.BlockAction"/> held by the instance.</param>
/// <returns>The <see cref="ActionEvaluation"/> of evaluating
Expand All @@ -599,6 +600,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
[Pure]
internal ActionEvaluation[] EvaluatePolicyBeginTxActions(
IPreEvaluationBlockHeader blockHeader,
ITransaction transaction,
IWorld previousState)
{
_logger.Information(
Expand All @@ -607,10 +609,11 @@ IActionContext CreateActionContext(IWorld newPrevState)

return EvaluateActions(
blockHeader: blockHeader,
tx: null,
tx: transaction,
previousState: previousState,
actions: _policyActionsRegistry.BeginTxActionsGetter(blockHeader),
stateStore: _stateStore,
blockAction: true,
logger: _logger).ToArray();
}

Expand All @@ -620,6 +623,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
/// <see cref="IPreEvaluationBlockHeader"/>.
/// </summary>
/// <param name="blockHeader">The header of the block to evaluate.</param>
/// <param name="transaction">The transaction that the tx action belongs to.</param>
/// <param name="previousState">The states immediately before the evaluation of
/// the <see cref="IBlockPolicy.BlockAction"/> held by the instance.</param>
/// <returns>The <see cref="ActionEvaluation"/> of evaluating
Expand All @@ -628,6 +632,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
[Pure]
internal ActionEvaluation[] EvaluatePolicyEndTxActions(
IPreEvaluationBlockHeader blockHeader,
ITransaction transaction,
IWorld previousState)
{
_logger.Information(
Expand All @@ -636,7 +641,7 @@ IActionContext CreateActionContext(IWorld newPrevState)

return EvaluateActions(
blockHeader: blockHeader,
tx: null,
tx: transaction,
previousState: previousState,
actions: _policyActionsRegistry.EndTxActionsGetter(blockHeader),
stateStore: _stateStore,
Expand Down

0 comments on commit d902057

Please sign in to comment.