diff --git a/NineChronicles.Headless.Executable/Commands/ReplayCommand.cs b/NineChronicles.Headless.Executable/Commands/ReplayCommand.cs index f90a348a1..c332de64c 100644 --- a/NineChronicles.Headless.Executable/Commands/ReplayCommand.cs +++ b/NineChronicles.Headless.Executable/Commands/ReplayCommand.cs @@ -271,7 +271,7 @@ public int Blocks( try { var rootHash = blockChain.DetermineBlockStateRootHash(block, - out IReadOnlyList actionEvaluations); + out IReadOnlyList actionEvaluations); if (verbose) { @@ -301,8 +301,9 @@ public int Blocks( outputSw?.WriteLine(msg); var actionEvaluator = GetActionEvaluator(blockChain); - var actionEvaluations = actionEvaluator.Evaluate(block); - LoggingActionEvaluations(actionEvaluations, outputSw); + var actionEvaluations = blockChain.DetermineBlockStateRootHash(block, + out IReadOnlyList failedActionEvaluations); + LoggingActionEvaluations(failedActionEvaluations, outputSw); msg = $"- block #{block.Index} evaluating failed with "; _console.Out.Write(msg); @@ -559,7 +560,7 @@ private void LoggingAboutIncompleteBlockStatesException( } private void LoggingActionEvaluations( - IReadOnlyList actionEvaluations, + IReadOnlyList actionEvaluations, TextWriter? textWriter) { var count = actionEvaluations.Count; diff --git a/NineChronicles.Headless.Executable/Commands/StateCommand.cs b/NineChronicles.Headless.Executable/Commands/StateCommand.cs index 235e7bbd8..664c4c8f8 100644 --- a/NineChronicles.Headless.Executable/Commands/StateCommand.cs +++ b/NineChronicles.Headless.Executable/Commands/StateCommand.cs @@ -132,31 +132,20 @@ IStateStore stateStore block.Index, block.Hash ); - IReadOnlyList delta; HashDigest stateRootHash = block.Index < 1 ? BlockChain.DetermineGenesisStateRootHash( actionEvaluator, preEvalBlock, - out delta) + out _) : chain.DetermineBlockStateRootHash( preEvalBlock, - out delta); + out _); DateTimeOffset now = DateTimeOffset.Now; if (invalidStateRootHashBlock is null && !stateRootHash.Equals(block.StateRootHash)) { - string blockDump = DumpBencodexToFile( - block.MarshalBlock(), - $"block_{block.Index}_{block.Hash}" - ); - string deltaDump = DumpBencodexToFile( - new Dictionary( - GetTotalDelta(delta, ToStateKey, ToFungibleAssetKey, ToTotalSupplyKey, ValidatorSetKey)), - $"delta_{block.Index}_{block.Hash}" - ); string message = $"Unexpected state root hash for block #{block.Index} {block.Hash}.\n" + - $" Expected: {block.StateRootHash}\n Actual: {stateRootHash}\n" + - $" Block file: {blockDump}\n Evaluated delta file: {deltaDump}\n"; + $" Expected: {block.StateRootHash}\n Actual: {stateRootHash}\n"; if (!bypassStateRootHashCheck) { throw new CommandExitedException(message, 1);