Skip to content

Commit b228412

Browse files
committed
Rename incorrect references to fork config
Problem: migration verifier tool and migration script incorrectly named genesis config of the fork network as the fork config which introduced certain confusion. Solution: rename all such occurences of fork config to fork genesis config.
1 parent 298b1a4 commit b228412

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

scripts/archive/migration/mina-berkeley-migration-script

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,13 @@ function final_help(){
542542
printf " %-25s %s\n" "-b | --blocks-bucket" "[string] name of precomputed blocks bucket. NOTICE: there is an assumption that precomputed blocks are named with format: {network}-{height}-{state_hash}.json";
543543
printf " %-25s %s\n" "-bs | --blocks-batch-size" "[int] number of precomputed blocks to be fetch at once from Gcloud. Bigger number like 1000 can help speed up migration process";
544544
printf " %-25s %s\n" "-n | --network" "[string] network name when determining precomputed blocks. NOTICE: there is an assumption that precomputed blocks are named with format: {network}-{height}-{state_hash}.json";
545-
printf " %-25s %s\n" "-fc | --fork-config" "[file] Fork-state config file is dump file in form of json containing fork block and ledger file. It should be provied by MF or O(1)Labs team after fork block is announced";
545+
printf " %-25s %s\n" "-fc | --fork-genesis-config" "[file] Genesis config file for the fork network. It should be provied by MF or O(1)Labs team after fork block is announced";
546546
printf " %-25s %s\n" "-d | --delete-blocks" "delete blocks after they are processed (saves space with -sb)"
547547
printf " %-25s %s\n" "-p | --prefetch-blocks" "downloads all blocks at once instead of incrementally"
548548
echo ""
549549
echo "Example:"
550550
echo ""
551-
echo " " $CLI_NAME final --replayer-checkpoint migration-replayer-checkpoint-1233.json --genesis-ledger "genesis_ledgers/mainnet.json" --source-db "postgres://postgres:pass@localhost:5432/archive_balances_migrated" --target-db "postgres://postgres:pass@localhost:5432/migrated" --blocks-batch-size 10 --blocks-bucket "mina_network_block_data" --network "mainnet" --fork-config fork_config.json
551+
echo " " $CLI_NAME final --replayer-checkpoint migration-replayer-checkpoint-1233.json --genesis-ledger "genesis_ledgers/mainnet.json" --source-db "postgres://postgres:pass@localhost:5432/archive_balances_migrated" --target-db "postgres://postgres:pass@localhost:5432/migrated" --blocks-batch-size 10 --blocks-bucket "mina_network_block_data" --network "mainnet" --fork-genesis-config fork_genesis_config.json
552552
echo ""
553553
echo "Notes:"
554554
echo " 1. After run migrated data will be filled with migrated blocks till last block in source db"
@@ -573,7 +573,7 @@ function final(){
573573
local __stream_blocks=true
574574
local __network=''
575575
local __checkpoint_interval=1000
576-
local __fork_config=''
576+
local __fork_genesis_config=''
577577

578578
while [ ${#} -gt 0 ]; do
579579
error_message="Error: a value is needed for '$1'";
@@ -585,8 +585,8 @@ function final(){
585585
__genesis_ledger=${2:?$error_message}
586586
shift 2;
587587
;;
588-
-fc | --fork-config )
589-
__fork_config=${2:?$error_message}
588+
-fc | --fork-genesis-config )
589+
__fork_genesis_config=${2:?$error_message}
590590
shift 2;
591591
;;
592592
-r | --replayer-checkpoint )
@@ -656,9 +656,9 @@ function final(){
656656
echo "Genesis ledger not defined"
657657
exit 1
658658
fi
659-
if [ -z "$__fork_config" ]; then
659+
if [ -z "$__fork_genesis_config" ]; then
660660
echo ""
661-
echo "Fork config file is not defined. Please refer to mina or o(1) Labs team announcements regarding fork block state hash"
661+
echo "Fork genesis config file is not defined. Please refer to mina or o(1) Labs team announcements regarding fork block state hash"
662662
echo "which is required to run final migration"
663663
exit 1
664664
fi
@@ -684,7 +684,7 @@ function final(){
684684
"$__network" \
685685
"$__checkpoint_interval" \
686686
"$__replayer_checkpoint" \
687-
"$__fork_config"
687+
"$__fork_genesis_config"
688688
}
689689

690690
function run_final_migration() {
@@ -698,9 +698,9 @@ function run_final_migration() {
698698
local __network=$8
699699
local __checkpoint_interval=$9
700700
local __replayer_checkpoint=${10}
701-
local __fork_config=${11}
701+
local __fork_genesis_config=${11}
702702

703-
local __fork_state_hash="$(jq -r .proof.fork.state_hash "$__fork_config")"
703+
local __fork_state_hash="$(jq -r .proof.fork.state_hash "$__fork_genesis_config")"
704704
local __date=$(date '+%Y-%m-%d_%H%M')
705705
local __berkely_migration_log="berkeley_migration_$__date.log"
706706
local __replayer_log="replayer_$__date.log"
@@ -744,7 +744,7 @@ function run_final_migration() {
744744
mina-berkeley-migration-verifier post-fork \
745745
--mainnet-archive-uri "$__mainnet_archive_uri" \
746746
--migrated-archive-uri "$__migrated_archive_uri" \
747-
--fork-config-file "$__fork_config" \
747+
--fork-genesis-config "$__fork_genesis_config" \
748748
--migrated-replayer-output "$migrated_replayer_output"
749749

750750
}

src/app/berkeley_migration_verifier/Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Application for validating migrated archive schema content. Performed checks rel
1212
Basic usage :
1313

1414
```
15-
mina-berkeley-migration-verifier --mainnet-archive-uri postgres://postgres:postgres@localhost:5432/source_archive --migrated-archive-uri postgres://postgres:postgres@localhost:5432/archive_migrated --migrated-replayer-output migrated_replayer.json --fork-config-file fork_config_fixed.json
15+
mina-berkeley-migration-verifier --mainnet-archive-uri postgres://postgres:postgres@localhost:5432/source_archive --migrated-archive-uri postgres://postgres:postgres@localhost:5432/archive_migrated --migrated-replayer-output migrated_replayer.json --fork-genesis-config fork_config_fixed.json
1616
```
1717

1818
where:
1919

2020
- **mainnet-archive-uri** is a connection string to original schema
2121
- **migrated-archive-uri** is a connection string to already migrated schema
2222
- **migrated-replayer-output** is an output for replayer on migrated schema
23-
- **fork-config-file** is a state dump with forked ledger
23+
- **fork-genesis-config** is a genesis config for the fork network
2424

2525
### Dependencies
2626

src/app/berkeley_migration_verifier/berkeley_migration_verifier.ml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,14 @@ let compare_internal_commands migrated_pool mainnet_pool ~work_dir =
255255
in
256256
diff_files internal_commands_berk internal_commands_main
257257

258-
let compare_ledger_hash ~migrated_replayer_output ~fork_config_file =
258+
let compare_ledger_hash ~migrated_replayer_output ~fork_genesis_config_file =
259259
let checkpoint_ledger_hash =
260260
Yojson.Basic.from_file migrated_replayer_output
261261
|> member "genesis_ledger" |> member "hash" |> to_string
262262
|> Ledger_hash.of_base58_check_exn
263263
in
264264
let fork_ledger_hash =
265-
Yojson.Basic.from_file fork_config_file
265+
Yojson.Basic.from_file fork_genesis_config_file
266266
|> member "ledger" |> member "hash" |> to_string
267267
|> Ledger_hash.of_base58_check_exn
268268
in
@@ -353,24 +353,26 @@ let pre_fork_validations ~mainnet_archive_uri ~migrated_archive_uri () =
353353
Deferred.Or_error.errorf
354354
"Some tests failed. Please refer to above output for details"
355355

356-
let fork_config_exn ~fork_config_file =
357-
Yojson.Basic.from_file fork_config_file |> member "proof" |> member "fork"
356+
let fork_config_exn ~fork_genesis_config_file =
357+
Yojson.Basic.from_file fork_genesis_config_file
358+
|> member "proof" |> member "fork"
358359

359-
let fork_block_state_hash_exn ~fork_config_file =
360-
fork_config_exn ~fork_config_file |> member "state_hash" |> to_string
360+
let fork_block_state_hash_exn ~fork_genesis_config_file =
361+
fork_config_exn ~fork_genesis_config_file |> member "state_hash" |> to_string
361362

362-
let fork_block_height_exn ~fork_config_file =
363-
fork_config_exn ~fork_config_file |> member "blockchain_length" |> to_int
363+
let fork_block_height_exn ~fork_genesis_config_file =
364+
fork_config_exn ~fork_genesis_config_file
365+
|> member "blockchain_length" |> to_int
364366

365367
let post_fork_validations ~mainnet_archive_uri ~migrated_archive_uri
366-
~migrated_replayer_output ~fork_config_file () =
368+
~migrated_replayer_output ~fork_genesis_config_file () =
367369
Async.printf
368370
"Running verifications for incremental migration between '%s' and '%s' \
369371
schemas. It may take a couple of minutes... \n"
370372
mainnet_archive_uri migrated_archive_uri ;
371373

372-
let fork_height = fork_block_height_exn ~fork_config_file in
373-
let fork_state_hash = fork_block_state_hash_exn ~fork_config_file in
374+
let fork_height = fork_block_height_exn ~fork_genesis_config_file in
375+
let fork_state_hash = fork_block_state_hash_exn ~fork_genesis_config_file in
374376

375377
let mainnet_archive_uri = Uri.of_string mainnet_archive_uri in
376378
let migrated_archive_uri = Uri.of_string migrated_archive_uri in
@@ -451,7 +453,7 @@ let post_fork_validations ~mainnet_archive_uri ~migrated_archive_uri
451453
|> Test.eval ;
452454

453455
let check =
454-
compare_ledger_hash ~migrated_replayer_output ~fork_config_file
456+
compare_ledger_hash ~migrated_replayer_output ~fork_genesis_config_file
455457
in
456458
Test.of_check check ~name:"Verify fork config vs migrated replayer output"
457459
~idx:8 ~prefix:"A10.3" test_count
@@ -494,14 +496,15 @@ let post_fork_migration_command =
494496
~aliases:[ "-migrated-replayer-output" ]
495497
Command.Param.(required string)
496498
~doc:"Path Path to migrated replayer output"
497-
and fork_config_file =
498-
Command.Param.flag "--fork-config-file" ~aliases:[ "-fork-config-file" ]
499+
and fork_genesis_config_file =
500+
Command.Param.flag "--fork-genesis-config"
501+
~aliases:[ "-fork-genesis-config" ]
499502
Command.Param.(required string)
500-
~doc:"String Path to fork config file"
503+
~doc:"String Path to config file of the fork network"
501504
in
502505

503506
post_fork_validations ~mainnet_archive_uri ~migrated_archive_uri
504-
~migrated_replayer_output ~fork_config_file)
507+
~migrated_replayer_output ~fork_genesis_config_file)
505508

506509
let commands =
507510
[ ("pre-fork", incremental_migration_command)

0 commit comments

Comments
 (0)