Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db migration app from mainnet to berkeley #12906

Merged
merged 24 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
216536e
Db migration app for berkeley
psteckler Mar 23, 2023
30c2888
revert name
psteckler Mar 23, 2023
fb2ac80
reformat
psteckler Mar 23, 2023
aeb1a0c
fix extract_blocks
psteckler Mar 23, 2023
0bd5452
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Mar 31, 2023
0d9b605
move berkeley_migration OPAM package to dune-project
psteckler Apr 1, 2023
b8714c1
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Apr 5, 2023
5900baf
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Apr 13, 2023
4406ab8
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler May 4, 2023
d4c5d9a
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Sep 6, 2023
80ad0d5
Patch over bit-rot
psteckler Sep 6, 2023
b8f8a35
add VALUES with type annos
psteckler Sep 9, 2023
3a99d5c
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Sep 9, 2023
5779397
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Oct 11, 2023
8414d6c
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Oct 20, 2023
4a90ec1
Add end-global-slot arg
Oct 20, 2023
6821720
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Oct 20, 2023
922bd6e
set mainnet protocol version
Oct 22, 2023
ce8e042
Mainnet protocol version is 1.0
Oct 23, 2023
0e33b1b
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Oct 30, 2023
c97ae58
Pass thru old txn hashes
Oct 30, 2023
fc599db
use generated field names for extensional blocks
Oct 31, 2023
031021e
Merge branch 'berkeley' into feature/berkeley-db-migrator
psteckler Oct 31, 2023
0af2e3c
Merge branch 'berkeley' into feature/berkeley-db-migrator
Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/app/archive/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
child_processes
precomputed_values
coda_genesis_ledger
consensus.vrf
mina_runtime_config
hex
sgn
mina_base.util
kimchi_backend.pasta
Expand Down Expand Up @@ -72,9 +72,10 @@
mina_version
staged_ledger_diff
error_json
ppx_deriving_yojson.runtime
ppx_version.runtime
)
(inline_tests)
(modes native)
(instrumentation (backend bisect_ppx))
(preprocess (pps ppx_mina ppx_version ppx_jane ppx_custom_printf h_list.ppx)))
(preprocess (pps ppx_mina ppx_version ppx_jane ppx_custom_printf ppx_deriving_yojson h_list.ppx)))
2 changes: 1 addition & 1 deletion src/app/archive/lib/extensional.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module Block = struct
; parent_hash : State_hash.Stable.V1.t
; creator : Public_key.Compressed.Stable.V1.t
; block_winner : Public_key.Compressed.Stable.V1.t
; last_vrf_output : string
; last_vrf_output : Consensus_vrf.Output.Truncated.Stable.V1.t
; snarked_ledger_hash : Frozen_ledger_hash.Stable.V1.t
; staking_epoch_data : Mina_base.Epoch_data.Value.Stable.V1.t
; next_epoch_data : Mina_base.Epoch_data.Value.Stable.V1.t
Expand Down
20 changes: 12 additions & 8 deletions src/app/archive/lib/processor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ module User_command = struct
(Caqti_request.find typ Caqti_type.int
(Mina_caqti.insert_into_cols ~returning:"id" ~table_name
~tannot:(function
| "typ" -> Some "user_command_type" | _ -> None )
| "command_type" -> Some "user_command_type" | _ -> None )
~cols:Fields.names () ) )
{ command_type = user_cmd.command_type
; fee_payer_id
Expand Down Expand Up @@ -2025,7 +2025,8 @@ module Internal_command = struct
(Caqti_request.find typ Caqti_type.int
(Mina_caqti.insert_into_cols ~returning:"id" ~table_name
~tannot:(function
| "typ" -> Some "internal_command_type" | _ -> None )
| "command_type" -> Some "internal_command_type" | _ -> None
)
~cols:Fields.names () ) )
{ command_type = internal_cmd.command_type
; receiver_id
Expand Down Expand Up @@ -2796,9 +2797,9 @@ module Block = struct
(Consensus.Data.Consensus_state.block_stake_winner consensus_state)
in
let last_vrf_output =
(* encode as hex, Postgresql won't accept arbitrary bitstrings *)
(* encode as base64, same as in precomputed blocks JSON *)
Consensus.Data.Consensus_state.last_vrf_output consensus_state
|> Hex.Safe.to_hex
|> Base64.encode_exn ~alphabet:Base64.uri_safe_alphabet
in
let%bind snarked_ledger_hash_id =
Snarked_ledger_hash.add_if_doesn't_exist
Expand Down Expand Up @@ -3200,8 +3201,9 @@ module Block = struct
Public_key.add_if_doesn't_exist (module Conn) block.block_winner
in
let last_vrf_output =
(* already encoded as hex *)
(* encode as base64, same as in precomputed blocks JSON *)
block.last_vrf_output
|> Base64.encode_exn ~alphabet:Base64.uri_safe_alphabet
in
let%bind snarked_ledger_hash_id =
Snarked_ledger_hash.add_if_doesn't_exist
Expand Down Expand Up @@ -3245,9 +3247,11 @@ module Block = struct
snarked_ledger_hash_id, staking_epoch_data_id,
next_epoch_data_id,
min_window_density, sub_window_densities, total_currency,
ledger_hash, height, global_slot_since_hard_fork,
global_slot_since_genesis, protocol_version, timestamp, chain_status)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?::chain_status_type)
ledger_hash, height,
global_slot_since_hard_fork, global_slot_since_genesis,
protocol_version_id, proposed_protocol_version_id,
timestamp, chain_status)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?::bigint[], ?, ?, ?, ?, ?, ?, ?, ?, ?::chain_status_type)
RETURNING id
|sql} )
{ state_hash = block.state_hash |> State_hash.to_base58_check
Expand Down
Loading