diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index be6560f4..ef68116a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -61,13 +61,17 @@ jobs: - name: 📥 Checkout snarkOS uses: actions/checkout@v4 with: - repository: AleoNet/snarkOS + repository: AleoHQ/snarkOS + fetch-depth: 0 + ref: ec943b39968215e17f43b5f53fd73acba66e3a5f # latest canarynet path: snarkos - name: 📥 Checkout snarkVM uses: actions/checkout@v4 with: - repository: AleoNet/snarkVM + repository: AleoHQ/snarkVM + fetch-depth: 0 + ref: ed20562d6f97ef593f051ce3cc848644e785f817 # latest canarynet path: snarkvm - name: ☁️ Install Nightly @@ -91,13 +95,17 @@ jobs: - name: 📥 Checkout snarkOS uses: actions/checkout@v4 with: - repository: AleoNet/snarkOS + repository: AleoHQ/snarkOS + fetch-depth: 0 + ref: ec943b39968215e17f43b5f53fd73acba66e3a5f # latest canarynet path: snarkos - name: 📥 Checkout snarkVM uses: actions/checkout@v4 with: - repository: AleoNet/snarkVM + repository: AleoHQ/snarkVM + fetch-depth: 0 + ref: ed20562d6f97ef593f051ce3cc848644e785f817 # latest canarynet path: snarkvm - name: 🥬 Use Mold Linker diff --git a/Cargo.lock b/Cargo.lock index 51cad68f..1cfda763 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5525,9 +5525,9 @@ dependencies = [ "snarkvm-console", "snarkvm-ledger-authority", "snarkvm-ledger-block", - "snarkvm-ledger-coinbase", "snarkvm-ledger-committee", "snarkvm-ledger-narwhal", + "snarkvm-ledger-puzzle", "snarkvm-ledger-query", "snarkvm-ledger-store", "snarkvm-synthesizer", @@ -5555,39 +5555,21 @@ dependencies = [ "serde_json", "snarkvm-console", "snarkvm-ledger-authority", - "snarkvm-ledger-coinbase", "snarkvm-ledger-committee", "snarkvm-ledger-narwhal-batch-header", "snarkvm-ledger-narwhal-subdag", "snarkvm-ledger-narwhal-transmission-id", + "snarkvm-ledger-puzzle", "snarkvm-synthesizer-program", "snarkvm-synthesizer-snark", ] -[[package]] -name = "snarkvm-ledger-coinbase" -version = "0.16.19" -dependencies = [ - "aleo-std", - "anyhow", - "bincode", - "blake2", - "indexmap 2.2.6", - "rayon", - "serde_json", - "snarkvm-algorithms", - "snarkvm-console", - "snarkvm-curves", - "snarkvm-fields", - "snarkvm-synthesizer-snark", - "snarkvm-utilities", -] - [[package]] name = "snarkvm-ledger-committee" version = "0.16.19" dependencies = [ "indexmap 2.2.6", + "rayon", "serde_json", "snarkvm-console", "snarkvm-ledger-narwhal-batch-header", @@ -5623,6 +5605,7 @@ name = "snarkvm-ledger-narwhal-batch-header" version = "0.16.19" dependencies = [ "indexmap 2.2.6", + "rayon", "serde_json", "snarkvm-console", "snarkvm-ledger-narwhal-transmission-id", @@ -5660,8 +5643,8 @@ dependencies = [ "serde_json", "snarkvm-console", "snarkvm-ledger-block", - "snarkvm-ledger-coinbase", "snarkvm-ledger-narwhal-data", + "snarkvm-ledger-puzzle", ] [[package]] @@ -5669,7 +5652,40 @@ name = "snarkvm-ledger-narwhal-transmission-id" version = "0.16.19" dependencies = [ "snarkvm-console", - "snarkvm-ledger-coinbase", + "snarkvm-ledger-puzzle", +] + +[[package]] +name = "snarkvm-ledger-puzzle" +version = "0.16.19" +dependencies = [ + "aleo-std", + "anyhow", + "bincode", + "indexmap 2.2.6", + "lru", + "once_cell", + "parking_lot", + "rand", + "rand_chacha", + "rayon", + "serde_json", + "snarkvm-algorithms", + "snarkvm-console", +] + +[[package]] +name = "snarkvm-ledger-puzzle-epoch" +version = "0.16.19" +dependencies = [ + "anyhow", + "colored", + "indexmap 2.2.6", + "rand", + "rand_chacha", + "rayon", + "snarkvm-console", + "snarkvm-ledger-puzzle", ] [[package]] @@ -5701,9 +5717,9 @@ dependencies = [ "snarkvm-console", "snarkvm-ledger-authority", "snarkvm-ledger-block", - "snarkvm-ledger-coinbase", "snarkvm-ledger-committee", "snarkvm-ledger-narwhal-batch-certificate", + "snarkvm-ledger-puzzle", "snarkvm-synthesizer-program", "snarkvm-synthesizer-snark", "tracing", @@ -5758,11 +5774,14 @@ dependencies = [ "snarkvm-console", "snarkvm-ledger-block", "snarkvm-ledger-committee", + "snarkvm-ledger-puzzle", + "snarkvm-ledger-puzzle-epoch", "snarkvm-ledger-query", "snarkvm-ledger-store", "snarkvm-synthesizer-process", "snarkvm-synthesizer-program", "snarkvm-synthesizer-snark", + "snarkvm-utilities", "tracing", ] diff --git a/Cargo.toml b/Cargo.toml index a4d5fbc1..fffd43a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,14 @@ strip = false inherits = "release" opt-level = "z" +[profile.release-big] +inherits = "release" +codegen-units = 16 +incremental = true +lto = "thin" +opt-level = 1 +panic = "unwind" + [workspace.dependencies] aleo-std = "=0.1.24" axum = { version = "0.7", default-features = false } diff --git a/crates/checkpoint/src/ledger.rs b/crates/checkpoint/src/ledger.rs index bd7db40b..dd20e406 100644 --- a/crates/checkpoint/src/ledger.rs +++ b/crates/checkpoint/src/ledger.rs @@ -135,7 +135,7 @@ impl Stores { // Remove the block solution IDs. for solution_id in solutions.solution_ids() { - db.puzzle_commitments_map().remove(solution_id)?; + db.solution_ids_map().remove(solution_id)?; } // Remove the aborted solution IDs. diff --git a/crates/snops-agent/src/reconcile.rs b/crates/snops-agent/src/reconcile.rs index 6911fb65..79ddd0cb 100644 --- a/crates/snops-agent/src/reconcile.rs +++ b/crates/snops-agent/src/reconcile.rs @@ -8,7 +8,7 @@ use snops_common::{ api::{CheckpointMeta, StorageInfo}, constant::{ LEDGER_BASE_DIR, LEDGER_PERSIST_DIR, LEDGER_STORAGE_FILE, SNARKOS_FILE, - SNARKOS_GENESIS_FILE, + SNARKOS_GENESIS_FILE, VERSION_FILE, }, rpc::error::ReconcileError, state::{EnvId, HeightRequest}, @@ -44,13 +44,31 @@ pub async fn check_files( .await .expect("failed to acquire snarkOS binary"); + let version_file = storage_path.join(VERSION_FILE); + + // wipe old storage when the version changes + if get_version_from_path(&version_file).await? != Some(info.version) && storage_path.exists() { + let _ = tokio::fs::remove_dir_all(&storage_path).await; + } + + std::fs::create_dir_all(&storage_path).map_err(|e| { + error!("failed to create storage directory: {e}"); + ReconcileError::StorageSetupError("create storage directory".to_string()) + })?; + + let genesis_path = storage_path.join(SNARKOS_GENESIS_FILE); let genesis_url = format!( "http://{}/content/storage/{storage_id}/{SNARKOS_GENESIS_FILE}", &state.endpoint ); + let ledger_path = storage_path.join(LEDGER_STORAGE_FILE); + let ledger_url = format!( + "http://{}/content/storage/{storage_id}/{LEDGER_STORAGE_FILE}", + &state.endpoint + ); // download the genesis block - api::check_file(genesis_url, &storage_path.join(SNARKOS_GENESIS_FILE)) + api::check_file(genesis_url, &genesis_path) .await .map_err(|e| { error!("failed to download {SNARKOS_GENESIS_FILE} from the control plane: {e}"); @@ -63,19 +81,22 @@ pub async fn check_files( return Ok(()); } - let ledger_url = format!( - "http://{}/content/storage/{storage_id}/{LEDGER_STORAGE_FILE}", - &state.endpoint - ); - // download the ledger file - api::check_file(ledger_url, &storage_path.join(LEDGER_STORAGE_FILE)) + api::check_file(ledger_url, &ledger_path) .await .map_err(|e| { error!("failed to download {SNARKOS_GENESIS_FILE} from the control plane: {e}"); ReconcileError::StorageAcquireError(LEDGER_STORAGE_FILE.to_owned()) })?; + // write the regen version to a "version" file + tokio::fs::write(&version_file, info.version.to_string()) + .await + .map_err(|e| { + error!("failed to write storage version: {e}"); + ReconcileError::StorageSetupError("write storage version".to_string()) + })?; + Ok(()) } @@ -342,3 +363,16 @@ fn find_checkpoint_by_span<'a>( .rev() .find_map(|(t, c)| if t <= timestamp { Some(c) } else { None }) } + +async fn get_version_from_path(path: &PathBuf) -> Result, ReconcileError> { + if !path.exists() { + return Ok(None); + } + + let data = tokio::fs::read_to_string(path).await.map_err(|e| { + error!("failed to read storage version: {e}"); + ReconcileError::StorageSetupError("failed to read storage version".to_string()) + })?; + + Ok(data.parse().ok()) +} diff --git a/crates/snops-common/src/api.rs b/crates/snops-common/src/api.rs index ae7ee447..f97f403f 100644 --- a/crates/snops-common/src/api.rs +++ b/crates/snops-common/src/api.rs @@ -19,4 +19,6 @@ pub struct StorageInfo { pub checkpoints: Vec, /// Whether to persist the ledger pub persist: bool, + /// Version identifier for this ledger + pub version: u16, } diff --git a/crates/snops-common/src/constant.rs b/crates/snops-common/src/constant.rs index b3176b3c..de549c51 100644 --- a/crates/snops-common/src/constant.rs +++ b/crates/snops-common/src/constant.rs @@ -10,3 +10,5 @@ pub const LEDGER_BASE_DIR: &str = "ledger"; pub const LEDGER_PERSIST_DIR: &str = "persist"; /// Temporary storage archive file name. pub const LEDGER_STORAGE_FILE: &str = "ledger.tar.gz"; +/// File containing a version counter for a ledger +pub const VERSION_FILE: &str = "version"; diff --git a/crates/snops/src/schema/error.rs b/crates/snops/src/schema/error.rs index da9be8f0..37275557 100644 --- a/crates/snops/src/schema/error.rs +++ b/crates/snops/src/schema/error.rs @@ -15,6 +15,8 @@ pub enum StorageError { Command(CommandError, String), #[error("mkdirs for storage generation id: `{0}`: {1}")] GenerateStorage(String, #[source] std::io::Error), + #[error("remove storage {0:#?}: {1}")] + RemoveStorage(PathBuf, #[source] std::io::Error), #[error("generating genesis id: `{0}`: {1}")] FailedToGenGenesis(String, #[source] std::io::Error), #[error("fetching genesis block id: `{0}` url: `{1}`: {2}")] @@ -27,6 +29,10 @@ pub enum StorageError { NoGenerationParams(String), #[error("reading balances {0:#?}: {1}")] ReadBalances(PathBuf, #[source] std::io::Error), + #[error("reading version {0:#?}: {1}")] + ReadVersion(PathBuf, #[source] std::io::Error), + #[error("writing version {0:#?}: {1}")] + WriteVersion(PathBuf, #[source] std::io::Error), #[error("parsing balances {0:#?}: {1}")] ParseBalances(PathBuf, #[source] serde_json::Error), #[error("error loading checkpoints: {0}")] diff --git a/crates/snops/src/schema/storage.rs b/crates/snops/src/schema/storage.rs index 0e6d2054..565ce923 100644 --- a/crates/snops/src/schema/storage.rs +++ b/crates/snops/src/schema/storage.rs @@ -18,7 +18,7 @@ use serde::{ }; use snops_common::{ api::{CheckpointMeta, StorageInfo}, - constant::{LEDGER_BASE_DIR, LEDGER_STORAGE_FILE, SNARKOS_GENESIS_FILE}, + constant::{LEDGER_BASE_DIR, LEDGER_STORAGE_FILE, SNARKOS_GENESIS_FILE, VERSION_FILE}, state::KeyState, }; use tokio::process::Command; @@ -35,6 +35,9 @@ use crate::{error::CommandError, state::GlobalState}; #[serde(rename_all = "kebab-case")] pub struct Document { pub id: FilenameString, + /// Regen version + #[serde(default)] + pub regen: u16, pub name: String, pub description: Option, /// Prefer using existing storage instead of generating new stuff. @@ -112,6 +115,9 @@ pub type AleoAddrMap = IndexMap; pub struct LoadedStorage { /// Storage ID pub id: String, + /// Version counter for this storage - incrementing will invalidate old + /// saved ledgers + pub version: u16, /// Path to storage data pub path: PathBuf, /// committee lookup @@ -207,10 +213,20 @@ impl Document { let mut base = state.cli.path.join("storage"); base.push(&id); + let version_file = base.join(VERSION_FILE); // TODO: The dir can be made by a previous run and the aot stuff can fail // i.e an empty/incomplete directory can exist and we should check those - let exists = matches!(tokio::fs::try_exists(&base).await, Ok(true)); + let mut exists = matches!(tokio::fs::try_exists(&base).await, Ok(true)); + + // wipe old storage when the version changes + if get_version_from_path(&version_file).await? != Some(self.regen) && exists { + info!("storage {id} version changed, removing old storage"); + tokio::fs::remove_dir_all(&base) + .await + .map_err(|e| StorageError::RemoveStorage(version_file.clone(), e))?; + exists = false; + } // TODO: respect self.prefer_existing @@ -384,6 +400,11 @@ impl Document { read_to_addrs(pick_additional_addr, base.join("accounts.json")).await?, ); + // write the regen version to a "version" file + tokio::fs::write(&version_file, self.regen.to_string()) + .await + .map_err(|e| StorageError::WriteVersion(version_file.clone(), e))?; + // todo: maybe update the loaded storage in global state if the hash // of the storage document is different I guess... // that might interfere with running tests, so I don't know @@ -408,6 +429,7 @@ impl Document { } let storage = Arc::new(LoadedStorage { + version: self.regen, id: id.to_owned(), path: base.clone(), committee: read_to_addrs(pick_commitee_addr, base.join("committee.json")).await?, @@ -567,9 +589,22 @@ impl LoadedStorage { .unwrap_or_default(); StorageInfo { id: self.id.clone(), + version: self.version, retention_policy: self.checkpoints.as_ref().map(|c| c.policy().clone()), checkpoints, persist: self.persist, } } } + +async fn get_version_from_path(path: &PathBuf) -> Result, StorageError> { + if !path.exists() { + return Ok(None); + } + + let data = tokio::fs::read_to_string(path) + .await + .map_err(|e| StorageError::ReadVersion(path.clone(), e))?; + + Ok(data.parse().ok()) +} diff --git a/scripts/abort_test.sh b/scripts/abort_test.sh deleted file mode 100755 index 13b3b787..00000000 --- a/scripts/abort_test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -curl 'http://127.0.0.1:1234/api/v1/env' -X DELETE - -# TODO: specify the test to abort - -# # check if index is set -# if [ ! -f "$1" ]; then -# echo "Usage: $0 " -# exit 1 -# fi -# curl -H "Content-Type: application/json" http://localhost:1234/api/v1/test/prepare -d "$(cat $1)" diff --git a/scripts/addr.sh b/scripts/addr.sh deleted file mode 100755 index e666db00..00000000 --- a/scripts/addr.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -BINARY="$(pwd)/target/release/snarkos-aot" - -TEST_PATH=$(scripts/test_path.sh) -COMMITTEE=$TEST_PATH/committee.json - -cat $COMMITTEE | jq "(. | keys)[$1]" -r; \ No newline at end of file diff --git a/scripts/agent.sh b/scripts/agent.sh index 31f9cf21..0525caaf 100755 --- a/scripts/agent.sh +++ b/scripts/agent.sh @@ -14,7 +14,7 @@ fi DATA_PATH="$(pwd)/snops-data/$INDEX" echo "Starting ${DATA_PATH}" -cargo run --release -p snops-agent -- \ +cargo run --profile release-big -p snops-agent -- \ --id "local-$INDEX" \ --path "$DATA_PATH" \ --bind "0.0.0.0" \ diff --git a/scripts/broadcast_tx.sh b/scripts/broadcast_tx.sh deleted file mode 100755 index 7226983e..00000000 --- a/scripts/broadcast_tx.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# broadcasts a single transaction from the tx.json file - -TEST_PATH=$(scripts/test_path.sh) -TRANSACTIONS=$TEST_PATH/tx.json - -# broadcast a transaction by index from the tx.json file -curl -H "Content-Type: application/json" -d "$(cat $TRANSACTIONS | jq ".[$1]")" \ - http://localhost:3030/mainnet/transaction/broadcast diff --git a/scripts/build_ledger.sh b/scripts/build_ledger.sh deleted file mode 100755 index 01db17ca..00000000 --- a/scripts/build_ledger.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -# generate a genesis block and initial ledger - -NAME="$(date +%Y%m%d_%H%M%S)" -BINARY="$(pwd)/target/release/snarkos-aot" - -mkdir -p tests/$NAME - -GENESIS=tests/$NAME/genesis.block -COMMITTEE=tests/$NAME/committee.json -ACCOUNTS=tests/$NAME/accounts.json -TRANSACTIONS=tests/$NAME/tx.json -LEDGER=tests/$NAME/ledger - -echo "Creating test $NAME" - -pk() { cat $COMMITTEE | jq "[.[][0]][$1]" -r; } -addr() { cat $COMMITTEE | jq "(. | keys)[$1]" -r; } - -# generate the genesis block -$BINARY genesis \ - --committee-size 6 \ - --committee-output $COMMITTEE \ - --output $GENESIS \ - --bonded-balance 10000000000000 \ - --additional-accounts 5 \ - --additional-accounts-output $ACCOUNTS -GENESIS_PK=$(pk 0) - -# setup the ledger -$BINARY ledger --genesis $GENESIS --ledger $LEDGER init - -echo "Start a validator with \`scripts/validator.sh 0\`" -echo "Broadcast some transactions with \`scripts/tx_cannon.sh\`" diff --git a/scripts/client.sh b/scripts/client.sh deleted file mode 100755 index a227a883..00000000 --- a/scripts/client.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -scripts/start.sh client $1 \ No newline at end of file diff --git a/scripts/env_start.sh b/scripts/env_start.sh deleted file mode 100755 index bea687b2..00000000 --- a/scripts/env_start.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# check if index is set -if [ -z "$1" ]; then - echo "Usage: $0 " - exit 1 -fi - -curl -v -X POST http://localhost:1234/api/v1/env/$1 diff --git a/scripts/pk.sh b/scripts/pk.sh deleted file mode 100755 index 1652b5bd..00000000 --- a/scripts/pk.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -BINARY="$(pwd)/target/release/snarkos-aot" - -TEST_PATH=$(scripts/test_path.sh) -COMMITTEE=$TEST_PATH/committee.json - -cat $COMMITTEE | jq "[.[][0]][$1]" -r; \ No newline at end of file diff --git a/scripts/print.sh b/scripts/print.sh new file mode 100755 index 00000000..2f2ef039 --- /dev/null +++ b/scripts/print.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +echo "0: $(curl -s http://localhost:3030/mainnet/block/height/latest)" +echo "1: $(curl -s http://localhost:3031/mainnet/block/height/latest)" +echo "2: $(curl -s http://localhost:3032/mainnet/block/height/latest)" +echo "3: $(curl -s http://localhost:3033/mainnet/block/height/latest)" diff --git a/scripts/prover.sh b/scripts/prover.sh deleted file mode 100755 index 4d48a79b..00000000 --- a/scripts/prover.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -scripts/start.sh prover $1 \ No newline at end of file diff --git a/scripts/run_test.sh b/scripts/run_test.sh deleted file mode 100755 index 097678cf..00000000 --- a/scripts/run_test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# check if index is set -if [ ! -f "$1" ]; then - echo "Usage: $0 " - exit 1 -fi - -curl http://localhost:1234/api/v1/env/prepare -d "$(cat $1)" diff --git a/scripts/start.sh b/scripts/start.sh deleted file mode 100755 index e509e821..00000000 --- a/scripts/start.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -# spin up a client using committee member 0's key - -MODE="$1" -INDEX="$2" - -# check if mode is client, validator, or prover -if [ -z "$MODE" ] || [ "$MODE" != "client" ] && [ "$MODE" != "validator" ] && [ "$MODE" != "prover" ]; then - echo "Usage: $0 " - exit 1 -fi - -# check if index is set -if [ -z "$INDEX" ]; then - echo "Usage: $0 " - exit 1 -fi - -TEST_PATH=$(scripts/test_path.sh) -BINARY="$(pwd)/target/release/snarkos-aot" - -GENESIS=$TEST_PATH/genesis.block -COMMITTEE=$TEST_PATH/committee.json -LEDGER=$TEST_PATH/ledger - -pk() { cat $COMMITTEE | jq "[.[][0]][$INDEX]" -r; } - -STORAGE="${LEDGER}_${MODE}_${INDEX}" - -# delete the old ledger -rm -rf $STORAGE -cp -r $LEDGER $STORAGE - -echo "Starting $MODE $INDEX" "${TEST_PATH}/${MODE}_${INDEX}.log" -$BINARY --log "${TEST_PATH}/${MODE}_${INDEX}.log" \ - run --type $MODE \ - --bind "0.0.0.0" \ - --bft "500$INDEX" \ - --rest "303$INDEX" \ - --node "413$INDEX" \ - --genesis $GENESIS \ - --ledger $STORAGE \ - --private-key $(pk 0) \ - --peers "127.0.0.1:4130,127.0.0.1:4131,127.0.0.1:4132,127.0.0.1:4133,127.0.0.1:4134" \ - --validators "127.0.0.1:5000,127.0.0.1:5001,127.0.0.1:5002,127.0.0.1:5003,127.0.0.1:5004,127.0.0.1:5005" diff --git a/scripts/test_path.sh b/scripts/test_path.sh deleted file mode 100755 index 8a54c3a4..00000000 --- a/scripts/test_path.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -if [[ -n "$1" ]] -then - TEST_PATH="$(pwd)/tests/$1" -else - TEST_PATH="$(pwd)/tests/$(ls tests | sort | tail -n1)" -fi - -if [[ ! -d $TEST_PATH ]] -then - exit 1 -fi - -echo $TEST_PATH \ No newline at end of file diff --git a/scripts/tx_cannon.sh b/scripts/tx_cannon.sh deleted file mode 100755 index 5098f069..00000000 --- a/scripts/tx_cannon.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -# generate 2 transactions and broadcast them to the local client at :3030 - -BINARY="$(pwd)/target/release/snarkos-aot" - -TEST_PATH=$(scripts/test_path.sh) -GENESIS=$TEST_PATH/genesis.block -COMMITTEE=$TEST_PATH/committee.json -ACCOUNTS=$TEST_PATH/accounts.json -TRANSACTIONS=$TEST_PATH/tx.json -LEDGER=$TEST_PATH/ledger - -pk() { cat $COMMITTEE | jq "[.[][0]][$1]" -r; } -addr() { cat $COMMITTEE | jq "(. | keys)[$1]" -r; } - - -# $BINARY ledger -g $GENESIS -l $LEDGER tx num 100 \ -# --private-keys $(cat $ACCOUNTS | jq -r '[to_entries[] | .value[0]] | join(",")') >> $TRANSACTIONS - -# emit 3 transactions -# curl -H "Content-Type: application/json" -d "$(cat $TRANSACTIONS | jq ".[0]")" \ -# http://localhost:3030/mainnet/transaction/broadcast -# curl -H "Content-Type: application/json" -d "$(cat $TRANSACTIONS | jq ".[1]")" \ -# http://localhost:3030/mainnet/transaction/broadcast - - -TX=$($BINARY ledger -g $GENESIS -l $LEDGER tx num 1 --private-keys $(cat $ACCOUNTS | jq -r '[to_entries[] | .value[0]] | join(",")')) -curl -H "Content-Type: application/json" http://localhost:3031/mainnet/transaction/broadcast -d "$TX" diff --git a/scripts/tx_cannon_append.sh b/scripts/tx_cannon_append.sh deleted file mode 100755 index 4066cf9c..00000000 --- a/scripts/tx_cannon_append.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -# generate 2 transactions and add them to the ledger - -BINARY="$(pwd)/target/release/snarkos-aot" - -TEST_PATH=$(scripts/test_path.sh) -GENESIS=$TEST_PATH/genesis.block -COMMITTEE=$TEST_PATH/committee.json -TRANSACTIONS=$TEST_PATH/tx.json -LEDGER=$TEST_PATH/ledger - -TXS_PER_BLOCK=10 - -pk() { cat $COMMITTEE | jq "[.[][0]][$1]" -r; } -addr() { cat $COMMITTEE | jq "(. | keys)[$1]" -r; } - -OPERATIONS=$(jq -r -n \ - --arg genesis_pk $(pk 0) \ - --arg addr_1 $(addr 1) \ - --arg addr_2 $(addr 2) \ -'[ - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_1, "amount": 500 }, - { "from": $genesis_pk, "to": $addr_2, "amount": 500 } -]') - -$BINARY ledger -g $GENESIS -l $LEDGER tx --operations "$OPERATIONS" \ - | $BINARY ledger -g $GENESIS -l $LEDGER add --txs-per-block $TXS_PER_BLOCK diff --git a/scripts/validator.sh b/scripts/validator.sh deleted file mode 100755 index 29bd2741..00000000 --- a/scripts/validator.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -scripts/start.sh validator $1 \ No newline at end of file diff --git a/scripts/view.sh b/scripts/view.sh deleted file mode 100755 index 350cfb02..00000000 --- a/scripts/view.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# generate 2 transactions and add them to the ledger - -BINARY="$(pwd)/target/release/snarkos-aot" - -TEST_PATH=$(scripts/test_path.sh) -GENESIS=$TEST_PATH/genesis.block -LEDGER=$TEST_PATH/ledger - -$BINARY ledger -g $GENESIS -l $LEDGER view block 0 diff --git a/specs/persist-4-validators.yaml b/specs/persist-4-validators.yaml index 67806ed0..639f7389 100644 --- a/specs/persist-4-validators.yaml +++ b/specs/persist-4-validators.yaml @@ -9,6 +9,7 @@ description: |- retention-policy: default generate: {} persist: true +regen: 1 --- version: nodes.snarkos.testing.monadic.us/v1