From e03be2326fdfe3eb2f47eec6a9ac2a873615b70e Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 16 Apr 2024 20:42:29 +1000 Subject: [PATCH] Experimenting with foldBlocks --- cardano-testnet/cardano-testnet.cabal | 1 + cardano-testnet/out.txt | 58 +++++++++++++++++++ .../Cardano/Testnet/Test/FoldBlocks.hs | 48 +++++++-------- 3 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 cardano-testnet/out.txt diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index bc12ed026ad..2b26f856ff5 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -221,6 +221,7 @@ test-suite cardano-testnet-test , microlens , mtl , process + , stm , regex-compat , tasty ^>= 1.5 , text diff --git a/cardano-testnet/out.txt b/cardano-testnet/out.txt new file mode 100644 index 00000000000..b641c906c46 --- /dev/null +++ b/cardano-testnet/out.txt @@ -0,0 +1,58 @@ +test 3 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +test done +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 4, hbSlotNo = SlotNo 189, hbPrev = BlockHash (HashHeader {unHashHeader = "7b79e0787da17510992a5b482dd51cf1421bceedb88844382686a00fd0e3e67f"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 5, hbSlotNo = SlotNo 205, hbPrev = BlockHash (HashHeader {unHashHeader = "e44e98b535cf7a6b969dd5ca01bd4bc0920742ed2a2e23952fcef6fdf68c1b38"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 4, hbSlotNo = SlotNo 189, hbPrev = BlockHash (HashHeader {unHashHeader = "7b79e0787da17510992a5b482dd51cf1421bceedb88844382686a00fd0e3e67f"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 6, hbSlotNo = SlotNo 240, hbPrev = BlockHash (HashHeader {unHashHeader = "6d0484fb98e1a2ddf782328915a463914efe43add933f781414e64f1b2c80422"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 5, hbSlotNo = SlotNo 205, hbPrev = BlockHash (HashHeader {unHashHeader = "e44e98b535cf7a6b969dd5ca01bd4bc0920742ed2a2e23952fcef6fdf68c1b38"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 4, hbSlotNo = SlotNo 189, hbPrev = BlockHash (HashHeader {unHashHeader = "7b79e0787da17510992a5b482dd51cf1421bceedb88844382686a00fd0e3e67f"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 7, hbSlotNo = SlotNo 286, hbPrev = BlockHash (HashHeader {unHashHeader = "6788bfb98f3e876851fa2d6b7d80b9021e46dd10161f32929f22a0c8eb4a2ae2"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 6, hbSlotNo = SlotNo 240, hbPrev = BlockHash (HashHeader {unHashHeader = "6d0484fb98e1a2ddf782328915a463914efe43add933f781414e64f1b2c80422"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 5, hbSlotNo = SlotNo 205, hbPrev = BlockHash (HashHeader {unHashHeader = "e44e98b535cf7a6b969dd5ca01bd4bc0920742ed2a2e23952fcef6fdf68c1b38"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 4, hbSlotNo = SlotNo 189, hbPrev = BlockHash (HashHeader {unHashHeader = "7b79e0787da17510992a5b482dd51cf1421bceedb88844382686a00fd0e3e67f"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 8, hbSlotNo = SlotNo 344, hbPrev = BlockHash (HashHeader {unHashHeader = "9f2b0af07f9c7e5033c041e60594277e7022af71e9f7864039ae523b542d9613"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 7, hbSlotNo = SlotNo 286, hbPrev = BlockHash (HashHeader {unHashHeader = "6788bfb98f3e876851fa2d6b7d80b9021e46dd10161f32929f22a0c8eb4a2ae2"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 6, hbSlotNo = SlotNo 240, hbPrev = BlockHash (HashHeader {unHashHeader = "6d0484fb98e1a2ddf782328915a463914efe43add933f781414e64f1b2c80422"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 5, hbSlotNo = SlotNo 205, hbPrev = BlockHash (HashHeader {unHashHeader = "e44e98b535cf7a6b969dd5ca01bd4bc0920742ed2a2e23952fcef6fdf68c1b38"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 4, hbSlotNo = SlotNo 189, hbPrev = BlockHash (HashHeader {unHashHeader = "7b79e0787da17510992a5b482dd51cf1421bceedb88844382686a00fd0e3e67f"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 9, hbSlotNo = SlotNo 375, hbPrev = BlockHash (HashHeader {unHashHeader = "fa5415462da885b9efa87f0506d5d56c9790c59743fcf4da206899bdea62f0ec"}), hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e5 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 8, hbSlotNo = SlotNo 344, hbPrev = BlockHash (HashHeader {unHashHeader = "9f2b0af07f9c7e5033c041e60594277e7022af71e9f7864039ae523b542d9613"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 7, hbSlotNo = SlotNo 286, hbPrev = BlockHash (HashHeader {unHashHeader = "6788bfb98f3e876851fa2d6b7d80b9021e46dd10161f32929f22a0c8eb4a2ae2"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 6, hbSlotNo = SlotNo 240, hbPrev = BlockHash (HashHeader {unHashHeader = "6d0484fb98e1a2ddf782328915a463914efe43add933f781414e64f1b2c80422"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 5, hbSlotNo = SlotNo 205, hbPrev = BlockHash (HashHeader {unHashHeader = "e44e98b535cf7a6b969dd5ca01bd4bc0920742ed2a2e23952fcef6fdf68c1b38"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 4, hbSlotNo = SlotNo 189, hbPrev = BlockHash (HashHeader {unHashHeader = "7b79e0787da17510992a5b482dd51cf1421bceedb88844382686a00fd0e3e67f"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 3, hbSlotNo = SlotNo 167, hbPrev = BlockHash (HashHeader {unHashHeader = "fa2ff79d97d035e04741821a7c9bb8a83d322b138147d1c7cafb0e82e00499bd"}), hbVk = VKey (VerKeyEd25519DSIGN "705c6120f3d7c5734df501e1f394f5b0ceb2d4 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 2, hbSlotNo = SlotNo 150, hbPrev = BlockHash (HashHeader {unHashHeader = "9300610bf080c6f1861e524db8c0dcda06133a6df49236f6aae2443cc1911968"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60 +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 1, hbSlotNo = SlotNo 74, hbPrev = BlockHash (HashHeader {unHashHeader = "128f8027fd7a18ca0c35630fdde44a2723e8b86ec48e4df6b02ca5bff9a06183"}), hbVk = VKey (VerKeyEd25519DSIGN "7b47e0eda4690bd87827cb663c28e134e90c60b +BlockInMode BabbageEra (ShelleyBlock ShelleyBasedEraBabbage (ShelleyBlock {shelleyBlockRaw = Block' (HeaderConstr {headerRaw = HeaderRaw {headerRawBody = HeaderBody {hbBlockNo = BlockNo 0, hbSlotNo = SlotNo 24, hbPrev = GenesisHash, hbVk = VKey (VerKeyEd25519DSIGN "322410c471e4408bc8c5d13f61f67d2d5736e568b69f22aaa9683a0a6ffe92df"), hbVrfVk = VerKeyPraosVRF "M\176\138\r\190\169\222\212\156Yi\155\ST +test end diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs index fe797a8f303..f4fe227a485 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs @@ -1,7 +1,7 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} module Cardano.Testnet.Test.FoldBlocks where @@ -14,12 +14,13 @@ import Cardano.Testnet as TN import Prelude -import qualified Control.Concurrent as IO import Control.Concurrent.Async (async, link) +import qualified Control.Concurrent.STM as STM import Control.Exception (Exception, throw) import Control.Monad import qualified System.Directory as IO import System.FilePath (()) +import qualified System.IO as IO import qualified Testnet.Property.Utils as H import Testnet.Runtime @@ -28,16 +29,11 @@ import qualified Hedgehog as H import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as H import qualified Hedgehog.Extras.Test as H - newtype FoldBlocksException = FoldBlocksException Api.FoldBlocksError instance Exception FoldBlocksException instance Show FoldBlocksException where show (FoldBlocksException a) = displayError a --- | This test starts a testnet with wery short timing, then starts --- `foldBlocks` in another thread to listen for ledger state, ledger --- events and block, and on reception writes this to the `lock` `MVar` --- that main thread blocks on. prop_foldBlocks :: H.Property prop_foldBlocks = H.integrationRetryWorkspace 2 "foldblocks" $ \tempAbsBasePath' -> do -- Start testnet @@ -56,25 +52,31 @@ prop_foldBlocks = H.integrationRetryWorkspace 2 "foldblocks" $ \tempAbsBasePath' socketPath' <- H.sprocketArgumentName <$> H.headM (poolSprockets runtime) H.noteIO (IO.canonicalizePath $ tempAbsPath' socketPath') + H.evalIO $ IO.appendFile "out.txt" "test 3\n" + + tDone <- H.evalIO $ STM.newTVarIO False + -- Start foldBlocks in a separate thread - lock <- H.evalIO IO.newEmptyMVar H.evalIO $ do - a <- async $ - -- The `forever` is here because `foldBlocks` drains blocks - -- until current slot and then quits -- even if there are no - -- permanent (= older than the k parameter) blocks created. In - -- that case we simply restart `foldBlocks` again. - forever $ do - let handler :: Env -> LedgerState -> [Api.LedgerEvent] -> BlockInMode -> () -> IO ((), FoldStatus) - handler _env _ledgerState _ledgerEvents _blockInCardanoMode _ = (, ContinueFold) <$> IO.putMVar lock () - e <- runExceptT (Api.foldBlocks (File configurationFile) (Api.File socketPathAbs) Api.QuickValidation () handler) - either (throw . FoldBlocksException) (\_ -> pure ()) e + a <- async $ do + let handler :: Env -> LedgerState -> [Api.LedgerEvent] -> BlockInMode -> () -> IO ((), FoldStatus) + handler _env _ledgerState _ledgerEvents blockInCardanoMode _ = do + IO.appendFile "out.txt" $ take 400 (show blockInCardanoMode) <> "\n" + STM.atomically $ STM.writeTVar tDone True + pure ((), ContinueFold) + e <- runExceptT (Api.foldBlocks (File configurationFile) (Api.File socketPathAbs) Api.QuickValidation () handler) + either (throw . FoldBlocksException) (\_ -> pure ()) e link a -- Throw async thread's exceptions in main thread - -- The `lock` is written to from within the `handler` above. It - -- tests that `foldBlocks` receives ledger state; once that happens, - -- handler is called, which then writes to the `lock` and allows the - -- test to finish. - _ <- H.evalIO $ H.timeout 30_000_000 $ IO.readMVar lock + _ <- H.evalIO $ H.timeout 30_000_000 $ STM.atomically $ do + done <- STM.readTVar tDone + unless done STM.retry + + H.evalIO $ IO.appendFile "out.txt" "test done\n" + + H.threadDelay 10_000_000 + + H.evalIO $ IO.appendFile "out.txt" "test end\n" + H.assert True