Skip to content

Commit

Permalink
Merge pull request #14603 from MinaProtocol/dkijania/port_log_precomp…
Browse files Browse the repository at this point in the history
…uted_blocks_dev

[Dev] port log precomputed blocks in local network script
  • Loading branch information
dkijania authored Nov 23, 2023
2 parents 78535ae + 04f0fe9 commit 7d11e9b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 19 additions & 0 deletions scripts/archive/split_precomputed_log.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

if [[ $# -lt 1 ]]; then
echo "Usage: $0 precomputed-log-file [output-folder]"
exit 1
fi



ARCHIVE_URI=${ARCHIVE_URI:-postgres://postgres@localhost:5432/archive}
PRECOMPUTED_LOG_FILE=$1

while IFS= read -r line; do
LEDGER_HASH=$(echo $line | jq -r '.protocol_state.body.blockchain_state.staged_ledger_hash.non_snark.ledger_hash')
FILE_NAME=$(psql $ARCHIVE_URI -t -c "SELECT 'mainnet-' || height || '-' ||state_hash || '.json' FROM blocks WHERE ledger_hash = '$LEDGER_HASH'")
echo $line > $FILE_NAME
done < $PRECOMPUTED_LOG_FILE


8 changes: 7 additions & 1 deletion scripts/mina-local-network/mina-local-network.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# set -x
#set -x

# Exit script when commands fail
set -e
Expand Down Expand Up @@ -34,6 +34,7 @@ ZKAPP_TRANSACTIONS=false
RESET=false
UPDATE_GENESIS_TIMESTAMP=false
PROOF_LEVEL="full"
LOG_PRECOMPUTED_BLOCKS=false

SNARK_WORKER_FEE=0.001
TRANSACTION_FREQUENCY=10 # in seconds
Expand Down Expand Up @@ -116,6 +117,8 @@ help() {
echo " | Default: ${TRANSACTION_FREQUENCY}"
echo "-sf |--snark-worker-fee <#> | SNARK Worker fee"
echo " | Default: ${SNARK_WORKER_FEE}"
echo "-lp |--log-precomputed-blocks | Log precomputed blocks"
echo " | Default: ${LOG_PRECOMPUTED_BLOCKS}"
echo "-pl |--proof-level <proof-level> | Proof level (currently consumed by SNARK Workers only)"
echo " | Default: ${PROOF_LEVEL}"
echo "-r |--reset | Whether to reset the Mina Local Network storage file-system (presence of argument)"
Expand Down Expand Up @@ -170,6 +173,8 @@ exec-daemon() {
-log-json \
-log-level ${LOG_LEVEL} \
-file-log-level ${FILE_LOG_LEVEL} \
-precomputed-blocks-file ${FOLDER}/precomputed_blocks.log \
-log-precomputed-blocks ${LOG_PRECOMPUTED_BLOCKS} \
$@
}

Expand Down Expand Up @@ -337,6 +342,7 @@ while [[ "$#" -gt 0 ]]; do
SNARK_WORKER_FEE="${2}"
shift
;;
-lp | --log-precomputed-blocks) LOG_PRECOMPUTED_BLOCKS=true ;;
-pl | --proof-level)
PROOF_LEVEL="${2}"
shift
Expand Down

0 comments on commit 7d11e9b

Please sign in to comment.