@@ -12,10 +12,14 @@ open Mina_automation_fixture.Archive
1212let assert_archived_blocks ~archive_uri ~expected =
1313 let connection = Psql. Conn_str archive_uri in
1414 let % bind actual_blocks_count =
15- Psql. run_command ~connection " Select count (*) from blocks where height > 0 "
15+ Psql. run_command ~connection " SELECT COUNT (*) FROM blocks WHERE height > 1 "
1616 in
1717 let actual_blocks_count =
18- actual_blocks_count |> String. strip |> Int. of_string
18+ match actual_blocks_count with
19+ | Ok count ->
20+ Int. of_string count
21+ | Error err ->
22+ failwith (" Failed to query blocks count: " ^ Error. to_string_hum err)
1923 in
2024 if Int. ( <> ) actual_blocks_count expected then
2125 failwithf " Invalid number of archive blocks. Actual (%d) vs Expected (%d)"
@@ -38,7 +42,7 @@ module ArchivePrecomputedBlocksFromDaemon = struct
3842 in
3943 Archive.Process. start_logging test_data.archive ;
4044 let % bind () =
41- Daemon. dispatch_blocks daemon
45+ Daemon. archive_blocks_from_files daemon
4246 ~archive_address: test_data.archive.config.server_port
4347 ~format: Archive_blocks. Precomputed precomputed_blocks
4448 in
@@ -49,19 +53,19 @@ module ArchivePrecomputedBlocksFromDaemon = struct
4953 in
5054 let connection = Psql. Conn_str archive_uri in
5155 let % bind latest_state_hash =
52- Psql. run_command ~connection
53- " select state_hash from blocks WHERE id=(SELECT max(id) FROM blocks) \
54- LIMIT 1"
56+ Psql. run_command_exn ~connection
57+ " SELECT state_hash FROM blocks ORDER BY id DESC LIMIT 1"
5558 in
5659 let output_ledger = output ^ " /output_ledger.json" in
5760 let replayer = Replayer. default in
58- let % bind _ =
61+ let % bind output =
5962 Replayer. run replayer ~archive_uri
6063 ~input_config:
6164 (Network_data. replayer_input_file_path test_data.network_data)
6265 ~target_state_hash: latest_state_hash ~interval_checkpoint: 10
6366 ~output_ledger ()
6467 in
68+ let () = print_endline output in
6569 let output_ledger = Replayer.Output. of_json_file_exn output_ledger in
6670 assert (
6771 String. equal output_ledger.target_epoch_ledgers_state_hash
0 commit comments