public static IEnumerable <KeyValuePair <ImmutableArray <byte>, IValue> > ListAllStates(
     this MerkleTrie merkleTrie)
 {
     return(merkleTrie.IterateNodes().Where(pair => pair.Node is ValueNode).Select(pair =>
                                                                                   new KeyValuePair <ImmutableArray <byte>, IValue>(
                                                                                       FromKey(pair.Path),
                                                                                       ((ValueNode)pair.Node).Value)));
 }
 DifferentNodes(
     this MerkleTrie origin,
     MerkleTrie other)
 {
     foreach (var pair in origin.ListAllStates())
     {
         IValue?otherValue = other.Get(new[] { pair.Key })[0];
         if (otherValue is null || !pair.Value.Equals(otherValue))
         {
             yield return(pair.Key, pair.Value, otherValue);
         }
     }
 }
        DifferentNodes(
            this MerkleTrie origin,
            MerkleTrie other)
        {
            var originValueNodes = origin.IterateNodes()
                                   .Where(pair => pair.Node is ValueNode)
                                   .Select(pair => (origin.Hash, ((ValueNode)pair.Node).Value, pair.Path));
            var otherValueNodes = other.IterateNodes()
                                  .Where(pair => pair.Node is ValueNode)
                                  .Select(pair => (other.Hash, ((ValueNode)pair.Node).Value, pair.Path));

            return(originValueNodes.Concat(otherValueNodes)
                   .GroupBy(
                       pair => ByteUtil.Hex(FromKey(pair.Path)),
                       pair => (pair.Hash, pair.Value))
                   .Where(group =>
                          group.Count() == 1 || !group.All(v => v.Value.Equals(group.First().Value))));
        }