-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rampup' into feat/add-o1js-stubs-rampup
- Loading branch information
Showing
19 changed files
with
94 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
scripts/archive/zkapp_duplicated_precondition/add_constraint.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
65 changes: 65 additions & 0 deletions
65
...rchive/zkapp_duplicated_precondition/remove_duplicated_zkapp_account_precondition_rows.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ $# -ne 1 ]; 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 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 | ||
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 with duplicated rows" "$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 | ||
|
||
|
||
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" | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name archive_lib) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name graphql_query) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 3.3) | ||
(name benchmarks) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 3.3) | ||
(name graphql) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name dump_blocks) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name logproc) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 3.2) | ||
(name reformat) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 3.3) | ||
(name rosetta) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name runtime_genesis_ledger) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name zkapp_test_transaction) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(lang dune 2.8) | ||
(name transition_frontier) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
(lang dune 2.8) | ||
(implicit_transitive_deps false) | ||
(implicit_transitive_deps true) |