diff --git a/.cargo/release-version b/.cargo/release-version index 992977ad20..24e56e03c0 100644 --- a/.cargo/release-version +++ b/.cargo/release-version @@ -1 +1 @@ -v1.1.0 \ No newline at end of file +v1.2.1 \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 4aad608529..f55a916ec5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ parameters: default: xlarge twoxlarge: type: string - default: aleonet/2xlarge + default: 2xlarge orbs: windows: circleci/windows@5.0 @@ -682,17 +682,27 @@ jobs: resource_class: << pipeline.parameters.twoxlarge >> steps: - run_serial: - flags: --lib --bins -- --test-threads=2 + flags: --lib --bins workspace_member: synthesizer cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-cache + synthesizer-mem-heavy: + docker: + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + resource_class: << pipeline.parameters.twoxlarge >> + steps: + - run_serial: + flags: -- --ignored test_deployment_synthesis_overload test_deep_nested_execution_cost + workspace_member: synthesizer + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-mem-heavy-cache + synthesizer-integration: docker: - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.twoxlarge >> steps: - run_serial: - flags: --test '*' -- --test-threads=8 + flags: --test '*' --features test -- --test-threads=8 workspace_member: synthesizer cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-integration-cache @@ -966,6 +976,7 @@ workflows: - parameters - parameters-uncached - synthesizer + - synthesizer-mem-heavy - synthesizer-integration - synthesizer-process - synthesizer-process-with-rocksdb diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 03e5b9555b..b090795c8b 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,3 +1,3 @@ -## πŸ‘‰ [Please follow one of these issue templates](https://github.com/AleoNet/snarkVM/issues/new/choose) πŸ‘ˆ +## πŸ‘‰ [Please follow one of these issue templates](https://github.com/ProvableHQ/snarkVM/issues/new/choose) πŸ‘ˆ Note: to keep the backlog clean and actionable, issues may be immediately closed if they do not follow one of the above issue templates. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 142af6df75..6a5b6aa82a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,7 +17,7 @@ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee6d42c75c..8ee51d2e8d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,8 +6,8 @@ Thank you for your interest in contributing to snarkVM! Below you can find some Please follow the instructions below when filing a pull request: -- ensure that your branch is forked from the current [master](https://github.com/AleoNet/snarkVM/tree/master) branch -- run `cargo fmt` before you commit; we use the `nightly` version of `rustfmt` to format the code, so you'll need to have the `nightly` toolchain installed on your machine; there's a [git hook](https://git-scm.com/docs/githooks) that ensures proper formatting before any commits can be made, and [`.rustfmt.toml`](https://github.com/AleoNet/snarkVM/blob/master/.rustfmt.toml) specifies some of the formatting conventions +- ensure that your branch is forked from the current [master](https://github.com/ProvableHQ/snarkVM/tree/master) branch +- run `cargo fmt` before you commit; we use the `nightly` version of `rustfmt` to format the code, so you'll need to have the `nightly` toolchain installed on your machine; there's a [git hook](https://git-scm.com/docs/githooks) that ensures proper formatting before any commits can be made, and [`.rustfmt.toml`](https://github.com/ProvableHQ/snarkVM/blob/master/.rustfmt.toml) specifies some of the formatting conventions - run `cargo clippy --all-targets --all-features` to ensure that popular correctness and performance pitfalls are avoided ## Coding conventions diff --git a/Cargo.lock b/Cargo.lock index 451bc28458..209acf52a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2551,7 +2551,7 @@ dependencies = [ [[package]] name = "snarkvm" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anstyle", "anyhow", @@ -2587,7 +2587,7 @@ dependencies = [ [[package]] name = "snarkvm-algorithms" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -2626,7 +2626,7 @@ dependencies = [ [[package]] name = "snarkvm-algorithms-cuda" -version = "1.1.0" +version = "1.2.1" dependencies = [ "blst", "cc", @@ -2636,7 +2636,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-account", "snarkvm-circuit-algorithms", @@ -2649,7 +2649,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-account" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "snarkvm-circuit-algorithms", @@ -2661,7 +2661,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-algorithms" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "snarkvm-circuit-types", @@ -2673,7 +2673,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-collections" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "snarkvm-circuit-algorithms", @@ -2687,7 +2687,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment" -version = "1.1.0" +version = "1.2.1" dependencies = [ "criterion", "indexmap 2.2.6", @@ -2708,11 +2708,11 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment-witness" -version = "1.1.0" +version = "1.2.1" [[package]] name = "snarkvm-circuit-network" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-collections", @@ -2723,7 +2723,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-program" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "paste", @@ -2741,7 +2741,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-address", @@ -2756,7 +2756,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-address" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -2768,7 +2768,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-boolean" -version = "1.1.0" +version = "1.2.1" dependencies = [ "criterion", "snarkvm-circuit-environment", @@ -2777,7 +2777,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-field" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -2786,7 +2786,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-group" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -2798,7 +2798,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-integers" -version = "1.1.0" +version = "1.2.1" dependencies = [ "paste", "snarkvm-circuit-environment", @@ -2811,7 +2811,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-scalar" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -2821,7 +2821,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-string" -version = "1.1.0" +version = "1.2.1" dependencies = [ "rand", "snarkvm-circuit-environment", @@ -2834,7 +2834,7 @@ dependencies = [ [[package]] name = "snarkvm-console" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-console-account", "snarkvm-console-algorithms", @@ -2846,7 +2846,7 @@ dependencies = [ [[package]] name = "snarkvm-console-account" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "bs58", @@ -2859,7 +2859,7 @@ dependencies = [ [[package]] name = "snarkvm-console-algorithms" -version = "1.1.0" +version = "1.2.1" dependencies = [ "blake2s_simd", "criterion", @@ -2877,7 +2877,7 @@ dependencies = [ [[package]] name = "snarkvm-console-collections" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "criterion", @@ -2890,7 +2890,7 @@ dependencies = [ [[package]] name = "snarkvm-console-network" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -2912,7 +2912,7 @@ dependencies = [ [[package]] name = "snarkvm-console-network-environment" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "bech32", @@ -2929,7 +2929,7 @@ dependencies = [ [[package]] name = "snarkvm-console-program" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "enum-iterator", @@ -2951,7 +2951,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types" -version = "1.1.0" +version = "1.2.1" dependencies = [ "criterion", "snarkvm-console-network", @@ -2967,7 +2967,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-address" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -2979,7 +2979,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-boolean" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -2988,7 +2988,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-field" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -2999,7 +2999,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-group" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -3011,7 +3011,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-integers" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -3023,7 +3023,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-scalar" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -3035,7 +3035,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-string" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -3047,7 +3047,7 @@ dependencies = [ [[package]] name = "snarkvm-curves" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "criterion", @@ -3062,7 +3062,7 @@ dependencies = [ [[package]] name = "snarkvm-fields" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3080,7 +3080,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3109,7 +3109,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-authority" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "bincode", @@ -3122,7 +3122,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-block" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "indexmap 2.2.6", @@ -3147,7 +3147,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-committee" -version = "1.1.0" +version = "1.2.1" dependencies = [ "anyhow", "bincode", @@ -3168,7 +3168,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal" -version = "1.1.0" +version = "1.2.1" dependencies = [ "snarkvm-ledger-narwhal", "snarkvm-ledger-narwhal-batch-certificate", @@ -3181,7 +3181,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-certificate" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "indexmap 2.2.6", @@ -3195,7 +3195,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-header" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "indexmap 2.2.6", @@ -3209,7 +3209,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-data" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bytes", "serde_json", @@ -3221,7 +3221,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-subdag" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "indexmap 2.2.6", @@ -3237,7 +3237,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "bytes", @@ -3250,7 +3250,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission-id" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "serde_json", @@ -3260,7 +3260,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3281,7 +3281,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle-epoch" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3301,7 +3301,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-query" -version = "1.1.0" +version = "1.2.1" dependencies = [ "async-trait", "reqwest", @@ -3313,7 +3313,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-store" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std-storage", "anyhow", @@ -3343,7 +3343,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-test-helpers" -version = "1.1.0" +version = "1.2.1" dependencies = [ "once_cell", "snarkvm-circuit", @@ -3357,7 +3357,7 @@ dependencies = [ [[package]] name = "snarkvm-metrics" -version = "1.1.0" +version = "1.2.1" dependencies = [ "metrics", "metrics-exporter-prometheus", @@ -3365,7 +3365,7 @@ dependencies = [ [[package]] name = "snarkvm-parameters" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3399,7 +3399,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3438,7 +3438,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-process" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "bincode", @@ -3466,7 +3466,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-program" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "criterion", @@ -3482,7 +3482,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-snark" -version = "1.1.0" +version = "1.2.1" dependencies = [ "bincode", "colored", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "snarkvm-utilities" -version = "1.1.0" +version = "1.2.1" dependencies = [ "aleo-std", "anyhow", @@ -3515,7 +3515,7 @@ dependencies = [ [[package]] name = "snarkvm-utilities-derives" -version = "1.1.0" +version = "1.2.1" dependencies = [ "proc-macro2", "quote 1.0.35", @@ -3524,7 +3524,7 @@ dependencies = [ [[package]] name = "snarkvm-wasm" -version = "1.1.0" +version = "1.2.1" dependencies = [ "getrandom", "snarkvm-circuit-network", diff --git a/Cargo.toml b/Cargo.toml index d722810219..6cba91e842 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -153,58 +153,58 @@ test_targets = [ "snarkvm-console/test_targets" ] [dependencies.snarkvm-algorithms] path = "./algorithms" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit] path = "./circuit" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console] path = "./console" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-curves] path = "./curves" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-fields] path = "./fields" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-ledger] path = "./ledger" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-metrics] path = "./metrics" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-parameters] path = "./parameters" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-synthesizer] path = "./synthesizer" -version = "=1.1.0" +version = "=1.2.1" default-features = false optional = true [dependencies.snarkvm-utilities] path = "./utilities" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-wasm] path = "./wasm" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.anstyle] @@ -292,7 +292,7 @@ debug-assertions = false [profile.dev] opt-level = 3 -lto = "thin" +lto = "off" incremental = true [profile.test] diff --git a/README.md b/README.md index f52c3d7d7d..f3c3064673 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@

- - + + - +

## Table of Contents @@ -71,7 +71,7 @@ Alternatively, you can install `snarkvm` by building from the source code as fol ```bash # Download the source code -git clone --branch mainnet --single-branch https://github.com/AleoNet/snarkVM.git +git clone --branch mainnet --single-branch https://github.com/ProvableHQ/snarkVM.git cd snarkVM git checkout tags/testnet-beta # Install snarkVM @@ -96,57 +96,57 @@ Thank you for helping make snarkVM better! - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + diff --git a/algorithms/Cargo.toml b/algorithms/Cargo.toml index 3603cc1a4a..ef95a6fff4 100644 --- a/algorithms/Cargo.toml +++ b/algorithms/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-algorithms" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Algorithms for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -47,27 +47,27 @@ required-features = [ "test" ] [dependencies.snarkvm-curves] path = "../curves" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-fields] path = "../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-parameters] path = "../parameters" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-utilities] path = "../utilities" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-algorithms-cuda] path = "./cuda" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.aleo-std] diff --git a/algorithms/cuda/Cargo.toml b/algorithms/cuda/Cargo.toml index df0ef1d5a6..81f7405322 100644 --- a/algorithms/cuda/Cargo.toml +++ b/algorithms/cuda/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-algorithms-cuda" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Cuda optimizations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", diff --git a/algorithms/src/snark/varuna/varuna.rs b/algorithms/src/snark/varuna/varuna.rs index f4fa998a14..bb9285783e 100644 --- a/algorithms/src/snark/varuna/varuna.rs +++ b/algorithms/src/snark/varuna/varuna.rs @@ -332,7 +332,7 @@ where /// This is the main entrypoint for creating proofs. /// You can find a specification of the prover algorithm in: - /// https://github.com/AleoNet/protocol-docs + /// https://github.com/ProvableHQ/protocol-docs fn prove_batch, R: Rng + CryptoRng>( universal_prover: &Self::UniversalProver, fs_parameters: &Self::FSParameters, @@ -621,7 +621,7 @@ where /// This is the main entrypoint for verifying proofs. /// You can find a specification of the verifier algorithm in: - /// https://github.com/AleoNet/protocol-docs + /// https://github.com/ProvableHQ/protocol-docs fn verify_batch>( universal_verifier: &Self::UniversalVerifier, fs_parameters: &Self::FSParameters, diff --git a/circuit/Cargo.toml b/circuit/Cargo.toml index a8b936bf5f..7dd6b53158 100644 --- a/circuit/Cargo.toml +++ b/circuit/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-circuit" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Circuits for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -25,28 +25,28 @@ edition = "2021" [dependencies.snarkvm-circuit-account] path = "./account" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-algorithms] path = "./algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-collections] path = "./collections" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-environment] path = "./environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-network] path = "./network" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-program] path = "./program" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types] path = "./types" -version = "=1.1.0" +version = "=1.2.1" diff --git a/circuit/account/Cargo.toml b/circuit/account/Cargo.toml index 5ea321f4b3..dd28275bbe 100644 --- a/circuit/account/Cargo.toml +++ b/circuit/account/Cargo.toml @@ -1,30 +1,30 @@ [package] name = "snarkvm-circuit-account" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Account circuit library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-account" path = "../../console/account" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-network] path = "../network" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.snarkvm-utilities] path = "../../utilities" diff --git a/circuit/algorithms/Cargo.toml b/circuit/algorithms/Cargo.toml index 1698c5ab8b..482cf405b5 100644 --- a/circuit/algorithms/Cargo.toml +++ b/circuit/algorithms/Cargo.toml @@ -1,26 +1,26 @@ [package] name = "snarkvm-circuit-algorithms" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Algorithm circuit library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-algorithms" path = "../../console/algorithms" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-fields] path = "../../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dev-dependencies.anyhow] diff --git a/circuit/collections/Cargo.toml b/circuit/collections/Cargo.toml index 48a87019d2..230048f927 100644 --- a/circuit/collections/Cargo.toml +++ b/circuit/collections/Cargo.toml @@ -1,26 +1,26 @@ [package] name = "snarkvm-circuit-collections" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Collections circuit library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-collections" path = "../../console/collections" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.snarkvm-circuit-network] path = "../network" diff --git a/circuit/environment/Cargo.toml b/circuit/environment/Cargo.toml index 32565fc279..47a62a23e0 100644 --- a/circuit/environment/Cargo.toml +++ b/circuit/environment/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-circuit-environment" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Circuit environment for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -16,32 +16,32 @@ harness = false [dependencies.console] package = "snarkvm-console-network" path = "../../console/network" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-algorithms] path = "../../algorithms" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "r1cs" ] [dependencies.snarkvm-circuit-environment-witness] path = "./witness" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-curves] path = "../../curves" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-fields] path = "../../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-utilities] path = "../../utilities" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.indexmap] diff --git a/circuit/environment/src/helpers/updatable_count.rs b/circuit/environment/src/helpers/updatable_count.rs index 122db5c861..d1f778a41a 100644 --- a/circuit/environment/src/helpers/updatable_count.rs +++ b/circuit/environment/src/helpers/updatable_count.rs @@ -33,7 +33,7 @@ static WORKSPACE_ROOT: OnceCell = OnceCell::new(); /// To update the arguments to `count_is!`, run cargo test with the `UPDATE_COUNT` flag set to the name of the file containing the macro invocation. /// e.g. `UPDATE_COUNT=boolean cargo test -/// See https://github.com/AleoNet/snarkVM/pull/1688 for more details. +/// See https://github.com/ProvableHQ/snarkVM/pull/1688 for more details. #[macro_export] macro_rules! count_is { ($num_constants:literal, $num_public:literal, $num_private:literal, $num_constraints:literal) => { @@ -51,7 +51,7 @@ macro_rules! count_is { /// To update the arguments to `count_less_than!`, run cargo test with the `UPDATE_COUNT` flag set to the name of the file containing the macro invocation. /// e.g. `UPDATE_COUNT=boolean cargo test -/// See https://github.com/AleoNet/snarkVM/pull/1688 for more details. +/// See https://github.com/ProvableHQ/snarkVM/pull/1688 for more details. #[macro_export] macro_rules! count_less_than { ($num_constants:literal, $num_public:literal, $num_private:literal, $num_constraints:literal) => { diff --git a/circuit/environment/witness/Cargo.toml b/circuit/environment/witness/Cargo.toml index a18c69c0ca..978394416c 100644 --- a/circuit/environment/witness/Cargo.toml +++ b/circuit/environment/witness/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-circuit-environment-witness" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A procedural macro to construct a witness in an environment" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2018" diff --git a/circuit/network/Cargo.toml b/circuit/network/Cargo.toml index b24c179eed..83e8bb82cd 100644 --- a/circuit/network/Cargo.toml +++ b/circuit/network/Cargo.toml @@ -1,30 +1,30 @@ [package] name = "snarkvm-circuit-network" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Network circuit library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-network" path = "../../console/network" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-collections] path = "../collections" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.snarkvm-console-types] path = "../../console/types" diff --git a/circuit/program/Cargo.toml b/circuit/program/Cargo.toml index 7201375106..d58e23bfac 100644 --- a/circuit/program/Cargo.toml +++ b/circuit/program/Cargo.toml @@ -1,42 +1,42 @@ [package] name = "snarkvm-circuit-program" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Program circuit library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-program" path = "../../console/program" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-account] path = "../account" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-collections] path = "../collections" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-network] path = "../network" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-utilities] path = "../../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.paste] version = "1.0" diff --git a/circuit/types/Cargo.toml b/circuit/types/Cargo.toml index 4929309e69..55b9648949 100644 --- a/circuit/types/Cargo.toml +++ b/circuit/types/Cargo.toml @@ -1,44 +1,44 @@ [package] name = "snarkvm-circuit-types" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Primitive circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-circuit-environment] path = "../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-address] path = "./address" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "./boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-field] path = "./field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-group] path = "./group" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-integers] path = "./integers" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-scalar] path = "./scalar" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-string] path = "./string" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.console] package = "snarkvm-console" diff --git a/circuit/types/address/Cargo.toml b/circuit/types/address/Cargo.toml index 63c5bfd9aa..7a3c72b009 100644 --- a/circuit/types/address/Cargo.toml +++ b/circuit/types/address/Cargo.toml @@ -1,38 +1,38 @@ [package] name = "snarkvm-circuit-types-address" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Address circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-types-address" path = "../../../console/types/address" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-group] path = "../group" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-scalar] path = "../scalar" -version = "=1.1.0" +version = "=1.2.1" [features] default = [ "enable_console" ] diff --git a/circuit/types/boolean/Cargo.toml b/circuit/types/boolean/Cargo.toml index 7d13450c56..83bbc55641 100644 --- a/circuit/types/boolean/Cargo.toml +++ b/circuit/types/boolean/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-circuit-types-boolean" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Boolean circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -16,12 +16,12 @@ harness = false [dependencies.console] package = "snarkvm-console-types-boolean" path = "../../../console/types/boolean" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.criterion] version = "0.5" diff --git a/circuit/types/field/Cargo.toml b/circuit/types/field/Cargo.toml index 3e6b83c941..b80a3aeb73 100644 --- a/circuit/types/field/Cargo.toml +++ b/circuit/types/field/Cargo.toml @@ -1,26 +1,26 @@ [package] name = "snarkvm-circuit-types-field" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Field circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-types-field" path = "../../../console/types/field" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [features] default = [ "enable_console" ] diff --git a/circuit/types/group/Cargo.toml b/circuit/types/group/Cargo.toml index 22fbc0bf06..aaa467e20f 100644 --- a/circuit/types/group/Cargo.toml +++ b/circuit/types/group/Cargo.toml @@ -1,34 +1,34 @@ [package] name = "snarkvm-circuit-types-group" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Group circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-types-group" path = "../../../console/types/group" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-scalar] path = "../scalar" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.snarkvm-utilities] path = "../../../utilities" diff --git a/circuit/types/integers/Cargo.toml b/circuit/types/integers/Cargo.toml index 6babf5f697..b6f52c3285 100644 --- a/circuit/types/integers/Cargo.toml +++ b/circuit/types/integers/Cargo.toml @@ -1,34 +1,34 @@ [package] name = "snarkvm-circuit-types-integers" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Integer circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-types-integers" path = "../../../console/types/integers" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-scalar] path = "../scalar" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.snarkvm-utilities] path = "../../../utilities" diff --git a/circuit/types/scalar/Cargo.toml b/circuit/types/scalar/Cargo.toml index 30d670132e..903ec7f153 100644 --- a/circuit/types/scalar/Cargo.toml +++ b/circuit/types/scalar/Cargo.toml @@ -1,30 +1,30 @@ [package] name = "snarkvm-circuit-types-scalar" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Scalar circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-types-scalar" path = "../../../console/types/scalar" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [features] default = [ "enable_console" ] diff --git a/circuit/types/string/Cargo.toml b/circuit/types/string/Cargo.toml index ca2b0ee97f..03a271a039 100644 --- a/circuit/types/string/Cargo.toml +++ b/circuit/types/string/Cargo.toml @@ -1,34 +1,34 @@ [package] name = "snarkvm-circuit-types-string" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "String circuit for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.console] package = "snarkvm-console-types-string" path = "../../../console/types/string" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-circuit-environment] path = "../../environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-circuit-types-integers] path = "../integers" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.snarkvm-utilities] path = "../../../utilities" diff --git a/console/Cargo.toml b/console/Cargo.toml index b7d7094acb..b21015580a 100644 --- a/console/Cargo.toml +++ b/console/Cargo.toml @@ -1,41 +1,41 @@ [package] name = "snarkvm-console" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Console environment for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-account] path = "./account" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-algorithms] path = "./algorithms" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-collections] path = "./collections" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-network] path = "./network" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-program] path = "./program" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types] path = "./types" -version = "=1.1.0" +version = "=1.2.1" optional = true [features] diff --git a/console/account/Cargo.toml b/console/account/Cargo.toml index 30128e8993..f918e6cd89 100644 --- a/console/account/Cargo.toml +++ b/console/account/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-console-account" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Account operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -15,11 +15,11 @@ harness = false [dependencies.snarkvm-console-network] path = "../network" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "address", "boolean", "field", "group", "scalar" ] diff --git a/console/algorithms/Cargo.toml b/console/algorithms/Cargo.toml index d4c2dcf45b..be82d96ebb 100644 --- a/console/algorithms/Cargo.toml +++ b/console/algorithms/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-console-algorithms" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Console algorithms for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -25,18 +25,18 @@ harness = false [dependencies.snarkvm-console-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "field", "group", "integers", "scalar" ] [dependencies.snarkvm-fields] path = "../../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-utilities] path = "../../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.blake2s_simd] version = "1.0" diff --git a/console/collections/Cargo.toml b/console/collections/Cargo.toml index 036d17bd69..8769102c59 100644 --- a/console/collections/Cargo.toml +++ b/console/collections/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-console-collections" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Collections for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -20,11 +20,11 @@ harness = false [dependencies.snarkvm-console-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "field", "integers" ] diff --git a/console/network/Cargo.toml b/console/network/Cargo.toml index 34f970c636..7f4f3f35aa 100644 --- a/console/network/Cargo.toml +++ b/console/network/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-console-network" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Network console library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -19,45 +19,45 @@ test_targets = [ ] [dependencies.snarkvm-algorithms] path = "../../algorithms" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "snark" ] [dependencies.snarkvm-console-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-collections] path = "../collections" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-network-environment] path = "./environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "field", "group", "scalar" ] [dependencies.snarkvm-curves] path = "../../curves" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-fields] path = "../../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-parameters] path = "../../parameters" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-utilities] path = "../../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.anyhow] version = "1.0.73" diff --git a/console/network/environment/Cargo.toml b/console/network/environment/Cargo.toml index f61c7dccc7..607b9b878a 100644 --- a/console/network/environment/Cargo.toml +++ b/console/network/environment/Cargo.toml @@ -1,26 +1,26 @@ [package] name = "snarkvm-console-network-environment" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Environment console library for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-curves] path = "../../../curves" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-fields] path = "../../../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-utilities] path = "../../../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.anyhow] version = "1.0.73" diff --git a/console/network/environment/src/helpers/sanitizer.rs b/console/network/environment/src/helpers/sanitizer.rs index 8892ef34fd..184f99583d 100644 --- a/console/network/environment/src/helpers/sanitizer.rs +++ b/console/network/environment/src/helpers/sanitizer.rs @@ -117,8 +117,9 @@ impl Sanitizer { /// /// Discard any leading newline. fn str_till_eol(string: &str) -> ParserResult<&str> { - // A heuristic approach is applied here in order to avoid - // costly parsing operations in the most common scenarios. + // A heuristic approach is applied here in order to avoid costly parsing operations in the + // most common scenarios: non-parsing methods are used to verify if the string has multiple + // lines and if there are any unsafe characters. if let Some((before, after)) = string.split_once('\n') { let is_multiline = before.ends_with('\\'); @@ -128,7 +129,9 @@ impl Sanitizer { if !contains_unsafe_chars { Ok((after, before)) } else { - recognize(Self::till(value((), Sanitizer::parse_safe_char), Self::eol))(before) + // `eoi` is used here instead of `eol`, since the earlier call to `split_once` + // already removed the newline + recognize(Self::till(value((), Sanitizer::parse_safe_char), Self::eoi))(before) } } else { map( @@ -277,6 +280,23 @@ mod tests { ("hello world", "// hel\u{4141}lo\n"), Sanitizer::parse_comments("// hel\u{4141}lo\nhello world").unwrap() ); + assert_eq!( + ("hello world", "/* multi\n line comment\n*/\n"), + Sanitizer::parse_comments("/* multi\n line comment\n*/\nhello world").unwrap() + ); + assert_eq!( + ("hello world", "// multiple\n// line\n// comments\n"), + Sanitizer::parse_comments("// multiple\n// line\n// comments\nhello world").unwrap() + ); + assert_eq!( + ("hello world", "/* multi\n line comment\n*/\n/* and\n another\n one\n*/\n"), + Sanitizer::parse_comments("/* multi\n line comment\n*/\n/* and\n another\n one\n*/\nhello world") + .unwrap() + ); + assert_eq!( + ("hello world", "/* multi\n line comment\n*/\n// two single\n// line comments\n/* and\n another\n multi-liner\n*/\n"), + Sanitizer::parse_comments("/* multi\n line comment\n*/\n// two single\n// line comments\n/* and\n another\n multi-liner\n*/\nhello world").unwrap() + ); assert!(Sanitizer::parse_comments("// hel\x08lo\nhello world").is_err()); assert!(Sanitizer::parse_comments("// hel\u{2066}lo\nhello world").is_err()); assert!(Sanitizer::parse_comments("/* hel\x7flo */\nhello world").is_err()); diff --git a/console/network/environment/src/lib.rs b/console/network/environment/src/lib.rs index bd14120900..6a741624cd 100644 --- a/console/network/environment/src/lib.rs +++ b/console/network/environment/src/lib.rs @@ -72,14 +72,21 @@ pub mod prelude { ToBytesSerializer, Uniform, cfg_chunks, + cfg_chunks_mut, cfg_find, cfg_find_map, cfg_into_iter, cfg_iter, cfg_iter_mut, cfg_keys, + cfg_par_bridge, cfg_reduce, + cfg_reduce_with, + cfg_sort_by_cached_key, + cfg_sort_unstable_by, + cfg_sorted_by, cfg_values, + cfg_zip_fold, error, has_duplicates, io::{Read, Result as IoResult, Write}, diff --git a/console/network/src/canary_v0.rs b/console/network/src/canary_v0.rs index 5aae6930ef..65c053e5c0 100644 --- a/console/network/src/canary_v0.rs +++ b/console/network/src/canary_v0.rs @@ -136,10 +136,16 @@ impl Network for CanaryV0 { /// The block height from which consensus V2 rules apply. #[cfg(not(any(test, feature = "test")))] const CONSENSUS_V2_HEIGHT: u32 = 2_900_000; - // TODO (raychu86): Update this value based on the desired canary height. /// The block height from which consensus V2 rules apply. #[cfg(any(test, feature = "test"))] - const CONSENSUS_V2_HEIGHT: u32 = 0; + const CONSENSUS_V2_HEIGHT: u32 = 10; + // TODO: (raychu86): Update this value based on the desired mainnet height. + // The block height from which consensus V3 rules apply. + #[cfg(not(any(test, feature = "test")))] + const CONSENSUS_V3_HEIGHT: u32 = 4_560_000; + /// The block height from which consensus V3 rules apply. + #[cfg(any(test, feature = "test"))] + const CONSENSUS_V3_HEIGHT: u32 = 11; /// The network edition. const EDITION: u16 = 0; /// The genesis block coinbase target. @@ -160,6 +166,8 @@ impl Network for CanaryV0 { const INCLUSION_FUNCTION_NAME: &'static str = MainnetV0::INCLUSION_FUNCTION_NAME; /// The maximum number of certificates in a batch. const MAX_CERTIFICATES: u16 = 100; + /// The maximum number of certificates in a batch before consensus V3 rules apply. + const MAX_CERTIFICATES_BEFORE_V3: u16 = 100; /// The network name. const NAME: &'static str = "Aleo Canary (v0)"; diff --git a/console/network/src/lib.rs b/console/network/src/lib.rs index 8a627bafed..c366bea139 100644 --- a/console/network/src/lib.rs +++ b/console/network/src/lib.rs @@ -93,6 +93,8 @@ pub trait Network: /// The block height from which consensus V2 rules apply. const CONSENSUS_V2_HEIGHT: u32; + /// The block height from which consensus V3 rules apply. + const CONSENSUS_V3_HEIGHT: u32; /// The function name for the inclusion circuit. const INCLUSION_FUNCTION_NAME: &'static str; @@ -192,7 +194,13 @@ pub trait Network: /// The maximum number of imports. const MAX_IMPORTS: usize = 64; + /// The maximum number of certificates in a batch before consensus V3 rules apply. + const MAX_CERTIFICATES_BEFORE_V3: u16; /// The maximum number of certificates in a batch. + // Note: This value must **not** be changed without considering the impact on serialization. + // Decreasing this value will break backwards compatibility of serialization without explicit + // declaration of migration based on round number rather than block height. + // Increasing this value will require a migration to prevent forking during network upgrades. const MAX_CERTIFICATES: u16; /// The maximum number of bytes in a transaction. diff --git a/console/network/src/mainnet_v0.rs b/console/network/src/mainnet_v0.rs index b38e59b2c9..09394060ae 100644 --- a/console/network/src/mainnet_v0.rs +++ b/console/network/src/mainnet_v0.rs @@ -137,10 +137,16 @@ impl Network for MainnetV0 { /// The block height from which consensus V2 rules apply. #[cfg(not(any(test, feature = "test")))] const CONSENSUS_V2_HEIGHT: u32 = 2_800_000; - // TODO (raychu86): Update this value based on the desired mainnet height. /// The block height from which consensus V2 rules apply. #[cfg(any(test, feature = "test"))] const CONSENSUS_V2_HEIGHT: u32 = 10; + // TODO: (raychu86): Update this value based on the desired canary height. + // The block height from which consensus V3 rules apply. + #[cfg(not(any(test, feature = "test")))] + const CONSENSUS_V3_HEIGHT: u32 = 4_900_000; + /// The block height from which consensus V3 rules apply. + #[cfg(any(test, feature = "test"))] + const CONSENSUS_V3_HEIGHT: u32 = 11; /// The network edition. const EDITION: u16 = 0; /// The genesis block coinbase target. @@ -164,7 +170,9 @@ impl Network for MainnetV0 { /// The function name for the inclusion circuit. const INCLUSION_FUNCTION_NAME: &'static str = snarkvm_parameters::mainnet::NETWORK_INCLUSION_FUNCTION_NAME; /// The maximum number of certificates in a batch. - const MAX_CERTIFICATES: u16 = 16; + const MAX_CERTIFICATES: u16 = 25; + /// The maximum number of certificates in a batch before consensus V3 rules apply. + const MAX_CERTIFICATES_BEFORE_V3: u16 = 16; /// The network name. const NAME: &'static str = "Aleo Mainnet (v0)"; diff --git a/console/network/src/testnet_v0.rs b/console/network/src/testnet_v0.rs index 0e4e9d1cd7..a967d8da8c 100644 --- a/console/network/src/testnet_v0.rs +++ b/console/network/src/testnet_v0.rs @@ -136,10 +136,16 @@ impl Network for TestnetV0 { /// The block height from which consensus V2 rules apply. #[cfg(not(any(test, feature = "test")))] const CONSENSUS_V2_HEIGHT: u32 = 2_950_000; - // TODO (raychu86): Update this value based on the desired testnet height. /// The block height from which consensus V2 rules apply. #[cfg(any(test, feature = "test"))] const CONSENSUS_V2_HEIGHT: u32 = 10; + // TODO: (raychu86): Update this value based on the desired testnet height. + // The block height from which consensus V3 rules apply. + #[cfg(not(any(test, feature = "test")))] + const CONSENSUS_V3_HEIGHT: u32 = 4_800_000; + /// The block height from which consensus V3 rules apply. + #[cfg(any(test, feature = "test"))] + const CONSENSUS_V3_HEIGHT: u32 = 11; /// The network edition. const EDITION: u16 = 0; /// The genesis block coinbase target. @@ -160,6 +166,8 @@ impl Network for TestnetV0 { const INCLUSION_FUNCTION_NAME: &'static str = MainnetV0::INCLUSION_FUNCTION_NAME; /// The maximum number of certificates in a batch. const MAX_CERTIFICATES: u16 = 100; + /// The maximum number of certificates in a batch before consensus V3 rules apply. + const MAX_CERTIFICATES_BEFORE_V3: u16 = 100; /// The network name. const NAME: &'static str = "Aleo Testnet (v0)"; diff --git a/console/program/Cargo.toml b/console/program/Cargo.toml index 2a84afbf51..6c6a019a9f 100644 --- a/console/program/Cargo.toml +++ b/console/program/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-console-program" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Program operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -14,27 +14,27 @@ test = [ ] [dependencies.snarkvm-console-account] path = "../account" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-algorithms] path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-collections] path = "../collections" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-network] path = "../network" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types] path = "../types" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-utilities] path = "../../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.enum_index] version = "0.2" diff --git a/console/types/Cargo.toml b/console/types/Cargo.toml index 7e8e8cf762..b5b0e4e5ed 100644 --- a/console/types/Cargo.toml +++ b/console/types/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-console-types" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Console types for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" @@ -15,41 +15,41 @@ harness = false [dependencies.snarkvm-console-network-environment] path = "../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-address] path = "./address" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types-boolean] path = "./boolean" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types-field] path = "./field" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types-group] path = "./group" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types-integers] path = "./integers" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types-scalar] path = "./scalar" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-console-types-string] path = "./string" -version = "=1.1.0" +version = "=1.2.1" optional = true [dev-dependencies.criterion] diff --git a/console/types/address/Cargo.toml b/console/types/address/Cargo.toml index 3bebd5ca40..8b2083c9d5 100644 --- a/console/types/address/Cargo.toml +++ b/console/types/address/Cargo.toml @@ -1,28 +1,28 @@ [package] name = "snarkvm-console-types-address" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-group] path = "../group" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.bincode] version = "1.3" diff --git a/console/types/boolean/Cargo.toml b/console/types/boolean/Cargo.toml index 423cb6e62a..4d0843a65e 100644 --- a/console/types/boolean/Cargo.toml +++ b/console/types/boolean/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "snarkvm-console-types-boolean" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.bincode] version = "1.3" diff --git a/console/types/field/Cargo.toml b/console/types/field/Cargo.toml index 6fc0731091..a403af95f2 100644 --- a/console/types/field/Cargo.toml +++ b/console/types/field/Cargo.toml @@ -1,20 +1,20 @@ [package] name = "snarkvm-console-types-field" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.zeroize] version = "1" diff --git a/console/types/group/Cargo.toml b/console/types/group/Cargo.toml index a3d82c05ec..bc4ab8ffa5 100644 --- a/console/types/group/Cargo.toml +++ b/console/types/group/Cargo.toml @@ -1,28 +1,28 @@ [package] name = "snarkvm-console-types-group" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-scalar] path = "../scalar" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.bincode] version = "1.3" diff --git a/console/types/integers/Cargo.toml b/console/types/integers/Cargo.toml index 8ea4bf3c2a..e04e49efec 100644 --- a/console/types/integers/Cargo.toml +++ b/console/types/integers/Cargo.toml @@ -1,28 +1,28 @@ [package] name = "snarkvm-console-types-integers" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-scalar] path = "../scalar" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.bincode] version = "1.3" diff --git a/console/types/scalar/Cargo.toml b/console/types/scalar/Cargo.toml index 9f2e70b28a..246c6e0895 100644 --- a/console/types/scalar/Cargo.toml +++ b/console/types/scalar/Cargo.toml @@ -1,24 +1,24 @@ [package] name = "snarkvm-console-types-scalar" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.zeroize] version = "1" diff --git a/console/types/string/Cargo.toml b/console/types/string/Cargo.toml index 33c9a3e39a..c4aaa979e4 100644 --- a/console/types/string/Cargo.toml +++ b/console/types/string/Cargo.toml @@ -1,28 +1,28 @@ [package] name = "snarkvm-console-types-string" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Type operations for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" license = "Apache-2.0" edition = "2021" [dependencies.snarkvm-console-network-environment] path = "../../network/environment" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-boolean] path = "../boolean" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-field] path = "../field" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-console-types-integers] path = "../integers" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.bincode] version = "1.3" diff --git a/curves/Cargo.toml b/curves/Cargo.toml index 643f4c00d7..958b17e6ef 100644 --- a/curves/Cargo.toml +++ b/curves/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-curves" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Curves for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -36,12 +36,12 @@ harness = false [dependencies.snarkvm-fields] path = "../fields" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-utilities] path = "../utilities" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.rand] diff --git a/fields/Cargo.toml b/fields/Cargo.toml index d7935f7845..07a8abdfbf 100644 --- a/fields/Cargo.toml +++ b/fields/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-fields" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Fields for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -30,7 +30,7 @@ harness = false [dependencies.snarkvm-utilities] path = "../utilities" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.aleo-std] diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 0b6502b0ce..74e214be83 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A node ledger for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -62,54 +62,54 @@ timer = [ "aleo-std/timer" ] [dependencies.console] package = "snarkvm-console" path = "../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-authority] package = "snarkvm-ledger-authority" path = "./authority" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-block] package = "snarkvm-ledger-block" path = "./block" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-committee] package = "snarkvm-ledger-committee" path = "./committee" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal] package = "snarkvm-ledger-narwhal" path = "./narwhal" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle] package = "snarkvm-ledger-puzzle" path = "puzzle" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-query] package = "snarkvm-ledger-query" path = "./query" -version = "=1.1.0" +version = "=1.2.1" features = [ "query" ] [dependencies.ledger-store] package = "snarkvm-ledger-store" path = "./store" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-test-helpers] package = "snarkvm-ledger-test-helpers" path = "./test-helpers" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.synthesizer] package = "snarkvm-synthesizer" path = "../synthesizer" -version = "=1.1.0" +version = "=1.2.1" [dependencies.aleo-std] version = "0.1.24" diff --git a/ledger/authority/Cargo.toml b/ledger/authority/Cargo.toml index 6774115c22..0f3ce04f21 100644 --- a/ledger/authority/Cargo.toml +++ b/ledger/authority/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-authority" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Data structures for a block authority in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -32,12 +32,12 @@ test-helpers = [ "narwhal-subdag/test-helpers" ] [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-subdag] package = "snarkvm-ledger-narwhal-subdag" path = "../narwhal/subdag" -version = "=1.1.0" +version = "=1.2.1" [dependencies.anyhow] version = "1" diff --git a/ledger/block/Cargo.toml b/ledger/block/Cargo.toml index 59ea5bb4bf..e58b513e1a 100644 --- a/ledger/block/Cargo.toml +++ b/ledger/block/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-block" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A block for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -39,52 +39,52 @@ test = [ ] [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-authority] package = "snarkvm-ledger-authority" path = "../authority" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-committee] package = "snarkvm-ledger-committee" path = "../../ledger/committee" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-batch-header] package = "snarkvm-ledger-narwhal-batch-header" path = "../narwhal/batch-header" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-data] package = "snarkvm-ledger-narwhal-data" path = "../narwhal/data" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-subdag] package = "snarkvm-ledger-narwhal-subdag" path = "../narwhal/subdag" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-transmission-id] package = "snarkvm-ledger-narwhal-transmission-id" path = "../narwhal/transmission-id" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle] package = "snarkvm-ledger-puzzle" path = "../puzzle" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-program] package = "snarkvm-synthesizer-program" path = "../../synthesizer/program" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-snark] package = "snarkvm-synthesizer-snark" path = "../../synthesizer/snark" -version = "=1.1.0" +version = "=1.2.1" [dependencies.indexmap] version = "2.0" diff --git a/ledger/committee/Cargo.toml b/ledger/committee/Cargo.toml index 12558b107b..a64a2d721a 100644 --- a/ledger/committee/Cargo.toml +++ b/ledger/committee/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-committee" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A committee for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -34,12 +34,12 @@ test-helpers = [ "prop-tests", "rand_distr" ] [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-batch-header] package = "snarkvm-ledger-narwhal-batch-header" path = "../narwhal/batch-header" -version = "=1.1.0" +version = "=1.2.1" [dependencies.indexmap] version = "2.0" @@ -48,7 +48,7 @@ features = [ "serde", "rayon" ] [dependencies.metrics] package = "snarkvm-metrics" path = "../../metrics" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.serde_json] diff --git a/ledger/committee/src/lib.rs b/ledger/committee/src/lib.rs index 206968fc33..d49a911d9a 100644 --- a/ledger/committee/src/lib.rs +++ b/ledger/committee/src/lib.rs @@ -63,6 +63,8 @@ impl Committee { pub const COMMITTEE_LOOKBACK_RANGE: u64 = BatchHeader::::MAX_GC_ROUNDS as u64; /// The maximum number of members that may be in a committee. pub const MAX_COMMITTEE_SIZE: u16 = BatchHeader::::MAX_CERTIFICATES; + /// The maximum number of members that may be in a committee before consensus V3 rules apply. + pub const MAX_COMMITTEE_SIZE_BEFORE_V3: u16 = BatchHeader::::MAX_CERTIFICATES_BEFORE_V3; /// Initializes a new `Committee` instance. pub fn new_genesis(members: IndexMap, (u64, bool, u8)>) -> Result { @@ -465,7 +467,18 @@ mod tests { } #[test] + #[allow(clippy::assertions_on_constants)] fn test_maximum_committee_size() { + assert_eq!( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3, + BatchHeader::::MAX_CERTIFICATES_BEFORE_V3 + ); assert_eq!(Committee::::MAX_COMMITTEE_SIZE, BatchHeader::::MAX_CERTIFICATES); + // Adding explicit check that updates to the maximum committee size are strictly increasing. A decreasing maximum will + // require additional migration logic based on a `round` number. + assert!( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 + <= Committee::::MAX_COMMITTEE_SIZE + ); } } diff --git a/ledger/narwhal/Cargo.toml b/ledger/narwhal/Cargo.toml index f5f3a2722b..6bd0892400 100644 --- a/ledger/narwhal/Cargo.toml +++ b/ledger/narwhal/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Data structures for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -64,37 +64,37 @@ transmission-id = [ "narwhal-transmission-id" ] [dependencies.narwhal-batch-certificate] package = "snarkvm-ledger-narwhal-batch-certificate" path = "./batch-certificate" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.narwhal-batch-header] package = "snarkvm-ledger-narwhal-batch-header" path = "./batch-header" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.narwhal-data] package = "snarkvm-ledger-narwhal-data" path = "./data" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.narwhal-subdag] package = "snarkvm-ledger-narwhal-subdag" path = "./subdag" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.narwhal-transmission] package = "snarkvm-ledger-narwhal-transmission" path = "./transmission" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.narwhal-transmission-id] package = "snarkvm-ledger-narwhal-transmission-id" path = "./transmission-id" -version = "=1.1.0" +version = "=1.2.1" optional = true [dev-dependencies.snarkvm-ledger-narwhal] diff --git a/ledger/narwhal/batch-certificate/Cargo.toml b/ledger/narwhal/batch-certificate/Cargo.toml index 23fb6f8122..d72756297b 100644 --- a/ledger/narwhal/batch-certificate/Cargo.toml +++ b/ledger/narwhal/batch-certificate/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal-batch-certificate" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A batch certificate for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -32,17 +32,17 @@ test-helpers = [ "narwhal-batch-header/test-helpers" ] [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-batch-header] package = "snarkvm-ledger-narwhal-batch-header" path = "../batch-header" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-transmission-id] package = "snarkvm-ledger-narwhal-transmission-id" path = "../transmission-id" -version = "=1.1.0" +version = "=1.2.1" [dependencies.indexmap] version = "2.0" diff --git a/ledger/narwhal/batch-header/Cargo.toml b/ledger/narwhal/batch-header/Cargo.toml index 69809c4bb3..b9404be1bd 100644 --- a/ledger/narwhal/batch-header/Cargo.toml +++ b/ledger/narwhal/batch-header/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal-batch-header" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A batch header for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -32,12 +32,12 @@ test-helpers = [ "narwhal-transmission-id/test-helpers", "time" ] [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-transmission-id] package = "snarkvm-ledger-narwhal-transmission-id" path = "../transmission-id" -version = "=1.1.0" +version = "=1.2.1" [dependencies.indexmap] version = "2.0" diff --git a/ledger/narwhal/batch-header/src/lib.rs b/ledger/narwhal/batch-header/src/lib.rs index 2fa80edf65..c48df6252b 100644 --- a/ledger/narwhal/batch-header/src/lib.rs +++ b/ledger/narwhal/batch-header/src/lib.rs @@ -37,7 +37,7 @@ use rayon::prelude::*; #[derive(Clone, PartialEq, Eq)] pub struct BatchHeader { /// The batch ID, defined as the hash of the author, round number, timestamp, transmission IDs, - /// committee ID, previous batch certificate IDs, and last election certificate IDs. + /// committee ID, and previous batch certificate IDs. batch_id: Field, /// The author of the batch. author: Address, @@ -63,6 +63,13 @@ impl BatchHeader { /// This is deliberately set to a high value (100) for testing purposes only. #[cfg(any(test, feature = "test-helpers"))] pub const MAX_CERTIFICATES: u16 = 100; + /// The maximum number of certificates in a batch before consensus V3 rules apply. + #[cfg(not(any(test, feature = "test-helpers")))] + pub const MAX_CERTIFICATES_BEFORE_V3: u16 = N::MAX_CERTIFICATES_BEFORE_V3; + /// The maximum number of certificates in a batch before consensus V3 rules apply. + /// This is deliberately set to a high value (100) for testing purposes only. + #[cfg(any(test, feature = "test-helpers"))] + pub const MAX_CERTIFICATES_BEFORE_V3: u16 = 100; /// The maximum number of rounds to store before garbage collecting. pub const MAX_GC_ROUNDS: usize = 100; /// The maximum number of transmissions in a batch. diff --git a/ledger/narwhal/data/Cargo.toml b/ledger/narwhal/data/Cargo.toml index 1b3aeb01ba..754cde6f0d 100644 --- a/ledger/narwhal/data/Cargo.toml +++ b/ledger/narwhal/data/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal-data" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A batch certificate for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -29,7 +29,7 @@ async = [ "tokio" ] [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.bytes] version = "1" diff --git a/ledger/narwhal/subdag/Cargo.toml b/ledger/narwhal/subdag/Cargo.toml index 6ecdb7b814..43ff4421a9 100644 --- a/ledger/narwhal/subdag/Cargo.toml +++ b/ledger/narwhal/subdag/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal-subdag" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A subdag for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -32,27 +32,27 @@ test-helpers = [ "narwhal-batch-certificate/test-helpers" ] [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-batch-certificate] package = "snarkvm-ledger-narwhal-batch-certificate" path = "../batch-certificate" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-batch-header] package = "snarkvm-ledger-narwhal-batch-header" path = "../batch-header" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-committee] package = "snarkvm-ledger-committee" path = "../../committee" -version = "=1.1.0" +version = "=1.2.1" [dependencies.narwhal-transmission-id] package = "snarkvm-ledger-narwhal-transmission-id" path = "../transmission-id" -version = "=1.1.0" +version = "=1.2.1" [dependencies.indexmap] version = "2.0" diff --git a/ledger/narwhal/transmission-id/Cargo.toml b/ledger/narwhal/transmission-id/Cargo.toml index 4be5f0657c..5978247533 100644 --- a/ledger/narwhal/transmission-id/Cargo.toml +++ b/ledger/narwhal/transmission-id/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal-transmission-id" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A transmission ID for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -32,12 +32,12 @@ test-helpers = [ ] [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle] package = "snarkvm-ledger-puzzle" path = "../../puzzle" -version = "=1.1.0" +version = "=1.2.1" [dev-dependencies.bincode] version = "1.3" diff --git a/ledger/narwhal/transmission/Cargo.toml b/ledger/narwhal/transmission/Cargo.toml index 6c71bfbcb6..2c3052ea7e 100644 --- a/ledger/narwhal/transmission/Cargo.toml +++ b/ledger/narwhal/transmission/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-narwhal-transmission" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A transmission for a Narwhal-style memory pool in a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -32,22 +32,22 @@ test-helpers = [ ] [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-block] package = "snarkvm-ledger-block" path = "../../block" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-data] package = "snarkvm-ledger-narwhal-data" path = "../data" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle] package = "snarkvm-ledger-puzzle" path = "../../puzzle" -version = "=1.1.0" +version = "=1.2.1" [dependencies.bytes] version = "1" diff --git a/ledger/puzzle/Cargo.toml b/ledger/puzzle/Cargo.toml index a7b15e7b17..a398ebe8cb 100644 --- a/ledger/puzzle/Cargo.toml +++ b/ledger/puzzle/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-puzzle" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Puzzle for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -40,11 +40,11 @@ wasm = [ "console/wasm", "snarkvm-algorithms/wasm" ] [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-algorithms] path = "../../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.aleo-std] version = "0.1.24" diff --git a/ledger/puzzle/epoch/Cargo.toml b/ledger/puzzle/epoch/Cargo.toml index 94ba127cf4..cafb14cc46 100644 --- a/ledger/puzzle/epoch/Cargo.toml +++ b/ledger/puzzle/epoch/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-puzzle-epoch" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Epoch puzzle for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -41,26 +41,26 @@ wasm = [ "console/wasm" ] [dependencies.circuit] package = "snarkvm-circuit" path = "../../../circuit" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.console] package = "snarkvm-console" path = "../../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-ledger-puzzle] path = "../." -version = "=1.1.0" +version = "=1.2.1" [dependencies.snarkvm-synthesizer-process] path = "../../../synthesizer/process" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-synthesizer-program] path = "../../../synthesizer/program" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.aleo-std] diff --git a/ledger/query/Cargo.toml b/ledger/query/Cargo.toml index d4ff55f37a..97aeda4ccd 100644 --- a/ledger/query/Cargo.toml +++ b/ledger/query/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-query" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A query for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -34,18 +34,18 @@ query = [ "ledger-store", "synthesizer-program", "ureq" ] [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-store] package = "snarkvm-ledger-store" path = "../store" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.synthesizer-program] package = "snarkvm-synthesizer-program" path = "../../synthesizer/program" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.async-trait] diff --git a/ledger/src/tests.rs b/ledger/src/tests.rs index cc5989c0e5..d3aacbd33c 100644 --- a/ledger/src/tests.rs +++ b/ledger/src/tests.rs @@ -1924,7 +1924,7 @@ fn test_max_committee_limit_with_bonds() { let vm = sample_vm(); // Construct the validators, one less than the maximum committee size. - let validators = (0..Committee::::MAX_COMMITTEE_SIZE - 1) + let validators = (0..Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 - 1) .map(|_| { let private_key = PrivateKey::::new(rng).unwrap(); let amount = MIN_VALIDATOR_STAKE; diff --git a/ledger/store/Cargo.toml b/ledger/store/Cargo.toml index 0b9d22a7a3..850a8498ac 100644 --- a/ledger/store/Cargo.toml +++ b/ledger/store/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-store" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A data store for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -42,42 +42,42 @@ test = [ ] [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-authority] package = "snarkvm-ledger-authority" path = "../authority" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-block] package = "snarkvm-ledger-block" path = "../block" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-committee] package = "snarkvm-ledger-committee" path = "../committee" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-batch-certificate] package = "snarkvm-ledger-narwhal-batch-certificate" path = "../narwhal/batch-certificate" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle] package = "snarkvm-ledger-puzzle" path = "../puzzle" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-program] package = "snarkvm-synthesizer-program" path = "../../synthesizer/program" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-snark] package = "snarkvm-synthesizer-snark" path = "../../synthesizer/snark" -version = "=1.1.0" +version = "=1.2.1" [dependencies.aleo-std-storage] version = "0.1.7" diff --git a/ledger/test-helpers/Cargo.toml b/ledger/test-helpers/Cargo.toml index a07898640f..50eabdd29a 100644 --- a/ledger/test-helpers/Cargo.toml +++ b/ledger/test-helpers/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-ledger-test-helpers" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Test helpers for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -19,39 +19,39 @@ edition = "2021" [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.circuit] package = "snarkvm-circuit" path = "../../circuit" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-block] package = "snarkvm-ledger-block" path = "../block" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-query] package = "snarkvm-ledger-query" path = "../query" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "query" ] [dependencies.ledger-store] package = "snarkvm-ledger-store" path = "../store" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-program] package = "snarkvm-synthesizer-program" path = "../../synthesizer/program" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-process] package = "snarkvm-synthesizer-process" path = "../../synthesizer/process" -version = "=1.1.0" +version = "=1.2.1" [dependencies.once_cell] version = "1.18" diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml index 1e192d82af..29fddd7e9c 100644 --- a/metrics/Cargo.toml +++ b/metrics/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-metrics" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Metrics for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", diff --git a/parameters/Cargo.toml b/parameters/Cargo.toml index c4e6f93496..751a156eb0 100644 --- a/parameters/Cargo.toml +++ b/parameters/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-parameters" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Parameters for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -31,12 +31,12 @@ wasm = [ "encoding", "js-sys", "web-sys" ] [dependencies.snarkvm-curves] path = "../curves" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.snarkvm-utilities] path = "../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.aleo-std] version = "0.1.24" diff --git a/parameters/src/mainnet/mod.rs b/parameters/src/mainnet/mod.rs index 029e0922f5..83cb38712d 100644 --- a/parameters/src/mainnet/mod.rs +++ b/parameters/src/mainnet/mod.rs @@ -41,7 +41,12 @@ impl_remote!(Degree24, REMOTE_URL, "resources/", "powers-of-beta-24", "usrs"); impl_remote!(Degree25, REMOTE_URL, "resources/", "powers-of-beta-25", "usrs"); impl_remote!(Degree26, REMOTE_URL, "resources/", "powers-of-beta-26", "usrs"); impl_remote!(Degree27, REMOTE_URL, "resources/", "powers-of-beta-27", "usrs"); -impl_remote!(Degree28, REMOTE_URL, "resources/", "powers-of-beta-28", "usrs"); +// TODO (nkls): restore on CI. +// The SRS is only used for proving and we don't currently support provers of +// this size. When a users wants to create a proof, they load the appropriate +// powers for the circuit in `batch_circuit_setup` which calls `max_degree` +// based on the domain size. +// impl_remote!(Degree28, REMOTE_URL, "resources/", "powers-of-beta-28", "usrs"); // Shifted Degrees #[cfg(not(feature = "wasm"))] @@ -62,7 +67,9 @@ impl_remote!(ShiftedDegree23, REMOTE_URL, "resources/", "shifted-powers-of-beta- impl_remote!(ShiftedDegree24, REMOTE_URL, "resources/", "shifted-powers-of-beta-24", "usrs"); impl_remote!(ShiftedDegree25, REMOTE_URL, "resources/", "shifted-powers-of-beta-25", "usrs"); impl_remote!(ShiftedDegree26, REMOTE_URL, "resources/", "shifted-powers-of-beta-26", "usrs"); -impl_remote!(ShiftedDegree27, REMOTE_URL, "resources/", "shifted-powers-of-beta-27", "usrs"); +// TODO (nkls): restore on CI. +// See `Degree28` above for context. +// impl_remote!(ShiftedDegree27, REMOTE_URL, "resources/", "shifted-powers-of-beta-27", "usrs"); // Powers of Beta Times Gamma * G impl_local!(Gamma, "resources/", "powers-of-beta-gamma", "usrs"); diff --git a/parameters/src/mainnet/powers.rs b/parameters/src/mainnet/powers.rs index c12245f07c..a18f6338d5 100644 --- a/parameters/src/mainnet/powers.rs +++ b/parameters/src/mainnet/powers.rs @@ -415,7 +415,8 @@ impl PowersOfBetaG { NUM_POWERS_25 => Degree25::load_bytes()?, NUM_POWERS_26 => Degree26::load_bytes()?, NUM_POWERS_27 => Degree27::load_bytes()?, - NUM_POWERS_28 => Degree28::load_bytes()?, + // TODO (nkls): restore on CI. + // NUM_POWERS_28 => Degree28::load_bytes()?, _ => bail!("Cannot download an invalid degree of '{num_powers}'"), }; @@ -492,7 +493,8 @@ impl PowersOfBetaG { NUM_POWERS_24 => ShiftedDegree24::load_bytes()?, NUM_POWERS_25 => ShiftedDegree25::load_bytes()?, NUM_POWERS_26 => ShiftedDegree26::load_bytes()?, - NUM_POWERS_27 => ShiftedDegree27::load_bytes()?, + // TODO (nkls): restore on CI. + // NUM_POWERS_27 => ShiftedDegree27::load_bytes()?, _ => bail!("Cannot download an invalid degree of '{num_powers}'"), }; diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index d100b6d540..b9fcecb1d9 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-synthesizer" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Synthesizer for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -44,7 +44,7 @@ serial = [ "synthesizer-snark/serial" ] setup = [ ] -test = [ "console/test" ] +test = [ "console/test", "ledger-block/test", "ledger-store/test" ] timer = [ "aleo-std/timer" ] wasm = [ "process", @@ -69,78 +69,78 @@ harness = false [dependencies.algorithms] package = "snarkvm-algorithms" path = "../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.circuit] package = "snarkvm-circuit" path = "../circuit" -version = "=1.1.0" +version = "=1.2.1" [dependencies.console] package = "snarkvm-console" path = "../console" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-block] package = "snarkvm-ledger-block" path = "../ledger/block" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-committee] package = "snarkvm-ledger-committee" path = "../ledger/committee" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-narwhal-data] package = "snarkvm-ledger-narwhal-data" path = "../ledger/narwhal/data" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle] package = "snarkvm-ledger-puzzle" path = "../ledger/puzzle" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-puzzle-epoch] package = "snarkvm-ledger-puzzle-epoch" path = "../ledger/puzzle/epoch" -version = "=1.1.0" +version = "=1.2.1" features = [ "synthesis" ] [dependencies.ledger-query] package = "snarkvm-ledger-query" path = "../ledger/query" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "query" ] [dependencies.ledger-store] package = "snarkvm-ledger-store" path = "../ledger/store" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-process] package = "snarkvm-synthesizer-process" path = "./process" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.synthesizer-program] package = "snarkvm-synthesizer-program" path = "./program" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.synthesizer-snark] package = "snarkvm-synthesizer-snark" path = "./snark" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.utilities] package = "snarkvm-utilities" path = "../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.aleo-std] version = "0.1.24" diff --git a/synthesizer/process/Cargo.toml b/synthesizer/process/Cargo.toml index 56c8de65b6..641f11a865 100644 --- a/synthesizer/process/Cargo.toml +++ b/synthesizer/process/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-synthesizer-process" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "A process for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -53,45 +53,45 @@ harness = false [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "network", "program", "types" ] [dependencies.circuit] package = "snarkvm-circuit" path = "../../circuit" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-block] package = "snarkvm-ledger-block" path = "../../ledger/block" -version = "=1.1.0" +version = "=1.2.1" [dependencies.ledger-query] package = "snarkvm-ledger-query" path = "../../ledger/query" -version = "=1.1.0" +version = "=1.2.1" default-features = false [dependencies.ledger-store] package = "snarkvm-ledger-store" path = "../../ledger/store" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-program] package = "snarkvm-synthesizer-program" path = "../../synthesizer/program" -version = "=1.1.0" +version = "=1.2.1" [dependencies.synthesizer-snark] package = "snarkvm-synthesizer-snark" path = "../../synthesizer/snark" -version = "=1.1.0" +version = "=1.2.1" [dependencies.utilities] package = "snarkvm-utilities" path = "../../utilities" -version = "=1.1.0" +version = "=1.2.1" [dependencies.aleo-std] version = "0.1.24" diff --git a/synthesizer/process/src/finalize.rs b/synthesizer/process/src/finalize.rs index 6606d2d152..f5b7e18c08 100644 --- a/synthesizer/process/src/finalize.rs +++ b/synthesizer/process/src/finalize.rs @@ -104,7 +104,11 @@ impl Process { lap!(timer, "Verify the number of transitions"); // Construct the call graph. - let call_graph = self.construct_call_graph(execution)?; + // If the height is greater than or equal to `CONSENSUS_V3_HEIGHT`, then provide an empty call graph, as it is no longer used during finalization. + let call_graph = match state.block_height() < N::CONSENSUS_V3_HEIGHT { + true => self.construct_call_graph(execution)?, + false => HashMap::new(), + }; atomic_batch_scope!(store, { // Finalize the root transition. @@ -160,9 +164,11 @@ fn finalize_fee_transition>( fee: &Fee, ) -> Result>> { // Construct the call graph. - let mut call_graph = HashMap::new(); - // Insert the fee transition. - call_graph.insert(*fee.transition_id(), Vec::new()); + // If the height is greater than or equal to `CONSENSUS_V3_HEIGHT`, then provide an empty call graph, as it is no longer used during finalization. + let call_graph = match state.block_height() < N::CONSENSUS_V3_HEIGHT { + true => HashMap::from([(*fee.transition_id(), Vec::new())]), + false => HashMap::new(), + }; // Finalize the transition. match finalize_transition(state, store, stack, fee, call_graph) { @@ -208,8 +214,12 @@ fn finalize_transition>( // Initialize a stack of active finalize states. let mut states = Vec::new(); + // Initialize a nonce for the finalize registers. + // Note that this nonce must be unique for each sub-transition being finalized. + let mut nonce = 0; + // Initialize the top-level finalize state. - states.push(initialize_finalize_state(state, future, stack, *transition.id())?); + states.push(initialize_finalize_state(state, future, stack, *transition.id(), nonce)?); // While there are active finalize states, finalize them. 'outer: while let Some(FinalizeState { @@ -263,20 +273,31 @@ fn finalize_transition>( await_.register() ); - // Get the current transition ID. - let transition_id = registers.transition_id(); - // Get the child transition ID. - let child_transition_id = match call_graph.get(transition_id) { - Some(transitions) => match transitions.get(call_counter) { - Some(transition_id) => *transition_id, - None => bail!("Child transition ID not found."), - }, - None => bail!("Transition ID '{transition_id}' not found in call graph"), + // Get the transition ID used to initialize the finalize registers. + // If the block height is greater than or equal to `CONSENSUS_V3_HEIGHT`, then use the top-level transition ID. + // Otherwise, query the call graph for the child transition ID corresponding to the future that is being awaited. + let transition_id = match state.block_height() < N::CONSENSUS_V3_HEIGHT { + true => { + // Get the current transition ID. + let transition_id = registers.transition_id(); + // Get the child transition ID. + match call_graph.get(transition_id) { + Some(transitions) => match transitions.get(call_counter) { + Some(transition_id) => *transition_id, + None => bail!("Child transition ID not found."), + }, + None => bail!("Transition ID '{transition_id}' not found in call graph"), + } + } + false => *transition.id(), }; + // Increment the nonce. + nonce += 1; + // Set up the finalize state for the await. let callee_state = - match try_vm_runtime!(|| setup_await(state, await_, stack, ®isters, child_transition_id)) { + match try_vm_runtime!(|| setup_await(state, await_, stack, ®isters, transition_id, nonce)) { Ok(Ok(callee_state)) => callee_state, // If the evaluation fails, bail and return the error. Ok(Err(error)) => bail!("'finalize' failed to evaluate command ({command}): {error}"), @@ -357,6 +378,7 @@ fn initialize_finalize_state<'a, N: Network>( future: &Future, stack: &'a Stack, transition_id: N::TransitionID, + nonce: u64, ) -> Result> { // Get the finalize logic and the stack. let (finalize, stack) = match stack.program_id() == future.program_id() { @@ -381,6 +403,7 @@ fn initialize_finalize_state<'a, N: Network>( transition_id, *future.function_name(), stack.get_finalize_types(future.function_name())?.clone(), + nonce, ); // Store the inputs. @@ -402,6 +425,7 @@ fn setup_await<'a, N: Network>( stack: &'a Stack, registers: &FinalizeRegisters, transition_id: N::TransitionID, + nonce: u64, ) -> Result> { // Retrieve the input as a future. let future = match registers.load(stack, &Operand::Register(await_.register().clone()))? { @@ -409,7 +433,7 @@ fn setup_await<'a, N: Network>( _ => bail!("The input to 'await' is not a future"), }; // Initialize the state. - initialize_finalize_state(state, &future, stack, transition_id) + initialize_finalize_state(state, &future, stack, transition_id, nonce) } // A helper function that returns the index to branch to. diff --git a/synthesizer/process/src/stack/finalize_registers/mod.rs b/synthesizer/process/src/stack/finalize_registers/mod.rs index ccc02fd42d..c86a1d35c2 100644 --- a/synthesizer/process/src/stack/finalize_registers/mod.rs +++ b/synthesizer/process/src/stack/finalize_registers/mod.rs @@ -46,6 +46,8 @@ pub struct FinalizeRegisters { finalize_types: FinalizeTypes, /// The mapping of assigned registers to their values. registers: IndexMap>, + /// A nonce for finalize registers. + nonce: u64, /// The tracker for the last register locator. last_register: Option, } @@ -58,8 +60,17 @@ impl FinalizeRegisters { transition_id: N::TransitionID, function_name: Identifier, finalize_types: FinalizeTypes, + nonce: u64, ) -> Self { - Self { state, transition_id, finalize_types, function_name, registers: IndexMap::new(), last_register: None } + Self { + state, + transition_id, + finalize_types, + function_name, + registers: IndexMap::new(), + nonce, + last_register: None, + } } } @@ -81,4 +92,10 @@ impl FinalizeRegistersState for FinalizeRegisters { fn function_name(&self) -> &Identifier { &self.function_name } + + /// Returns the nonce for the finalize registers. + #[inline] + fn nonce(&self) -> u64 { + self.nonce + } } diff --git a/synthesizer/process/src/stack/register_types/initialize.rs b/synthesizer/process/src/stack/register_types/initialize.rs index 3714852a3a..82bb47422e 100644 --- a/synthesizer/process/src/stack/register_types/initialize.rs +++ b/synthesizer/process/src/stack/register_types/initialize.rs @@ -158,7 +158,7 @@ impl RegisterTypes { } /* Additional checks. */ - // - All futures produces before the `async` call must be consumed by the `async` call. + // - All futures produced before the `async` call must be consumed by the `async` call. // Get all registers containing futures. let mut future_registers: IndexSet<(Register, Locator)> = register_types diff --git a/synthesizer/program/Cargo.toml b/synthesizer/program/Cargo.toml index 851bd1c888..968b934994 100644 --- a/synthesizer/program/Cargo.toml +++ b/synthesizer/program/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-synthesizer-program" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Program for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -31,12 +31,12 @@ wasm = [ "console/wasm" ] [dependencies.circuit] package = "snarkvm-circuit" path = "../../circuit" -version = "=1.1.0" +version = "=1.2.1" [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "account", "network", "program", "types" ] diff --git a/synthesizer/program/src/logic/command/rand_chacha.rs b/synthesizer/program/src/logic/command/rand_chacha.rs index 44aa938c97..3bd3c3a0fa 100644 --- a/synthesizer/program/src/logic/command/rand_chacha.rs +++ b/synthesizer/program/src/logic/command/rand_chacha.rs @@ -89,15 +89,29 @@ impl RandChaCha { let seeds: Vec<_> = self.operands.iter().map(|operand| registers.load(stack, operand)).try_collect()?; // Construct the random seed. - let preimage = to_bits_le![ - registers.state().random_seed(), - **registers.transition_id(), - stack.program_id(), - registers.function_name(), - self.destination.locator(), - self.destination_type.type_id(), - seeds - ]; + // If the height is greater than or equal to `CONSENSUS_V3_HEIGHT`, then use the new preimage definition. + // The difference is that a nonce is also included in the new definition. + let preimage = match registers.state().block_height() < N::CONSENSUS_V3_HEIGHT { + true => to_bits_le![ + registers.state().random_seed(), + **registers.transition_id(), + stack.program_id(), + registers.function_name(), + self.destination.locator(), + self.destination_type.type_id(), + seeds + ], + false => to_bits_le![ + registers.state().random_seed(), + **registers.transition_id(), + stack.program_id(), + registers.function_name(), + registers.nonce(), + self.destination.locator(), + self.destination_type.type_id(), + seeds + ], + }; // Hash the preimage. let digest = N::hash_bhp1024(&preimage)?.to_bytes_le()?; diff --git a/synthesizer/program/src/logic/instruction/operation/hash.rs b/synthesizer/program/src/logic/instruction/operation/hash.rs index 7a7ef228f2..4a469f4a3c 100644 --- a/synthesizer/program/src/logic/instruction/operation/hash.rs +++ b/synthesizer/program/src/logic/instruction/operation/hash.rs @@ -105,14 +105,19 @@ fn check_number_of_operands(variant: u8, opcode: Opcode, num_operands: usize) -> } /// Returns 'true' if the destination type is valid. -fn is_valid_destination_type(destination_type: &PlaintextType) -> bool { - !matches!( - destination_type, +fn is_valid_destination_type(variant: u8, destination_type: &PlaintextType) -> bool { + match destination_type { PlaintextType::Literal(LiteralType::Boolean) - | PlaintextType::Literal(LiteralType::String) - | PlaintextType::Struct(..) - | PlaintextType::Array(..) - ) + | PlaintextType::Literal(LiteralType::String) + | PlaintextType::Struct(..) => false, + PlaintextType::Array(array) => match variant { + 4 | 12 => **array.length() == 32 && *array.base_element_type() == PlaintextType::Literal(LiteralType::U8), + 5 | 13 => **array.length() == 24 && *array.base_element_type() == PlaintextType::Literal(LiteralType::U16), + 6 | 14 => **array.length() == 32 && *array.base_element_type() == PlaintextType::Literal(LiteralType::U16), + _ => false, + }, + _ => true, + } } /// Hashes the operand into the declared type. @@ -137,9 +142,11 @@ impl HashInstruction { // Sanity check the number of operands. check_number_of_operands(VARIANT, Self::opcode(), operands.len())?; // Sanity check the destination type. - if !is_valid_destination_type(&destination_type) { - bail!("Invalid destination type for 'hash' instruction") - } + ensure!( + is_valid_destination_type(VARIANT, &destination_type), + "Invalid destination type for 'hash' instruction" + ); + // Return the instruction. Ok(Self { operands, destination, destination_type }) } @@ -196,6 +203,103 @@ impl HashInstruction { } } +fn to_destination_literal_type( + output: Literal, + destination_type: &PlaintextType, +) -> Result> { + let dest = match destination_type { + PlaintextType::Literal(literal_type) => output.cast_lossy(*literal_type)?, + PlaintextType::Struct(..) => bail!("Cannot hash into a struct"), + PlaintextType::Array(..) => bail!("Cannot hash into an array (yet)"), + }; + + Ok(Value::Plaintext(Plaintext::from(dest))) +} + +fn to_destination_circuit_literal( + output: circuit::Literal, + destination_type: &PlaintextType, +) -> Result> { + let dest = match destination_type { + PlaintextType::Literal(literal) => output.cast_lossy(*literal)?, + PlaintextType::Struct(..) => bail!("Cannot hash into a struct"), + PlaintextType::Array(..) => bail!("Cannot hash into an array (yet)"), + }; + + Ok(circuit::Value::Plaintext(circuit::Plaintext::Literal(dest, Default::default()))) +} + +fn to_console_array(hash: &[bool], len: usize, literal_type: LiteralType) -> Result> { + let chunk_size = match literal_type { + LiteralType::U8 => 8, + LiteralType::U16 => 16, + _ => bail!("Unsupported literal type: {literal_type} for array"), + }; + + ensure!( + hash.len() % chunk_size == 0, + "Expected hash length to be a multiple of {chunk_size}, but found {}", + hash.len() + ); + + let hash = hash + .chunks(chunk_size) + .map(|element| match literal_type { + LiteralType::U8 => { + let value = console::types::U8::from_bits_le(element)?; + Ok(Plaintext::Literal(Literal::U8(value), Default::default())) + } + LiteralType::U16 => { + let value = console::types::U16::from_bits_le(element)?; + Ok(Plaintext::Literal(Literal::U16(value), Default::default())) + } + _ => bail!("Unsupported literal type: {literal_type} for array"), + }) + .collect::, _>>()?; + + ensure!(len == hash.len(), "Expected to produce {len} elements, but produced {}", hash.len()); + + Ok(Plaintext::Array(hash, Default::default())) +} + +fn to_circuit_array_u8(hash: &[circuit::Boolean], len: usize) -> Result> { + use circuit::traits::FromBits; + + ensure!(hash.len() % 8 == 0, "Expected hash length to be a multiple of 8, but found {}", hash.len()); + + let hash: Vec<_> = hash + .chunks(8) + .map(|element| { + let value = circuit::types::U8::::from_bits_le(element); + + circuit::Plaintext::Literal(circuit::Literal::U8(value), Default::default()) + }) + .collect(); + + ensure!(len == hash.len(), "Expected to produce {len} elements, but produced {}", hash.len()); + + Ok(circuit::Plaintext::Array(hash, Default::default())) +} + +fn to_circuit_array_u16(hash: &[circuit::Boolean], len: usize) -> Result> { + use circuit::traits::FromBits; + + ensure!(hash.len() % 16 == 0, "Expected hash length to be a multiple of 16, but found {}", hash.len()); + + let hash: Vec<_> = hash + .chunks(16) + .map(|element| { + let value = circuit::types::U16::::from_bits_le(element); + + circuit::Plaintext::Literal(circuit::Literal::U16(value), Default::default()) + }) + .collect(); + + ensure!(len == hash.len(), "Expected to produce {len} elements, but produced {}", hash.len()); + + Ok(circuit::Plaintext::Array(hash, Default::default())) +} + impl HashInstruction { /// Evaluates the instruction. #[inline] @@ -207,47 +311,132 @@ impl HashInstruction { // Ensure the number of operands is correct. check_number_of_operands(VARIANT, Self::opcode(), self.operands.len())?; // Ensure the destination type is valid. - ensure!(is_valid_destination_type(&self.destination_type), "Invalid destination type in 'hash' instruction"); + ensure!( + is_valid_destination_type(VARIANT, &self.destination_type), + "Invalid destination type in 'hash' instruction" + ); // Load the operand. let input = registers.load(stack, &self.operands[0])?; // Hash the input. let output = match (VARIANT, &self.destination_type) { - (0, PlaintextType::Literal(..)) => Literal::Group(N::hash_to_group_bhp256(&input.to_bits_le())?), - (1, PlaintextType::Literal(..)) => Literal::Group(N::hash_to_group_bhp512(&input.to_bits_le())?), - (2, PlaintextType::Literal(..)) => Literal::Group(N::hash_to_group_bhp768(&input.to_bits_le())?), - (3, PlaintextType::Literal(..)) => Literal::Group(N::hash_to_group_bhp1024(&input.to_bits_le())?), + (0, PlaintextType::Literal(..)) => { + let output = Literal::Group(N::hash_to_group_bhp256(&input.to_bits_le())?); + + to_destination_literal_type(output, &self.destination_type)? + } + (1, PlaintextType::Literal(..)) => { + let output = Literal::Group(N::hash_to_group_bhp512(&input.to_bits_le())?); + + to_destination_literal_type(output, &self.destination_type)? + } + (2, PlaintextType::Literal(..)) => { + let output = Literal::Group(N::hash_to_group_bhp768(&input.to_bits_le())?); + + to_destination_literal_type(output, &self.destination_type)? + } + (3, PlaintextType::Literal(..)) => { + let output = Literal::Group(N::hash_to_group_bhp1024(&input.to_bits_le())?); + + to_destination_literal_type(output, &self.destination_type)? + } (4, PlaintextType::Literal(..)) => { - Literal::Group(N::hash_to_group_bhp256(&N::hash_keccak256(&input.to_bits_le())?)?) + let output = Literal::Group(N::hash_to_group_bhp256(&N::hash_keccak256(&input.to_bits_le())?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (4, PlaintextType::Array(..)) => { + let hash = &N::hash_keccak256(&input.to_bits_le())?; + + Value::Plaintext(to_console_array(hash, 32, LiteralType::U8)?) } (5, PlaintextType::Literal(..)) => { - Literal::Group(N::hash_to_group_bhp512(&N::hash_keccak384(&input.to_bits_le())?)?) + let output = Literal::Group(N::hash_to_group_bhp512(&N::hash_keccak384(&input.to_bits_le())?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (5, PlaintextType::Array(..)) => { + let hash = &N::hash_keccak384(&input.to_bits_le())?; + + Value::Plaintext(to_console_array(hash, 24, LiteralType::U16)?) } (6, PlaintextType::Literal(..)) => { - Literal::Group(N::hash_to_group_bhp512(&N::hash_keccak512(&input.to_bits_le())?)?) + let output = Literal::Group(N::hash_to_group_bhp512(&N::hash_keccak512(&input.to_bits_le())?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (6, PlaintextType::Array(..)) => { + let hash = N::hash_keccak512(&input.to_bits_le())?; + + Value::Plaintext(to_console_array(&hash, 32, LiteralType::U16)?) + } + (7, PlaintextType::Literal(..)) => { + let output = Literal::Group(N::hash_to_group_ped64(&input.to_bits_le())?); + + to_destination_literal_type(output, &self.destination_type)? + } + (8, PlaintextType::Literal(..)) => { + let output = Literal::Group(N::hash_to_group_ped128(&input.to_bits_le())?); + + to_destination_literal_type(output, &self.destination_type)? } - (7, PlaintextType::Literal(..)) => Literal::Group(N::hash_to_group_ped64(&input.to_bits_le())?), - (8, PlaintextType::Literal(..)) => Literal::Group(N::hash_to_group_ped128(&input.to_bits_le())?), (9, PlaintextType::Literal(LiteralType::Address)) | (9, PlaintextType::Literal(LiteralType::Group)) => { - Literal::Group(N::hash_to_group_psd2(&input.to_fields()?)?) + let output = Literal::Group(N::hash_to_group_psd2(&input.to_fields()?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (9, PlaintextType::Literal(..)) => { + let output = Literal::Field(N::hash_psd2(&input.to_fields()?)?); + + to_destination_literal_type(output, &self.destination_type)? } - (9, PlaintextType::Literal(..)) => Literal::Field(N::hash_psd2(&input.to_fields()?)?), (10, PlaintextType::Literal(LiteralType::Address)) | (10, PlaintextType::Literal(LiteralType::Group)) => { - Literal::Group(N::hash_to_group_psd4(&input.to_fields()?)?) + let output = Literal::Group(N::hash_to_group_psd4(&input.to_fields()?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (10, PlaintextType::Literal(..)) => { + let output = Literal::Field(N::hash_psd4(&input.to_fields()?)?); + + to_destination_literal_type(output, &self.destination_type)? } - (10, PlaintextType::Literal(..)) => Literal::Field(N::hash_psd4(&input.to_fields()?)?), (11, PlaintextType::Literal(LiteralType::Address)) | (11, PlaintextType::Literal(LiteralType::Group)) => { - Literal::Group(N::hash_to_group_psd8(&input.to_fields()?)?) + let output = Literal::Group(N::hash_to_group_psd8(&input.to_fields()?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (11, PlaintextType::Literal(..)) => { + let output = Literal::Field(N::hash_psd8(&input.to_fields()?)?); + + to_destination_literal_type(output, &self.destination_type)? } - (11, PlaintextType::Literal(..)) => Literal::Field(N::hash_psd8(&input.to_fields()?)?), (12, PlaintextType::Literal(..)) => { - Literal::Group(N::hash_to_group_bhp256(&N::hash_sha3_256(&input.to_bits_le())?)?) + let output = Literal::Group(N::hash_to_group_bhp256(&N::hash_sha3_256(&input.to_bits_le())?)?); + to_destination_literal_type(output, &self.destination_type)? + } + (12, PlaintextType::Array(..)) => { + let hash = &N::hash_sha3_256(&input.to_bits_le())?; + + Value::Plaintext(to_console_array(hash, 32, LiteralType::U8)?) } (13, PlaintextType::Literal(..)) => { - Literal::Group(N::hash_to_group_bhp512(&N::hash_sha3_384(&input.to_bits_le())?)?) + let output = Literal::Group(N::hash_to_group_bhp512(&N::hash_sha3_384(&input.to_bits_le())?)?); + to_destination_literal_type(output, &self.destination_type)? + } + (13, PlaintextType::Array(..)) => { + let hash = &N::hash_sha3_384(&input.to_bits_le())?; + + Value::Plaintext(to_console_array(hash, 24, LiteralType::U16)?) } (14, PlaintextType::Literal(..)) => { - Literal::Group(N::hash_to_group_bhp512(&N::hash_sha3_512(&input.to_bits_le())?)?) + let output = Literal::Group(N::hash_to_group_bhp512(&N::hash_sha3_512(&input.to_bits_le())?)?); + + to_destination_literal_type(output, &self.destination_type)? + } + (14, PlaintextType::Array(..)) => { + let hash = &N::hash_sha3_512(&input.to_bits_le())?; + + Value::Plaintext(to_console_array(hash, 32, LiteralType::U16)?) } (15, _) => bail!("'hash_many.psd2' is not yet implemented"), (16, _) => bail!("'hash_many.psd4' is not yet implemented"), @@ -256,14 +445,9 @@ impl HashInstruction { (_, PlaintextType::Struct(..)) => bail!("Cannot hash into a struct"), (_, PlaintextType::Array(..)) => bail!("Cannot hash into an array (yet)"), }; - // Cast the output to the destination type. - let output = match self.destination_type { - PlaintextType::Literal(literal_type) => output.cast_lossy(literal_type)?, - PlaintextType::Struct(..) => bail!("Cannot hash into a struct"), - PlaintextType::Array(..) => bail!("Cannot hash into an array (yet)"), - }; + // Store the output. - registers.store(stack, &self.destination, Value::Plaintext(Plaintext::from(output))) + registers.store(stack, &self.destination, output) } /// Executes the instruction. @@ -278,47 +462,110 @@ impl HashInstruction { // Ensure the number of operands is correct. check_number_of_operands(VARIANT, Self::opcode(), self.operands.len())?; // Ensure the destination type is valid. - ensure!(is_valid_destination_type(&self.destination_type), "Invalid destination type in 'hash' instruction"); + ensure!( + is_valid_destination_type(VARIANT, &self.destination_type), + "Invalid destination type in 'hash' instruction" + ); // Load the operand. let input = registers.load_circuit(stack, &self.operands[0])?; // Hash the input. let output = match (VARIANT, &self.destination_type) { - (0, PlaintextType::Literal(..)) => circuit::Literal::Group(A::hash_to_group_bhp256(&input.to_bits_le())), - (1, PlaintextType::Literal(..)) => circuit::Literal::Group(A::hash_to_group_bhp512(&input.to_bits_le())), - (2, PlaintextType::Literal(..)) => circuit::Literal::Group(A::hash_to_group_bhp768(&input.to_bits_le())), - (3, PlaintextType::Literal(..)) => circuit::Literal::Group(A::hash_to_group_bhp1024(&input.to_bits_le())), + (0, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Group(A::hash_to_group_bhp256(&input.to_bits_le())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (1, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Group(A::hash_to_group_bhp512(&input.to_bits_le())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (2, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Group(A::hash_to_group_bhp768(&input.to_bits_le())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (3, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Group(A::hash_to_group_bhp1024(&input.to_bits_le())); + to_destination_circuit_literal(output, &self.destination_type)? + } (4, PlaintextType::Literal(..)) => { - circuit::Literal::Group(A::hash_to_group_bhp256(&A::hash_keccak256(&input.to_bits_le()))) + let output = circuit::Literal::Group(A::hash_to_group_bhp256(&A::hash_keccak256(&input.to_bits_le()))); + to_destination_circuit_literal(output, &self.destination_type)? + } + (4, PlaintextType::Array(..)) => { + let hash = A::hash_keccak256(&input.to_bits_le()); + circuit::Value::Plaintext(to_circuit_array_u8(&hash, 32).unwrap()) } (5, PlaintextType::Literal(..)) => { - circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_keccak384(&input.to_bits_le()))) + let output = circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_keccak384(&input.to_bits_le()))); + to_destination_circuit_literal(output, &self.destination_type)? + } + (5, PlaintextType::Array(..)) => { + let hash = A::hash_keccak384(&input.to_bits_le()); + circuit::Value::Plaintext(to_circuit_array_u16(&hash, 24).unwrap()) } (6, PlaintextType::Literal(..)) => { - circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_keccak512(&input.to_bits_le()))) + let output = circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_keccak512(&input.to_bits_le()))); + to_destination_circuit_literal(output, &self.destination_type)? + } + (6, PlaintextType::Array(..)) => { + let hash = A::hash_keccak512(&input.to_bits_le()); + circuit::Value::Plaintext(to_circuit_array_u16(&hash, 32).unwrap()) + } + (7, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Group(A::hash_to_group_ped64(&input.to_bits_le())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (8, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Group(A::hash_to_group_ped128(&input.to_bits_le())); + to_destination_circuit_literal(output, &self.destination_type)? } - (7, PlaintextType::Literal(..)) => circuit::Literal::Group(A::hash_to_group_ped64(&input.to_bits_le())), - (8, PlaintextType::Literal(..)) => circuit::Literal::Group(A::hash_to_group_ped128(&input.to_bits_le())), (9, PlaintextType::Literal(LiteralType::Address)) | (9, PlaintextType::Literal(LiteralType::Group)) => { - circuit::Literal::Group(A::hash_to_group_psd2(&input.to_fields())) + let output = circuit::Literal::Group(A::hash_to_group_psd2(&input.to_fields())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (9, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Field(A::hash_psd2(&input.to_fields())); + to_destination_circuit_literal(output, &self.destination_type)? } - (9, PlaintextType::Literal(..)) => circuit::Literal::Field(A::hash_psd2(&input.to_fields())), (10, PlaintextType::Literal(LiteralType::Address)) | (10, PlaintextType::Literal(LiteralType::Group)) => { - circuit::Literal::Group(A::hash_to_group_psd4(&input.to_fields())) + let output = circuit::Literal::Group(A::hash_to_group_psd4(&input.to_fields())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (10, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Field(A::hash_psd4(&input.to_fields())); + to_destination_circuit_literal(output, &self.destination_type)? } - (10, PlaintextType::Literal(..)) => circuit::Literal::Field(A::hash_psd4(&input.to_fields())), (11, PlaintextType::Literal(LiteralType::Address)) | (11, PlaintextType::Literal(LiteralType::Group)) => { - circuit::Literal::Group(A::hash_to_group_psd8(&input.to_fields())) + let output = circuit::Literal::Group(A::hash_to_group_psd8(&input.to_fields())); + to_destination_circuit_literal(output, &self.destination_type)? + } + (11, PlaintextType::Literal(..)) => { + let output = circuit::Literal::Field(A::hash_psd8(&input.to_fields())); + to_destination_circuit_literal(output, &self.destination_type)? } - (11, PlaintextType::Literal(..)) => circuit::Literal::Field(A::hash_psd8(&input.to_fields())), (12, PlaintextType::Literal(..)) => { - circuit::Literal::Group(A::hash_to_group_bhp256(&A::hash_sha3_256(&input.to_bits_le()))) + let output = circuit::Literal::Group(A::hash_to_group_bhp256(&A::hash_sha3_256(&input.to_bits_le()))); + to_destination_circuit_literal(output, &self.destination_type)? + } + (12, PlaintextType::Array(..)) => { + let hash = A::hash_sha3_256(&input.to_bits_le()); + circuit::Value::Plaintext(to_circuit_array_u8(&hash, 32).unwrap()) } (13, PlaintextType::Literal(..)) => { - circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_sha3_384(&input.to_bits_le()))) + let output = circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_sha3_384(&input.to_bits_le()))); + to_destination_circuit_literal(output, &self.destination_type)? + } + (13, PlaintextType::Array(..)) => { + let hash = A::hash_sha3_384(&input.to_bits_le()); + circuit::Value::Plaintext(to_circuit_array_u16(&hash, 24).unwrap()) } (14, PlaintextType::Literal(..)) => { - circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_sha3_512(&input.to_bits_le()))) + let output = circuit::Literal::Group(A::hash_to_group_bhp512(&A::hash_sha3_512(&input.to_bits_le()))); + to_destination_circuit_literal(output, &self.destination_type)? + } + (14, PlaintextType::Array(..)) => { + let hash = A::hash_sha3_512(&input.to_bits_le()); + circuit::Value::Plaintext(to_circuit_array_u16(&hash, 32).unwrap()) } (15, _) => bail!("'hash_many.psd2' is not yet implemented"), (16, _) => bail!("'hash_many.psd4' is not yet implemented"), @@ -327,15 +574,7 @@ impl HashInstruction { (_, PlaintextType::Struct(..)) => bail!("Cannot hash into a struct"), (_, PlaintextType::Array(..)) => bail!("Cannot hash into an array (yet)"), }; - // Cast the output to the destination type. - let output = match self.destination_type { - PlaintextType::Literal(literal_type) => output.cast_lossy(literal_type)?, - PlaintextType::Struct(..) => bail!("Cannot hash into a struct"), - PlaintextType::Array(..) => bail!("Cannot hash into an array (yet)"), - }; - // Convert the output to a stack value. - let output = circuit::Value::Plaintext(circuit::Plaintext::Literal(output, Default::default())); - // Store the output. + registers.store_circuit(stack, &self.destination, output) } @@ -361,7 +600,10 @@ impl HashInstruction { // Ensure the number of operands is correct. check_number_of_operands(VARIANT, Self::opcode(), self.operands.len())?; // Ensure the destination type is valid. - ensure!(is_valid_destination_type(&self.destination_type), "Invalid destination type in 'hash' instruction"); + ensure!( + is_valid_destination_type(VARIANT, &self.destination_type), + "Invalid destination type in 'hash' instruction" + ); // TODO (howardwu): If the operation is Pedersen, check that it is within the number of bits. diff --git a/synthesizer/program/src/traits/stack_and_registers.rs b/synthesizer/program/src/traits/stack_and_registers.rs index 508e619d95..73a7859675 100644 --- a/synthesizer/program/src/traits/stack_and_registers.rs +++ b/synthesizer/program/src/traits/stack_and_registers.rs @@ -123,6 +123,9 @@ pub trait FinalizeRegistersState { /// Returns the function name for the finalize scope. fn function_name(&self) -> &Identifier; + + /// Returns the nonce for the finalize registers. + fn nonce(&self) -> u64; } pub trait RegistersSigner { diff --git a/synthesizer/program/tests/helpers/sample.rs b/synthesizer/program/tests/helpers/sample.rs index 4f6395125b..c6a11031a1 100644 --- a/synthesizer/program/tests/helpers/sample.rs +++ b/synthesizer/program/tests/helpers/sample.rs @@ -73,6 +73,7 @@ pub fn sample_finalize_registers( ::TransitionID::default(), *function_name, stack.get_finalize_types(function_name)?.clone(), + 0u64, ); // For each literal, diff --git a/synthesizer/snark/Cargo.toml b/synthesizer/snark/Cargo.toml index 5f704bac36..9f2e330c3b 100644 --- a/synthesizer/snark/Cargo.toml +++ b/synthesizer/snark/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-synthesizer-snark" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "SNARK wrappers for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -33,18 +33,18 @@ wasm = [ "console/wasm", "snarkvm-algorithms/wasm" ] [dependencies.circuit] package = "snarkvm-circuit" path = "../../circuit" -version = "=1.1.0" +version = "=1.2.1" [dependencies.console] package = "snarkvm-console" path = "../../console" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "network" ] [dependencies.snarkvm-algorithms] path = "../../algorithms" -version = "=1.1.0" +version = "=1.2.1" [dependencies.bincode] version = "1" diff --git a/synthesizer/src/vm/execute.rs b/synthesizer/src/vm/execute.rs index 97ab70d379..42d831d10c 100644 --- a/synthesizer/src/vm/execute.rs +++ b/synthesizer/src/vm/execute.rs @@ -915,6 +915,7 @@ finalize test: } #[test] + #[ignore = "memory-intensive"] fn test_deep_nested_execution_cost() { // Initialize an RNG. let rng = &mut TestRng::default(); diff --git a/synthesizer/src/vm/finalize.rs b/synthesizer/src/vm/finalize.rs index 199a571060..dda3f3137b 100644 --- a/synthesizer/src/vm/finalize.rs +++ b/synthesizer/src/vm/finalize.rs @@ -393,7 +393,7 @@ impl> VM { // and update the respective leaves of the finalize tree. Transaction::Execute(_, execution, fee) => { // Determine if the transaction is safe for execution, and proceed to execute it. - match Self::prepare_for_execution(store, execution) + match Self::prepare_for_execution(state, store, execution) .and_then(|_| process.finalize_execution(state, store, execution, fee.as_ref())) { // Construct the accepted execute transaction. @@ -953,7 +953,11 @@ impl> VM { /// - If the transaction contains a `credits.aleo/bond_public` transition, /// then the outcome should not exceed the maximum committee size. #[inline] - fn prepare_for_execution(store: &FinalizeStore, execution: &Execution) -> Result<()> { + fn prepare_for_execution( + state: FinalizeGlobalState, + store: &FinalizeStore, + execution: &Execution, + ) -> Result<()> { // Construct the program ID. let program_id = ProgramID::from_str("credits.aleo")?; // Construct the committee mapping name. @@ -995,8 +999,13 @@ impl> VM { bond_validator_addresses.into_iter().filter(|address| !committee_members.contains(address)).count(); // Compute the next committee size. let next_committee_size = committee_members.len().saturating_add(num_new_validators); + // Determine the maximum committee size to use. + let max_committee_size = match state.block_height() < N::CONSENSUS_V3_HEIGHT { + true => Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3, + false => Committee::::MAX_COMMITTEE_SIZE, + }; // Check that the number of new validators being bonded does not exceed the maximum number of validators. - match next_committee_size > Committee::::MAX_COMMITTEE_SIZE as usize { + match next_committee_size > max_committee_size as usize { true => Err(anyhow!("Call to 'credits.aleo/bond_public' exceeds the committee size")), false => Ok(()), } @@ -1049,6 +1058,13 @@ impl> VM { committee.members().len() <= Committee::::MAX_COMMITTEE_SIZE as usize, "Ratify::Genesis(..) exceeds the maximum number of committee members" ); + // Ensure that the number of members in the committee does not exceed the maximum before consensus V3 rules apply. + if state.block_height() < N::CONSENSUS_V3_HEIGHT { + ensure!( + committee.members().len() <= Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 as usize, + "Ratify::Genesis(..) exceeds the maximum number of committee members before V3" + ); + } // Ensure that the number of delegators does not exceed the maximum. ensure!( bonded_balances.len().saturating_sub(committee.members().len()) <= MAX_DELEGATORS as usize, @@ -1809,8 +1825,10 @@ finalize transfer_public: let vm = sample_vm(); // Initialize the validators with the maximum number of validators. - let validators = - sample_validators::(Committee::::MAX_COMMITTEE_SIZE as usize, rng); + let validators = sample_validators::( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 as usize, + rng, + ); // Initialize a new address. let new_validator_private_key = PrivateKey::::new(rng).unwrap(); @@ -1895,6 +1913,200 @@ finalize transfer_public: ); } + #[cfg(feature = "test")] + #[test] + fn test_genesis_num_validators_does_not_exceed_maximum_before_v3() { + // This test will fail if the consensus v3 height is 0 + assert_ne!(0, CurrentNetwork::CONSENSUS_V3_HEIGHT); + + // Initialize an RNG. + let rng = &mut TestRng::default(); + + // Initialize the VM. + let vm = sample_vm(); + + // Initialize the validators with the maximum number of validators before consensus v3. + let validators = sample_validators::( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 as usize + 1, + rng, + ); + + // Initialize a new address. + let new_validator_private_key = PrivateKey::::new(rng).unwrap(); + let new_validator_address = Address::try_from(&new_validator_private_key).unwrap(); + + // Construct the committee. + // Track the allocated amount. + let (committee_map, allocated_amount) = + sample_committee_map_and_allocated_amount(&validators, &IndexMap::new()); + + // Collect all of the addresses in a single place + let validator_addresses = + validators.keys().map(|private_key| Address::try_from(private_key).unwrap()).collect::>(); + + // Construct the public balances, allocating the remaining supply. + let new_validator_balance = MIN_VALIDATOR_STAKE + 100_000_000; + let mut public_balances = sample_public_balances( + &validator_addresses, + ::STARTING_SUPPLY - allocated_amount - new_validator_balance, + ); + // Set the public balance of the new validator to the minimum validator stake. + public_balances.insert(new_validator_address, new_validator_balance); + + // Construct the bonded balances. + let bonded_balances = sample_bonded_balances(&validators, &IndexMap::new()); + + // Ensure that the block with too many validators fails to be created. + assert!( + vm.genesis_quorum( + validators.keys().next().unwrap(), + Committee::new_genesis(committee_map).unwrap(), + public_balances, + bonded_balances, + rng, + ) + .is_err() + ); + } + + #[cfg(feature = "test")] + #[test] + #[allow(clippy::assertions_on_constants)] + fn test_migration_v3_maximum_validator_increase() { + // This test will fail if the consensus v3 height is 0 + assert_ne!(0, CurrentNetwork::CONSENSUS_V3_HEIGHT); + + // Initialize an RNG. + let rng = &mut TestRng::default(); + + // Initialize the VM. + let vm = sample_vm(); + + // Initialize the validators with the maximum number of validators before consensus v3. + let validators = sample_validators::( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 as usize, + rng, + ); + + // Initialize a new address. + let new_validator_private_key = PrivateKey::::new(rng).unwrap(); + let new_validator_address = Address::try_from(&new_validator_private_key).unwrap(); + + // Construct the committee. + // Track the allocated amount. + let (committee_map, allocated_amount) = + sample_committee_map_and_allocated_amount(&validators, &IndexMap::new()); + + // Collect all of the addresses in a single place + let validator_addresses = + validators.keys().map(|private_key| Address::try_from(private_key).unwrap()).collect::>(); + + // Construct the public balances, allocating the remaining supply. + let new_validator_balance = MIN_VALIDATOR_STAKE + 100_000_000; + let mut public_balances = sample_public_balances( + &validator_addresses, + ::STARTING_SUPPLY - allocated_amount - new_validator_balance, + ); + // Set the public balance of the new validator to the minimum validator stake. + public_balances.insert(new_validator_address, new_validator_balance); + + // Construct the bonded balances. + let bonded_balances = sample_bonded_balances(&validators, &IndexMap::new()); + + // Construct the genesis block, which should pass. + let block = vm + .genesis_quorum( + validators.keys().next().unwrap(), + Committee::new_genesis(committee_map).unwrap(), + public_balances, + bonded_balances, + rng, + ) + .unwrap(); + + // Add the block. + vm.add_next_block(&block).unwrap(); + + // Attempt to bond a new validator above the maximum number of validators. + let inputs = vec![ + Value::::from_str(&validator_addresses.first().unwrap().to_string()).unwrap(), // Withdrawal address + Value::::from_str(&format!("{MIN_VALIDATOR_STAKE}u64")).unwrap(), // Amount + Value::::from_str("42u8").unwrap(), // Commission + ]; + + // Execute. + let bond_validator_transaction = vm + .execute( + &new_validator_private_key, + ("credits.aleo", "bond_validator"), + inputs.clone().into_iter(), + None, + 1, + None, + rng, + ) + .unwrap(); + + // Verify. + vm.check_transaction(&bond_validator_transaction, None, rng).unwrap(); + + // Speculate on the transactions. + let transactions = [bond_validator_transaction.clone()]; + let (_, confirmed_transactions, _, _) = vm + .atomic_speculate( + sample_finalize_state(1), + CurrentNetwork::BLOCK_TIME as i64, + None, + vec![], + &None.into(), + transactions.iter(), + ) + .unwrap(); + + // Assert that the transaction is rejected. + assert_eq!(confirmed_transactions.len(), 1); + assert_eq!( + confirmed_transactions[0], + reject(0, &bond_validator_transaction, confirmed_transactions[0].finalize_operations()) + ); + + // Update the VM to the migration block height + let private_key = test_helpers::sample_genesis_private_key(rng); + let transactions: [Transaction; 0] = []; + while vm.block_store().current_block_height() < CurrentNetwork::CONSENSUS_V3_HEIGHT { + // Call the function + let next_block = crate::vm::test_helpers::sample_next_block(&vm, &private_key, &transactions, rng).unwrap(); + vm.add_next_block(&next_block).unwrap(); + } + + // Test that attempting to bond a new validator above the maximum number of validators after the migration block height succeeds. + + // Check that the new committee size is greater than the maximum committee size before the migration. + assert!( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 < Committee::::MAX_COMMITTEE_SIZE + ); + + // Speculate on the transactions. + let transactions = [bond_validator_transaction.clone()]; + let (_, confirmed_transactions, aborted_transaction_ids, _) = vm + .atomic_speculate( + sample_finalize_state(CurrentNetwork::CONSENSUS_V3_HEIGHT), + CurrentNetwork::BLOCK_TIME as i64, + None, + vec![], + &None.into(), + transactions.iter(), + ) + .unwrap(); + + // Assert that the transaction is accepted. + assert_eq!(confirmed_transactions.len(), 1); + assert!(confirmed_transactions[0].is_accepted()); + assert!(aborted_transaction_ids.is_empty()); + + assert_eq!(confirmed_transactions[0].transaction(), &bond_validator_transaction); + } + #[test] fn test_atomic_finalize_many() { let rng = &mut TestRng::default(); @@ -2437,8 +2649,10 @@ finalize compute: // Reset the validators. // Note: We use a smaller committee size to ensure that there is enough supply to allocate to the validators and genesis block transactions. - let validators = - sample_validators::(Committee::::MAX_COMMITTEE_SIZE as usize, rng); + let validators = sample_validators::( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 as usize, + rng, + ); // Construct the committee. // Track the allocated amount. @@ -2480,8 +2694,10 @@ finalize compute: // Construct the validators. // Note: We use a smaller committee size to ensure that there is enough supply to allocate to the validators and genesis block transactions. - let validators = - sample_validators::(Committee::::MAX_COMMITTEE_SIZE as usize / 4, rng); + let validators = sample_validators::( + Committee::::MAX_COMMITTEE_SIZE_BEFORE_V3 as usize / 4, + rng, + ); // Construct the delegators, greater than the maximum delegator size. let delegators = (0..MAX_DELEGATORS + 1) diff --git a/synthesizer/src/vm/mod.rs b/synthesizer/src/vm/mod.rs index 72b7166b70..aed27fb2bc 100644 --- a/synthesizer/src/vm/mod.rs +++ b/synthesizer/src/vm/mod.rs @@ -1356,6 +1356,7 @@ function call_fee_private: } #[test] + #[ignore = "memory-intensive"] fn test_deployment_synthesis_overload() { let rng = &mut TestRng::default(); diff --git a/synthesizer/src/vm/verify.rs b/synthesizer/src/vm/verify.rs index ab45e68444..478350c748 100644 --- a/synthesizer/src/vm/verify.rs +++ b/synthesizer/src/vm/verify.rs @@ -132,9 +132,6 @@ impl> VM { lap!(timer, "Check for duplicate elements"); - // First, verify the fee. - self.check_fee(transaction, rejected_id)?; - // Construct the transaction checksum. let checksum = Data::>::Buffer(transaction.to_bytes_le()?.into()).to_checksum::()?; @@ -142,6 +139,9 @@ impl> VM { let is_partially_verified = self.partially_verified_transactions.read().peek(&(transaction.id())) == Some(&checksum); + // Verify the fee. + self.check_fee(transaction, rejected_id, is_partially_verified)?; + // Next, verify the deployment or execution. match transaction { Transaction::Deploy(id, owner, deployment, _) => { @@ -202,7 +202,12 @@ impl> VM { /// Verifies the `fee` in the given transaction. On failure, returns an error. #[inline] - pub fn check_fee(&self, transaction: &Transaction, rejected_id: Option>) -> Result<()> { + pub fn check_fee( + &self, + transaction: &Transaction, + rejected_id: Option>, + is_partially_verified: bool, + ) -> Result<()> { match transaction { Transaction::Deploy(id, _, deployment, fee) => { // Ensure the rejected ID is not present. @@ -218,7 +223,7 @@ impl> VM { bail!("Transaction '{id}' has an insufficient base fee (deployment) - requires {cost} microcredits") } // Verify the fee. - self.check_fee_internal(fee, deployment_id)?; + self.check_fee_internal(fee, deployment_id, is_partially_verified)?; } Transaction::Execute(id, execution, fee) => { // Ensure the rejected ID is not present. @@ -253,7 +258,7 @@ impl> VM { ensure!(*fee.base_amount()? == 0, "Transaction '{id}' has a non-zero base fee (execution)"); } // Verify the fee. - self.check_fee_internal(fee, execution_id)?; + self.check_fee_internal(fee, execution_id, is_partially_verified)?; } else { // Ensure the fee can be safely skipped. ensure!(!is_fee_required, "Transaction '{id}' is missing a fee (execution)"); @@ -265,7 +270,7 @@ impl> VM { Transaction::Fee(id, fee) => { // Verify the fee. match rejected_id { - Some(rejected_id) => self.check_fee_internal(fee, rejected_id)?, + Some(rejected_id) => self.check_fee_internal(fee, rejected_id, is_partially_verified)?, None => bail!("Transaction '{id}' is missing a rejected ID (fee)"), } } @@ -339,15 +344,23 @@ impl> VM { /// Note: This is an internal check only. To ensure all components of the fee are checked, /// use `VM::check_fee` instead. #[inline] - fn check_fee_internal(&self, fee: &Fee, deployment_or_execution_id: Field) -> Result<()> { + fn check_fee_internal( + &self, + fee: &Fee, + deployment_or_execution_id: Field, + is_partially_verified: bool, + ) -> Result<()> { let timer = timer!("VM::check_fee"); // Ensure the fee does not exceed the limit. let fee_amount = fee.amount()?; ensure!(*fee_amount <= N::MAX_FEE, "Fee verification failed: fee exceeds the maximum limit"); - // Verify the fee. - let verification = self.process.read().verify_fee(fee, deployment_or_execution_id); + // Verify the fee, if it has not been partially-verified before. + let verification = match is_partially_verified { + true => Ok(()), + false => self.process.read().verify_fee(fee, deployment_or_execution_id), + }; lap!(timer, "Verify the fee"); // TODO (howardwu): This check is technically insufficient. Consider moving this upstream @@ -408,16 +421,22 @@ mod tests { let deployment_transaction = crate::vm::test_helpers::sample_deployment_transaction(rng); // Ensure the transaction verifies. vm.check_transaction(&deployment_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&deployment_transaction.id()).is_some()); // Fetch an execution transaction. let execution_transaction = crate::vm::test_helpers::sample_execution_transaction_with_private_fee(rng); // Ensure the transaction verifies. vm.check_transaction(&execution_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&execution_transaction.id()).is_some()); // Fetch an execution transaction. let execution_transaction = crate::vm::test_helpers::sample_execution_transaction_with_public_fee(rng); // Ensure the transaction verifies. vm.check_transaction(&execution_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&execution_transaction.id()).is_some()); } #[test] @@ -433,11 +452,15 @@ mod tests { // Ensure the deployment is valid. vm.check_deployment_internal(&deployment, rng).unwrap(); + // Ensure the partially_verified_transactions cache is not updated. + assert!(vm.partially_verified_transactions.read().peek(&deployment.to_deployment_id().unwrap()).is_none()); // Ensure that deserialization doesn't break the transaction verification. let serialized_deployment = deployment.to_string(); let deployment_transaction: Deployment = serde_json::from_str(&serialized_deployment).unwrap(); vm.check_deployment_internal(&deployment_transaction, rng).unwrap(); + // Ensure the partially_verified_transactions cache is not updated. + assert!(vm.partially_verified_transactions.read().peek(&deployment.to_deployment_id().unwrap()).is_none()); } #[test] @@ -458,12 +481,23 @@ mod tests { assert!(execution.proof().is_some()); // Verify the execution. vm.check_execution_internal(&execution, false).unwrap(); + // Ensure the partially_verified_transactions cache is not updated. + assert!( + vm.partially_verified_transactions.read().peek(&execution.to_execution_id().unwrap()).is_none() + ); // Ensure that deserialization doesn't break the transaction verification. let serialized_execution = execution.to_string(); let recovered_execution: Execution = serde_json::from_str(&serialized_execution).unwrap(); vm.check_execution_internal(&recovered_execution, false).unwrap(); + // Ensure the partially_verified_transactions cache is not updated. + assert!( + vm.partially_verified_transactions + .read() + .peek(&recovered_execution.to_execution_id().unwrap()) + .is_none() + ); } _ => panic!("Expected an execution transaction"), } @@ -489,12 +523,16 @@ mod tests { // Ensure the proof exists. assert!(fee.proof().is_some()); // Verify the fee. - vm.check_fee_internal(&fee, execution_id).unwrap(); + vm.check_fee_internal(&fee, execution_id, false).unwrap(); + // Ensure the partially_verified_transactions cache is not updated. + assert!(vm.partially_verified_transactions.read().peek(&execution_id).is_none()); // Ensure that deserialization doesn't break the transaction verification. let serialized_fee = fee.to_string(); let recovered_fee: Fee = serde_json::from_str(&serialized_fee).unwrap(); - vm.check_fee_internal(&recovered_fee, execution_id).unwrap(); + vm.check_fee_internal(&recovered_fee, execution_id, false).unwrap(); + // Ensure the partially_verified_transactions cache is not updated. + assert!(vm.partially_verified_transactions.read().peek(&execution_id).is_none()); } _ => panic!("Expected an execution with a fee"), } @@ -515,14 +553,20 @@ mod tests { // Fetch a valid execution transaction with a private fee. let valid_transaction = crate::vm::test_helpers::sample_execution_transaction_with_private_fee(rng); vm.check_transaction(&valid_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&valid_transaction.id()).is_some()); // Fetch a valid execution transaction with a public fee. let valid_transaction = crate::vm::test_helpers::sample_execution_transaction_with_public_fee(rng); vm.check_transaction(&valid_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&valid_transaction.id()).is_some()); - // Fetch an valid execution transaction with no fee. + // Fetch a valid execution transaction with no fee. let valid_transaction = crate::vm::test_helpers::sample_execution_transaction_without_fee(rng); vm.check_transaction(&valid_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&valid_transaction.id()).is_some()); } #[test] @@ -630,6 +674,8 @@ mod tests { // Verify. vm.check_transaction(&transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&transaction.id()).is_some()); } #[test] @@ -679,6 +725,8 @@ function compute: // Fetch a valid execution transaction with a public fee. let valid_transaction = crate::vm::test_helpers::sample_execution_transaction_with_public_fee(rng); vm.check_transaction(&valid_transaction, None, rng).unwrap(); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&valid_transaction.id()).is_some()); // Mutate the execution transaction by inserting a Field::Zero as an output. let execution = valid_transaction.execution().unwrap(); @@ -730,6 +778,8 @@ function compute: // Ensure that the mutated transaction fails verification due to an extra output. assert!(vm.check_transaction(&mutated_transaction, None, rng).is_err()); + // Ensure the partially_verified_transactions cache is not updated. + assert!(vm.partially_verified_transactions.read().peek(&mutated_transaction.id()).is_none()); } #[cfg(feature = "test")] @@ -760,6 +810,8 @@ function compute: minimum_credits_transfer_public_fee, ); assert!(vm.check_transaction(&fee_too_low_transaction, None, rng).is_err()); + // Ensure the partially_verified_transactions cache is not updated. + assert!(vm.partially_verified_transactions.read().peek(&fee_too_low_transaction.id()).is_none()); // Try to submit a tx with the old fee before the migration block height let old_valid_transaction = crate::vm::test_helpers::create_new_transaction_with_different_fee( @@ -768,6 +820,8 @@ function compute: old_minimum_credits_transfer_public_fee, ); assert!(vm.check_transaction(&old_valid_transaction, None, rng).is_ok()); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&old_valid_transaction.id()).is_some()); // Update the VM to the migration block height let private_key = test_helpers::sample_genesis_private_key(rng); @@ -811,6 +865,8 @@ function compute: old_minimum_credits_transfer_public_fee, ); assert!(vm.check_transaction(&fee_too_high_transaction, None, rng).is_ok()); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&fee_too_high_transaction.id()).is_some()); // Try to submit a tx with the new fee after the migration block height let valid_transaction = crate::vm::test_helpers::create_new_transaction_with_different_fee( @@ -819,5 +875,7 @@ function compute: minimum_credits_transfer_public_fee, ); assert!(vm.check_transaction(&valid_transaction, None, rng).is_ok()); + // Ensure the partially_verified_transactions cache is updated. + assert!(vm.partially_verified_transactions.read().peek(&valid_transaction.id()).is_some()); } } diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/interleave_async_and_non_async.out b/synthesizer/tests/expectations/vm/execute_and_finalize/interleave_async_and_non_async.out new file mode 100644 index 0000000000..370ae08718 --- /dev/null +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/interleave_async_and_non_async.out @@ -0,0 +1,144 @@ +errors: [] +outputs: +- verified: true + execute: + mid.aleo/save_mid_rand_2: + outputs: + - '{"type":"future","id":"8133252294099058744569698548841506104644319254713927471060413341001678088866field","value":"{\n program_id: mid.aleo,\n function_name: save_mid_rand_2,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n}"}' + speculate: the execution was accepted + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/call_mid_3: + outputs: + - '{"type":"future","id":"3943339733672692638395740341671994092158484825516042860641043685177097488932field","value":"{\n program_id: outer.aleo,\n function_name: call_mid_3,\n arguments: [\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n },\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n }\n \n ]\n}"}' + speculate: the execution was accepted + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/call_mid: + outputs: + - '{"type":"future","id":"3234621292740822058818055697198799540048108651323455396840123946866280290387field","value":"{\n program_id: outer.aleo,\n function_name: call_mid,\n arguments: [\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n }\n \n ]\n}"}' + speculate: the execution was rejected + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/call_mid_2: + outputs: + - '{"type":"future","id":"6256136872031781770553816141201857256304896691884762229618319303437235049235field","value":"{\n program_id: outer.aleo,\n function_name: call_mid_2,\n arguments: [\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n },\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n }\n \n ]\n}"}' + speculate: the execution was rejected + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/dummy: + outputs: [] + speculate: the execution was accepted + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/dummy: + outputs: [] + speculate: the execution was accepted + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/dummy: + outputs: [] + speculate: the execution was accepted + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/call_mid: + outputs: + - '{"type":"future","id":"1442432016017783473506018231162631985706673203904773748822729317313361172014field","value":"{\n program_id: outer.aleo,\n function_name: call_mid,\n arguments: [\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n }\n \n ]\n}"}' + speculate: the execution was accepted + add_next_block: succeeded. +- verified: true + execute: + outer.aleo/call_mid_2: + outputs: + - '{"type":"future","id":"5992337061564037613503594922642940602038279609368168204573599540929191074383field","value":"{\n program_id: outer.aleo,\n function_name: call_mid_2,\n arguments: [\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n },\n {\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n }\n \n ]\n}"}' + speculate: the execution was accepted + add_next_block: succeeded. +additional: +- child_outputs: + inner.aleo/dummy: + outputs: [] + inner.aleo/save_inner_rand: + outputs: + - '{"type":"future","id":"2491454043368457724827856328992492378252414844160971129371068949933787800327field","value":"{\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n}"}' + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"8364085965948136284430782264975904513362941894972177369414604763679081824990field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 76697u64\n ]\n}"}' +- child_outputs: + inner.aleo/save_inner_rand: + outputs: + - '{"type":"future","id":"5529824764130005030074933219733459982343596117334741286429948259175211128460field","value":"{\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n}"}' + mid.aleo/save_mid_rand: + outputs: + - '{"type":"future","id":"4360736171399918590300263879039970750359601853381250666126605518412297988622field","value":"{\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n}"}' + mid.aleo/dummy: + outputs: [] + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"115907321802783128984566810198532384178634534374658674607472564056856197283field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 153515u64\n ]\n}"}' +- child_outputs: + mid.aleo/dummy: + outputs: [] + inner.aleo/save_inner_rand: + outputs: + - '{"type":"future","id":"4614422449220197915414605795206400101815072983960277710851966783861356960406field","value":"{\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n}"}' + mid.aleo/save_mid_rand: + outputs: + - '{"type":"future","id":"2508191276062236001575741846287485044265199754282255664177008646882560557252field","value":"{\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n}"}' + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"1073608049274464266751816702008249392786653692342830056680162189620354498415field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 78340u64\n ]\n}"}' +- child_outputs: + inner.aleo/save_inner_rand: + outputs: + - '{"type":"future","id":"5225218680008854881439125057672129573587587270307645239381393215803081422716field","value":"{\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n}"}' + mid.aleo/save_mid_rand: + outputs: + - '{"type":"future","id":"4178750000665019990650488851451367780305518344784410337482918142723400529474field","value":"{\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n}"}' + mid.aleo/dummy: + outputs: [] + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"4292470820134718797108426369632556448016220649849044091832458381384800389195field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 153515u64\n ]\n}"}' +- child_outputs: + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"2175759062123847325921919658496101458036093092082217212502708037221890199855field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 1140u64\n ]\n}"}' +- child_outputs: + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"6194763244383380375407778496857186996903616164599482246071751164326478513956field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 1140u64\n ]\n}"}' +- child_outputs: + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"3151232768265173099533482325200135082196611776899131767046189738654148288813field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 1140u64\n ]\n}"}' +- child_outputs: + mid.aleo/dummy: + outputs: [] + inner.aleo/save_inner_rand: + outputs: + - '{"type":"future","id":"3781138230531216134803918113073564019590837492666786203651760435560048390574field","value":"{\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n}"}' + mid.aleo/save_mid_rand: + outputs: + - '{"type":"future","id":"1854222538487907081019921151742727624945465976988156169205987233789227119336field","value":"{\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n}"}' + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"980755046892470614607368500543837612430909182049571628417208493317193054184field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 78340u64\n ]\n}"}' +- child_outputs: + inner.aleo/save_inner_rand: + outputs: + - '{"type":"future","id":"1830717585596798770552682302518960343184861438855342797877280317303603466513field","value":"{\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n}"}' + mid.aleo/save_mid_rand: + outputs: + - '{"type":"future","id":"7936932634716586129080809761782643240019726776810406151200679219592309609450field","value":"{\n program_id: mid.aleo,\n function_name: save_mid_rand,\n arguments: [\n {\n program_id: inner.aleo,\n function_name: save_inner_rand,\n arguments: [\n 0field\n ]\n }\n \n ]\n}"}' + mid.aleo/dummy: + outputs: [] + credits.aleo/fee_public: + outputs: + - '{"type":"future","id":"6344729803713548482408907680045723475400123463965072084769348280630820289540field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1dg8dpzx0d53ajd87nhppq79z9vrvhelhh45frsqkusndtaasgcxqqs0ay8,\n 153515u64\n ]\n}"}' diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out b/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out index 6380117c04..0af538e48d 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out @@ -26,7 +26,7 @@ outputs: test_rand.aleo/rand_chacha_check: outputs: - '{"type":"future","id":"818878742790741579153893179075772445872751227433677932822653185952935999557field","value":"{\n program_id: test_rand.aleo,\n function_name: rand_chacha_check,\n arguments: [\n 1field,\n true\n ]\n}"}' - speculate: the execution was rejected + speculate: the execution was accepted add_next_block: succeeded. additional: - child_outputs: diff --git a/synthesizer/tests/tests/vm/execute_and_finalize/interleave_async_and_non_async.aleo b/synthesizer/tests/tests/vm/execute_and_finalize/interleave_async_and_non_async.aleo new file mode 100644 index 0000000000..a06d369a3a --- /dev/null +++ b/synthesizer/tests/tests/vm/execute_and_finalize/interleave_async_and_non_async.aleo @@ -0,0 +1,146 @@ +/* +randomness: 402893173 +cases: + - program: mid.aleo + function: save_mid_rand_2 + inputs: [0field] + - program: outer.aleo + function: call_mid_3 + inputs: [0field] + - program: outer.aleo + function: call_mid + inputs: [0field] + - program: outer.aleo + function: call_mid_2 + inputs: [0field] + - program: outer.aleo + function: dummy + inputs: [] + - program: outer.aleo + function: dummy + inputs: [] + - program: outer.aleo + function: dummy + inputs: [] + - program: outer.aleo + function: call_mid + inputs: [0field] + - program: outer.aleo + function: call_mid_2 + inputs: [0field] +*/ + +program inner.aleo; + +mapping rand_store: + key as u8.public; + value as u128.public; + +function save_inner_rand: + input r0 as field.public; + async save_inner_rand r0 into r1; + output r1 as inner.aleo/save_inner_rand.future; + +finalize save_inner_rand: + input r0 as field.public; + rand.chacha r0 into r1 as u128; + set r1 into rand_store[0u8]; + +function dummy: + +///////////////////////////////////////////////// + +import inner.aleo; + +program mid.aleo; + +mapping rand_store: + key as u8.public; + value as u128.public; + + +function save_mid_rand: + input r0 as field.public; + call inner.aleo/save_inner_rand r0 into r1; + async save_mid_rand r1 into r2; + output r2 as mid.aleo/save_mid_rand.future; + +finalize save_mid_rand: + input r0 as inner.aleo/save_inner_rand.future; + await r0; + rand.chacha into r1 as u128; + set r1 into rand_store[0u8]; + +// A call to `save_mid_rand_2` should be accepted because the non-async call is not a complex one. +function save_mid_rand_2: + input r0 as field.public; + call inner.aleo/dummy; + call inner.aleo/save_inner_rand r0 into r1; + async save_mid_rand_2 r1 into r2; + output r2 as mid.aleo/save_mid_rand_2.future; + +finalize save_mid_rand_2: + input r0 as inner.aleo/save_inner_rand.future; + await r0; + rand.chacha into r1 as u128; + set r1 into rand_store[0u8]; + +function dummy: + + +///////////////////////////////////////////////// + +import inner.aleo; +import mid.aleo; + +program outer.aleo; + +// A call to `call_mid` will be rejected if called before the `CONSENSUS_V3_HEIGHT` because the complex non-async call +// is before the async ones, triggering a known failure. +// If it is called after the `CONSENSUS_V3_HEIGHT`, then it should be accepted. +function call_mid: + input r0 as field.public; + call mid.aleo/dummy; + call mid.aleo/save_mid_rand r0 into r1; + call mid.aleo/dummy; + async call_mid r1 into r2; + output r2 as outer.aleo/call_mid.future; + +finalize call_mid: + input r0 as mid.aleo/save_mid_rand.future; + await r0; + +// A call to `call_mid_2` will be rejected if called before the `CONSENSUS_V3_HEIGHT` because the complex non-async call +// is before the async ones, triggering a known failure. +// If it is called after the `CONSENSUS_V3_HEIGHT`, then it should be accepted. +function call_mid_2: + input r0 as field.public; + call mid.aleo/save_mid_rand r0 into r1; + call mid.aleo/dummy; + call mid.aleo/save_mid_rand r0 into r2; + async call_mid_2 r1 r2 into r3; + output r3 as outer.aleo/call_mid_2.future; + +finalize call_mid_2: + input r0 as mid.aleo/save_mid_rand.future; + input r1 as mid.aleo/save_mid_rand.future; + await r1; + await r0; + +// A call to `call_mid_3` should be accepted because the non-async call is after the async ones. +function call_mid_3: + input r0 as field.public; + call mid.aleo/save_mid_rand r0 into r1; + call mid.aleo/save_mid_rand r0 into r2; + call mid.aleo/dummy; + async call_mid_3 r1 r2 into r3; + output r3 as outer.aleo/call_mid_3.future; + +finalize call_mid_3: + input r0 as mid.aleo/save_mid_rand.future; + input r1 as mid.aleo/save_mid_rand.future; + await r1; + await r0; + +function dummy: + diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index 8d6ca632a4..250a74d672 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-utilities" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Utilities for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -25,7 +25,7 @@ edition = "2021" [dependencies.snarkvm-utilities-derives] path = "./derives" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.aleo-std] diff --git a/utilities/derives/Cargo.toml b/utilities/derives/Cargo.toml index c92d70cf86..cf937bcd2e 100644 --- a/utilities/derives/Cargo.toml +++ b/utilities/derives/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-utilities-derives" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "Canonical serialization for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", diff --git a/vm/cli/helpers/updater.rs b/vm/cli/helpers/updater.rs index 7912cdfa03..5e4581872d 100644 --- a/vm/cli/helpers/updater.rs +++ b/vm/cli/helpers/updater.rs @@ -25,7 +25,7 @@ pub struct Updater; impl Updater { const SNARKVM_BIN_NAME: &'static str = "snarkvm"; const SNARKVM_REPO_NAME: &'static str = "snarkvm"; - const SNARKVM_REPO_OWNER: &'static str = "AleoNet"; + const SNARKVM_REPO_OWNER: &'static str = "ProvableHQ"; /// Show all available releases for `snarkvm`. #[allow(clippy::format_push_string)] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 7d39c22718..84c2b307a6 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "snarkvm-wasm" -version = "1.1.0" +version = "1.2.1" authors = [ "The Aleo Team " ] description = "WASM for a decentralized virtual machine" homepage = "https://aleo.org" -repository = "https://github.com/AleoNet/snarkVM" +repository = "https://github.com/ProvableHQ/snarkVM" keywords = [ "aleo", "cryptography", @@ -51,54 +51,54 @@ utilities = [ "snarkvm-utilities" ] [dependencies.snarkvm-circuit-network] path = "../circuit/network" -version = "=1.1.0" +version = "=1.2.1" features = [ "wasm" ] optional = true [dependencies.snarkvm-console] path = "../console" -version = "=1.1.0" +version = "=1.2.1" features = [ "wasm" ] optional = true [dependencies.snarkvm-curves] path = "../curves" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-fields] path = "../fields" -version = "=1.1.0" +version = "=1.2.1" optional = true [dependencies.snarkvm-ledger-block] path = "../ledger/block" -version = "=1.1.0" +version = "=1.2.1" features = [ "wasm" ] optional = true [dependencies.snarkvm-ledger-query] path = "../ledger/query" -version = "=1.1.0" +version = "=1.2.1" features = [ "async", "wasm" ] optional = true [dependencies.snarkvm-ledger-store] path = "../ledger/store" -version = "=1.1.0" +version = "=1.2.1" features = [ "wasm" ] optional = true [dependencies.snarkvm-synthesizer] path = "../synthesizer" -version = "=1.1.0" +version = "=1.2.1" default-features = false features = [ "async", "wasm" ] optional = true [dependencies.snarkvm-utilities] path = "../utilities" -version = "=1.1.0" +version = "=1.2.1" features = [ "wasm" ] optional = true
Howard Wu
Howard Wu

πŸ’» 🚧 πŸ€” πŸ‘€
Raymond Chu
Raymond Chu

πŸ’» 🚧 πŸ€” πŸ‘€
d0cd
d0cd

πŸ’» 🚧 πŸ€” πŸ‘€
Pratyush Mishra
Pratyush Mishra

πŸ’» 🚧 πŸ€” πŸ‘€
vicsn
vicsn

πŸ’» 🚧 πŸ“– πŸ‘€
ljedrz
ljedrz

πŸ’» πŸ”§ πŸ‘€
Mike Turner
Mike Turner

πŸ’» πŸ“– πŸ‘€
Howard Wu
Howard Wu

πŸ’» 🚧 πŸ€” πŸ‘€
Raymond Chu
Raymond Chu

πŸ’» 🚧 πŸ€” πŸ‘€
d0cd
d0cd

πŸ’» 🚧 πŸ€” πŸ‘€
Pratyush Mishra
Pratyush Mishra

πŸ’» 🚧 πŸ€” πŸ‘€
vicsn
vicsn

πŸ’» 🚧 πŸ“– πŸ‘€
ljedrz
ljedrz

πŸ’» πŸ”§ πŸ‘€
Mike Turner
Mike Turner

πŸ’» πŸ“– πŸ‘€
Collin Chin
Collin Chin

πŸ’» πŸ“– πŸ‘€
Alessandro Coglio
Alessandro Coglio

πŸ’» πŸ“– ⚠️
Niklas Long
Niklas Long

πŸ’»
jules
jules

πŸ’»
Ali Mousa
Ali Mousa

πŸ’»
Weikeng Chen
Weikeng Chen

πŸ’»
Evan Schott
Evan Schott

πŸ’»
Collin Chin
Collin Chin

πŸ’» πŸ“– πŸ‘€
Alessandro Coglio
Alessandro Coglio

πŸ’» πŸ“– ⚠️
Niklas Long
Niklas Long

πŸ’»
jules
jules

πŸ’»
Ali Mousa
Ali Mousa

πŸ’»
Weikeng Chen
Weikeng Chen

πŸ’»
Evan Schott
Evan Schott

πŸ’»
Max Bruce
Max Bruce

πŸ’»
zhiqiangxu
zhiqiangxu

πŸ’»
Javier RodrΓ­guez Chatruc
Javier RodrΓ­guez Chatruc

πŸ’»
Eduardo Morais
Eduardo Morais

πŸ’»
Maciej ZwoliΕ„ski
Maciej ZwoliΕ„ski

πŸ’»
Ivan Litteri
Ivan Litteri

πŸ’»
Francisco Strambini
Francisco Strambini

πŸ’»
Max Bruce
Max Bruce

πŸ’»
zhiqiangxu
zhiqiangxu

πŸ’»
Javier RodrΓ­guez Chatruc
Javier RodrΓ­guez Chatruc

πŸ’»
Eduardo Morais
Eduardo Morais

πŸ’»
Maciej ZwoliΕ„ski
Maciej ZwoliΕ„ski

πŸ’»
Ivan Litteri
Ivan Litteri

πŸ’»
Francisco Strambini
Francisco Strambini

πŸ’»
Haruka
Haruka

πŸ› πŸ’»
StarLI-Trapdoor
StarLI-Trapdoor

πŸ’»
Vesa-Ville
Vesa-Ville

πŸ’»
Jos Dehaes
Jos Dehaes

πŸ’»
apruden2008
apruden2008

πŸ’»
Evan Marshall
Evan Marshall

πŸ› πŸ’»
Psi Vesely
Psi Vesely

πŸ’»
Haruka
Haruka

πŸ› πŸ’»
StarLI-Trapdoor
StarLI-Trapdoor

πŸ’»
Vesa-Ville
Vesa-Ville

πŸ’»
Jos Dehaes
Jos Dehaes

πŸ’»
apruden2008
apruden2008

πŸ’»
Evan Marshall
Evan Marshall

πŸ› πŸ’»
Psi Vesely
Psi Vesely

πŸ’»
swift-mx
swift-mx

πŸ’»
Nacho Avecilla
Nacho Avecilla

πŸ’»
qy3u
qy3u

πŸ’»
Yt
Yt

πŸ’»
Kostyan
Kostyan

πŸ’»
stanlagermin
stanlagermin

πŸ’»
Sukey
Sukey

πŸ’»
swift-mx
swift-mx

πŸ’»
Nacho Avecilla
Nacho Avecilla

πŸ’»
qy3u
qy3u

πŸ’»
Yt
Yt

πŸ’»
Kostyan
Kostyan

πŸ’»
stanlagermin
stanlagermin

πŸ’»
Sukey
Sukey

πŸ’»
Alex Zhao
Alex Zhao

πŸ’»
ghost ant
ghost ant

πŸ’»
Psi Vesely
Psi Vesely

πŸ’»
Dependabot
Dependabot

πŸ’»
Dependabot Preview
Dependabot Preview

πŸ’»
All Contributors
All Contributors

πŸ“–
Alex Zhao
Alex Zhao

πŸ’»
ghost ant
ghost ant

πŸ’»
Psi Vesely
Psi Vesely

πŸ’»
Dependabot
Dependabot

πŸ’»
Dependabot Preview
Dependabot Preview

πŸ’»
All Contributors
All Contributors

πŸ“–