SHA256
Обновить тесты актуальных форматов
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ final class Ans104DataItemTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
byte[] actual = Ans104DataItem.buildSigningMessage(owner, tags, data);
|
byte[] actual = Ans104DataItem.buildSigningMessage(owner, tags, data);
|
||||||
byte[] expected = hex("1abe0371d12268b34be32ca5ebf3d3d2189f9d311d9004c142538ca8a4312faa329d1a4873df72dd01b632a2ecce6b87");
|
byte[] expected = hex("507e6879ff233333fb4116c9495fcf695f0cabbb2c2d956b3fb32b6dc1f894b67e4d23170444f0cecdb805eec3494234");
|
||||||
assertArrayEquals(expected, actual);
|
assertArrayEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -84,10 +84,9 @@ final class TargetLoginFormatTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void forkZeroIsReservedButStillDecodableAsHistoricalUnknown() {
|
void forkZeroIsRejectedByCurrentFormat() {
|
||||||
ReactionBody source = new ReactionBody(MsgSubType.REACTION_LIKE, "alice", 0, 42, HASH);
|
assertThrows(IllegalArgumentException.class,
|
||||||
ReactionBody parsed = new ReactionBody(MsgSubType.REACTION_LIKE, ReactionBody.VER, source.toBytes()).check();
|
() -> new ReactionBody(MsgSubType.REACTION_LIKE, "alice", 0, 42, HASH));
|
||||||
assertEquals(0, parsed.toForkNumber());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+3
-17
@@ -11,25 +11,11 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
class ShineUsersCodecLegacyV10Test {
|
class ShineUsersCodecLegacyV10Test {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void readsLegacyV10ServerPdaForBootstrap() {
|
void rejectsLegacyServerPdaLayout() {
|
||||||
byte[] raw = buildLegacyServerPda();
|
byte[] raw = buildLegacyServerPda();
|
||||||
ShineUsersCodec.UserPdaSnapshot snapshot = ShineUsersCodec.parseUserPdaAccount(
|
assertThrows(IllegalArgumentException.class, () -> ShineUsersCodec.parseUserPdaAccount(
|
||||||
"legacy-pda", 123L, Base64.getEncoder().encodeToString(raw), "legacy-tx"
|
"legacy-pda", 123L, Base64.getEncoder().encodeToString(raw), "legacy-tx"
|
||||||
);
|
));
|
||||||
|
|
||||||
assertEquals("legacy_server", snapshot.login());
|
|
||||||
assertEquals("legacy_server-001", snapshot.blockchainName());
|
|
||||||
assertEquals(100_000L, snapshot.paidLimitBytes());
|
|
||||||
assertEquals(12_345L, snapshot.usedBytes());
|
|
||||||
assertEquals(7, snapshot.lastBlockNumber());
|
|
||||||
assertTrue(snapshot.isServer());
|
|
||||||
assertEquals(1, snapshot.addressFormatType());
|
|
||||||
assertEquals(0, snapshot.addressFormatVersion());
|
|
||||||
assertEquals("wss://legacy.example/ws", snapshot.serverAddress());
|
|
||||||
assertEquals(java.util.List.of("sync-old"), snapshot.syncServers());
|
|
||||||
assertEquals(java.util.List.of("access-old"), snapshot.accessServers());
|
|
||||||
assertEquals(1, snapshot.blockchainForks().size());
|
|
||||||
assertEquals(snapshot.blockchainKey(), snapshot.blockchainForks().get(0).blockchainKey());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] buildLegacyServerPda() {
|
private static byte[] buildLegacyServerPda() {
|
||||||
|
|||||||
+3
-5
@@ -36,14 +36,12 @@ class ShineUsersCodecStarsTest {
|
|||||||
var parsed = ShineUsersCodec.parseShineUsersInstruction(instruction, "test_program");
|
var parsed = ShineUsersCodec.parseShineUsersInstruction(instruction, "test_program");
|
||||||
assertEquals(ShineUsersCodec.TxKind.SUPPORT_DAO, parsed.kind());
|
assertEquals(ShineUsersCodec.TxKind.SUPPORT_DAO, parsed.kind());
|
||||||
}
|
}
|
||||||
@Test void v1LamportCountersAreNotConvertedToStars() {
|
@Test void onlyV2StarsCountersAreAccepted() {
|
||||||
byte[] raw = new byte[105];
|
byte[] raw = new byte[105];
|
||||||
raw[7] = 80; raw[80] = 1; raw[81] = 75;
|
raw[7] = 80; raw[80] = 1; raw[81] = 75;
|
||||||
var stats = ShineUsersCodec.parseSupportStats(raw);
|
assertThrows(IllegalArgumentException.class, () -> ShineUsersCodec.parseSupportStats(raw));
|
||||||
assertEquals(2, stats.version());
|
|
||||||
assertEquals(0L, stats.supportSent());
|
|
||||||
raw[80] = 2;
|
raw[80] = 2;
|
||||||
stats = ShineUsersCodec.parseSupportStats(raw);
|
var stats = ShineUsersCodec.parseSupportStats(raw);
|
||||||
assertEquals(75L, stats.supportSent());
|
assertEquals(75L, stats.supportSent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user