From 3b186d6598982eb998e6c15b6e174de35870c5d6 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Fri, 20 Oct 2023 00:59:06 +0100 Subject: [PATCH 01/14] Reset feature flags before assertion --- src/lib/pickles/step.ml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/pickles/step.ml b/src/lib/pickles/step.ml index f2476f8360be..ee196b1597c5 100644 --- a/src/lib/pickles/step.ml +++ b/src/lib/pickles/step.ml @@ -346,8 +346,7 @@ struct Option.map ~f:(Scalar_challenge.map ~f:Challenge.Constant.of_tock_field) (O.joint_combiner_chal o) - ; feature_flags = - t.statement.proof_state.deferred_values.plonk.feature_flags + ; feature_flags = Plonk_types.Features.none_bool } in let xi = scalar_chal O.v in From 080acace858dadb74d3158ff2d473d701af4f0a3 Mon Sep 17 00:00:00 2001 From: dkijania Date: Thu, 4 Jan 2024 15:51:41 +0100 Subject: [PATCH 02/14] Fix duplicated rows in zkapp_account_precondition table --- .../add_constraint.sql | 2 + ...licated_zkapp_account_precondition_rows.sh | 56 +++++++++++++++++++ src/app/archive/zkapp_tables.sql | 1 + src/app/rosetta/download-missing-blocks.sh | 6 +- 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 scripts/archive/zkapp_duplicated_precondition/add_constraint.sql create mode 100755 scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh diff --git a/scripts/archive/zkapp_duplicated_precondition/add_constraint.sql b/scripts/archive/zkapp_duplicated_precondition/add_constraint.sql new file mode 100644 index 000000000000..13802417040d --- /dev/null +++ b/scripts/archive/zkapp_duplicated_precondition/add_constraint.sql @@ -0,0 +1,2 @@ +ALTER TABLE zkapp_account_precondition +ADD CONSTRAINT zkapp_account_precondition_unique UNIQUE(balance_id, receipt_chain_hash, delegate_id, state_id, action_state_id, proved_state, is_new, nonce_id); \ No newline at end of file diff --git a/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh b/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh new file mode 100755 index 000000000000..0f9db642226c --- /dev/null +++ b/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +if [ $# -gt 2 ]; then + echo "Usage $0 archive-db" + exit 0 +fi + +ARCHIVE_DB=$1 +BODY_DATA_BCK=zkapp_update_body_data_table.bck +PRECONDITION_DATA_BCK=zkapp_precondition_table.bck +PRECONDITION_DATA_TMP=zkapp_precondition_table.tmp +PRECONDITION_UPDATE_SCRIPT=zkapp_precondition_script.sql +BODY_UPDATE_SCRIPT=zkapp_update_body_script.sql + +echo "This script will produce two scripts which will remove duplicated zkppp account preconditions rows in archive db" "$ARCHIVE_DB" + +rm -f $BODY_DATA_BCK +rm -f $PRECONDITION_DATA_BCK +rm -f $PRECONDITION_DATA_TMP +rm -f $PRECONDITION_UPDATE_SCRIPT +rm -f $BODY_UPDATE_SCRIPT + +ALL_TABLES="balance_id,receipt_chain_hash,delegate_id,state_id,action_state_id,proved_state, is_new, nonce_id" + +echo "Creating backup of zkapp_account_preconditions table " "$PRECONDITION_DATA_BCK" + +echo "SELECT * FROM zkapp_account_precondition" | \ + psql -U postgres --csv -q -t "$ARCHIVE_DB" > $PRECONDITION_DATA_BCK + +echo "Creating backup of zkapp_update_body table " "$BODY_DATA_BCK" + +echo "SELECT * FROM zkapp_account_update_body" | \ + psql -U postgres --csv -q -t "$ARCHIVE_DB" > $BODY_DATA_BCK + + +echo "Creating temporary file of zkapp_account_preconditions table " "$PRECONDITION_DATA_TMP" + +echo "SELECT MIN(id) as id, $ALL_TABLES, MAX(id) as duplicated_id \ + FROM zkapp_account_precondition \ + GROUP BY $ALL_TABLES \ + HAVING COUNT(*) > 1" | \ + psql -U postgres --csv -q -t "$ARCHIVE_DB" > $PRECONDITION_DATA_TMP + +echo "Creating SQL scripts for removing duplications" "$PRECONDITION_UPDATE_SCRIPT" "and updating references" "$BODY_UPDATE_SCRIPT" + +cat $PRECONDITION_DATA_TMP | while IFS= read -r line +do + ID_TO_REPLACE=$(echo "$line" | awk -F , '{print $1}'); + ID_TO_REMOVE=$(echo "$line" | awk -F , '{print $10}'); + echo -n . + echo "$ID_TO_REPLACE $ID_TO_REMOVE" | awk '{print "UPDATE zkapp_account_update_body SET zkapp_account_precondition_id = " $1 " WHERE zkapp_account_precondition_id =" $2 ";"}' >> $BODY_UPDATE_SCRIPT + echo "$ID_TO_REMOVE" | awk '{print "DELETE FROM zkapp_account_precondition WHERE id=" $1 ";"}' >> $PRECONDITION_UPDATE_SCRIPT +done + +echo +echo "Scripts are ready $PRECONDITION_UPDATE_SCRIPT, $BODY_UPDATE_SCRIPT !" diff --git a/src/app/archive/zkapp_tables.sql b/src/app/archive/zkapp_tables.sql index 03445a146aaa..5ddf525573fe 100644 --- a/src/app/archive/zkapp_tables.sql +++ b/src/app/archive/zkapp_tables.sql @@ -162,6 +162,7 @@ CREATE TABLE zkapp_account_precondition , action_state_id int REFERENCES zkapp_field(id) , proved_state boolean , is_new boolean +, UNIQUE(balance_id, receipt_chain_hash, delegate_id, state_id, action_state_id, proved_state, is_new, nonce_id) ); CREATE TABLE zkapp_accounts diff --git a/src/app/rosetta/download-missing-blocks.sh b/src/app/rosetta/download-missing-blocks.sh index b8dfb8c45ab1..eec7422c89c7 100755 --- a/src/app/rosetta/download-missing-blocks.sh +++ b/src/app/rosetta/download-missing-blocks.sh @@ -1,8 +1,8 @@ #!/bin/bash -BLOCKS_BUCKET="${BLOCKS_BUCKET:=https://storage.googleapis.com/mina_network_block_data}" +BLOCKS_BUCKET="${BLOCKS_BUCKET:=gs://mina_network_block_data}" -set -u +set -ux MINA_NETWORK=${1} # Postgres database connection string and related variables @@ -25,7 +25,7 @@ function populate_db() { function download_block() { echo "Downloading $1 block" - curl -sO "${BLOCKS_BUCKET}/${1}" + gsutil cp "${BLOCKS_BUCKET}/${1}" . } HASH='map(select(.metadata.parent_hash != null and .metadata.parent_height != null)) | .[0].metadata.parent_hash' From e81a72c395877debfe695e2d9f4a135b18e20522 Mon Sep 17 00:00:00 2001 From: dkijania Date: Thu, 4 Jan 2024 16:08:48 +0100 Subject: [PATCH 03/14] Revert "Auxiliary commit to revert individual files from 080acace858dadb74d3158ff2d473d701af4f0a3" This reverts commit 4883c25838c8650d74fb51e97baad2c663a60390. --- src/app/rosetta/download-missing-blocks.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/rosetta/download-missing-blocks.sh b/src/app/rosetta/download-missing-blocks.sh index eec7422c89c7..b8dfb8c45ab1 100755 --- a/src/app/rosetta/download-missing-blocks.sh +++ b/src/app/rosetta/download-missing-blocks.sh @@ -1,8 +1,8 @@ #!/bin/bash -BLOCKS_BUCKET="${BLOCKS_BUCKET:=gs://mina_network_block_data}" +BLOCKS_BUCKET="${BLOCKS_BUCKET:=https://storage.googleapis.com/mina_network_block_data}" -set -ux +set -u MINA_NETWORK=${1} # Postgres database connection string and related variables @@ -25,7 +25,7 @@ function populate_db() { function download_block() { echo "Downloading $1 block" - gsutil cp "${BLOCKS_BUCKET}/${1}" . + curl -sO "${BLOCKS_BUCKET}/${1}" } HASH='map(select(.metadata.parent_hash != null and .metadata.parent_height != null)) | .[0].metadata.parent_hash' From 32464642e4ae796db89cf99828c2c0ef5c86657a Mon Sep 17 00:00:00 2001 From: Dariusz Kijania Date: Thu, 4 Jan 2024 20:08:22 +0100 Subject: [PATCH 04/14] Apply suggestions from Serhii in code review Co-authored-by: Serhii Shymkiv --- .../remove_duplicated_zkapp_account_precondition_rows.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh b/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh index 0f9db642226c..04db7b2d7cc1 100755 --- a/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh +++ b/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh @@ -12,7 +12,7 @@ PRECONDITION_DATA_TMP=zkapp_precondition_table.tmp PRECONDITION_UPDATE_SCRIPT=zkapp_precondition_script.sql BODY_UPDATE_SCRIPT=zkapp_update_body_script.sql -echo "This script will produce two scripts which will remove duplicated zkppp account preconditions rows in archive db" "$ARCHIVE_DB" +echo "This Shell script will produce two SQL scripts that will remove duplicated zkApp account preconditions rows in the archive DB" "$ARCHIVE_DB" rm -f $BODY_DATA_BCK rm -f $PRECONDITION_DATA_BCK @@ -53,4 +53,4 @@ do done echo -echo "Scripts are ready $PRECONDITION_UPDATE_SCRIPT, $BODY_UPDATE_SCRIPT !" +echo "SQL scripts are ready: $PRECONDITION_UPDATE_SCRIPT, $BODY_UPDATE_SCRIPT !" From a146c1230936828bae10a69fd51a6e8406782f4c Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Thu, 4 Jan 2024 21:19:23 +0000 Subject: [PATCH 05/14] End the suffering, turn back on `implicit_transitive_deps` --- src/app/archive/dune-project | 2 +- src/app/archive/lib/dune-project | 2 +- src/app/benchmarks/dune-project | 2 +- src/app/cli/src/dune-project | 2 +- src/app/dump_blocks/dune-project | 2 +- src/app/logproc/dune-project | 2 +- src/app/reformat/dune-project | 2 +- src/app/rosetta/dune-project | 2 +- src/app/runtime_genesis_ledger/dune-project | 2 +- src/app/zkapp_test_transaction/dune-project | 2 +- src/dune-project | 2 +- src/lib/transition_frontier/dune-project | 2 +- src/nonconsensus/dune-project | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/archive/dune-project b/src/app/archive/dune-project index 2b006b630f4f..edce9fabb477 100644 --- a/src/app/archive/dune-project +++ b/src/app/archive/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name archive_lib) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/archive/lib/dune-project b/src/app/archive/lib/dune-project index 92eab6bf10fc..cfef69d8b4fc 100644 --- a/src/app/archive/lib/dune-project +++ b/src/app/archive/lib/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name graphql_query) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/benchmarks/dune-project b/src/app/benchmarks/dune-project index 30f53fc00388..ae55889bf2f3 100644 --- a/src/app/benchmarks/dune-project +++ b/src/app/benchmarks/dune-project @@ -1,3 +1,3 @@ (lang dune 3.3) (name benchmarks) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/cli/src/dune-project b/src/app/cli/src/dune-project index 6f8123e33f7c..9ad7e7d0bf5e 100644 --- a/src/app/cli/src/dune-project +++ b/src/app/cli/src/dune-project @@ -1,3 +1,3 @@ (lang dune 3.3) (name graphql) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/dump_blocks/dune-project b/src/app/dump_blocks/dune-project index aa4c91fbd906..0fa63202f487 100644 --- a/src/app/dump_blocks/dune-project +++ b/src/app/dump_blocks/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name dump_blocks) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/logproc/dune-project b/src/app/logproc/dune-project index e42209dad38c..95c7cc315ba3 100644 --- a/src/app/logproc/dune-project +++ b/src/app/logproc/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name logproc) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/reformat/dune-project b/src/app/reformat/dune-project index 6a975213f4b5..a656f0c52962 100644 --- a/src/app/reformat/dune-project +++ b/src/app/reformat/dune-project @@ -1,3 +1,3 @@ (lang dune 3.2) (name reformat) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/rosetta/dune-project b/src/app/rosetta/dune-project index e9c79df2a05e..95563d34ea51 100644 --- a/src/app/rosetta/dune-project +++ b/src/app/rosetta/dune-project @@ -1,3 +1,3 @@ (lang dune 3.3) (name rosetta) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/runtime_genesis_ledger/dune-project b/src/app/runtime_genesis_ledger/dune-project index 5991456a2c56..425cc91c4e8d 100644 --- a/src/app/runtime_genesis_ledger/dune-project +++ b/src/app/runtime_genesis_ledger/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name runtime_genesis_ledger) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/app/zkapp_test_transaction/dune-project b/src/app/zkapp_test_transaction/dune-project index 2be065f82eb3..b316070ac57d 100644 --- a/src/app/zkapp_test_transaction/dune-project +++ b/src/app/zkapp_test_transaction/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name zkapp_test_transaction) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/dune-project b/src/dune-project index 7a68f9cdfa8f..ed9b508e577a 100644 --- a/src/dune-project +++ b/src/dune-project @@ -1,5 +1,5 @@ (lang dune 3.3) -(implicit_transitive_deps false) +(implicit_transitive_deps true) (package (name allocation_functor)) (package (name archive_blocks)) diff --git a/src/lib/transition_frontier/dune-project b/src/lib/transition_frontier/dune-project index 89fce2cde93f..b93245aff275 100644 --- a/src/lib/transition_frontier/dune-project +++ b/src/lib/transition_frontier/dune-project @@ -1,3 +1,3 @@ (lang dune 2.8) (name transition_frontier) -(implicit_transitive_deps false) +(implicit_transitive_deps true) diff --git a/src/nonconsensus/dune-project b/src/nonconsensus/dune-project index e99cf75c7325..ed3dcb91eab7 100644 --- a/src/nonconsensus/dune-project +++ b/src/nonconsensus/dune-project @@ -1,2 +1,2 @@ (lang dune 2.8) -(implicit_transitive_deps false) +(implicit_transitive_deps true) From 25a2e111a9e3cc3156923f48e9474cd18a579c1b Mon Sep 17 00:00:00 2001 From: Tang Jiawei Date: Thu, 4 Jan 2024 00:53:47 +0800 Subject: [PATCH 06/14] add idx for element_ids --- src/app/archive/zkapp_tables.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/archive/zkapp_tables.sql b/src/app/archive/zkapp_tables.sql index 03445a146aaa..f9d71b076b57 100644 --- a/src/app/archive/zkapp_tables.sql +++ b/src/app/archive/zkapp_tables.sql @@ -33,6 +33,8 @@ CREATE TABLE zkapp_field_array , element_ids int[] NOT NULL ); +create INDEX idx_zkapp_field_array_element_ids ON zkapp_field_array(element_ids); + /* Fixed-width arrays of algebraic fields, given as id's from zkapp_field From 2e6514467e230e8cf983c88ec609bcc3f2170c52 Mon Sep 17 00:00:00 2001 From: Tang Jiawei Date: Thu, 4 Jan 2024 07:08:36 +0800 Subject: [PATCH 07/14] add an index for zkapp_events --- src/app/archive/zkapp_tables.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/archive/zkapp_tables.sql b/src/app/archive/zkapp_tables.sql index f9d71b076b57..3219004ca71e 100644 --- a/src/app/archive/zkapp_tables.sql +++ b/src/app/archive/zkapp_tables.sql @@ -83,6 +83,9 @@ CREATE TABLE zkapp_events , element_ids int[] NOT NULL ); +create index idx_zkapp_events_element_ids ON zkapp_events(element_ids); + + /* field elements derived from verification keys */ CREATE TABLE zkapp_verification_key_hashes ( id serial PRIMARY KEY From db5f1cdd217fa7b6eecf8c1472d25f58d06d97e2 Mon Sep 17 00:00:00 2001 From: Tang Jiawei Date: Sat, 6 Jan 2024 03:17:33 +0800 Subject: [PATCH 08/14] use upper case for sql key word --- src/app/archive/zkapp_tables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/archive/zkapp_tables.sql b/src/app/archive/zkapp_tables.sql index 3219004ca71e..ded3a2f3db25 100644 --- a/src/app/archive/zkapp_tables.sql +++ b/src/app/archive/zkapp_tables.sql @@ -33,7 +33,7 @@ CREATE TABLE zkapp_field_array , element_ids int[] NOT NULL ); -create INDEX idx_zkapp_field_array_element_ids ON zkapp_field_array(element_ids); +CREATE INDEX idx_zkapp_field_array_element_ids ON zkapp_field_array(element_ids); /* Fixed-width arrays of algebraic fields, given as id's from zkapp_field @@ -83,7 +83,7 @@ CREATE TABLE zkapp_events , element_ids int[] NOT NULL ); -create index idx_zkapp_events_element_ids ON zkapp_events(element_ids); +CREATE INDEX idx_zkapp_events_element_ids ON zkapp_events(element_ids); /* field elements derived from verification keys */ From 7f2844158ebf4d2bd1e20e02e6cfdfded54520e2 Mon Sep 17 00:00:00 2001 From: Tang Jiawei Date: Sat, 6 Jan 2024 04:48:23 +0800 Subject: [PATCH 09/14] add sql file to add indexes --- src/app/archive/add_indexes.sql | 3 +++ src/app/archive/zkapp_tables.sql | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 src/app/archive/add_indexes.sql diff --git a/src/app/archive/add_indexes.sql b/src/app/archive/add_indexes.sql new file mode 100644 index 000000000000..12d8cb71e003 --- /dev/null +++ b/src/app/archive/add_indexes.sql @@ -0,0 +1,3 @@ +CREATE INDEX idx_zkapp_field_array_element_ids ON zkapp_field_array(element_ids); + +CREATE INDEX idx_zkapp_events_element_ids ON zkapp_events(element_ids); \ No newline at end of file diff --git a/src/app/archive/zkapp_tables.sql b/src/app/archive/zkapp_tables.sql index ded3a2f3db25..21389206bb17 100644 --- a/src/app/archive/zkapp_tables.sql +++ b/src/app/archive/zkapp_tables.sql @@ -85,7 +85,6 @@ CREATE TABLE zkapp_events CREATE INDEX idx_zkapp_events_element_ids ON zkapp_events(element_ids); - /* field elements derived from verification keys */ CREATE TABLE zkapp_verification_key_hashes ( id serial PRIMARY KEY From 39f8bde53c90b6c3f20e4f4974b4a304590143ac Mon Sep 17 00:00:00 2001 From: dkijania Date: Sun, 7 Jan 2024 21:24:58 +0100 Subject: [PATCH 10/14] Fixed arguments count checks and conditional printing in remove duplicated zkapp precondition row --- ...licated_zkapp_account_precondition_rows.sh | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh b/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh index 04db7b2d7cc1..3d016dba157f 100755 --- a/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh +++ b/scripts/archive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh @@ -1,6 +1,8 @@ #!/bin/bash -if [ $# -gt 2 ]; then +set -e + +if [ $# -ne 1 ]; then echo "Usage $0 archive-db" exit 0 fi @@ -33,7 +35,7 @@ echo "SELECT * FROM zkapp_account_update_body" | \ psql -U postgres --csv -q -t "$ARCHIVE_DB" > $BODY_DATA_BCK -echo "Creating temporary file of zkapp_account_preconditions table " "$PRECONDITION_DATA_TMP" +echo "Creating temporary file of zkapp_account_preconditions table with duplicated rows" "$PRECONDITION_DATA_TMP" echo "SELECT MIN(id) as id, $ALL_TABLES, MAX(id) as duplicated_id \ FROM zkapp_account_precondition \ @@ -41,16 +43,23 @@ echo "SELECT MIN(id) as id, $ALL_TABLES, MAX(id) as duplicated_id \ HAVING COUNT(*) > 1" | \ psql -U postgres --csv -q -t "$ARCHIVE_DB" > $PRECONDITION_DATA_TMP -echo "Creating SQL scripts for removing duplications" "$PRECONDITION_UPDATE_SCRIPT" "and updating references" "$BODY_UPDATE_SCRIPT" -cat $PRECONDITION_DATA_TMP | while IFS= read -r line -do - ID_TO_REPLACE=$(echo "$line" | awk -F , '{print $1}'); - ID_TO_REMOVE=$(echo "$line" | awk -F , '{print $10}'); - echo -n . - echo "$ID_TO_REPLACE $ID_TO_REMOVE" | awk '{print "UPDATE zkapp_account_update_body SET zkapp_account_precondition_id = " $1 " WHERE zkapp_account_precondition_id =" $2 ";"}' >> $BODY_UPDATE_SCRIPT - echo "$ID_TO_REMOVE" | awk '{print "DELETE FROM zkapp_account_precondition WHERE id=" $1 ";"}' >> $PRECONDITION_UPDATE_SCRIPT -done +if [[ $(wc -l < $PRECONDITION_DATA_TMP) -gt 0 ]]; then + + echo "Creating SQL scripts for removing duplications" "$PRECONDITION_UPDATE_SCRIPT" "and updating references" "$BODY_UPDATE_SCRIPT" -echo -echo "SQL scripts are ready: $PRECONDITION_UPDATE_SCRIPT, $BODY_UPDATE_SCRIPT !" + cat $PRECONDITION_DATA_TMP | while IFS= read -r line + do + ID_TO_REPLACE=$(echo "$line" | awk -F , '{print $1}'); + ID_TO_REMOVE=$(echo "$line" | awk -F , '{print $10}'); + echo -n . + echo "$ID_TO_REPLACE $ID_TO_REMOVE" | awk '{print "UPDATE zkapp_account_update_body SET zkapp_account_precondition_id = " $1 " WHERE zkapp_account_precondition_id =" $2 ";"}' >> $BODY_UPDATE_SCRIPT + echo "$ID_TO_REMOVE" | awk '{print "DELETE FROM zkapp_account_precondition WHERE id=" $1 ";"}' >> $PRECONDITION_UPDATE_SCRIPT + done + + echo + echo "SQL scripts are ready: $PRECONDITION_UPDATE_SCRIPT, $BODY_UPDATE_SCRIPT !" +else + echo + echo "No duplicated rows found. Database state is correct !" +fi From 81d994d8c565a5209fe122870d5beeaa9bb18955 Mon Sep 17 00:00:00 2001 From: dkijania Date: Mon, 8 Jan 2024 19:15:20 +0100 Subject: [PATCH 11/14] Empty commit to signpost Berkeley 2.0.0rampup8 From 24c39c2f16c9ce9741ba8ae38d968ba6889828ac Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 9 Jan 2024 05:14:12 +0000 Subject: [PATCH 12/14] Fix parsing of URLs With this change, we now support all of the likely URLs, including ``` https://foo:bar@github.com/ORG/REPO.git https://github.com/ORG/REPO.git git://github.com/ORG/REPO.git git@github.com:ORG/REPO.git ``` --- buildkite/scripts/export-git-env-vars.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildkite/scripts/export-git-env-vars.sh b/buildkite/scripts/export-git-env-vars.sh index 5b45997339d4..3d207d89e9a0 100755 --- a/buildkite/scripts/export-git-env-vars.sh +++ b/buildkite/scripts/export-git-env-vars.sh @@ -35,7 +35,7 @@ if [ "${BUILDKITE_REPO}" != "${MINA_REPO}" ]; then # We don't want to use tags (as this can replace our dockers/debian packages). Instead we are using repo name # For example: for given repo 'https://github.com/dkijania/mina.git' we convert it to 'dkijania_mina' - export GITTAG=1.0.0$(echo ${BUILDKITE_REPO} | sed -e "s/https:\/\/github.com\///g" | sed -e "s/.git//g" | sed -e "s/\//-/g") + export GITTAG=1.0.0$(echo ${BUILDKITE_REPO} | sed -e 's/^.*github.com[:\/]\(.*\)\.git$/\1/' -e 's/\//-/') export THIS_COMMIT_TAG="" RELEASE=unstable From b071672a154ceec790a9eff86556764c7c041b26 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 9 Jan 2024 05:23:22 +0000 Subject: [PATCH 13/14] If our regex will fail, exit early --- buildkite/scripts/export-git-env-vars.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildkite/scripts/export-git-env-vars.sh b/buildkite/scripts/export-git-env-vars.sh index 3d207d89e9a0..92c3704e3a61 100755 --- a/buildkite/scripts/export-git-env-vars.sh +++ b/buildkite/scripts/export-git-env-vars.sh @@ -29,6 +29,9 @@ export MINA_DEB_CODENAME=${MINA_DEB_CODENAME:=bullseye} if [ "${BUILDKITE_REPO}" != "${MINA_REPO}" ]; then + # Abort if `BUILDKITE_REPO` doesn't have the expected format + echo ${BUILDKITE_REPO} | grep -P '^.*github.com[:\/](.*)\.git$' > /dev/null + # We don't want to allow some operations on fork repository which should be done on main repo only. # Publish to docker hub or publish to unstable debian channel should be exclusive to main repo as it can override # packages from main repo (by using the same commit and the same branch from forked repository) From f2ddea6bc1cd60cb18da2c271533031a14376804 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 9 Jan 2024 05:25:40 +0000 Subject: [PATCH 14/14] Add a message on failure --- buildkite/scripts/export-git-env-vars.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildkite/scripts/export-git-env-vars.sh b/buildkite/scripts/export-git-env-vars.sh index 92c3704e3a61..90df88f660c2 100755 --- a/buildkite/scripts/export-git-env-vars.sh +++ b/buildkite/scripts/export-git-env-vars.sh @@ -30,7 +30,8 @@ export MINA_DEB_CODENAME=${MINA_DEB_CODENAME:=bullseye} if [ "${BUILDKITE_REPO}" != "${MINA_REPO}" ]; then # Abort if `BUILDKITE_REPO` doesn't have the expected format - echo ${BUILDKITE_REPO} | grep -P '^.*github.com[:\/](.*)\.git$' > /dev/null + echo ${BUILDKITE_REPO} | grep -P '^.*github.com[:\/](.*)\.git$' > /dev/null || \ + (echo "BUILDKITE_REPO does not have the expected format" && false) # We don't want to allow some operations on fork repository which should be done on main repo only. # Publish to docker hub or publish to unstable debian channel should be exclusive to main repo as it can override