#1035 LAA1002: DictionariesOrSetsShouldBeOrderedToEnumerate

Merged Hong Minhee (洪 民憙) dahlia Pseudo commit used to compare (5b1ef5d...8b2098c)
Missing base report.

Unable to compare commits because the base of the pull request did not upload a coverage report.

Changes found in between 5b1ef5d...8b2098c (pseudo...base) which prevent comparing this pull request.

Showing 152 of 212 files from the diff.
Newly tracked file
Libplanet/Address.cs changed.
Newly tracked file
Libplanet/Hashcash.cs changed.
Newly tracked file
Libplanet/ByteUtil.cs changed.
Newly tracked file
Libplanet/Nonce.cs changed.
Other files ignored by Codecov
.gitignore has changed.
Docs/docfx.json has changed.
Libplanet.sln has changed.
CONTRIBUTING.md has changed.
CHANGES.md has changed.
Libplanet.ruleset has changed.
Docs/toc.yml has changed.

@@ -807,11 +807,11 @@
Loading
807 807
            );
808 808
809 809
            var chain = TestUtils.MakeBlockChain(new NullPolicy<DumbAction>(), Fx.Store);
810 -
            chain.Append(Fx.Block1);
810 +
            var block = chain.MineBlock(address).Result;
811 811
812 812
            // Even if state references in a chain are empty it should not throw
813 813
            // ChainIdNotFoundException unless the chain in itself does not exist.
814 -
            Fx.BlockStatesStore.ForkStateReferences(chain.Id, targetChainId, Fx.Block1);
814 +
            Fx.BlockStatesStore.ForkStateReferences(chain.Id, targetChainId, block);
815 815
        }
816 816
817 817
        [SkippableFact]

@@ -1,4 +1,5 @@
Loading
1 1
using System;
2 +
using System.Threading;
2 3
using Libplanet.Blocks;
3 4
using Libplanet.Tx;
4 5
@@ -30,5 +31,10 @@
Loading
30 31
        /// The timeout used to receive recent states from other peers.
31 32
        /// </summary>
32 33
        public TimeSpan RecentStateRecvTimeout { get; set; } = TimeSpan.FromSeconds(90);
34 +
35 +
        /// <summary>
36 +
        /// The timeout used to block download in preloading.
37 +
        /// </summary>
38 +
        public TimeSpan BlockDownloadTimeout { get; set; } = Timeout.InfiniteTimeSpan;
33 39
    }
34 40
}

@@ -0,0 +1,26 @@
Loading
1 +
using Bencodex.Types;
2 +
using Libplanet.Store.Trie.Nodes;
3 +
using Xunit;
4 +
5 +
namespace Libplanet.Tests.Store.Trie.Nodes
6 +
{
7 +
    public class ShortNodeTest
8 +
    {
9 +
        [Fact]
10 +
        public void ToBencodex()
11 +
        {
12 +
            var shortNode = new ShortNode(ByteUtil.ParseHex("beef"), new ValueNode((Text)"foo"));
13 +
14 +
            var expected =
15 +
                new List(new IValue[]
16 +
                {
17 +
                    (Binary)ByteUtil.ParseHex("beef"),
18 +
                    new List(new IValue[] { default(Null), (Text)"foo" }),
19 +
                });
20 +
            var encoded = shortNode.ToBencodex();
21 +
            Assert.IsType<List>(encoded);
22 +
            Assert.Equal(expected.Count, ((List)encoded).Count);
23 +
            Assert.Equal(expected, encoded);
24 +
        }
25 +
    }
26 +
}

@@ -1,21 +1,82 @@
Loading
1 +
using System;
1 2
using Libplanet.Action;
3 +
using Libplanet.Blocks;
2 4
3 5
namespace Libplanet.Tests.Common
4 6
{
5 -
    public struct RenderRecord
7 +
    public abstract class RenderRecord<T>
8 +
        where T : IAction, new()
6 9
    {
7 -
        public bool Render { get; set; }
10 +
        public long Index;
8 11
9 -
        public bool Unrender
12 +
        public string StackTrace;
13 +
14 +
        public override string ToString() => $"{Index}.";
15 +
16 +
        public abstract class ActionBase : RenderRecord<T>
17 +
        {
18 +
            public IAction Action;
19 +
20 +
            public IActionContext Context;
21 +
22 +
            public bool Render;
23 +
24 +
            public bool Unrender
25 +
            {
26 +
                get => !Render;
27 +
                set => Render = !value;
28 +
            }
29 +
30 +
            public override string ToString() =>
31 +
                $"{base.ToString()} #{Context.BlockIndex} " +
32 +
                (Render ? "Render" : "Unrender") + "Action";
33 +
        }
34 +
35 +
        public class ActionSuccess : ActionBase
10 36
        {
11 -
            get => !Render;
12 -
            set => Render = !value;
37 +
            public IAccountStateDelta NextStates;
38 +
39 +
            public override string ToString() => $"{base.ToString()} [success]";
13 40
        }
14 41
15 -
        public IAction Action { get; set; }
42 +
        public class ActionError : ActionBase
43 +
        {
44 +
            public Exception Exception;
16 45
17 -
        public IActionContext Context { get; set; }
46 +
            public override string ToString() => $"{base.ToString()} [error]";
47 +
        }
18 48
19 -
        public IAccountStateDelta NextStates { get; set; }
49 +
        public abstract class BlockBase : RenderRecord<T>
50 +
        {
51 +
            public Libplanet.Blocks.Block<T> OldTip;
52 +
            public Libplanet.Blocks.Block<T> NewTip;
53 +
            public bool Begin;
54 +
55 +
            public bool End
56 +
            {
57 +
                get => !Begin;
58 +
                set => Begin = !value;
59 +
            }
60 +
61 +
            public override string ToString() =>
62 +
                $"{base.ToString()} " +
63 +
                $"#{OldTip.Index} {OldTip.Hash} -> #{NewTip.Index} {NewTip.Hash} Render..." +
64 +
                (End ? "End" : string.Empty);
65 +
        }
66 +
67 +
        public class Block : BlockBase
68 +
        {
69 +
            public override string ToString() =>
70 +
                base.ToString().Replace("Render...", "RenderBlock");
71 +
        }
72 +
73 +
        public class Reorg : BlockBase
74 +
        {
75 +
            public Libplanet.Blocks.Block<T> Branchpoint;
76 +
77 +
            public override string ToString() =>
78 +
                base.ToString().Replace("Render...", "RenderReorg") +
79 +
                $" [branchpoint: #{Branchpoint.Index} {Branchpoint.Hash}]";
80 +
        }
20 81
    }
21 82
}

@@ -0,0 +1,26 @@
Loading
1 +
using System.Collections.Immutable;
2 +
using System.Text;
3 +
using Bencodex.Types;
4 +
5 +
namespace Libplanet.Store.Trie
6 +
{
7 +
    internal static class ITrieExtensions
8 +
    {
9 +
        public static ITrie Set(this ITrie trie, IImmutableDictionary<byte[], IValue> values)
10 +
        {
11 +
            foreach (var pair in values)
12 +
            {
13 +
                trie = trie.Set(pair.Key, pair.Value);
14 +
            }
15 +
16 +
            return trie;
17 +
        }
18 +
19 +
        public static ITrie Set(this ITrie trie, IImmutableDictionary<string, IValue> values)
20 +
        {
21 +
            return trie.Set(values.ToImmutableDictionary(
22 +
                pair => Encoding.UTF8.GetBytes(pair.Key),
23 +
                pair => pair.Value));
24 +
        }
25 +
    }
26 +
}

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Unable to process changes.

No base report to compare against.

250 Commits

+12
+4
+8
Hiding 4 contexual commits
+248
+204
+32
+12
Hiding 1 contexual commits
+9
+22
-4
-9
-1 Files
+4
-6
+2
+8
+6
+43
-5
-32
Hiding 13 contexual commits
+1 Files
+197
+161
+3
+33
-3
-3
+6
+10
+5
-15
Hiding 5 contexual commits
+6 Files
+347
+294
+17
+36
+9
+3
-12
Hiding 6 contexual commits
+1 Files
+68
+34
+5
+29
-1
-1
+2
-6
+1
+5
Hiding 3 contexual commits
+1 Files
+48
+50
+3
-5
Hiding 2 contexual commits
+12
+10
+2
Hiding 1 contexual commits
+24 Files
+680
+861
+6
-187
Hiding 2 contexual commits
-24 Files
-681
-851
-9
+179
Hiding 2 contexual commits
+7 Files
+756
+705
+8
+43
Hiding 1 contexual commits
-7 Files
-756
-708
-7
-41
Hiding 2 contexual commits
+40
+1
-41
Hiding 9 contexual commits
+3 Files
+97
+50
-1
+48
+43
-2
-41
-32
+4
+28
Hiding 3 contexual commits
+11
+7
-2
+6
-5
+5
Hiding 1 contexual commits
+2
+16
+5
-19
-13
+1
+12
+29
+1
+28
-3
-1
+4
Hiding 1 contexual commits
+14
-14
Hiding 3 contexual commits
+1 Files
+283
+121
+31
+131
Hiding 1 contexual commits
+7 Files
+756
+721
+11
+24
-7 Files
-754
-743
-7
-4
Hiding 1 contexual commits
+27
-3
-24
Hiding 1 contexual commits
-19
+19
Hiding 1 contexual commits
+3
+10
+4
-11
+18
-20
-2
+40
+19
+1
-20
+14
+30
-3
-13
-6
+1
+5
Hiding 1 contexual commits
-5
+5
+6
+2
-8
Hiding 3 contexual commits
+1 Files
-9
-21
+5
+7
+14
-3
-11
Hiding 4 contexual commits
-1 Files
-8
-30
+2
+20
Hiding 1 contexual commits
+9
-2
-7
Hiding 5 contexual commits
+2
+4
-6
Hiding 2 contexual commits
+8
-1
-7
Hiding 1 contexual commits
+42
+16
+6
+20
-6
-2
+8
+6
+2
-8
+2 Files
+65
+74
-9
Hiding 3 contexual commits
+91
+24
-1
+68
+12
-1
-11
-91
-62
+2
-31
Hiding 3 contexual commits
+91
+75
-1
+17
-16
+2
+14
Hiding 2 contexual commits
+221
+227
+4
-10
+13
+2
-15
Hiding 1 contexual commits
+16
+9
+7
-5
-1
+6
Hiding 14 contexual commits
+4 Files
+95
+27
-3
+71
-3
-3
+6
Hiding 6 contexual commits
+69
+62
-4
+11
Hiding 3 contexual commits
+45
+64
+1
-20
-1
-1
+2
+6
+3
+3
+19
+39
-3
-17
+38
+42
+4
-8
+29
+22
-5
+12
-38
-37
+2
-3