diff --git a/.Lib9c.Tests/Model/State/CollectionStateTest.cs b/.Lib9c.Tests/Model/State/CollectionStateTest.cs index bdd8d6d862..d4519be9c6 100644 --- a/.Lib9c.Tests/Model/State/CollectionStateTest.cs +++ b/.Lib9c.Tests/Model/State/CollectionStateTest.cs @@ -2,8 +2,6 @@ namespace Lib9c.Tests.Model.State { using System.Collections.Generic; using Bencodex.Types; - using Libplanet.Crypto; - using Nekoyume.Action; using Nekoyume.Model.State; using Xunit; @@ -14,7 +12,7 @@ public void Bencoded() { var state = new CollectionState { - Ids = new List + Ids = new SortedSet { 1, 2, diff --git a/.Lib9c.Tests/Module/CollectionModuleTest.cs b/.Lib9c.Tests/Module/CollectionModuleTest.cs index a996886239..fe3e7c5cc5 100644 --- a/.Lib9c.Tests/Module/CollectionModuleTest.cs +++ b/.Lib9c.Tests/Module/CollectionModuleTest.cs @@ -22,7 +22,7 @@ public void CollectionState() var state = new CollectionState { - Ids = new List + Ids = new SortedSet { 1, }, @@ -47,7 +47,7 @@ public void CollectionStates() var state = new CollectionState { - Ids = new List + Ids = new SortedSet { 1, }, diff --git a/Lib9c/Model/State/CollectionState.cs b/Lib9c/Model/State/CollectionState.cs index 6966218390..1458e83bc4 100644 --- a/Lib9c/Model/State/CollectionState.cs +++ b/Lib9c/Model/State/CollectionState.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using Bencodex; using Bencodex.Types; using Nekoyume.Model.Stat; @@ -12,7 +11,7 @@ namespace Nekoyume.Model.State /// public class CollectionState : IBencodable { - public List Ids = new(); + public SortedSet Ids = new(); public CollectionState() { @@ -25,15 +24,13 @@ public CollectionState(List serialized) { Ids.Add((Integer)value); } - - Ids = Ids.Distinct().ToList(); } public CollectionState(IValue bencoded) : this((List)bencoded) { } - public IValue Bencoded => List.Empty.Add(new List(Ids.Distinct())); + public IValue Bencoded => List.Empty.Add(new List(Ids)); public List GetModifiers(CollectionSheet collectionSheet) {