Skip to content
Permalink
Browse files

Menees.Analyzers.2017

  • Loading branch information...
dahlia committed Feb 7, 2019
1 parent 3a731b4 commit 6cdbfa9e2f90bee112f3ae66ebabfbbd88bd07e1
Showing with 756 additions and 220 deletions.
  1. +4 −3 Libplanet.Tests/Common/Action/DummyAction.cs
  2. +1 −1 Libplanet.Tests/Common/Action/Sleep.cs
  3. +115 −22 Libplanet.Tests/Crypto/PrivateKeyTest.cs
  4. +78 −12 Libplanet.Tests/Crypto/PublicKeyTest.cs
  5. +1 −1 Libplanet.Tests/Libplanet.Tests.csproj
  6. +3 −2 Libplanet.Tests/Net/SwarmTest.cs
  7. +12 −2 Libplanet.Tests/Serialization/Bencode/BencodeFormatterTest.cs
  8. +2 −2 Libplanet.Tests/Store/AddressTransactionSetTest.cs
  9. +137 −33 Libplanet.Tests/Tx/TransactionTest.cs
  10. +17 −2 StyleCop.Analyzers.ruleset → Libplanet.ruleset
  11. +27 −8 Libplanet/Action/AddressStateMap.cs
  12. +15 −8 Libplanet/Blockchain.cs
  13. +24 −10 Libplanet/Blocks/Block.cs
  14. +25 −10 Libplanet/Blocks/RawBlock.cs
  15. +2 −1 Libplanet/HashDigest.cs
  16. +5 −1 Libplanet/Libplanet.csproj
  17. +4 −1 Libplanet/Net/InvalidMessageException.cs
  18. +3 −1 Libplanet/Net/Messages/Message.cs
  19. +9 −3 Libplanet/Net/NetMQSocketExtension.cs
  20. +4 −1 Libplanet/Net/NoSwarmContextException.cs
  21. +7 −2 Libplanet/Net/Peer.cs
  22. +4 −1 Libplanet/Net/PeerNotFoundException.cs
  23. +4 −1 Libplanet/Net/PeerSetDelta.cs
  24. +91 −35 Libplanet/Net/Swarm.cs
  25. +4 −1 Libplanet/Net/SwarmException.cs
  26. +4 −3 Libplanet/Store/AddressTransactionSet.cs
  27. +14 −4 Libplanet/Store/BaseStore.cs
  28. +84 −27 Libplanet/Store/FileStore.cs
  29. +4 −1 Libplanet/Store/IStore.cs
  30. +30 −13 Libplanet/Tx/RawTransaction.cs
  31. +10 −6 Libplanet/Tx/Transaction.cs
  32. +8 −2 Libplanet/Tx/TxId.cs
  33. +4 −0 Menees.Analyzers.Settings.xml
@@ -6,16 +6,17 @@ namespace Libplanet.Tests.Common.Action
{
public class DummyAction : BaseAction
{
public override IImmutableDictionary<string, object> PlainValue => throw new NotImplementedException();
public override IImmutableDictionary<string, object> PlainValue =>
throw new NotSupportedException();

public override AddressStateMap Execute(IActionContext context)
{
throw new NotImplementedException();
throw new NotSupportedException();
}

public override void LoadPlainValue(IImmutableDictionary<string, object> plainValue)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
}
@@ -19,7 +19,7 @@ public class Sleep : BaseAction

public override AddressStateMap Execute(IActionContext context)
{
throw new NotImplementedException();
throw new NotSupportedException();
}

public override void LoadPlainValue(
@@ -9,19 +9,39 @@ public class PrivateKeyTest
[Fact]
public void BytesTest()
{
var bs = ByteUtil.ParseHex(
"98669850728c6c410bf42c45fe7c49232d14cfb55b784d8135ae404c7c243fc7");
var bs = new byte[]
{
0x98, 0x66, 0x98, 0x50, 0x72, 0x8c, 0x6c, 0x41, 0x0b, 0xf4,
0x2c, 0x45, 0xfe, 0x7c, 0x49, 0x23, 0x2d, 0x14, 0xcf, 0xb5,
0x5b, 0x78, 0x4d, 0x81, 0x35, 0xae, 0x40, 0x4c, 0x7c, 0x24,
0x3f, 0xc7,
};
var key = new PrivateKey(bs);
Assert.Equal(bs, key.ByteArray);
}

[Fact]
public void PublicKeyTest()
{
var key = new PrivateKey(ByteUtil.ParseHex(
"82fc9947e878fc7ed01c6c310688603f0a41c8e8704e5b990e8388343b0fd465"));
var expected = ByteUtil.ParseHex(
"04c7c674a223661faefed8515febacc411c0f3569c10c65ec86cdce4d85c7ea26c617f0cf19ce0b10686501e57af1a7002282fefa52845be2267d1f4d7af322974");
var key = new PrivateKey(
new byte[]
{
0x82, 0xfc, 0x99, 0x47, 0xe8, 0x78, 0xfc, 0x7e, 0xd0, 0x1c,
0x6c, 0x31, 0x06, 0x88, 0x60, 0x3f, 0x0a, 0x41, 0xc8, 0xe8,
0x70, 0x4e, 0x5b, 0x99, 0x0e, 0x83, 0x88, 0x34, 0x3b, 0x0f,
0xd4, 0x65,
}
);
var expected = new byte[]
{
0x04, 0xc7, 0xc6, 0x74, 0xa2, 0x23, 0x66, 0x1f, 0xae, 0xfe,
0xd8, 0x51, 0x5f, 0xeb, 0xac, 0xc4, 0x11, 0xc0, 0xf3, 0x56,
0x9c, 0x10, 0xc6, 0x5e, 0xc8, 0x6c, 0xdc, 0xe4, 0xd8, 0x5c,
0x7e, 0xa2, 0x6c, 0x61, 0x7f, 0x0c, 0xf1, 0x9c, 0xe0, 0xb1,
0x06, 0x86, 0x50, 0x1e, 0x57, 0xaf, 0x1a, 0x70, 0x02, 0x28,
0x2f, 0xef, 0xa5, 0x28, 0x45, 0xbe, 0x22, 0x67, 0xd1, 0xf4,
0xd7, 0xaf, 0x32, 0x29, 0x74,
};
var actual = key.PublicKey.Format(false);

Assert.Equal(expected, actual);
@@ -30,12 +50,48 @@ public void PublicKeyTest()
[Fact]
public void SignTest()
{
var pk = new PrivateKey(ByteUtil.ParseHex(
"520938fae079789561268c2933f636d8b5a0011ea04112dbababf295e5ddef88"));
var payload = ByteUtil.ParseHex(
"64373a616374696f6e736c6531303a7075626c69635f6b657936353a04b5a24aa2112720423bad39a0205182379d6f2b33e3487c9ab6cc8fc496f8a5483440efbbef0657ac2ef6c6ee05db06a94532fda7ddc44a1695e5ce1a3d3c76db393a726563697069656e7432303a8ae72efab09594665112e6d49dfd1941538cf374363a73656e64657232303ab6c03de57ddf0369c7207d2d113adff8205199cf393a74696d657374616d7032373a323031382d30312d30325430333a30343a30352e3030363030305a65");
var expected = ByteUtil.ParseHex(
"3044022062cf8a04419c6a03baf55de10d9b200edaa9df2b9bf0cf989fd65d71c55c356002202aa55969d0adb15e9e708d8300e105311e1a16165db73ed8f4f0051d9f1381fd");
var pk = new PrivateKey(
new byte[]
{
0x52, 0x09, 0x38, 0xfa, 0xe0, 0x79, 0x78, 0x95, 0x61, 0x26,
0x8c, 0x29, 0x33, 0xf6, 0x36, 0xd8, 0xb5, 0xa0, 0x01, 0x1e,
0xa0, 0x41, 0x12, 0xdb, 0xab, 0xab, 0xf2, 0x95, 0xe5, 0xdd,
0xef, 0x88,
}
);
var payload = new byte[]
{
0x64, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x6c, 0x65, 0x31, 0x30, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, 0xb5,
0xa2, 0x4a, 0xa2, 0x11, 0x27, 0x20, 0x42, 0x3b, 0xad, 0x39,
0xa0, 0x20, 0x51, 0x82, 0x37, 0x9d, 0x6f, 0x2b, 0x33, 0xe3,
0x48, 0x7c, 0x9a, 0xb6, 0xcc, 0x8f, 0xc4, 0x96, 0xf8, 0xa5,
0x48, 0x34, 0x40, 0xef, 0xbb, 0xef, 0x06, 0x57, 0xac, 0x2e,
0xf6, 0xc6, 0xee, 0x05, 0xdb, 0x06, 0xa9, 0x45, 0x32, 0xfd,
0xa7, 0xdd, 0xc4, 0x4a, 0x16, 0x95, 0xe5, 0xce, 0x1a, 0x3d,
0x3c, 0x76, 0xdb, 0x39, 0x3a, 0x72, 0x65, 0x63, 0x69, 0x70,
0x69, 0x65, 0x6e, 0x74, 0x32, 0x30, 0x3a, 0x8a, 0xe7, 0x2e,
0xfa, 0xb0, 0x95, 0x94, 0x66, 0x51, 0x12, 0xe6, 0xd4, 0x9d,
0xfd, 0x19, 0x41, 0x53, 0x8c, 0xf3, 0x74, 0x36, 0x3a, 0x73,
0x65, 0x6e, 0x64, 0x65, 0x72, 0x32, 0x30, 0x3a, 0xb6, 0xc0,
0x3d, 0xe5, 0x7d, 0xdf, 0x03, 0x69, 0xc7, 0x20, 0x7d, 0x2d,
0x11, 0x3a, 0xdf, 0xf8, 0x20, 0x51, 0x99, 0xcf, 0x39, 0x3a,
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x32,
0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x30, 0x31, 0x2d,
0x30, 0x32, 0x54, 0x30, 0x33, 0x3a, 0x30, 0x34, 0x3a, 0x30,
0x35, 0x2e, 0x30, 0x30, 0x36, 0x30, 0x30, 0x30, 0x5a, 0x65,
};
var expected = new byte[]
{
0x30, 0x44, 0x02, 0x20, 0x62, 0xcf, 0x8a, 0x04, 0x41, 0x9c,
0x6a, 0x03, 0xba, 0xf5, 0x5d, 0xe1, 0x0d, 0x9b, 0x20, 0x0e,
0xda, 0xa9, 0xdf, 0x2b, 0x9b, 0xf0, 0xcf, 0x98, 0x9f, 0xd6,
0x5d, 0x71, 0xc5, 0x5c, 0x35, 0x60, 0x02, 0x20, 0x2a, 0xa5,
0x59, 0x69, 0xd0, 0xad, 0xb1, 0x5e, 0x9e, 0x70, 0x8d, 0x83,
0x00, 0xe1, 0x05, 0x31, 0x1e, 0x1a, 0x16, 0x16, 0x5d, 0xb7,
0x3e, 0xd8, 0xf4, 0xf0, 0x05, 0x1d, 0x9f, 0x13, 0x81, 0xfd,
};
var actual = pk.Sign(payload);

Assert.Equal(expected, actual);
@@ -68,10 +124,26 @@ public void ExchangeTest()
[Fact]
public void DecryptTest()
{
var prvKey = new PrivateKey(ByteUtil.ParseHex(
"fbc20042b3a707a7d5a1fa577171f49cd3a9e67ab9295757c714e3f2f8c2d573"));
var cipherText = ByteUtil.ParseHex(
"03e31a0dea31e2b1327bd8700ad357cc69314ecad70ae2e4fa5517a33b67cfb1c4faa110d4d27311eff14799d73d3caaa20e357c41c88e1422c764edcce06c06b58644c168a5abf39dcb46b6e2");
var prvKey = new PrivateKey(
new byte[]
{
0xfb, 0xc2, 0x00, 0x42, 0xb3, 0xa7, 0x07, 0xa7, 0xd5, 0xa1,
0xfa, 0x57, 0x71, 0x71, 0xf4, 0x9c, 0xd3, 0xa9, 0xe6, 0x7a,
0xb9, 0x29, 0x57, 0x57, 0xc7, 0x14, 0xe3, 0xf2, 0xf8, 0xc2,
0xd5, 0x73,
}
);
var cipherText = new byte[]
{
0x03, 0xe3, 0x1a, 0x0d, 0xea, 0x31, 0xe2, 0xb1, 0x32, 0x7b,
0xd8, 0x70, 0x0a, 0xd3, 0x57, 0xcc, 0x69, 0x31, 0x4e, 0xca,
0xd7, 0x0a, 0xe2, 0xe4, 0xfa, 0x55, 0x17, 0xa3, 0x3b, 0x67,
0xcf, 0xb1, 0xc4, 0xfa, 0xa1, 0x10, 0xd4, 0xd2, 0x73, 0x11,
0xef, 0xf1, 0x47, 0x99, 0xd7, 0x3d, 0x3c, 0xaa, 0xa2, 0x0e,
0x35, 0x7c, 0x41, 0xc8, 0x8e, 0x14, 0x22, 0xc7, 0x64, 0xed,
0xcc, 0xe0, 0x6c, 0x06, 0xb5, 0x86, 0x44, 0xc1, 0x68, 0xa5,
0xab, 0xf3, 0x9d, 0xcb, 0x46, 0xb6, 0xe2,
};
var expected = Encoding.ASCII.GetBytes("test message");

Assert.Equal(prvKey.Decrypt(cipherText), expected);
@@ -80,12 +152,33 @@ public void DecryptTest()
[Fact]
public void EqualsTest()
{
var key1 = new PrivateKey(ByteUtil.ParseHex(
"fbc20042b3a707a7d5a1fa577171f49cd3a9e67ab9295757c714e3f2f8c2d573"));
var key2 = new PrivateKey(ByteUtil.ParseHex(
"fbc20042b3a707a7d5a1fa577171f49cd3a9e67ab9295757c714e3f2f8c2d573"));
var key3 = new PrivateKey(ByteUtil.ParseHex(
"fbc20042b3a707a7d5a1fa577171f49cd3a9e67ab9295757c714e3f2f8c2d537"));
var key1 = new PrivateKey(
new byte[]
{
0xfb, 0xc2, 0x00, 0x42, 0xb3, 0xa7, 0x07, 0xa7, 0xd5, 0xa1,
0xfa, 0x57, 0x71, 0x71, 0xf4, 0x9c, 0xd3, 0xa9, 0xe6, 0x7a,
0xb9, 0x29, 0x57, 0x57, 0xc7, 0x14, 0xe3, 0xf2, 0xf8, 0xc2,
0xd5, 0x73,
}
);
var key2 = new PrivateKey(
new byte[]
{
0xfb, 0xc2, 0x00, 0x42, 0xb3, 0xa7, 0x07, 0xa7, 0xd5, 0xa1,
0xfa, 0x57, 0x71, 0x71, 0xf4, 0x9c, 0xd3, 0xa9, 0xe6, 0x7a,
0xb9, 0x29, 0x57, 0x57, 0xc7, 0x14, 0xe3, 0xf2, 0xf8, 0xc2,
0xd5, 0x73,
}
);
var key3 = new PrivateKey(
new byte[]
{
0xfb, 0xc2, 0x00, 0x42, 0xb3, 0xa7, 0x07, 0xa7, 0xd5, 0xa1,
0xfa, 0x57, 0x71, 0x71, 0xf4, 0x9c, 0xd3, 0xa9, 0xe6, 0x7a,
0xb9, 0x29, 0x57, 0x57, 0xc7, 0x14, 0xe3, 0xf2, 0xf8, 0xc2,
0xd5, 0x37,
}
);

Assert.Equal(key1, key2);
Assert.NotEqual(key2, key3);
@@ -9,12 +9,51 @@ public class PublicKeyTest
[Fact]
public void VerifyTest()
{
var pubKey = new PublicKey(ByteUtil.ParseHex(
"04b5a24aa2112720423bad39a0205182379d6f2b33e3487c9ab6cc8fc496f8a5483440efbbef0657ac2ef6c6ee05db06a94532fda7ddc44a1695e5ce1a3d3c76db"));
var payload = ByteUtil.ParseHex(
"64373a616374696f6e736c6531303a7075626c69635f6b657936353a04b5a24aa2112720423bad39a0205182379d6f2b33e3487c9ab6cc8fc496f8a5483440efbbef0657ac2ef6c6ee05db06a94532fda7ddc44a1695e5ce1a3d3c76db393a726563697069656e7432303a8ae72efab09594665112e6d49dfd1941538cf374363a73656e64657232303ab6c03de57ddf0369c7207d2d113adff8205199cf393a74696d657374616d7032373a323031382d30312d30325430333a30343a30352e3030363030305a65");
var signature = ByteUtil.ParseHex(
"3044022062cf8a04419c6a03baf55de10d9b200edaa9df2b9bf0cf989fd65d71c55c356002202aa55969d0adb15e9e708d8300e105311e1a16165db73ed8f4f0051d9f1381fd");
var pubKey = new PublicKey(
new byte[]
{
0x04, 0xb5, 0xa2, 0x4a, 0xa2, 0x11, 0x27, 0x20, 0x42, 0x3b,
0xad, 0x39, 0xa0, 0x20, 0x51, 0x82, 0x37, 0x9d, 0x6f, 0x2b,
0x33, 0xe3, 0x48, 0x7c, 0x9a, 0xb6, 0xcc, 0x8f, 0xc4, 0x96,
0xf8, 0xa5, 0x48, 0x34, 0x40, 0xef, 0xbb, 0xef, 0x06, 0x57,
0xac, 0x2e, 0xf6, 0xc6, 0xee, 0x05, 0xdb, 0x06, 0xa9, 0x45,
0x32, 0xfd, 0xa7, 0xdd, 0xc4, 0x4a, 0x16, 0x95, 0xe5, 0xce,
0x1a, 0x3d, 0x3c, 0x76, 0xdb,
}
);
var payload = new byte[]
{
0x64, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x6c, 0x65, 0x31, 0x30, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, 0xb5,
0xa2, 0x4a, 0xa2, 0x11, 0x27, 0x20, 0x42, 0x3b, 0xad, 0x39,
0xa0, 0x20, 0x51, 0x82, 0x37, 0x9d, 0x6f, 0x2b, 0x33, 0xe3,
0x48, 0x7c, 0x9a, 0xb6, 0xcc, 0x8f, 0xc4, 0x96, 0xf8, 0xa5,
0x48, 0x34, 0x40, 0xef, 0xbb, 0xef, 0x06, 0x57, 0xac, 0x2e,
0xf6, 0xc6, 0xee, 0x05, 0xdb, 0x06, 0xa9, 0x45, 0x32, 0xfd,
0xa7, 0xdd, 0xc4, 0x4a, 0x16, 0x95, 0xe5, 0xce, 0x1a, 0x3d,
0x3c, 0x76, 0xdb, 0x39, 0x3a, 0x72, 0x65, 0x63, 0x69, 0x70,
0x69, 0x65, 0x6e, 0x74, 0x32, 0x30, 0x3a, 0x8a, 0xe7, 0x2e,
0xfa, 0xb0, 0x95, 0x94, 0x66, 0x51, 0x12, 0xe6, 0xd4, 0x9d,
0xfd, 0x19, 0x41, 0x53, 0x8c, 0xf3, 0x74, 0x36, 0x3a, 0x73,
0x65, 0x6e, 0x64, 0x65, 0x72, 0x32, 0x30, 0x3a, 0xb6, 0xc0,
0x3d, 0xe5, 0x7d, 0xdf, 0x03, 0x69, 0xc7, 0x20, 0x7d, 0x2d,
0x11, 0x3a, 0xdf, 0xf8, 0x20, 0x51, 0x99, 0xcf, 0x39, 0x3a,
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x32,
0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x30, 0x31, 0x2d,
0x30, 0x32, 0x54, 0x30, 0x33, 0x3a, 0x30, 0x34, 0x3a, 0x30,
0x35, 0x2e, 0x30, 0x30, 0x36, 0x30, 0x30, 0x30, 0x5a, 0x65,
};
var signature = new byte[]
{
0x30, 0x44, 0x02, 0x20, 0x62, 0xcf, 0x8a, 0x04, 0x41, 0x9c,
0x6a, 0x03, 0xba, 0xf5, 0x5d, 0xe1, 0x0d, 0x9b, 0x20, 0x0e,
0xda, 0xa9, 0xdf, 0x2b, 0x9b, 0xf0, 0xcf, 0x98, 0x9f, 0xd6,
0x5d, 0x71, 0xc5, 0x5c, 0x35, 0x60, 0x02, 0x20, 0x2a, 0xa5,
0x59, 0x69, 0xd0, 0xad, 0xb1, 0x5e, 0x9e, 0x70, 0x8d, 0x83,
0x00, 0xe1, 0x05, 0x31, 0x1e, 0x1a, 0x16, 0x16, 0x5d, 0xb7,
0x3e, 0xd8, 0xf4, 0xf0, 0x05, 0x1d, 0x9f, 0x13, 0x81, 0xfd,
};
Assert.True(pubKey.Verify(payload, signature));
}

@@ -32,12 +71,39 @@ public void EncryptTest()
[Fact]
public void EqualsTest()
{
var key1 = new PublicKey(ByteUtil.ParseHex(
"0446115b0131baccf94a5856ede871295f6f3d352e6847cda9c03e89fe09f732808711ec97af6e341f110a326da1bdb81f5ae3badf76a90b22c8c491aed3aaa296"));
var key2 = new PublicKey(ByteUtil.ParseHex(
"0246115b0131baccf94a5856ede871295f6f3d352e6847cda9c03e89fe09f73280")); // compressed of key1
var key3 = new PublicKey(ByteUtil.ParseHex(
"04b5a24aa2112720423bad39a0205182379d6f2b33e3487c9ab6cc8fc496f8a5483440efbbef0657ac2ef6c6ee05db06a94532fda7ddc44a1695e5ce1a3d3c76db"));
var key1 = new PublicKey(
new byte[]
{
0x04, 0x46, 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a,
0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, 0x3d, 0x35,
0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09,
0xf7, 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34,
0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, 0xbd, 0xb8, 0x1f, 0x5a,
0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91,
0xae, 0xd3, 0xaa, 0xa2, 0x96,
}
);
var key2 = new PublicKey(
new byte[]
{
0x02, 0x46, 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a,
0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, 0x3d, 0x35,
0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09,
0xf7, 0x32, 0x80,
}
); // compressed of key1
var key3 = new PublicKey(
new byte[]
{
0x04, 0xb5, 0xa2, 0x4a, 0xa2, 0x11, 0x27, 0x20, 0x42, 0x3b,
0xad, 0x39, 0xa0, 0x20, 0x51, 0x82, 0x37, 0x9d, 0x6f, 0x2b,
0x33, 0xe3, 0x48, 0x7c, 0x9a, 0xb6, 0xcc, 0x8f, 0xc4, 0x96,
0xf8, 0xa5, 0x48, 0x34, 0x40, 0xef, 0xbb, 0xef, 0x06, 0x57,
0xac, 0x2e, 0xf6, 0xc6, 0xee, 0x05, 0xdb, 0x06, 0xa9, 0x45,
0x32, 0xfd, 0xa7, 0xdd, 0xc4, 0x4a, 0x16, 0x95, 0xe5, 0xce,
0x1a, 0x3d, 0x3c, 0x76, 0xdb,
}
);

Assert.Equal(key1, key2);
Assert.NotEqual(key2, key3);
@@ -9,7 +9,7 @@
</PropertyGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\StyleCop.Analyzers.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>..\Libplanet.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup>
@@ -294,7 +294,7 @@ public async Task CanGetTx()
new PrivateKey(),
new PrivateKey().PublicKey.ToAddress(),
new BaseAction[] { },
DateTime.Now
DateTime.UtcNow
);
chainB.StageTransactions(new[] { tx }.ToHashSet());
chainB.MineBlock(_fx1.Address1);
@@ -346,7 +346,8 @@ public async Task CanBroadcastTx()
new PrivateKey(),
new PrivateKey().PublicKey.ToAddress(),
new BaseAction[] { },
DateTime.Now);
DateTime.UtcNow
);

chainA.StageTransactions(new[] { tx }.ToHashSet());
chainA.MineBlock(_fx1.Address1);
@@ -10,6 +10,7 @@

namespace Libplanet.Tests.Serialization.Bencode
{
// FIXME: This class should be renamed to BencodexFormatterTest.
public class BencodeFormatterTest
{
[Fact]
@@ -53,8 +54,17 @@ public void Serialize()
[Fact]
public void Deserialize()
{
byte[] serialized = ByteUtil.ParseHex(
"64333a41676569333065343a4e616d65383a5377656e204d756e353a4e616d65736c383a5377656e204d756e393aebacb8ec84b1ec9b9031383ae383a0e383b3e382bde383b3e383afe383b36565");
byte[] serialized = new byte[]
{
0x64, 0x33, 0x3a, 0x41, 0x67, 0x65, 0x69, 0x33, 0x30, 0x65,
0x34, 0x3a, 0x4e, 0x61, 0x6d, 0x65, 0x38, 0x3a, 0x53, 0x77,
0x65, 0x6e, 0x20, 0x4d, 0x75, 0x6e, 0x35, 0x3a, 0x4e, 0x61,
0x6d, 0x65, 0x73, 0x6c, 0x38, 0x3a, 0x53, 0x77, 0x65, 0x6e,
0x20, 0x4d, 0x75, 0x6e, 0x39, 0x3a, 0xeb, 0xac, 0xb8, 0xec,
0x84, 0xb1, 0xec, 0x9b, 0x90, 0x31, 0x38, 0x3a, 0xe3, 0x83,
0xa0, 0xe3, 0x83, 0xb3, 0xe3, 0x82, 0xbd, 0xe3, 0x83, 0xb3,
0xe3, 0x83, 0xaf, 0xe3, 0x83, 0xb3, 0x65, 0x65,
};
var formatter = new BencodexFormatter<Person>();
using (var stream = new MemoryStream(serialized))
{
@@ -21,7 +21,7 @@ public AddressTransactionSetTest()
[Fact]
public void CanNotStore()
{
Assert.Throws<NotImplementedException>(() =>
Assert.Throws<NotSupportedException>(() =>
{
_set[_fx.Address1] = new List<Transaction<BaseAction>>()
{
@@ -95,7 +95,7 @@ public void CanCheckContainsKey()
[Fact]
public void CanNotRemoveItem()
{
Assert.Throws<NotImplementedException>(() =>
Assert.Throws<NotSupportedException>(() =>
{
_set.Remove(_fx.Address1);
});
Oops, something went wrong.

0 comments on commit 6cdbfa9

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.