diff --git a/.circleci/config.yml b/.circleci/config.yml index 9aeb00d3cb..4aad608529 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,7 +60,7 @@ commands: parameters: cache_key: type: string - default: snarkvm-stable-cache + default: v1.0.0-rust-1.81.0-snarkvm-stable-cache steps: - run: set -e - run: @@ -88,7 +88,7 @@ commands: parameters: cache_key: type: string - default: snarkvm-stable-cache + default: v1.0.0-rust-1.81.0-snarkvm-stable-cache steps: - run: (sccache -s || true) - run: set +e @@ -154,7 +154,7 @@ commands: jobs: snarkvm: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.large >> steps: - checkout @@ -164,511 +164,511 @@ jobs: algorithms: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.large >> steps: - run_serial: workspace_member: algorithms - cache_key: v1-snarkvm-algorithms-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-algorithms-cache algorithms-profiler: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: # This runs a single test with profiler enabled workspace_member: algorithms - cache_key: v1-snarkvm-algorithms-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-algorithms-cache flags: varuna::prove_and_verify_with_square_matrix --features profiler circuit: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit - cache_key: v1-snarkvm-circuit-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-cache circuit-account: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/account - cache_key: v1-snarkvm-circuit-account-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-account-cache # This checks that no `console` structs are used in core circuit logic. circuit-account-noconsole: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/account flags: --no-default-features - cache_key: v1-snarkvm-circuit-account-noconsole-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-account-noconsole-cache circuit-algorithms: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: circuit/algorithms - cache_key: v1-snarkvm-circuit-algorithms-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-algorithms-cache circuit-collections: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: workspace_member: circuit/collections - cache_key: v1-snarkvm-circuit-collections-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-collections-cache # This checks that no `console` structs are used in core circuit logic. circuit-collections-noconsole: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: workspace_member: circuit/collections flags: --no-default-features - cache_key: v1-snarkvm-circuit-collections-noconsole-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-collections-noconsole-cache circuit-environment: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/environment - cache_key: v1-snarkvm-circuit-environment-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-environment-cache circuit-network: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/network - cache_key: v1-snarkvm-circuit-network-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-network-cache circuit-program: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: circuit/program - cache_key: v1-snarkvm-circuit-program-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-program-cache circuit-types: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types - cache_key: v1-snarkvm-circuit-types-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-cache circuit-types-address: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types/address - cache_key: v1-snarkvm-circuit-types-address-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-address-cache circuit-types-boolean: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types/boolean - cache_key: v1-snarkvm-circuit-types-boolean-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-boolean-cache circuit-types-field: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types/field - cache_key: v1-snarkvm-circuit-types-field-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-field-cache circuit-types-group: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types/group - cache_key: v1-snarkvm-circuit-types-group-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-group-cache circuit-types-integers: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: workspace_member: circuit/types/integers - cache_key: v1-snarkvm-circuit-types-integers-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-integers-cache flags: -- --ignored circuit-types-scalar: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types/scalar - cache_key: v1-snarkvm-circuit-types-scalar-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-scalar-cache circuit-types-string: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: circuit/types/string - cache_key: v1-snarkvm-circuit-types-string-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-circuit-types-string-cache console: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console - cache_key: v1-snarkvm-console-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-cache console-account: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: console/account - cache_key: v1-snarkvm-console-account-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-account-cache console-algorithms: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/algorithms - cache_key: v1-snarkvm-console-algorithms-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-algorithms-cache console-collections: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: workspace_member: console/collections - cache_key: v1-snarkvm-console-collections-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-collections-cache console-network: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/network - cache_key: v1-snarkvm-console-network-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-network-cache console-network-environment: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/network/environment - cache_key: v1-snarkvm-console-network-environment-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-network-environment-cache console-program: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/program - cache_key: v1-snarkvm-console-program-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-program-cache console-types: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types - cache_key: v1-snarkvm-console-types-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-cache console-types-address: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/address - cache_key: v1-snarkvm-console-types-address-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-address-cache console-types-boolean: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/boolean - cache_key: v1-snarkvm-console-types-boolean-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-boolean-cache console-types-field: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/field - cache_key: v1-snarkvm-console-types-field-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-field-cache console-types-group: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/group - cache_key: v1-snarkvm-console-types-group-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-group-cache console-types-integers: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/integers - cache_key: v1-snarkvm-console-types-integers-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-integers-cache console-types-scalar: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/scalar - cache_key: v1-snarkvm-console-types-scalar-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-scalar-cache console-types-string: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: console/types/string - cache_key: v1-snarkvm-console-types-string-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-console-types-string-cache curves: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: curves - cache_key: v1-snarkvm-curves-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-curves-cache fields: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: fields - cache_key: v1-snarkvm-fields-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-fields-cache ledger: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: workspace_member: ledger - cache_key: v1-snarkvm-ledger-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-cache ledger-with-rocksdb: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: flags: --features=rocks workspace_member: ledger - cache_key: v1-snarkvm-ledger-with-rocksdb-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-with-rocksdb-cache ledger-with-valid-solutions: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: valid_solutions --features=test workspace_member: ledger - cache_key: v1-snarkvm-ledger-with-valid-solutions-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-with-valid-solutions-cache ledger-authority: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/authority - cache_key: v1-snarkvm-ledger-authority-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-authority-cache ledger-block: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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: workspace_member: ledger/block - cache_key: v1-snarkvm-ledger-block-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-block-cache ledger-committee: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: ledger/committee - cache_key: v1-snarkvm-ledger-committee-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-committee-cache ledger-narwhal: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/narwhal - cache_key: v1-snarkvm-ledger-narwhal-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-cache ledger-narwhal-batch-certificate: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: ledger/narwhal/batch-certificate - cache_key: v1-snarkvm-ledger-narwhal-batch-certificate-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-batch-certificate-cache ledger-narwhal-batch-header: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/narwhal/batch-header - cache_key: v1-snarkvm-ledger-narwhal-batch-header-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-batch-header-cache ledger-narwhal-data: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/narwhal/data - cache_key: v1-snarkvm-ledger-narwhal-data-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-data-cache ledger-narwhal-subdag: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: ledger/narwhal/subdag - cache_key: v1-snarkvm-ledger-narwhal-subdag-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-subdag-cache ledger-narwhal-transmission: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: ledger/narwhal/transmission - cache_key: v1-snarkvm-ledger-narwhal-transmission-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-transmission-cache ledger-narwhal-transmission-id: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: ledger/narwhal/transmission-id - cache_key: v1-snarkvm-ledger-narwhal-transmission-id-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-narwhal-transmission-id-cache ledger-puzzle: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/puzzle - cache_key: v1-snarkvm-ledger-puzzle-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-puzzle-cache ledger-puzzle-epoch: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/puzzle/epoch - cache_key: v1-snarkvm-ledger-puzzle-epoch-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-puzzle-epoch-cache ledger-query: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: ledger/query - cache_key: v1-snarkvm-ledger-query-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-query-cache ledger-store: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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: --features=rocks workspace_member: ledger/store - cache_key: v1-snarkvm-ledger-store-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-store-cache ledger-test-helpers: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: workspace_member: ledger/test-helpers - cache_key: v1-snarkvm-ledger-test-helpers-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-ledger-test-helpers-cache parameters: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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-threads=2 workspace_member: parameters - cache_key: v1-snarkvm-parameters-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-parameters-cache parameters-uncached: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.large >> steps: - run_serial: @@ -678,159 +678,159 @@ jobs: synthesizer: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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: --lib --bins -- --test-threads=2 workspace_member: synthesizer - cache_key: v1-snarkvm-synthesizer-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-cache synthesizer-integration: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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 workspace_member: synthesizer - cache_key: v1-snarkvm-synthesizer-integration-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-integration-cache synthesizer-process: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: -- --test-threads=8 workspace_member: synthesizer/process - cache_key: v1-snarkvm-synthesizer-process-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-process-cache synthesizer-process-with-rocksdb: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: --features=rocks workspace_member: synthesizer/process - cache_key: v1-snarkvm-synthesizer-process-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-process-cache synthesizer-program: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: --lib --bins workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-cache synthesizer-program-integration: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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 '*' -- --skip keccak --skip psd --skip sha --skip instruction::is --skip instruction::equal --skip instruction::commit workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-integration-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-integration-cache synthesizer-program-integration-keccak: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: keccak --test '*' workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-keccak-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-keccak-cache synthesizer-program-integration-psd: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: psd --test '*' workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-psd-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-psd-cache synthesizer-program-integration-sha: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: sha --test '*' workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-sha-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-sha-cache synthesizer-program-integration-instruction-is: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - 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: instruction::is --test '*' workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-is-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-is-cache synthesizer-program-integration-instruction-equal: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - run_serial: flags: instruction::equal --test '*' workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-equal-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-equal-cache synthesizer-program-integration-instruction-commit: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - run_serial: flags: instruction::commit --test '*' workspace_member: synthesizer/program - cache_key: v1-snarkvm-synthesizer-program-commit-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-program-commit-cache synthesizer-snark: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: synthesizer/snark - cache_key: v1-snarkvm-synthesizer-snark-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-synthesizer-snark-cache utilities: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.large >> steps: - run_serial: workspace_member: utilities - cache_key: v1-snarkvm-utilities-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-utilities-cache utilities-derives: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - run_serial: workspace_member: utilities/derives - cache_key: v1-snarkvm-utilities-derives-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-utilities-derives-cache wasm: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - checkout - setup_environment: - cache_key: v1-snarkvm-wasm-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-wasm-cache - run: no_output_timeout: 30m command: | @@ -839,32 +839,32 @@ jobs: cd wasm && wasm-pack test --node # cargo test --target wasm32-unknown-unknown - clear_environment: - cache_key: v1-snarkvm-wasm-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-wasm-cache check-fmt: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.medium >> steps: - checkout - install_rust_nightly - setup_environment: - cache_key: v1-snarkvm-fmt-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-fmt-cache - run: name: Check style no_output_timeout: 35m command: cargo +nightly fmt --all -- --check - clear_environment: - cache_key: v1-snarkvm-fmt-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-fmt-cache check-clippy: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.xlarge >> steps: - checkout - setup_environment: - cache_key: v1-snarkvm-clippy-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-clippy-cache - run: name: Check Clippy no_output_timeout: 35m @@ -872,22 +872,22 @@ jobs: cargo clippy --workspace --all-targets -- -D warnings cargo clippy --workspace --all-targets --all-features -- -D warnings - clear_environment: - cache_key: v1-snarkvm-clippy-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-clippy-cache check-all-targets: docker: - - image: cimg/rust:1.76.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well + - image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well resource_class: << pipeline.parameters.small >> steps: - checkout - setup_environment: - cache_key: v1-snarkvm-all-targets-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-all-targets-cache - run: name: Check all targets no_output_timeout: 35m command: cargo check --release --workspace --all-targets - clear_environment: - cache_key: v1-snarkvm-all-targets-cache + cache_key: v1.0.0-rust-1.81.0-snarkvm-all-targets-cache verify-windows: executor: diff --git a/Cargo.toml b/Cargo.toml index 528cc42cb0..01dda7a469 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ categories = [ include = [ "Cargo.toml", "vm", "README.md", "LICENSE.md" ] license = "Apache-2.0" edition = "2021" -rust-version = "1.76.0" +rust-version = "1.81.0" # Attention - Change the MSRV in rust-toolchain and in .circleci/config.yml as well [workspace] members = [ diff --git a/algorithms/cuda/build.rs b/algorithms/cuda/build.rs index e97eba0ec7..174110d885 100644 --- a/algorithms/cuda/build.rs +++ b/algorithms/cuda/build.rs @@ -18,9 +18,6 @@ use std::{env, path::PathBuf}; fn main() { let curve = "FEATURE_BLS12_377"; - // account for cross-compilation [by examining environment variable] - let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); - // Set CC environment variable to choose an alternative C compiler. // Optimization level depends on whether or not --release is passed // or implied. @@ -30,28 +27,22 @@ fn main() { let files = vec![c_src_dir.join("lib.c")]; let mut cc_opt = None; - match (cfg!(feature = "portable"), cfg!(feature = "force-adx")) { - (true, false) => { + match cfg!(feature = "portable") { + true => { println!("Compiling in portable mode without ISA extensions"); cc_opt = Some("__BLST_PORTABLE__"); } - (false, true) => { - if target_arch.eq("x86_64") { - println!("Enabling ADX support via `force-adx` feature"); - cc_opt = Some("__ADX__"); - } else { - println!("`force-adx` is ignored for non-x86_64 targets"); - } - } - (false, false) => - { + false => { #[cfg(target_arch = "x86_64")] - if target_arch.eq("x86_64") && std::is_x86_feature_detected!("adx") { - println!("Enabling ADX because it was detected on the host"); - cc_opt = Some("__ADX__"); + { + // account for cross-compilation [by examining environment variable] + let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); + if target_arch.eq("x86_64") && std::is_x86_feature_detected!("adx") { + println!("Enabling ADX because it was detected on the host"); + cc_opt = Some("__ADX__"); + } } } - (true, true) => panic!("Cannot compile with both `portable` and `force-adx` features"), } cc.flag_if_supported("-mno-avx") // avoid costly transitions @@ -86,8 +77,6 @@ fn main() { nvcc.flag("-Xcompiler").flag("-Wno-unused-function"); nvcc.flag("-Xcompiler").flag("-Wno-subobject-linkage"); nvcc.define("TAKE_RESPONSIBILITY_FOR_ERROR_MESSAGE", None); - #[cfg(feature = "cuda-mobile")] - nvcc.define("NTHREADS", "128"); nvcc.define(curve, None); if let Some(def) = cc_opt { nvcc.define(def, None); diff --git a/algorithms/src/r1cs/test_constraint_system.rs b/algorithms/src/r1cs/test_constraint_system.rs index 267ae50a45..6995e80e56 100644 --- a/algorithms/src/r1cs/test_constraint_system.rs +++ b/algorithms/src/r1cs/test_constraint_system.rs @@ -24,6 +24,7 @@ use itertools::Itertools; /// This field is the scalar field (Fr) of BLS12-377. pub type Fr = snarkvm_curves::bls12_377::Fr; +#[allow(dead_code)] #[derive(Debug, Clone)] enum NamedObject { Constraint(usize), diff --git a/algorithms/src/snark/varuna/ahp/indexer/indexer.rs b/algorithms/src/snark/varuna/ahp/indexer/indexer.rs index 1bdb09633d..b89889d344 100644 --- a/algorithms/src/snark/varuna/ahp/indexer/indexer.rs +++ b/algorithms/src/snark/varuna/ahp/indexer/indexer.rs @@ -37,7 +37,6 @@ use std::collections::BTreeMap; #[cfg(not(feature = "serial"))] use rayon::prelude::*; -#[cfg(not(feature = "std"))] use snarkvm_utilities::println; use super::Matrix; diff --git a/algorithms/src/snark/varuna/ahp/prover/round_functions/mod.rs b/algorithms/src/snark/varuna/ahp/prover/round_functions/mod.rs index 67694956cb..652d58bb55 100644 --- a/algorithms/src/snark/varuna/ahp/prover/round_functions/mod.rs +++ b/algorithms/src/snark/varuna/ahp/prover/round_functions/mod.rs @@ -29,9 +29,7 @@ use rand::Rng; use rand_core::CryptoRng; use std::collections::BTreeMap; -use snarkvm_utilities::cfg_iter; -#[cfg(not(feature = "std"))] -use snarkvm_utilities::println; +use snarkvm_utilities::{cfg_iter, println}; #[cfg(not(feature = "serial"))] use rayon::prelude::*; diff --git a/algorithms/src/snark/varuna/varuna.rs b/algorithms/src/snark/varuna/varuna.rs index d14bc6a78d..f4fa998a14 100644 --- a/algorithms/src/snark/varuna/varuna.rs +++ b/algorithms/src/snark/varuna/varuna.rs @@ -54,7 +54,6 @@ use rand::{CryptoRng, Rng}; use std::{borrow::Borrow, collections::BTreeMap, ops::Deref, sync::Arc}; use crate::srs::UniversalProver; -#[cfg(not(feature = "std"))] use snarkvm_utilities::println; /// The Varuna proof system. diff --git a/circuit/account/src/compute_key/equal.rs b/circuit/account/src/compute_key/equal.rs index 591137d341..83661d7fcb 100644 --- a/circuit/account/src/compute_key/equal.rs +++ b/circuit/account/src/compute_key/equal.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl Equal for ComputeKey { type Output = Boolean; @@ -67,7 +67,7 @@ impl OutputMode, Output = Boolean>> for Comp } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -98,12 +98,12 @@ mod tests { console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(), ); - CurrentAleo::scope(&format!("{mode_a} {mode_a} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_a} {i}"), || { let equals = a.is_equal(&a); assert!(equals.eject_value()); }); - CurrentAleo::scope(&format!("{mode_a} {mode_b} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_b} {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -131,12 +131,12 @@ mod tests { console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(), ); - CurrentAleo::scope(&format!("{mode_a} {mode_a} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_a} {i}"), || { let equals = a.is_not_equal(&a); assert!(!equals.eject_value()); }); - CurrentAleo::scope(&format!("{mode_a} {mode_b} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_b} {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/account/src/compute_key/from.rs b/circuit/account/src/compute_key/from.rs index d9f36f9d54..a3a8557e82 100644 --- a/circuit/account/src/compute_key/from.rs +++ b/circuit/account/src/compute_key/from.rs @@ -25,7 +25,7 @@ impl From<(Group, Group)> for ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -50,7 +50,7 @@ mod tests { let pk_sig = Group::new(mode, compute_key.pk_sig()); let pr_sig = Group::new(mode, compute_key.pr_sig()); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = ComputeKey::::from((pk_sig, pr_sig)); assert_eq!(compute_key, candidate.eject_value()); if i > 0 { diff --git a/circuit/account/src/compute_key/from_private_key.rs b/circuit/account/src/compute_key/from_private_key.rs index 96488f04ea..e0c7d0aecf 100644 --- a/circuit/account/src/compute_key/from_private_key.rs +++ b/circuit/account/src/compute_key/from_private_key.rs @@ -33,7 +33,7 @@ impl ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -56,7 +56,7 @@ mod tests { // Initialize the private key. let private_key = PrivateKey::::new(mode, private_key); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = ComputeKey::from_private_key(&private_key); assert_eq!(compute_key, candidate.eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/account/src/compute_key/helpers/from_bits.rs b/circuit/account/src/compute_key/helpers/from_bits.rs index 1fef99c4ed..0e8c0b6466 100644 --- a/circuit/account/src/compute_key/helpers/from_bits.rs +++ b/circuit/account/src/compute_key/helpers/from_bits.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl FromBits for ComputeKey { type Boolean = Boolean; @@ -54,7 +54,7 @@ impl FromBits for ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -73,7 +73,7 @@ mod tests { let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(); let candidate = ComputeKey::::new(mode, expected).to_bits_le(); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = ComputeKey::::from_bits_le(&candidate); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -90,7 +90,7 @@ mod tests { let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(); let candidate = ComputeKey::::new(mode, expected).to_bits_be(); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = ComputeKey::::from_bits_be(&candidate); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/account/src/compute_key/helpers/to_bits.rs b/circuit/account/src/compute_key/helpers/to_bits.rs index b2dcb7f0c4..21fdad5fb7 100644 --- a/circuit/account/src/compute_key/helpers/to_bits.rs +++ b/circuit/account/src/compute_key/helpers/to_bits.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl ToBits for ComputeKey { type Boolean = Boolean; @@ -30,7 +30,7 @@ impl ToBits for ComputeKey { } } -#[cfg(console)] +#[cfg(feature = "console")] impl ToBits for &ComputeKey { type Boolean = Boolean; @@ -51,7 +51,7 @@ impl ToBits for &ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -72,7 +72,7 @@ mod tests { let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(); let candidate = ComputeKey::::new(mode, expected); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_le(); assert_eq!(expected_number_of_bits, candidate.len()); @@ -99,7 +99,7 @@ mod tests { let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(); let candidate = ComputeKey::::new(mode, expected); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_be(); assert_eq!(expected_number_of_bits, candidate.len()); diff --git a/circuit/account/src/compute_key/helpers/to_fields.rs b/circuit/account/src/compute_key/helpers/to_fields.rs index 15d3b4f2e5..b4281e750f 100644 --- a/circuit/account/src/compute_key/helpers/to_fields.rs +++ b/circuit/account/src/compute_key/helpers/to_fields.rs @@ -24,7 +24,7 @@ impl ToFields for ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -45,7 +45,7 @@ mod tests { let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(); let candidate = ComputeKey::::new(mode, expected); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = candidate.to_fields(); assert_eq!(candidate.len(), 2); diff --git a/circuit/account/src/compute_key/mod.rs b/circuit/account/src/compute_key/mod.rs index 21f8640ea7..68a1507253 100644 --- a/circuit/account/src/compute_key/mod.rs +++ b/circuit/account/src/compute_key/mod.rs @@ -37,7 +37,7 @@ pub struct ComputeKey { sk_prf: Scalar, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for ComputeKey { type Primitive = console::ComputeKey; @@ -69,7 +69,7 @@ impl ComputeKey { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for ComputeKey { type Primitive = console::ComputeKey; @@ -87,7 +87,7 @@ impl Eject for ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] pub(crate) mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; diff --git a/circuit/account/src/compute_key/ternary.rs b/circuit/account/src/compute_key/ternary.rs index 38ce5ba1e7..85128d63e9 100644 --- a/circuit/account/src/compute_key/ternary.rs +++ b/circuit/account/src/compute_key/ternary.rs @@ -59,7 +59,7 @@ impl OutputMode, Output = Self>> for C } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/account/src/compute_key/to_address.rs b/circuit/account/src/compute_key/to_address.rs index 4f34c62a48..2d25308bb9 100644 --- a/circuit/account/src/compute_key/to_address.rs +++ b/circuit/account/src/compute_key/to_address.rs @@ -25,7 +25,7 @@ impl ComputeKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -48,7 +48,7 @@ mod tests { // Initialize the compute key. let candidate = ComputeKey::::new(mode, compute_key); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_address(); assert_eq!(*address, candidate.to_group().eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/account/src/graph_key/mod.rs b/circuit/account/src/graph_key/mod.rs index 4cfd64ef08..2f357682f9 100644 --- a/circuit/account/src/graph_key/mod.rs +++ b/circuit/account/src/graph_key/mod.rs @@ -24,7 +24,7 @@ pub struct GraphKey { sk_tag: Field, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for GraphKey { type Primitive = console::GraphKey; @@ -44,7 +44,7 @@ impl GraphKey { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for GraphKey { type Primitive = console::GraphKey; @@ -62,7 +62,7 @@ impl Eject for GraphKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] pub(crate) mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; diff --git a/circuit/account/src/lib.rs b/circuit/account/src/lib.rs index a405b0fa36..836f7248e6 100644 --- a/circuit/account/src/lib.rs +++ b/circuit/account/src/lib.rs @@ -34,7 +34,7 @@ pub use signature::*; pub mod view_key; pub use view_key::*; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] pub(crate) mod helpers { use snarkvm_circuit_network::AleoV0; use snarkvm_circuit_types::environment::Environment; diff --git a/circuit/account/src/private_key/mod.rs b/circuit/account/src/private_key/mod.rs index 14df2759ee..58c6890e18 100644 --- a/circuit/account/src/private_key/mod.rs +++ b/circuit/account/src/private_key/mod.rs @@ -30,7 +30,7 @@ pub struct PrivateKey { r_sig: Scalar, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for PrivateKey { type Primitive = console::PrivateKey; @@ -52,7 +52,7 @@ impl PrivateKey { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for PrivateKey { type Primitive = (console::Scalar, console::Scalar); @@ -67,7 +67,7 @@ impl Eject for PrivateKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; diff --git a/circuit/account/src/private_key/to_compute_key.rs b/circuit/account/src/private_key/to_compute_key.rs index 491a4b966d..2150da9191 100644 --- a/circuit/account/src/private_key/to_compute_key.rs +++ b/circuit/account/src/private_key/to_compute_key.rs @@ -22,7 +22,7 @@ impl PrivateKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -45,7 +45,7 @@ mod tests { // Initialize the private key. let candidate = PrivateKey::::new(mode, private_key); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_compute_key(); assert_eq!(compute_key, candidate.eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/account/src/private_key/to_view_key.rs b/circuit/account/src/private_key/to_view_key.rs index 963b06f7ca..5544a769da 100644 --- a/circuit/account/src/private_key/to_view_key.rs +++ b/circuit/account/src/private_key/to_view_key.rs @@ -22,7 +22,7 @@ impl PrivateKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -45,7 +45,7 @@ mod tests { // Initialize the private key. let candidate = PrivateKey::::new(mode, private_key); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_view_key(); assert_eq!(view_key, candidate.eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/account/src/signature/equal.rs b/circuit/account/src/signature/equal.rs index 7d4d1b5100..b4da29cfe7 100644 --- a/circuit/account/src/signature/equal.rs +++ b/circuit/account/src/signature/equal.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl Equal for Signature { type Output = Boolean; @@ -67,7 +67,7 @@ impl OutputMode, Output = Boolean>> for Signa } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -92,12 +92,12 @@ mod tests { let a = Signature::::new(mode_a, crate::helpers::generate_signature(i, rng)); let b = Signature::::new(mode_b, crate::helpers::generate_signature(i, rng)); - CurrentAleo::scope(&format!("{mode_a} {mode_a} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_a} {i}"), || { let equals = a.is_equal(&a); assert!(equals.eject_value()); }); - CurrentAleo::scope(&format!("{mode_a} {mode_b} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_b} {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -119,12 +119,12 @@ mod tests { let a = Signature::::new(mode_a, crate::helpers::generate_signature(i, rng)); let b = Signature::::new(mode_b, crate::helpers::generate_signature(i, rng)); - CurrentAleo::scope(&format!("{mode_a} {mode_a} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_a} {i}"), || { let equals = a.is_not_equal(&a); assert!(!equals.eject_value()); }); - CurrentAleo::scope(&format!("{mode_a} {mode_b} {i}"), || { + CurrentAleo::scope(format!("{mode_a} {mode_b} {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/account/src/signature/helpers/from_bits.rs b/circuit/account/src/signature/helpers/from_bits.rs index e79ab24e68..1d8d8737d6 100644 --- a/circuit/account/src/signature/helpers/from_bits.rs +++ b/circuit/account/src/signature/helpers/from_bits.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl FromBits for Signature { type Boolean = Boolean; @@ -72,7 +72,7 @@ impl FromBits for Signature { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -91,7 +91,7 @@ mod tests { let expected = crate::helpers::generate_signature(i, rng); let candidate = Signature::::new(mode, expected).to_bits_le(); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = Signature::::from_bits_le(&candidate); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -108,7 +108,7 @@ mod tests { let expected = crate::helpers::generate_signature(i, rng); let candidate = Signature::::new(mode, expected).to_bits_be(); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = Signature::::from_bits_be(&candidate); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/account/src/signature/helpers/to_bits.rs b/circuit/account/src/signature/helpers/to_bits.rs index df0edd9085..d924e0bfa0 100644 --- a/circuit/account/src/signature/helpers/to_bits.rs +++ b/circuit/account/src/signature/helpers/to_bits.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl ToBits for Signature { type Boolean = Boolean; @@ -30,7 +30,7 @@ impl ToBits for Signature { } } -#[cfg(console)] +#[cfg(feature = "console")] impl ToBits for &Signature { type Boolean = Boolean; @@ -55,7 +55,7 @@ impl ToBits for &Signature { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; @@ -76,7 +76,7 @@ mod tests { let expected = crate::helpers::generate_signature(i, rng); let candidate = Signature::::new(mode, expected); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_le(); assert_eq!(expected_number_of_bits, candidate.len()); @@ -104,7 +104,7 @@ mod tests { let expected = crate::helpers::generate_signature(i, rng); let candidate = Signature::::new(mode, expected); - CurrentAleo::scope(&format!("{mode} {i}"), || { + CurrentAleo::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_be(); assert_eq!(expected_number_of_bits, candidate.len()); diff --git a/circuit/account/src/signature/helpers/to_fields.rs b/circuit/account/src/signature/helpers/to_fields.rs index f7137e3584..20c945917c 100644 --- a/circuit/account/src/signature/helpers/to_fields.rs +++ b/circuit/account/src/signature/helpers/to_fields.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl ToFields for Signature { type Field = Field; @@ -27,7 +27,7 @@ impl ToFields for Signature { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/account/src/signature/mod.rs b/circuit/account/src/signature/mod.rs index 3fcb2b7d49..8583113a48 100644 --- a/circuit/account/src/signature/mod.rs +++ b/circuit/account/src/signature/mod.rs @@ -35,7 +35,7 @@ pub struct Signature { compute_key: ComputeKey, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Signature { type Primitive = console::Signature; @@ -66,7 +66,7 @@ impl Signature { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Signature { type Primitive = console::Signature; @@ -81,7 +81,7 @@ impl Eject for Signature { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Signature { /// Parses a string into a signature circuit. #[inline] @@ -98,7 +98,7 @@ impl Parser for Signature { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Signature { type Err = Error; @@ -117,7 +117,7 @@ impl FromStr for Signature { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Signature { /// Returns the type name of the circuit as a string. #[inline] @@ -126,21 +126,21 @@ impl TypeName for Signature { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Signature { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Signature { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; diff --git a/circuit/account/src/signature/ternary.rs b/circuit/account/src/signature/ternary.rs index 897805545c..2fdf9b6e20 100644 --- a/circuit/account/src/signature/ternary.rs +++ b/circuit/account/src/signature/ternary.rs @@ -59,7 +59,7 @@ impl OutputMode, Output = Self>> for S } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/account/src/signature/verify.rs b/circuit/account/src/signature/verify.rs index f0c78c257c..1dd98f89e3 100644 --- a/circuit/account/src/signature/verify.rs +++ b/circuit/account/src/signature/verify.rs @@ -42,7 +42,7 @@ impl Signature { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] pub(crate) mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -74,7 +74,7 @@ pub(crate) mod tests { let signature = Signature::::new(mode, signature); let address = Address::new(mode, address); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = signature.verify(&address, &message); assert!(candidate.eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. @@ -114,7 +114,7 @@ pub(crate) mod tests { let signature = Signature::::new(mode, signature); let address = Address::new(mode, address); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = signature.verify(&address, &message); assert!(candidate.eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/account/src/view_key/from_private_key.rs b/circuit/account/src/view_key/from_private_key.rs index 53b135fdd6..d0ab79a4bc 100644 --- a/circuit/account/src/view_key/from_private_key.rs +++ b/circuit/account/src/view_key/from_private_key.rs @@ -25,7 +25,7 @@ impl ViewKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -48,7 +48,7 @@ mod tests { // Initialize the private key. let private_key = PrivateKey::::new(mode, private_key); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = ViewKey::from_private_key(&private_key); assert_eq!(view_key, candidate.eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/account/src/view_key/mod.rs b/circuit/account/src/view_key/mod.rs index 207dd50db6..1227ef6f7a 100644 --- a/circuit/account/src/view_key/mod.rs +++ b/circuit/account/src/view_key/mod.rs @@ -28,7 +28,7 @@ use core::ops::Deref; /// The account view key is able to decrypt records and ciphertext. pub struct ViewKey(Scalar, OnceCell>); -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for ViewKey { type Primitive = console::ViewKey; @@ -38,7 +38,7 @@ impl Inject for ViewKey { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for ViewKey { type Primitive = console::ViewKey; @@ -61,7 +61,7 @@ impl Deref for ViewKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; diff --git a/circuit/account/src/view_key/to_address.rs b/circuit/account/src/view_key/to_address.rs index 8a3bdd3c0e..f4aa01e0a1 100644 --- a/circuit/account/src/view_key/to_address.rs +++ b/circuit/account/src/view_key/to_address.rs @@ -22,7 +22,7 @@ impl ViewKey { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, helpers::generate_account}; @@ -45,7 +45,7 @@ mod tests { // Initialize the view key. let candidate = ViewKey::::new(mode, view_key); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_address(); assert_eq!(*address, candidate.to_group().eject_value()); // TODO (howardwu): Resolve skipping the cost count checks for the burn-in round. diff --git a/circuit/algorithms/src/bhp/commit.rs b/circuit/algorithms/src/bhp/commit.rs index cf15a7a278..3d14287636 100644 --- a/circuit/algorithms/src/bhp/commit.rs +++ b/circuit/algorithms/src/bhp/commit.rs @@ -26,7 +26,7 @@ impl Commit for BH } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/bhp/commit_uncompressed.rs b/circuit/algorithms/src/bhp/commit_uncompressed.rs index 28320478f3..ba79a19055 100644 --- a/circuit/algorithms/src/bhp/commit_uncompressed.rs +++ b/circuit/algorithms/src/bhp/commit_uncompressed.rs @@ -36,7 +36,7 @@ impl CommitUncompr } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/bhp/hash.rs b/circuit/algorithms/src/bhp/hash.rs index b4c25d1004..54839026d0 100644 --- a/circuit/algorithms/src/bhp/hash.rs +++ b/circuit/algorithms/src/bhp/hash.rs @@ -25,7 +25,7 @@ impl Hash for BHP< } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/bhp/hash_uncompressed.rs b/circuit/algorithms/src/bhp/hash_uncompressed.rs index 00ecec0ef8..4179c545e3 100644 --- a/circuit/algorithms/src/bhp/hash_uncompressed.rs +++ b/circuit/algorithms/src/bhp/hash_uncompressed.rs @@ -71,7 +71,7 @@ impl HashUncompres } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/bhp/hasher/hash_uncompressed.rs b/circuit/algorithms/src/bhp/hasher/hash_uncompressed.rs index 22c721f9aa..7872933e80 100644 --- a/circuit/algorithms/src/bhp/hasher/hash_uncompressed.rs +++ b/circuit/algorithms/src/bhp/hasher/hash_uncompressed.rs @@ -180,7 +180,7 @@ impl HashUncompres } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/bhp/hasher/mod.rs b/circuit/algorithms/src/bhp/hasher/mod.rs index 57fa428191..a79715a29b 100644 --- a/circuit/algorithms/src/bhp/hasher/mod.rs +++ b/circuit/algorithms/src/bhp/hasher/mod.rs @@ -15,7 +15,7 @@ mod hash_uncompressed; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] use snarkvm_circuit_types::environment::assert_scope; use crate::HashUncompressed; @@ -56,7 +56,7 @@ impl BHPHasher Inject for BHPHasher { type Primitive = console::BHP; @@ -100,7 +100,7 @@ impl Inject for BH } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::{Circuit, Eject}; diff --git a/circuit/algorithms/src/bhp/mod.rs b/circuit/algorithms/src/bhp/mod.rs index bce4e6b70f..946aecb207 100644 --- a/circuit/algorithms/src/bhp/mod.rs +++ b/circuit/algorithms/src/bhp/mod.rs @@ -21,7 +21,7 @@ mod commit_uncompressed; mod hash; mod hash_uncompressed; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] use snarkvm_circuit_types::environment::assert_scope; use crate::{Commit, CommitUncompressed, Hash, HashUncompressed}; @@ -60,7 +60,7 @@ pub struct BHP { hasher: BHPHasher, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for BHP { type Primitive = console::BHP; @@ -85,7 +85,7 @@ impl Inject for BH } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::{Circuit, Eject}; diff --git a/circuit/algorithms/src/elligator2/encode.rs b/circuit/algorithms/src/elligator2/encode.rs index d218e9c168..2dc4853a62 100644 --- a/circuit/algorithms/src/elligator2/encode.rs +++ b/circuit/algorithms/src/elligator2/encode.rs @@ -127,7 +127,7 @@ impl Elligator2 { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/elligator2/mod.rs b/circuit/algorithms/src/elligator2/mod.rs index 2675050a9c..aff5ab78c9 100644 --- a/circuit/algorithms/src/elligator2/mod.rs +++ b/circuit/algorithms/src/elligator2/mod.rs @@ -15,7 +15,7 @@ mod encode; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] use snarkvm_circuit_types::environment::assert_scope; use snarkvm_circuit_types::prelude::*; diff --git a/circuit/algorithms/src/keccak/hash.rs b/circuit/algorithms/src/keccak/hash.rs index f3e67c75f0..bee4fa598b 100644 --- a/circuit/algorithms/src/keccak/hash.rs +++ b/circuit/algorithms/src/keccak/hash.rs @@ -282,7 +282,7 @@ impl Keccak } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/pedersen/commit_uncompressed.rs b/circuit/algorithms/src/pedersen/commit_uncompressed.rs index 3c42d3e20c..a38eeceef4 100644 --- a/circuit/algorithms/src/pedersen/commit_uncompressed.rs +++ b/circuit/algorithms/src/pedersen/commit_uncompressed.rs @@ -105,7 +105,7 @@ impl } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/pedersen/hash.rs b/circuit/algorithms/src/pedersen/hash.rs index 8ceff496ee..cd10747163 100644 --- a/circuit/algorithms/src/pedersen/hash.rs +++ b/circuit/algorithms/src/pedersen/hash.rs @@ -48,7 +48,7 @@ impl OutputMode, } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/pedersen/hash_uncompressed.rs b/circuit/algorithms/src/pedersen/hash_uncompressed.rs index 0f560c754f..1f756efa8f 100644 --- a/circuit/algorithms/src/pedersen/hash_uncompressed.rs +++ b/circuit/algorithms/src/pedersen/hash_uncompressed.rs @@ -102,7 +102,7 @@ impl OutputMode { random_base: Vec>, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Pedersen { type Primitive = console::Pedersen; @@ -56,7 +56,7 @@ impl Inject for Pedersen { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/poseidon/hash.rs b/circuit/algorithms/src/poseidon/hash.rs index 68d8e04ba6..2666ea75ad 100644 --- a/circuit/algorithms/src/poseidon/hash.rs +++ b/circuit/algorithms/src/poseidon/hash.rs @@ -25,7 +25,7 @@ impl Hash for Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/poseidon/hash_many.rs b/circuit/algorithms/src/poseidon/hash_many.rs index 51429e18ef..0e5a1ad687 100644 --- a/circuit/algorithms/src/poseidon/hash_many.rs +++ b/circuit/algorithms/src/poseidon/hash_many.rs @@ -193,7 +193,7 @@ impl Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/poseidon/hash_to_group.rs b/circuit/algorithms/src/poseidon/hash_to_group.rs index 2d2e2f410d..4176805beb 100644 --- a/circuit/algorithms/src/poseidon/hash_to_group.rs +++ b/circuit/algorithms/src/poseidon/hash_to_group.rs @@ -36,7 +36,7 @@ impl HashToGroup for Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/poseidon/hash_to_scalar.rs b/circuit/algorithms/src/poseidon/hash_to_scalar.rs index b2cd4ce843..512dc4ad63 100644 --- a/circuit/algorithms/src/poseidon/hash_to_scalar.rs +++ b/circuit/algorithms/src/poseidon/hash_to_scalar.rs @@ -31,7 +31,7 @@ impl HashToScalar for Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/algorithms/src/poseidon/mod.rs b/circuit/algorithms/src/poseidon/mod.rs index dc537be6f6..b65115236f 100644 --- a/circuit/algorithms/src/poseidon/mod.rs +++ b/circuit/algorithms/src/poseidon/mod.rs @@ -19,7 +19,7 @@ mod hash_to_group; mod hash_to_scalar; mod prf; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] use snarkvm_circuit_types::environment::assert_scope; #[cfg(test)] use snarkvm_utilities::{TestRng, Uniform}; @@ -68,7 +68,7 @@ pub struct Poseidon { mds: Vec>>, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Poseidon { type Primitive = console::Poseidon; diff --git a/circuit/algorithms/src/poseidon/prf.rs b/circuit/algorithms/src/poseidon/prf.rs index 167f73d5a3..292ab181af 100644 --- a/circuit/algorithms/src/poseidon/prf.rs +++ b/circuit/algorithms/src/poseidon/prf.rs @@ -32,7 +32,7 @@ impl PRF for Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_types::environment::Circuit; diff --git a/circuit/collections/src/kary_merkle_tree/helpers/leaf_hash.rs b/circuit/collections/src/kary_merkle_tree/helpers/leaf_hash.rs index 8866316105..5a05eda3da 100644 --- a/circuit/collections/src/kary_merkle_tree/helpers/leaf_hash.rs +++ b/circuit/collections/src/kary_merkle_tree/helpers/leaf_hash.rs @@ -74,7 +74,7 @@ impl LeafHash for Keccak Default for BooleanHash { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for BooleanHash { type Primitive = console::kary_merkle_tree::BooleanHash; @@ -48,7 +48,7 @@ impl Inject for BooleanHash { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for BooleanHash { type Primitive = console::kary_merkle_tree::BooleanHash; diff --git a/circuit/collections/src/kary_merkle_tree/helpers/path_hash.rs b/circuit/collections/src/kary_merkle_tree/helpers/path_hash.rs index ee698bb567..1cb44c200e 100644 --- a/circuit/collections/src/kary_merkle_tree/helpers/path_hash.rs +++ b/circuit/collections/src/kary_merkle_tree/helpers/path_hash.rs @@ -91,7 +91,7 @@ impl PathHash for Kecca } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_algorithms::{BHP512, Keccak256, Poseidon2, Sha3_256}; diff --git a/circuit/collections/src/kary_merkle_tree/mod.rs b/circuit/collections/src/kary_merkle_tree/mod.rs index 608b7ea580..dea7af97cf 100644 --- a/circuit/collections/src/kary_merkle_tree/mod.rs +++ b/circuit/collections/src/kary_merkle_tree/mod.rs @@ -18,7 +18,7 @@ pub use helpers::{BooleanHash, LeafHash, PathHash}; mod verify; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] use snarkvm_circuit_types::environment::assert_scope; use snarkvm_circuit_types::{Boolean, Field, U16, U64, environment::prelude::*}; @@ -30,7 +30,7 @@ pub struct KaryMerklePath, const DEPTH: u8, cons siblings: Vec>, } -#[cfg(console)] +#[cfg(feature = "console")] impl, const DEPTH: u8, const ARITY: u8> Inject for KaryMerklePath { type Primitive = console::kary_merkle_tree::KaryMerklePath; @@ -60,7 +60,7 @@ impl, const DEPTH: u8, const ARITY: u8> Inject f } } -#[cfg(console)] +#[cfg(feature = "console")] impl, const DEPTH: u8, const ARITY: u8> Eject for KaryMerklePath { type Primitive = console::kary_merkle_tree::KaryMerklePath; @@ -78,7 +78,7 @@ impl, const DEPTH: u8, const ARITY: u8> Eject fo } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use console::{ diff --git a/circuit/collections/src/kary_merkle_tree/verify.rs b/circuit/collections/src/kary_merkle_tree/verify.rs index 2a9a2af031..f3e76d5cc0 100644 --- a/circuit/collections/src/kary_merkle_tree/verify.rs +++ b/circuit/collections/src/kary_merkle_tree/verify.rs @@ -103,7 +103,7 @@ impl, const DEPTH: u8, const ARITY: u8> KaryMerk } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_algorithms::{BHP512, BHP1024, Keccak256, Poseidon2, Poseidon4, Sha3_256}; diff --git a/circuit/collections/src/merkle_tree/helpers/leaf_hash.rs b/circuit/collections/src/merkle_tree/helpers/leaf_hash.rs index a465b6d2be..1f33c070a7 100644 --- a/circuit/collections/src/merkle_tree/helpers/leaf_hash.rs +++ b/circuit/collections/src/merkle_tree/helpers/leaf_hash.rs @@ -55,7 +55,7 @@ impl LeafHash for Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_algorithms::{BHP1024, Poseidon4}; diff --git a/circuit/collections/src/merkle_tree/helpers/path_hash.rs b/circuit/collections/src/merkle_tree/helpers/path_hash.rs index c721a7838b..2b90ddff3f 100644 --- a/circuit/collections/src/merkle_tree/helpers/path_hash.rs +++ b/circuit/collections/src/merkle_tree/helpers/path_hash.rs @@ -56,7 +56,7 @@ impl PathHash for Poseidon { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_algorithms::{BHP512, Poseidon2}; diff --git a/circuit/collections/src/merkle_tree/mod.rs b/circuit/collections/src/merkle_tree/mod.rs index 59f880017d..2d58338d9f 100644 --- a/circuit/collections/src/merkle_tree/mod.rs +++ b/circuit/collections/src/merkle_tree/mod.rs @@ -18,7 +18,7 @@ use helpers::{LeafHash, PathHash}; mod verify; -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] use snarkvm_circuit_types::environment::assert_scope; use snarkvm_circuit_types::{Boolean, Field, U64, environment::prelude::*}; @@ -30,7 +30,7 @@ pub struct MerklePath { siblings: Vec>, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for MerklePath { type Primitive = console::merkle_tree::MerklePath; @@ -49,7 +49,7 @@ impl Inject for MerklePath { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for MerklePath { type Primitive = console::merkle_tree::MerklePath; @@ -67,7 +67,7 @@ impl Eject for MerklePath { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_network::AleoV0 as Circuit; diff --git a/circuit/collections/src/merkle_tree/verify.rs b/circuit/collections/src/merkle_tree/verify.rs index c4108952cb..1d72a31b11 100644 --- a/circuit/collections/src/merkle_tree/verify.rs +++ b/circuit/collections/src/merkle_tree/verify.rs @@ -56,7 +56,7 @@ impl MerklePath { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_algorithms::{BHP512, BHP1024, Poseidon2, Poseidon4}; diff --git a/circuit/environment/src/canary_circuit.rs b/circuit/environment/src/canary_circuit.rs index d8aa84553d..99edef9eba 100644 --- a/circuit/environment/src/canary_circuit.rs +++ b/circuit/environment/src/canary_circuit.rs @@ -23,10 +23,10 @@ use core::{ type Field = ::Field; thread_local! { - static VARIABLE_LIMIT: Cell> = Cell::new(None); - static CONSTRAINT_LIMIT: Cell> = Cell::new(None); + static VARIABLE_LIMIT: Cell> = const { Cell::new(None) }; + static CONSTRAINT_LIMIT: Cell> = const { Cell::new(None) }; pub(super) static CANARY_CIRCUIT: RefCell> = RefCell::new(R1CS::new()); - static IN_WITNESS: Cell = Cell::new(false); + static IN_WITNESS: Cell = const { Cell::new(false) }; static ZERO: LinearCombination = LinearCombination::zero(); static ONE: LinearCombination = LinearCombination::one(); } diff --git a/circuit/environment/src/circuit.rs b/circuit/environment/src/circuit.rs index d941547d9d..3bf3742a40 100644 --- a/circuit/environment/src/circuit.rs +++ b/circuit/environment/src/circuit.rs @@ -23,10 +23,10 @@ use core::{ type Field = ::Field; thread_local! { - static VARIABLE_LIMIT: Cell> = Cell::new(None); - static CONSTRAINT_LIMIT: Cell> = Cell::new(None); + static VARIABLE_LIMIT: Cell> = const { Cell::new(None) }; + static CONSTRAINT_LIMIT: Cell> = const { Cell::new(None) }; pub(super) static CIRCUIT: RefCell> = RefCell::new(R1CS::new()); - static IN_WITNESS: Cell = Cell::new(false); + static IN_WITNESS: Cell = const { Cell::new(false) }; static ZERO: LinearCombination = LinearCombination::zero(); static ONE: LinearCombination = LinearCombination::one(); } diff --git a/circuit/environment/src/testnet_circuit.rs b/circuit/environment/src/testnet_circuit.rs index 3405bb62e6..add19ad89a 100644 --- a/circuit/environment/src/testnet_circuit.rs +++ b/circuit/environment/src/testnet_circuit.rs @@ -23,10 +23,10 @@ use core::{ type Field = ::Field; thread_local! { - static VARIABLE_LIMIT: Cell> = Cell::new(None); - static CONSTRAINT_LIMIT: Cell> = Cell::new(None); + static VARIABLE_LIMIT: Cell> = const { Cell::new(None) }; + static CONSTRAINT_LIMIT: Cell> = const { Cell::new(None) }; pub(super) static TESTNET_CIRCUIT: RefCell> = RefCell::new(R1CS::new()); - static IN_WITNESS: Cell = Cell::new(false); + static IN_WITNESS: Cell = const { Cell::new(false) }; static ZERO: LinearCombination = LinearCombination::zero(); static ONE: LinearCombination = LinearCombination::one(); } diff --git a/circuit/program/src/data/access/mod.rs b/circuit/program/src/data/access/mod.rs index c2a2037524..62f919dc54 100644 --- a/circuit/program/src/data/access/mod.rs +++ b/circuit/program/src/data/access/mod.rs @@ -32,7 +32,7 @@ pub enum Access { Index(U32), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Access { type Primitive = console::Access; @@ -46,7 +46,7 @@ impl Inject for Access { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Access { type Primitive = console::Access; @@ -67,7 +67,7 @@ impl Eject for Access { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Access { /// Parses a UTF-8 string into an access. #[inline] @@ -79,7 +79,7 @@ impl Parser for Access { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Access { type Err = Error; @@ -98,14 +98,14 @@ impl FromStr for Access { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Access { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Access { /// Prints the identifier as a string. fn fmt(&self, f: &mut Formatter) -> fmt::Result { diff --git a/circuit/program/src/data/ciphertext/decrypt.rs b/circuit/program/src/data/ciphertext/decrypt.rs index 5e94aa1d48..007dd1baaf 100644 --- a/circuit/program/src/data/ciphertext/decrypt.rs +++ b/circuit/program/src/data/ciphertext/decrypt.rs @@ -39,7 +39,7 @@ impl Ciphertext { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, Literal}; diff --git a/circuit/program/src/data/ciphertext/mod.rs b/circuit/program/src/data/ciphertext/mod.rs index 3b5c21c65a..29b553e442 100644 --- a/circuit/program/src/data/ciphertext/mod.rs +++ b/circuit/program/src/data/ciphertext/mod.rs @@ -31,7 +31,7 @@ use core::ops::Deref; #[derive(Clone)] pub struct Ciphertext(Vec>); -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Ciphertext { type Primitive = console::Ciphertext; @@ -45,7 +45,7 @@ impl Inject for Ciphertext { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Ciphertext { type Primitive = console::Ciphertext; diff --git a/circuit/program/src/data/identifier/from_bits.rs b/circuit/program/src/data/identifier/from_bits.rs index 9b6603f8d3..1ba41b149b 100644 --- a/circuit/program/src/data/identifier/from_bits.rs +++ b/circuit/program/src/data/identifier/from_bits.rs @@ -49,7 +49,7 @@ impl FromBits for Identifier { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, data::identifier::tests::sample_console_identifier}; diff --git a/circuit/program/src/data/identifier/from_field.rs b/circuit/program/src/data/identifier/from_field.rs index bfea3eb5a0..4d9124e12b 100644 --- a/circuit/program/src/data/identifier/from_field.rs +++ b/circuit/program/src/data/identifier/from_field.rs @@ -25,7 +25,7 @@ impl FromField for Identifier { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, data::identifier::tests::sample_console_identifier}; diff --git a/circuit/program/src/data/identifier/mod.rs b/circuit/program/src/data/identifier/mod.rs index 3c57a05e5a..8cff8d1009 100644 --- a/circuit/program/src/data/identifier/mod.rs +++ b/circuit/program/src/data/identifier/mod.rs @@ -39,7 +39,7 @@ use snarkvm_utilities::ToBits as TB; #[derive(Clone)] pub struct Identifier(Field, u8); // Number of bytes in the identifier. -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Identifier { type Primitive = console::Identifier; @@ -58,7 +58,7 @@ impl Inject for Identifier { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Identifier { type Primitive = console::Identifier; @@ -77,7 +77,7 @@ impl Eject for Identifier { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Identifier { /// Parses a UTF-8 string into an identifier. #[inline] @@ -89,7 +89,7 @@ impl Parser for Identifier { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Identifier { type Err = Error; @@ -108,14 +108,14 @@ impl FromStr for Identifier { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Identifier { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Identifier { /// Prints the identifier as a string. fn fmt(&self, f: &mut Formatter) -> fmt::Result { @@ -153,7 +153,7 @@ impl From<&Identifier> for LinearCombination { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] pub(crate) mod tests { use super::*; use crate::Circuit; diff --git a/circuit/program/src/data/identifier/to_bits.rs b/circuit/program/src/data/identifier/to_bits.rs index da5487b11e..24094acfd7 100644 --- a/circuit/program/src/data/identifier/to_bits.rs +++ b/circuit/program/src/data/identifier/to_bits.rs @@ -47,7 +47,7 @@ impl ToBits for &Identifier { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, data::identifier::tests::sample_console_identifier}; diff --git a/circuit/program/src/data/literal/cast/mod.rs b/circuit/program/src/data/literal/cast/mod.rs index 0af593ec02..8b08c2bf97 100644 --- a/circuit/program/src/data/literal/cast/mod.rs +++ b/circuit/program/src/data/literal/cast/mod.rs @@ -65,6 +65,7 @@ impl Literal { /// - (`Address`, `Group`) <-> `Field` <-> `Scalar` <-> `Integer` <-> `Boolean` /// - `Signature` (not supported) /// - `String` (not supported) + /// /// Note that casting to left along the hierarchy always preserves information. pub fn cast(&self, to_type: LiteralType) -> Result { match self { diff --git a/circuit/program/src/data/literal/cast_lossy/mod.rs b/circuit/program/src/data/literal/cast_lossy/mod.rs index 7d86dd9924..764763a665 100644 --- a/circuit/program/src/data/literal/cast_lossy/mod.rs +++ b/circuit/program/src/data/literal/cast_lossy/mod.rs @@ -68,6 +68,7 @@ impl Literal { /// - (`Address`, `Group`) <-> `Field` <-> `Scalar` <-> `Integer` <-> `Boolean` /// - `Signature` (not supported) /// - `String` (not supported) + /// /// Note that casting to left along the hierarchy always preserves information. pub fn cast_lossy(&self, to_type: LiteralType) -> Result { match self { diff --git a/circuit/program/src/data/literal/from_bits.rs b/circuit/program/src/data/literal/from_bits.rs index 1643343b0e..cfc59dbfbd 100644 --- a/circuit/program/src/data/literal/from_bits.rs +++ b/circuit/program/src/data/literal/from_bits.rs @@ -67,7 +67,7 @@ impl Literal { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/program/src/data/literal/mod.rs b/circuit/program/src/data/literal/mod.rs index 2bd86230ba..89df765a19 100644 --- a/circuit/program/src/data/literal/mod.rs +++ b/circuit/program/src/data/literal/mod.rs @@ -72,7 +72,7 @@ pub enum Literal { String(StringType), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Literal { type Primitive = console::Literal; @@ -100,7 +100,7 @@ impl Inject for Literal { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Literal { type Primitive = console::Literal; @@ -151,7 +151,7 @@ impl Eject for Literal { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Literal { /// Parses a string into a literal. #[inline] @@ -178,7 +178,7 @@ impl Parser for Literal { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Literal { type Err = Error; @@ -197,7 +197,7 @@ impl FromStr for Literal { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Literal { /// Returns the type name of the literal. pub fn type_name(&self) -> &str { @@ -223,14 +223,14 @@ impl Literal { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Literal { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Literal { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self { diff --git a/circuit/program/src/data/literal/to_type.rs b/circuit/program/src/data/literal/to_type.rs index 95b1afac6d..299aad2c06 100644 --- a/circuit/program/src/data/literal/to_type.rs +++ b/circuit/program/src/data/literal/to_type.rs @@ -15,7 +15,7 @@ use super::*; -#[cfg(console)] +#[cfg(feature = "console")] impl Literal { /// Returns the type name of the literal. pub fn to_type(&self) -> console::LiteralType { diff --git a/circuit/program/src/data/plaintext/mod.rs b/circuit/program/src/data/plaintext/mod.rs index e0b0ef279e..af772d60cd 100644 --- a/circuit/program/src/data/plaintext/mod.rs +++ b/circuit/program/src/data/plaintext/mod.rs @@ -40,7 +40,7 @@ pub enum Plaintext { Array(Vec>, OnceCell>>), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Plaintext { type Primitive = console::Plaintext; @@ -54,7 +54,7 @@ impl Inject for Plaintext { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Plaintext { type Primitive = console::Plaintext; @@ -99,7 +99,7 @@ impl From<&Literal> for Plaintext { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/program/src/data/record/decrypt.rs b/circuit/program/src/data/record/decrypt.rs index 688783e5c2..5474423bf5 100644 --- a/circuit/program/src/data/record/decrypt.rs +++ b/circuit/program/src/data/record/decrypt.rs @@ -83,7 +83,7 @@ impl Record> { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::{Circuit, Literal}; diff --git a/circuit/program/src/data/record/entry/mod.rs b/circuit/program/src/data/record/entry/mod.rs index 8b09932c59..95c958681e 100644 --- a/circuit/program/src/data/record/entry/mod.rs +++ b/circuit/program/src/data/record/entry/mod.rs @@ -33,7 +33,7 @@ pub enum Entry> { Private(Private), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Entry> { type Primitive = console::Entry>; @@ -47,7 +47,7 @@ impl Inject for Entry> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Entry> { type Primitive = console::Entry>; @@ -61,7 +61,7 @@ impl Inject for Entry> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Entry> { type Primitive = console::Entry>; @@ -84,7 +84,7 @@ impl Eject for Entry> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Entry> { type Primitive = console::Entry>; diff --git a/circuit/program/src/data/record/helpers/owner.rs b/circuit/program/src/data/record/helpers/owner.rs index a8d8f76b99..351e163745 100644 --- a/circuit/program/src/data/record/helpers/owner.rs +++ b/circuit/program/src/data/record/helpers/owner.rs @@ -26,7 +26,7 @@ pub enum Owner> { Private(Private), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Owner> { type Primitive = console::Owner>; @@ -45,7 +45,7 @@ impl Inject for Owner> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Owner> { type Primitive = console::Owner>; diff --git a/circuit/program/src/data/record/mod.rs b/circuit/program/src/data/record/mod.rs index 3a81091ec3..7d92025424 100644 --- a/circuit/program/src/data/record/mod.rs +++ b/circuit/program/src/data/record/mod.rs @@ -48,7 +48,7 @@ pub struct Record> { nonce: Group, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Record> { type Primitive = console::Record>; @@ -62,7 +62,7 @@ impl Inject for Record> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Record> { type Primitive = console::Record>; @@ -76,7 +76,7 @@ impl Inject for Record> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl> Record { /// Initializes a new record plaintext. pub fn from_plaintext( @@ -132,7 +132,7 @@ impl> Record { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Record> { type Primitive = console::Record>; @@ -173,7 +173,7 @@ impl Eject for Record> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Record> { type Primitive = console::Record>; @@ -214,7 +214,7 @@ impl Eject for Record> { } } -#[cfg(console)] +#[cfg(feature = "console")] impl> TypeName for Record { fn type_name() -> &'static str { "record" diff --git a/circuit/program/src/id/mod.rs b/circuit/program/src/id/mod.rs index 2a402b41d6..9028322ade 100644 --- a/circuit/program/src/id/mod.rs +++ b/circuit/program/src/id/mod.rs @@ -34,7 +34,7 @@ pub struct ProgramID { network: Identifier, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for ProgramID { type Primitive = console::ProgramID; @@ -61,7 +61,7 @@ impl ProgramID { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for ProgramID { type Primitive = console::ProgramID; diff --git a/circuit/program/src/request/mod.rs b/circuit/program/src/request/mod.rs index e9aa82a9bd..a388909d37 100644 --- a/circuit/program/src/request/mod.rs +++ b/circuit/program/src/request/mod.rs @@ -37,7 +37,7 @@ pub enum InputID { ExternalRecord(Field), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for InputID { type Primitive = console::InputID; @@ -63,7 +63,7 @@ impl Inject for InputID { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for InputID { type Primitive = console::InputID; @@ -141,7 +141,7 @@ pub struct Request { scm: Field, } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Request { type Primitive = console::Request; @@ -286,7 +286,7 @@ impl Request { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Request { type Primitive = console::Request; diff --git a/circuit/program/src/request/verify.rs b/circuit/program/src/request/verify.rs index 04aa39852e..fa42a83521 100644 --- a/circuit/program/src/request/verify.rs +++ b/circuit/program/src/request/verify.rs @@ -308,7 +308,7 @@ impl Request { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/program/src/response/from_outputs.rs b/circuit/program/src/response/from_outputs.rs index b97da6e1eb..efff43271c 100644 --- a/circuit/program/src/response/from_outputs.rs +++ b/circuit/program/src/response/from_outputs.rs @@ -175,7 +175,7 @@ impl Response { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/program/src/response/mod.rs b/circuit/program/src/response/mod.rs index 81d3492816..b61f6cbabf 100644 --- a/circuit/program/src/response/mod.rs +++ b/circuit/program/src/response/mod.rs @@ -38,7 +38,7 @@ pub enum OutputID { Future(Field), } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for OutputID { type Primitive = console::OutputID; @@ -127,7 +127,7 @@ impl OutputID { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for OutputID { type Primitive = console::OutputID; @@ -177,7 +177,7 @@ impl Response { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Response { type Primitive = console::Response; diff --git a/circuit/program/src/response/process_outputs_from_callback.rs b/circuit/program/src/response/process_outputs_from_callback.rs index e2ddbfe626..1a985d2f8b 100644 --- a/circuit/program/src/response/process_outputs_from_callback.rs +++ b/circuit/program/src/response/process_outputs_from_callback.rs @@ -190,7 +190,7 @@ impl Response { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/program/src/state_path/mod.rs b/circuit/program/src/state_path/mod.rs index 0d58b2b640..66a1fc5b49 100644 --- a/circuit/program/src/state_path/mod.rs +++ b/circuit/program/src/state_path/mod.rs @@ -153,7 +153,7 @@ impl Eject for StatePath { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use crate::Circuit; diff --git a/circuit/types/address/src/equal.rs b/circuit/types/address/src/equal.rs index 06d1f442c4..1902464f77 100644 --- a/circuit/types/address/src/equal.rs +++ b/circuit/types/address/src/equal.rs @@ -29,7 +29,7 @@ impl Equal for Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; @@ -50,12 +50,12 @@ mod tests { let a = Address::::from_group(Group::new(mode_a, Uniform::rand(rng))); let b = Address::::from_group(Group::new(mode_b, Uniform::rand(rng))); - Circuit::scope(&format!("{mode_a} {mode_a} {i}"), || { + Circuit::scope(format!("{mode_a} {mode_a} {i}"), || { let equals = a.is_equal(&a); assert!(equals.eject_value()); }); - Circuit::scope(&format!("{mode_a} {mode_b} {i}"), || { + Circuit::scope(format!("{mode_a} {mode_b} {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -77,12 +77,12 @@ mod tests { let a = Address::::from_group(Group::new(mode_a, Uniform::rand(rng))); let b = Address::::from_group(Group::new(mode_b, Uniform::rand(rng))); - Circuit::scope(&format!("{mode_a} {mode_a} {i}"), || { + Circuit::scope(format!("{mode_a} {mode_a} {i}"), || { let equals = a.is_not_equal(&a); assert!(!equals.eject_value()); }); - Circuit::scope(&format!("{mode_a} {mode_b} {i}"), || { + Circuit::scope(format!("{mode_a} {mode_b} {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/types/address/src/helpers/from_bits.rs b/circuit/types/address/src/helpers/from_bits.rs index 553aa62ce4..0cfc1c8600 100644 --- a/circuit/types/address/src/helpers/from_bits.rs +++ b/circuit/types/address/src/helpers/from_bits.rs @@ -29,7 +29,7 @@ impl FromBits for Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; @@ -44,7 +44,7 @@ mod tests { let expected: console::Group<::Network> = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected).to_bits_le(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Address::::from_bits_le(&candidate); assert_eq!(expected, *candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -61,7 +61,7 @@ mod tests { let expected: console::Group<::Network> = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected).to_bits_be(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Address::::from_bits_be(&candidate); assert_eq!(expected, *candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/types/address/src/helpers/from_field.rs b/circuit/types/address/src/helpers/from_field.rs index b22d580fcf..ae73fa5c5b 100644 --- a/circuit/types/address/src/helpers/from_field.rs +++ b/circuit/types/address/src/helpers/from_field.rs @@ -38,7 +38,7 @@ impl FromField for Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; @@ -53,7 +53,7 @@ mod tests { let expected: console::Group<::Network> = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected).to_x_coordinate(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Address::from_field(candidate); assert_eq!(expected.to_x_coordinate(), candidate.eject_value().to_x_coordinate()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/types/address/src/helpers/from_group.rs b/circuit/types/address/src/helpers/from_group.rs index ec5318d4ec..bc60ea526e 100644 --- a/circuit/types/address/src/helpers/from_group.rs +++ b/circuit/types/address/src/helpers/from_group.rs @@ -39,7 +39,7 @@ impl FromGroup for Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; diff --git a/circuit/types/address/src/helpers/to_bits.rs b/circuit/types/address/src/helpers/to_bits.rs index bbe78d3ea6..bfe4170d54 100644 --- a/circuit/types/address/src/helpers/to_bits.rs +++ b/circuit/types/address/src/helpers/to_bits.rs @@ -43,7 +43,7 @@ impl ToBits for &Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; @@ -60,7 +60,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Address::::from_group(Group::new(mode, expected)); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_le(); assert_eq!(expected_number_of_bits, candidate.len()); for (expected_bit, candidate_bit) in @@ -83,7 +83,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Address::::from_group(Group::new(mode, expected)); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_be(); assert_eq!(expected_number_of_bits, candidate.len()); for (expected_bit, candidate_bit) in diff --git a/circuit/types/address/src/helpers/to_field.rs b/circuit/types/address/src/helpers/to_field.rs index d54a931236..e8664ba2dc 100644 --- a/circuit/types/address/src/helpers/to_field.rs +++ b/circuit/types/address/src/helpers/to_field.rs @@ -38,7 +38,7 @@ impl ToField for Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; @@ -53,7 +53,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Address::::from_group(Group::new(mode, expected)); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_field(); assert_eq!(expected.to_x_coordinate(), candidate.eject_value()); assert_scope!(0, 0, 0, 0); diff --git a/circuit/types/address/src/helpers/to_group.rs b/circuit/types/address/src/helpers/to_group.rs index 926142de49..b2a30bcb3c 100644 --- a/circuit/types/address/src/helpers/to_group.rs +++ b/circuit/types/address/src/helpers/to_group.rs @@ -39,7 +39,7 @@ impl ToGroup for Address { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; diff --git a/circuit/types/address/src/lib.rs b/circuit/types/address/src/lib.rs index b7a7eb2d8d..6d5cffb295 100644 --- a/circuit/types/address/src/lib.rs +++ b/circuit/types/address/src/lib.rs @@ -48,7 +48,7 @@ impl Address { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Address { type Primitive = console::Address; @@ -58,7 +58,7 @@ impl Inject for Address { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Address { type Primitive = console::Address; @@ -73,7 +73,7 @@ impl Eject for Address { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Address { /// Parses a string into an address circuit. #[inline] @@ -90,7 +90,7 @@ impl Parser for Address { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Address { type Err = Error; @@ -109,7 +109,7 @@ impl FromStr for Address { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Address { /// Returns the type name of the circuit as a string. #[inline] @@ -118,14 +118,14 @@ impl TypeName for Address { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Address { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Address { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) @@ -144,7 +144,7 @@ impl From<&Address> for LinearCombination { } } -#[cfg(all(test, console))] +#[cfg(all(test, feature = "console"))] mod tests { use super::*; use snarkvm_circuit_environment::Circuit; diff --git a/circuit/types/boolean/src/lib.rs b/circuit/types/boolean/src/lib.rs index 0952d86ec3..a34eea4d1f 100644 --- a/circuit/types/boolean/src/lib.rs +++ b/circuit/types/boolean/src/lib.rs @@ -52,7 +52,7 @@ impl Boolean { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Boolean { type Primitive = bool; @@ -79,7 +79,7 @@ impl Inject for Boolean { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Boolean { type Primitive = bool; @@ -100,7 +100,7 @@ impl Eject for Boolean { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Boolean { /// Parses a string into a boolean circuit. #[inline] @@ -117,7 +117,7 @@ impl Parser for Boolean { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Boolean { type Err = Error; @@ -136,7 +136,7 @@ impl FromStr for Boolean { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Boolean { /// Returns the type name of the circuit as a string. #[inline] @@ -145,14 +145,14 @@ impl TypeName for Boolean { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Boolean { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Boolean { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) diff --git a/circuit/types/field/src/helpers/from_bits.rs b/circuit/types/field/src/helpers/from_bits.rs index 93e1815238..9e5bdc5e4e 100644 --- a/circuit/types/field/src/helpers/from_bits.rs +++ b/circuit/types/field/src/helpers/from_bits.rs @@ -129,7 +129,7 @@ mod tests { // Add excess zero bits. let candidate = [given_bits, vec![Boolean::new(mode, false); i as usize]].concat(); - Circuit::scope(&format!("Excess {mode} {i}"), || { + Circuit::scope(format!("Excess {mode} {i}"), || { let candidate = Field::::from_bits_le(&candidate); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.get().expect("Caching failed").len()); @@ -174,7 +174,7 @@ mod tests { // Add excess zero bits. let candidate = [vec![Boolean::new(mode, false); i as usize], given_bits].concat(); - Circuit::scope(&format!("Excess {mode} {i}"), || { + Circuit::scope(format!("Excess {mode} {i}"), || { let candidate = Field::::from_bits_be(&candidate); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.get().expect("Caching failed").len()); diff --git a/circuit/types/field/src/helpers/to_bits.rs b/circuit/types/field/src/helpers/to_bits.rs index 5ea18e25cc..0eeb16cede 100644 --- a/circuit/types/field/src/helpers/to_bits.rs +++ b/circuit/types/field/src/helpers/to_bits.rs @@ -123,7 +123,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Field::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate_bits = candidate.to_bits_le(); assert_eq!(expected_number_of_bits, candidate_bits.len()); for (expected_bit, candidate_bit) in expected.to_bits_le().iter().zip_eq(&candidate_bits) { @@ -151,7 +151,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Field::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate_bits = candidate.to_bits_be(); assert_eq!(expected_number_of_bits, candidate_bits.len()); for (expected_bit, candidate_bit) in expected.to_bits_be().iter().zip_eq(&candidate_bits) { diff --git a/circuit/types/field/src/helpers/to_lower_bits.rs b/circuit/types/field/src/helpers/to_lower_bits.rs index da00b267a4..00522b326f 100644 --- a/circuit/types/field/src/helpers/to_lower_bits.rs +++ b/circuit/types/field/src/helpers/to_lower_bits.rs @@ -103,7 +103,7 @@ mod tests { // Construct the unsigned integer as a field element. let candidate = Field::::new(mode, console::Field::from_bits_le(&expected).unwrap()); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_lower_bits_le(I::BITS as usize); assert_eq!(I::BITS, candidate.len() as u64); for (i, (expected_bit, candidate_bit)) in expected.iter().zip_eq(candidate.iter()).enumerate() { diff --git a/circuit/types/field/src/helpers/to_upper_bits.rs b/circuit/types/field/src/helpers/to_upper_bits.rs index 2a4105e35f..46af42f528 100644 --- a/circuit/types/field/src/helpers/to_upper_bits.rs +++ b/circuit/types/field/src/helpers/to_upper_bits.rs @@ -130,7 +130,7 @@ mod tests { Field::::new(mode, console::Field::from_bits_be(&bits_be).unwrap()) }; - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let num_bits_with_capacity = I::BITS + 1; let candidate = candidate.to_upper_bits_be(num_bits_with_capacity as usize); assert_eq!(num_bits_with_capacity, candidate.len() as u64); diff --git a/circuit/types/field/src/lib.rs b/circuit/types/field/src/lib.rs index 24f11d0a50..82711ef158 100644 --- a/circuit/types/field/src/lib.rs +++ b/circuit/types/field/src/lib.rs @@ -60,7 +60,7 @@ impl Default for Field { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Field { type Primitive = console::Field; @@ -70,7 +70,7 @@ impl Inject for Field { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Field { type Primitive = console::Field; @@ -85,7 +85,7 @@ impl Eject for Field { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Field { /// Parses a string into a field circuit. #[inline] @@ -102,7 +102,7 @@ impl Parser for Field { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Field { type Err = Error; @@ -121,7 +121,7 @@ impl FromStr for Field { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Field { /// Returns the type name of the circuit as a string. #[inline] @@ -130,14 +130,14 @@ impl TypeName for Field { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Field { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Field { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) diff --git a/circuit/types/group/src/double.rs b/circuit/types/group/src/double.rs index 801d57b6f1..e3c210255b 100644 --- a/circuit/types/group/src/double.rs +++ b/circuit/types/group/src/double.rs @@ -106,7 +106,7 @@ mod tests { // Constant variable let affine = Group::::new(Mode::Constant, point); - Circuit::scope(&format!("Constant {i}"), || { + Circuit::scope(format!("Constant {i}"), || { let candidate = affine.double(); assert_eq!(expected, candidate.eject_value()); assert_scope!(3, 0, 0, 0); @@ -116,7 +116,7 @@ mod tests { // Public variable let affine = Group::::new(Mode::Public, point); - Circuit::scope(&format!("Public {i}"), || { + Circuit::scope(format!("Public {i}"), || { let candidate = affine.double(); assert_eq!(expected, candidate.eject_value()); assert_scope!(1, 0, 5, 5); @@ -126,7 +126,7 @@ mod tests { // Private variable let affine = Group::::new(Mode::Private, point); - Circuit::scope(&format!("Private {i}"), || { + Circuit::scope(format!("Private {i}"), || { let candidate = affine.double(); assert_eq!(expected, candidate.eject_value()); assert_scope!(1, 0, 5, 5); diff --git a/circuit/types/group/src/equal.rs b/circuit/types/group/src/equal.rs index b0f555531d..3c685a2f6f 100644 --- a/circuit/types/group/src/equal.rs +++ b/circuit/types/group/src/equal.rs @@ -62,14 +62,14 @@ mod tests { let a = Group::::new(Mode::Constant, a); let b = Group::::new(Mode::Constant, b); - Circuit::scope(&format!("Constant Equals {i}"), || { + Circuit::scope(format!("Constant Equals {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(2, 0, 0, 0); }); Circuit::reset(); - Circuit::scope(&format!("Constant Not Equals {i}"), || { + Circuit::scope(format!("Constant Not Equals {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(2, 0, 0, 0); @@ -86,14 +86,14 @@ mod tests { let a = Group::::new(Mode::Constant, a); let b = Group::::new(Mode::Public, b); - Circuit::scope(&format!("Constant and Public Equals {i}"), || { + Circuit::scope(format!("Constant and Public Equals {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(0, 0, 5, 5); }); Circuit::reset(); - Circuit::scope(&format!("Constant and Public Not Equals {i}"), || { + Circuit::scope(format!("Constant and Public Not Equals {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(0, 0, 5, 5); @@ -110,14 +110,14 @@ mod tests { let a = Group::::new(Mode::Public, a); let b = Group::::new(Mode::Constant, b); - Circuit::scope(&format!("Public and Constant Equals {i}"), || { + Circuit::scope(format!("Public and Constant Equals {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(0, 0, 5, 5); }); Circuit::reset(); - Circuit::scope(&format!("Public and Constant Not Equals {i}"), || { + Circuit::scope(format!("Public and Constant Not Equals {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(0, 0, 5, 5); @@ -134,14 +134,14 @@ mod tests { let a = Group::::new(Mode::Public, a); let b = Group::::new(Mode::Public, b); - Circuit::scope(&format!("Public Equals {i}"), || { + Circuit::scope(format!("Public Equals {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(0, 0, 5, 5); }); Circuit::reset(); - Circuit::scope(&format!("Public Not Equals {i}"), || { + Circuit::scope(format!("Public Not Equals {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(0, 0, 5, 5); @@ -158,14 +158,14 @@ mod tests { let a = Group::::new(Mode::Private, a); let b = Group::::new(Mode::Private, b); - Circuit::scope(&format!("Private Equals {i}"), || { + Circuit::scope(format!("Private Equals {i}"), || { let equals = a.is_equal(&b); assert!(!equals.eject_value()); assert_scope!(0, 0, 5, 5); }); Circuit::reset(); - Circuit::scope(&format!("Private Not Equals {i}"), || { + Circuit::scope(format!("Private Not Equals {i}"), || { let equals = a.is_not_equal(&b); assert!(equals.eject_value()); assert_scope!(0, 0, 5, 5); diff --git a/circuit/types/group/src/helpers/from_bits.rs b/circuit/types/group/src/helpers/from_bits.rs index beeda2d35b..f6991ffbd6 100644 --- a/circuit/types/group/src/helpers/from_bits.rs +++ b/circuit/types/group/src/helpers/from_bits.rs @@ -50,7 +50,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected).to_bits_le(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Group::::from_bits_le(&candidate); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -67,7 +67,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected).to_bits_be(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Group::::from_bits_be(&candidate); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/types/group/src/helpers/mul_by_cofactor.rs b/circuit/types/group/src/helpers/mul_by_cofactor.rs index 49fbe5ff9d..1d385279f8 100644 --- a/circuit/types/group/src/helpers/mul_by_cofactor.rs +++ b/circuit/types/group/src/helpers/mul_by_cofactor.rs @@ -47,7 +47,7 @@ mod tests { // Initialize the input. let affine = Group::::new(mode, input); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = affine.mul_by_cofactor(); assert_eq!(expected, candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -87,7 +87,7 @@ mod tests { // Initialize the input. let affine = Group::::new(Mode::Private, input); - Circuit::scope(&format!("Constant {i}"), || { + Circuit::scope(format!("Constant {i}"), || { let candidate = affine * Scalar::constant(console::Scalar::new(::ScalarField::from(4u128))); assert_eq!(expected, candidate.eject_value()); diff --git a/circuit/types/group/src/helpers/to_bits.rs b/circuit/types/group/src/helpers/to_bits.rs index 884cbe0a40..76284375d4 100644 --- a/circuit/types/group/src/helpers/to_bits.rs +++ b/circuit/types/group/src/helpers/to_bits.rs @@ -60,7 +60,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_le(); assert_eq!(expected_number_of_bits, candidate.len()); for (expected_bit, candidate_bit) in @@ -83,7 +83,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_be(); assert_eq!(expected_number_of_bits, candidate.len()); for (expected_bit, candidate_bit) in diff --git a/circuit/types/group/src/helpers/to_field.rs b/circuit/types/group/src/helpers/to_field.rs index 45409df1f5..0b14035ce9 100644 --- a/circuit/types/group/src/helpers/to_field.rs +++ b/circuit/types/group/src/helpers/to_field.rs @@ -41,7 +41,7 @@ mod tests { let expected = Uniform::rand(rng); let candidate = Group::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_field(); assert_eq!(expected.to_field().unwrap(), candidate.eject_value()); assert_scope!(0, 0, 0, 0); diff --git a/circuit/types/group/src/helpers/to_x_coordinate.rs b/circuit/types/group/src/helpers/to_x_coordinate.rs index b4b7edb325..47b7293041 100644 --- a/circuit/types/group/src/helpers/to_x_coordinate.rs +++ b/circuit/types/group/src/helpers/to_x_coordinate.rs @@ -35,7 +35,7 @@ mod tests { let expected = Uniform::rand(&mut TestRng::default()); let candidate = Group::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_x_coordinate(); assert_eq!(expected.to_x_coordinate(), candidate.eject_value()); assert_scope!(0, 0, 0, 0); diff --git a/circuit/types/group/src/helpers/to_y_coordinate.rs b/circuit/types/group/src/helpers/to_y_coordinate.rs index 12fb7b3b44..e5e04f450f 100644 --- a/circuit/types/group/src/helpers/to_y_coordinate.rs +++ b/circuit/types/group/src/helpers/to_y_coordinate.rs @@ -37,7 +37,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Group::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_y_coordinate(); assert_eq!(expected.to_y_coordinate(), candidate.eject_value()); assert_scope!(0, 0, 0, 0); diff --git a/circuit/types/group/src/lib.rs b/circuit/types/group/src/lib.rs index bbd002000a..65d7ef2a36 100644 --- a/circuit/types/group/src/lib.rs +++ b/circuit/types/group/src/lib.rs @@ -53,7 +53,7 @@ impl Group { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Group { type Primitive = console::Group; @@ -148,7 +148,7 @@ impl Group { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Group { type Primitive = console::Group; @@ -163,7 +163,7 @@ impl Eject for Group { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Group { /// Parses a string into a group circuit. #[inline] @@ -180,7 +180,7 @@ impl Parser for Group { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Group { type Err = Error; @@ -199,7 +199,7 @@ impl FromStr for Group { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Group { /// Returns the type name of the circuit as a string. #[inline] @@ -208,14 +208,14 @@ impl TypeName for Group { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Group { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Group { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) @@ -259,7 +259,7 @@ mod tests { // Sample a random element. let point = Uniform::rand(&mut rng); - Circuit::scope(&format!("Constant {i}"), || { + Circuit::scope(format!("Constant {i}"), || { let affine = Group::::new(Mode::Constant, point); assert_eq!(point, affine.eject_value()); assert_scope!(10, 0, 0, 0); @@ -271,7 +271,7 @@ mod tests { // Sample a random element. let point = Uniform::rand(&mut rng); - Circuit::scope(&format!("Public {i}"), || { + Circuit::scope(format!("Public {i}"), || { let affine = Group::::new(Mode::Public, point); assert_eq!(point, affine.eject_value()); assert_scope!(4, 2, 12, 13); @@ -283,7 +283,7 @@ mod tests { // Sample a random element. let point = Uniform::rand(&mut rng); - Circuit::scope(&format!("Private {i}"), || { + Circuit::scope(format!("Private {i}"), || { let affine = Group::::new(Mode::Private, point); assert_eq!(point, affine.eject_value()); assert_scope!(4, 0, 14, 13); diff --git a/circuit/types/integers/src/helpers/from_bits.rs b/circuit/types/integers/src/helpers/from_bits.rs index abc750218b..5d6953f75a 100644 --- a/circuit/types/integers/src/helpers/from_bits.rs +++ b/circuit/types/integers/src/helpers/from_bits.rs @@ -67,7 +67,7 @@ mod tests { let given_bits = Integer::::new(mode, expected).to_bits_le(); let expected_size_in_bits = given_bits.len(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Integer::::from_bits_le(&given_bits); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.len()); @@ -77,7 +77,7 @@ mod tests { // Add excess zero bits. let candidate = [given_bits, vec![Boolean::new(mode, false); i as usize]].concat(); - Circuit::scope(&format!("Excess {mode} {i}"), || { + Circuit::scope(format!("Excess {mode} {i}"), || { let candidate = Integer::::from_bits_le(&candidate); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.len()); @@ -107,7 +107,7 @@ mod tests { let given_bits = Integer::::new(mode, expected).to_bits_be(); let expected_size_in_bits = given_bits.len(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Integer::::from_bits_be(&given_bits); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.len()); @@ -117,7 +117,7 @@ mod tests { // Add excess zero bits. let candidate = [vec![Boolean::new(mode, false); i as usize], given_bits].concat(); - Circuit::scope(&format!("Excess {mode} {i}"), || { + Circuit::scope(format!("Excess {mode} {i}"), || { let candidate = Integer::::from_bits_be(&candidate); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.len()); diff --git a/circuit/types/integers/src/helpers/to_bits.rs b/circuit/types/integers/src/helpers/to_bits.rs index 3b1e8684ae..924cca44f9 100644 --- a/circuit/types/integers/src/helpers/to_bits.rs +++ b/circuit/types/integers/src/helpers/to_bits.rs @@ -66,7 +66,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Integer::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_le(); assert_eq!(I::BITS, candidate.len() as u64); @@ -95,7 +95,7 @@ mod tests { let expected = Uniform::rand(&mut rng); let candidate = Integer::::new(mode, expected); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_be(); assert_eq!(I::BITS, candidate.len() as u64); diff --git a/circuit/types/integers/src/lib.rs b/circuit/types/integers/src/lib.rs index 17cf496781..82f6e91b23 100644 --- a/circuit/types/integers/src/lib.rs +++ b/circuit/types/integers/src/lib.rs @@ -99,7 +99,7 @@ impl Integer { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Integer { type Primitive = console::Integer; @@ -115,7 +115,7 @@ impl Inject for Integer { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Integer { type Primitive = console::Integer; @@ -133,7 +133,7 @@ impl Eject for Integer { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Integer { /// Parses a string into an integer circuit. #[inline] @@ -150,7 +150,7 @@ impl Parser for Integer { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Integer { type Err = Error; @@ -169,7 +169,7 @@ impl FromStr for Integer { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Integer { /// Returns the type name of the circuit as a string. #[inline] @@ -178,14 +178,14 @@ impl TypeName for Integer { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Integer { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Integer { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) diff --git a/circuit/types/scalar/src/compare.rs b/circuit/types/scalar/src/compare.rs index d5091ed6df..77f82f564a 100644 --- a/circuit/types/scalar/src/compare.rs +++ b/circuit/types/scalar/src/compare.rs @@ -84,7 +84,7 @@ mod tests { let candidate_b = Scalar::::new(mode_b, expected_b); // Perform the less than comparison. - Circuit::scope(&format!("{mode_a} {mode_b} {i}"), || { + Circuit::scope(format!("{mode_a} {mode_b} {i}"), || { let candidate = candidate_a.is_less_than(&candidate_b); assert_eq!(expected_a < expected_b, candidate.eject_value()); assert_scope!(<=num_constants, <=num_public, <=num_private, <=num_constraints); diff --git a/circuit/types/scalar/src/helpers/from_bits.rs b/circuit/types/scalar/src/helpers/from_bits.rs index 7653c4233c..4458224043 100644 --- a/circuit/types/scalar/src/helpers/from_bits.rs +++ b/circuit/types/scalar/src/helpers/from_bits.rs @@ -108,7 +108,7 @@ mod tests { let given_bits = Scalar::::new(mode, expected).to_bits_le(); let expected_size_in_bits = given_bits.len(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Scalar::::from_bits_le(&given_bits); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.get().unwrap().len()); @@ -119,7 +119,7 @@ mod tests { // Add excess zero bits. let candidate = [given_bits, vec![Boolean::new(mode, false); i as usize]].concat(); - Circuit::scope(&format!("Excess {mode} {i}"), || { + Circuit::scope(format!("Excess {mode} {i}"), || { let candidate = Scalar::::from_bits_le(&candidate); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.get().unwrap().len()); @@ -149,7 +149,7 @@ mod tests { let given_bits = Scalar::::new(mode, expected).to_bits_be(); let expected_size_in_bits = given_bits.len(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = Scalar::::from_bits_be(&given_bits); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.get().unwrap().len()); @@ -160,7 +160,7 @@ mod tests { // Add excess zero bits. let candidate = [vec![Boolean::new(mode, false); i as usize], given_bits].concat(); - Circuit::scope(&format!("Excess {mode} {i}"), || { + Circuit::scope(format!("Excess {mode} {i}"), || { let candidate = Scalar::::from_bits_be(&candidate); assert_eq!(expected, candidate.eject_value()); assert_eq!(expected_size_in_bits, candidate.bits_le.get().unwrap().len()); diff --git a/circuit/types/scalar/src/helpers/from_field.rs b/circuit/types/scalar/src/helpers/from_field.rs index 75832a1b67..da4be32cee 100644 --- a/circuit/types/scalar/src/helpers/from_field.rs +++ b/circuit/types/scalar/src/helpers/from_field.rs @@ -23,8 +23,8 @@ impl FromField for Scalar { /// This method guarantees the following: /// 1. If the field element is larger than the scalar field modulus, then the operation will fail. /// 2. If the field element is smaller than the scalar field modulus, then the operation will succeed. - /// - This is particularly useful for the case where a user called, `Scalar::from_field(scalar.to_field())`, - /// and the scalar bit representation is between `size_in_data_bits < bits.len() < size_in_bits`. + /// - This is particularly useful for the case where a user called, `Scalar::from_field(scalar.to_field())`, + /// and the scalar bit representation is between `size_in_data_bits < bits.len() < size_in_bits`. fn from_field(field: Self::Field) -> Self { // Note: We are reconstituting the integer from the base field. // This is safe as the number of bits in the integer is less than the base field modulus, diff --git a/circuit/types/scalar/src/lib.rs b/circuit/types/scalar/src/lib.rs index 4cacfc7b8a..1dde301382 100644 --- a/circuit/types/scalar/src/lib.rs +++ b/circuit/types/scalar/src/lib.rs @@ -44,7 +44,7 @@ pub struct Scalar { impl ScalarTrait for Scalar {} -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for Scalar { type Primitive = console::Scalar; @@ -63,7 +63,7 @@ impl Inject for Scalar { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for Scalar { type Primitive = console::Scalar; @@ -81,7 +81,7 @@ impl Eject for Scalar { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for Scalar { /// Parses a string into a scalar circuit. #[inline] @@ -98,7 +98,7 @@ impl Parser for Scalar { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for Scalar { type Err = Error; @@ -117,7 +117,7 @@ impl FromStr for Scalar { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for Scalar { /// Returns the type name of the circuit as a string. #[inline] @@ -126,14 +126,14 @@ impl TypeName for Scalar { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for Scalar { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for Scalar { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) diff --git a/circuit/types/string/src/helpers/from_bits.rs b/circuit/types/string/src/helpers/from_bits.rs index f5e10e4545..000c98f8e5 100644 --- a/circuit/types/string/src/helpers/from_bits.rs +++ b/circuit/types/string/src/helpers/from_bits.rs @@ -86,7 +86,7 @@ mod tests { let candidate = StringType::::new(mode, console::StringType::new(&expected)).to_bits_le(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = StringType::::from_bits_le(&candidate); assert_eq!(expected, *candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); @@ -106,7 +106,7 @@ mod tests { let candidate = StringType::::new(mode, console::StringType::new(&expected)).to_bits_be(); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = StringType::::from_bits_be(&candidate); assert_eq!(expected, *candidate.eject_value()); assert_scope!(num_constants, num_public, num_private, num_constraints); diff --git a/circuit/types/string/src/helpers/to_bits.rs b/circuit/types/string/src/helpers/to_bits.rs index 56dd5b4751..4cc4ec32cc 100644 --- a/circuit/types/string/src/helpers/to_bits.rs +++ b/circuit/types/string/src/helpers/to_bits.rs @@ -61,7 +61,7 @@ mod tests { let candidate = StringType::::new(mode, console::StringType::new(&expected)); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_le(); assert_eq!(expected_num_bytes * 8, candidate.len()); @@ -86,7 +86,7 @@ mod tests { let candidate = StringType::::new(mode, console::StringType::new(&expected)); - Circuit::scope(&format!("{mode} {i}"), || { + Circuit::scope(format!("{mode} {i}"), || { let candidate = candidate.to_bits_be(); assert_eq!(expected_num_bytes * 8, candidate.len()); diff --git a/circuit/types/string/src/lib.rs b/circuit/types/string/src/lib.rs index 9dbde14be7..16e6545d88 100644 --- a/circuit/types/string/src/lib.rs +++ b/circuit/types/string/src/lib.rs @@ -38,7 +38,7 @@ pub struct StringType { impl StringTrait for StringType {} -#[cfg(console)] +#[cfg(feature = "console")] impl Inject for StringType { type Primitive = console::StringType; @@ -68,7 +68,7 @@ impl Inject for StringType { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Eject for StringType { type Primitive = console::StringType; @@ -94,7 +94,7 @@ impl Eject for StringType { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Parser for StringType { /// Parses a string into a string circuit. #[inline] @@ -111,7 +111,7 @@ impl Parser for StringType { } } -#[cfg(console)] +#[cfg(feature = "console")] impl FromStr for StringType { type Err = Error; @@ -130,7 +130,7 @@ impl FromStr for StringType { } } -#[cfg(console)] +#[cfg(feature = "console")] impl TypeName for StringType { /// Returns the type name of the circuit as a string. #[inline] @@ -139,14 +139,14 @@ impl TypeName for StringType { } } -#[cfg(console)] +#[cfg(feature = "console")] impl Debug for StringType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(self, f) } } -#[cfg(console)] +#[cfg(feature = "console")] impl Display for StringType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}.{}", self.eject_value(), self.eject_mode()) diff --git a/console/account/src/signature/parse.rs b/console/account/src/signature/parse.rs index 20372af17c..e3f3cbc3c6 100644 --- a/console/account/src/signature/parse.rs +++ b/console/account/src/signature/parse.rs @@ -113,7 +113,7 @@ mod tests { // Check the string representation. let candidate = format!("{expected}"); assert_eq!(expected, Signature::from_str(&candidate)?); - assert_eq!(SIGNATURE_PREFIX, candidate.to_string().split('1').next().unwrap()); + assert_eq!(SIGNATURE_PREFIX, candidate.split('1').next().unwrap()); } Ok(()) } diff --git a/console/collections/benches/merkle_tree.rs b/console/collections/benches/merkle_tree.rs index 90b41b2b61..e1cd6289b2 100644 --- a/console/collections/benches/merkle_tree.rs +++ b/console/collections/benches/merkle_tree.rs @@ -164,12 +164,12 @@ fn update_vs_update_many(c: &mut Criterion) { let index = index % num_leaves; let new_leaf = generate_leaves!(1, &mut rng).pop().unwrap(); // Benchmark the standard update operation. - group.bench_with_input(BenchmarkId::new("Single", &format!("{depth}")), &new_leaf, |b, new_leaf| { + group.bench_with_input(BenchmarkId::new("Single", format!("{depth}")), &new_leaf, |b, new_leaf| { b.iter_batched(|| tree.clone(), |mut tree| tree.update(index, new_leaf), BatchSize::SmallInput) }); // Benchmark the `update_many` operation. group.bench_with_input( - BenchmarkId::new("Batch", &format!("{depth}")), + BenchmarkId::new("Batch", format!("{depth}")), &BTreeMap::from([(index, new_leaf)]), |b, updates| b.iter_batched(|| tree.clone(), |mut tree| tree.update_many(updates), BatchSize::SmallInput), ); diff --git a/console/network/environment/src/traits/parse_string.rs b/console/network/environment/src/traits/parse_string.rs index 5427b8a5f5..854f9731fa 100644 --- a/console/network/environment/src/traits/parse_string.rs +++ b/console/network/environment/src/traits/parse_string.rs @@ -15,17 +15,16 @@ /// From https://github.com/Geal/nom/blob/main/examples/string.rs pub mod string_parser { - //! This example shows an example of how to parse an escaped string. The - //! rules for the string are similar to JSON and rust. A string is: - //! - //! - Enclosed by double quotes - //! - Can contain any raw unescaped code point besides \ and " - //! - Matches the following escape sequences: \b, \f, \n, \r, \t, \", \\, \/ - //! - Matches code points like Rust: \u{XXXX}, where XXXX can be up to 6 - //! hex characters - //! - an escape followed by whitespace consumes all whitespace between the - //! escape and the next non-whitespace character - + /// This example shows an example of how to parse an escaped string. The + /// rules for the string are similar to JSON and rust. A string is: + /// + /// - Enclosed by double quotes + /// - Can contain any raw unescaped code point besides \ and " + /// - Matches the following escape sequences: \b, \f, \n, \r, \t, \", \\, \/ + /// - Matches code points like Rust: \u{XXXX}, where XXXX can be up to 6 + /// hex characters + /// - an escape followed by whitespace consumes all whitespace between the + /// escape and the next non-whitespace character use nom::{ Err::Error, IResult, diff --git a/console/program/src/data/ciphertext/parse.rs b/console/program/src/data/ciphertext/parse.rs index 698ea6f9e7..693b84fc25 100644 --- a/console/program/src/data/ciphertext/parse.rs +++ b/console/program/src/data/ciphertext/parse.rs @@ -114,7 +114,7 @@ mod tests { // Check the string representation. let candidate = format!("{expected}"); assert_eq!(expected, Ciphertext::from_str(&candidate)?); - assert_eq!(CIPHERTEXT_PREFIX, candidate.to_string().split('1').next().unwrap()); + assert_eq!(CIPHERTEXT_PREFIX, candidate.split('1').next().unwrap()); } Ok(()) } diff --git a/console/program/src/data/literal/cast/mod.rs b/console/program/src/data/literal/cast/mod.rs index 94f5af3b92..77cde083e9 100644 --- a/console/program/src/data/literal/cast/mod.rs +++ b/console/program/src/data/literal/cast/mod.rs @@ -41,6 +41,7 @@ impl Literal { /// - (`Address`, `Group`) <-> `Field` <-> `Scalar` <-> `Integer` <-> `Boolean` /// - `Signature` (not supported) /// - `String` (not supported) + /// /// Note that casting to left along the hierarchy always preserves information. pub fn cast(&self, to_type: LiteralType) -> Result { match self { diff --git a/console/program/src/data/literal/cast_lossy/mod.rs b/console/program/src/data/literal/cast_lossy/mod.rs index c9516539bb..0b6c11eeef 100644 --- a/console/program/src/data/literal/cast_lossy/mod.rs +++ b/console/program/src/data/literal/cast_lossy/mod.rs @@ -42,6 +42,7 @@ impl Literal { /// - (`Address`, `Group`) <-> `Field` <-> `Scalar` <-> `Integer` <-> `Boolean` /// - `Signature` (not supported) /// - `String` (not supported) + /// /// Note that casting to left along the hierarchy always preserves information. pub fn cast_lossy(&self, to_type: LiteralType) -> Result { match self { @@ -115,10 +116,7 @@ fn cast_lossy_group_to_type(input: &Group, to_type: LiteralType) } /// Casts an integer literal to the given literal type, with lossy truncation. -fn cast_lossy_integer_to_type( - input: &Integer, - to_type: LiteralType, -) -> Result> +fn cast_lossy_integer_to_type(input: &Integer, to_type: LiteralType) -> Result> where I: AsPrimitive + AsPrimitive @@ -129,7 +127,8 @@ where + AsPrimitive + AsPrimitive + AsPrimitive - + AsPrimitive, + + AsPrimitive + + IntegerType, { impl_cast_lossy_body!(integer, cast_lossy, input, to_type) } diff --git a/console/program/src/state_path/parse.rs b/console/program/src/state_path/parse.rs index d1536762f2..21edd0b8de 100644 --- a/console/program/src/state_path/parse.rs +++ b/console/program/src/state_path/parse.rs @@ -114,7 +114,7 @@ mod tests { // Check the string representation. let candidate = format!("{expected}"); assert_eq!(expected, StatePath::from_str(&candidate).unwrap()); - assert_eq!(STATE_PATH_PREFIX, candidate.to_string().split('1').next().unwrap()); + assert_eq!(STATE_PATH_PREFIX, candidate.split('1').next().unwrap()); } } diff --git a/console/types/address/src/parse.rs b/console/types/address/src/parse.rs index 5df8797ca9..d76461a559 100644 --- a/console/types/address/src/parse.rs +++ b/console/types/address/src/parse.rs @@ -117,7 +117,7 @@ mod tests { // Check the string representation. let candidate = format!("{expected}"); assert_eq!(expected, Address::from_str(&candidate)?); - assert_eq!(ADDRESS_PREFIX, candidate.to_string().split('1').next().unwrap()); + assert_eq!(ADDRESS_PREFIX, candidate.split('1').next().unwrap()); } Ok(()) } diff --git a/console/types/scalar/src/from_field.rs b/console/types/scalar/src/from_field.rs index 69afd781de..1f13d9e283 100644 --- a/console/types/scalar/src/from_field.rs +++ b/console/types/scalar/src/from_field.rs @@ -23,8 +23,8 @@ impl FromField for Scalar { /// This method guarantees the following: /// 1. If the field element is larger than the scalar field modulus, then the operation will fail. /// 2. If the field element is smaller than the scalar field modulus, then the operation will succeed. - /// - This is particularly useful for the case where a user called, `Scalar::from_field(scalar.to_field())`, - /// and the scalar bit representation is between `size_in_data_bits < bits.len() < size_in_bits`. + /// - This is particularly useful for the case where a user called, `Scalar::from_field(scalar.to_field())`, + /// and the scalar bit representation is between `size_in_data_bits < bits.len() < size_in_bits`. fn from_field(field: &Self::Field) -> Result { // Note: We are reconstituting the base field into a scalar field. // This is safe as the scalar field modulus is less than the base field modulus, diff --git a/curves/src/bls12_377/mod.rs b/curves/src/bls12_377/mod.rs index 25c7e1a982..2667c9a3bc 100644 --- a/curves/src/bls12_377/mod.rs +++ b/curves/src/bls12_377/mod.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![cfg_attr(nightly, doc = include_str!("../../documentation/the_aleo_curves/02_bls12-377.md"))] +#![doc = include_str!("../../documentation/the_aleo_curves/02_bls12-377.md")] pub mod fr; #[doc(inline)] diff --git a/curves/src/edwards_bls12/mod.rs b/curves/src/edwards_bls12/mod.rs index 5cf9316064..7ba8acc6c6 100644 --- a/curves/src/edwards_bls12/mod.rs +++ b/curves/src/edwards_bls12/mod.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![cfg_attr(nightly, doc = include_str!("../../documentation/the_aleo_curves/01_edwards_bls12.md"))] +#![doc = include_str!("../../documentation/the_aleo_curves/01_edwards_bls12.md")] pub mod fq; #[doc(inline)] diff --git a/curves/src/edwards_bls12/parameters.rs b/curves/src/edwards_bls12/parameters.rs index edc4d85684..c03024dfaa 100644 --- a/curves/src/edwards_bls12/parameters.rs +++ b/curves/src/edwards_bls12/parameters.rs @@ -104,7 +104,7 @@ impl FromStr for EdwardsAffine { return Err(GroupError::InvalidString); } let mut point = Vec::new(); - for substr in s.split(|c| c == '(' || c == ')' || c == ',' || c == ' ') { + for substr in s.split(['(', ')', ',', ' ']) { if !substr.is_empty() { point.push(Fq::from_str(substr)?); } diff --git a/fields/src/macros.rs b/fields/src/macros.rs index ac17e9ece4..3b09e90f89 100644 --- a/fields/src/macros.rs +++ b/fields/src/macros.rs @@ -45,7 +45,7 @@ macro_rules! impl_primefield_standard_sample { loop { let mut tmp = $field(rng.sample(rand::distributions::Standard), PhantomData); // Mask away the unused bits at the beginning. - tmp.0.as_mut().last_mut().map(|val| *val &= std::u64::MAX >> P::REPR_SHAVE_BITS); + tmp.0.as_mut().last_mut().map(|val| *val &= u64::MAX >> P::REPR_SHAVE_BITS); if tmp.is_valid() { return tmp; diff --git a/ledger/puzzle/epoch/src/synthesis/program/to_r1cs.rs b/ledger/puzzle/epoch/src/synthesis/program/to_r1cs.rs index 139026a9da..533f3fc982 100644 --- a/ledger/puzzle/epoch/src/synthesis/program/to_r1cs.rs +++ b/ledger/puzzle/epoch/src/synthesis/program/to_r1cs.rs @@ -65,8 +65,11 @@ impl EpochProgram { bail!("Failed to execute instruction ({instruction}): {error}"); } - #[cfg(feature = "debug")] + #[cfg(debug_assertions)] { + use circuit::Eject; + use snarkvm_synthesizer_program::RegistersLoadCircuit; + use colored::Colorize; let is_satisfied = A::is_satisfied(); @@ -76,7 +79,6 @@ impl EpochProgram { ); if !is_satisfied { for operand in instruction.operands() { - use synthesizer_program::RegistersLoadCircuit; let value = registers.load_circuit(&self.stack, operand)?; println!(" {operand} = {}", value.eject_value()); } diff --git a/ledger/puzzle/src/solution_id/string.rs b/ledger/puzzle/src/solution_id/string.rs index 5f608f6365..42d04f5961 100644 --- a/ledger/puzzle/src/solution_id/string.rs +++ b/ledger/puzzle/src/solution_id/string.rs @@ -79,7 +79,7 @@ mod tests { // Check the string representation. let candidate = format!("{expected}"); assert_eq!(expected, SolutionID::from_str(&candidate)?); - assert_eq!(SOLUTION_ID_PREFIX, candidate.to_string().split('1').next().unwrap()); + assert_eq!(SOLUTION_ID_PREFIX, candidate.split('1').next().unwrap()); } Ok(()) } diff --git a/ledger/store/src/block/mod.rs b/ledger/store/src/block/mod.rs index dd95020619..156208c870 100644 --- a/ledger/store/src/block/mod.rs +++ b/ledger/store/src/block/mod.rs @@ -488,16 +488,10 @@ pub trait BlockStorage: 'static + Clone + Send + Sync { }; // Retrieve the aborted solution IDs. - let aborted_solution_ids = match self.get_block_aborted_solution_ids(block_hash)? { - Some(solution_ids) => solution_ids, - None => Vec::new(), - }; + let aborted_solution_ids = (self.get_block_aborted_solution_ids(block_hash)?).unwrap_or_default(); // Retrieve the aborted transaction IDs. - let aborted_transaction_ids = match self.get_block_aborted_transaction_ids(block_hash)? { - Some(transaction_ids) => transaction_ids, - None => Vec::new(), - }; + let aborted_transaction_ids = (self.get_block_aborted_transaction_ids(block_hash)?).unwrap_or_default(); // Retrieve the rejected transaction IDs, and the deployment or execution ID. let rejected_transaction_ids_and_deployment_or_execution_id = match self.get_block_transactions(block_hash)? { diff --git a/rust-toolchain b/rust-toolchain index 32a6ce3c71..dbd41264aa 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.76.0 +1.81.0 diff --git a/synthesizer/process/src/lib.rs b/synthesizer/process/src/lib.rs index 80650bbf70..65bfede98e 100644 --- a/synthesizer/process/src/lib.rs +++ b/synthesizer/process/src/lib.rs @@ -289,7 +289,7 @@ impl Process { } } -#[cfg(any(test, feature = "test"))] +#[cfg(test)] pub mod test_helpers { use super::*; use console::{account::PrivateKey, network::MainnetV0, program::Identifier}; diff --git a/synthesizer/program/src/lib.rs b/synthesizer/program/src/lib.rs index d6d06cddd9..5adf88f0e1 100644 --- a/synthesizer/program/src/lib.rs +++ b/synthesizer/program/src/lib.rs @@ -266,7 +266,7 @@ impl, Command: CommandTrait> Pro /// Returns the function with the given name. pub fn get_function(&self, name: &Identifier) -> Result> { - self.get_function_ref(name).map(|function| function.clone()) + self.get_function_ref(name).cloned() } /// Returns a reference to the function with the given name. diff --git a/synthesizer/program/src/logic/instruction/bytes.rs b/synthesizer/program/src/logic/instruction/bytes.rs index 0c7ca494e6..04ba7f90e8 100644 --- a/synthesizer/program/src/logic/instruction/bytes.rs +++ b/synthesizer/program/src/logic/instruction/bytes.rs @@ -65,6 +65,8 @@ impl ToBytes for Instruction { let index = Instruction::::OPCODES.iter().position(|&opcode| $variant::::opcode() == opcode).unwrap(); // Serialize the instruction. + // Note that this cast is safe as the number of instructions is less than `u16::MAX`. + #[allow(clippy::cast_possible_truncation)] u16::write_le(&(index as u16),&mut $writer)?; instruction.write_le(&mut $writer)?; }),+ diff --git a/synthesizer/program/src/logic/instruction/mod.rs b/synthesizer/program/src/logic/instruction/mod.rs index c54ce23919..22b516e662 100644 --- a/synthesizer/program/src/logic/instruction/mod.rs +++ b/synthesizer/program/src/logic/instruction/mod.rs @@ -469,6 +469,7 @@ mod tests { #[test] fn test_opcodes() { // Sanity check the number of instructions is unchanged. + // Note that the number of opcodes **MUST NOT** exceed u16::MAX. assert_eq!( 68, Instruction::::OPCODES.len(), diff --git a/synthesizer/program/src/logic/instruction/operation/macros.rs b/synthesizer/program/src/logic/instruction/operation/macros.rs index 5f64c95989..eeed6eef7d 100644 --- a/synthesizer/program/src/logic/instruction/operation/macros.rs +++ b/synthesizer/program/src/logic/instruction/operation/macros.rs @@ -775,7 +775,8 @@ mod tests { } // These indicators are later used in the for-loops below. is_shift_operator |= true; - shift_exceeds_bitwidth |= ((*b as u32) >= $input_a::::size_in_bits() as u32); + let input_a_size_in_bits = u32::try_from($input_a::::size_in_bits()).expect("Input size in bits exceeded u32::MAX"); + shift_exceeds_bitwidth |= ((*b as u32) >= input_a_size_in_bits); }; ("ensure divide by zero halts") => { should_succeed &= (*b) != *$input_b::::zero(); diff --git a/synthesizer/snark/src/certificate/mod.rs b/synthesizer/snark/src/certificate/mod.rs index cd39b97f65..adbc4ca00c 100644 --- a/synthesizer/snark/src/certificate/mod.rs +++ b/synthesizer/snark/src/certificate/mod.rs @@ -68,6 +68,7 @@ impl Certificate { let fiat_shamir = N::varuna_fs_parameters(); // Verify the certificate. + #[allow(clippy::manual_unwrap_or_default)] match Varuna::::verify_vk(universal_verifier, fiat_shamir, assignment, verifying_key, self) { Ok(is_valid) => { #[cfg(feature = "aleo-cli")] diff --git a/synthesizer/snark/src/verifying_key/mod.rs b/synthesizer/snark/src/verifying_key/mod.rs index dc4ee79125..293c532083 100644 --- a/synthesizer/snark/src/verifying_key/mod.rs +++ b/synthesizer/snark/src/verifying_key/mod.rs @@ -50,6 +50,7 @@ impl VerifyingKey { let fiat_shamir = N::varuna_fs_parameters(); // Verify the proof. + #[allow(clippy::manual_unwrap_or_default)] match Varuna::::verify(universal_verifier, fiat_shamir, self, inputs, proof) { Ok(is_valid) => { #[cfg(feature = "aleo-cli")] diff --git a/synthesizer/src/restrictions/helpers/block_range.rs b/synthesizer/src/restrictions/helpers/block_range.rs index 6ce1d051e1..9c84bcef6a 100644 --- a/synthesizer/src/restrictions/helpers/block_range.rs +++ b/synthesizer/src/restrictions/helpers/block_range.rs @@ -162,7 +162,7 @@ impl<'de> Deserialize<'de> for BlockRange { Ok(BlockRange::RangeInclusive(RangeInclusive::new(start, end))) } Field::FullRange => { - variant.newtype_variant()?; + variant.unit_variant()?; Ok(BlockRange::FullRange) } } diff --git a/synthesizer/src/vm/mod.rs b/synthesizer/src/vm/mod.rs index 6edec6338e..6a915a3f8a 100644 --- a/synthesizer/src/vm/mod.rs +++ b/synthesizer/src/vm/mod.rs @@ -443,19 +443,15 @@ impl> VM { // Note: This call is guaranteed to succeed (without error), because `DISCARD_BATCH == true`. self.block_store().unpause_atomic_writes::()?; // Rollback the Merkle tree. - self.block_store().remove_last_n_from_tree_only(1).map_err(|removal_error| { + self.block_store().remove_last_n_from_tree_only(1).inspect_err(|_| { // Log the finalize error. error!("Failed to finalize block {} - {finalize_error}", block.height()); - // Return the removal error. - removal_error })?; } else { // Rollback the block. - self.block_store().remove_last_n(1).map_err(|removal_error| { + self.block_store().remove_last_n(1).inspect_err(|_| { // Log the finalize error. error!("Failed to finalize block {} - {finalize_error}", block.height()); - // Return the removal error. - removal_error })?; } // Return the finalize error. diff --git a/synthesizer/tests/test_process_execute.rs b/synthesizer/tests/test_process_execute.rs index 2f8be038e0..8d63e707fd 100644 --- a/synthesizer/tests/test_process_execute.rs +++ b/synthesizer/tests/test_process_execute.rs @@ -59,7 +59,7 @@ fn run_test(process: Process, test: &ProgramTest) -> serde_yaml: for program in test.programs() { if let Err(err) = process.add_program(program) { output - .get_mut(&serde_yaml::Value::String("errors".to_string())) + .get_mut(serde_yaml::Value::String("errors".to_string())) .unwrap() .as_sequence_mut() .unwrap() diff --git a/synthesizer/tests/utilities/tests/program_test.rs b/synthesizer/tests/utilities/tests/program_test.rs index 349cc103ab..713b700f5e 100644 --- a/synthesizer/tests/utilities/tests/program_test.rs +++ b/synthesizer/tests/utilities/tests/program_test.rs @@ -141,8 +141,8 @@ impl ExpectedTest for ProgramTest { if !self.rewrite { // Check that the errors match. let expected_errors = - self.expected.get(&Value::String("errors".to_string())).unwrap().as_sequence().unwrap(); - let actual_errors = output.get(&Value::String("errors".to_string())).unwrap().as_sequence().unwrap(); + self.expected.get(Value::String("errors".to_string())).unwrap().as_sequence().unwrap(); + let actual_errors = output.get(Value::String("errors".to_string())).unwrap().as_sequence().unwrap(); expected_errors.iter().zip_eq(actual_errors.iter()).for_each(|(expected, actual)| { if expected != actual { let expected = @@ -153,8 +153,8 @@ impl ExpectedTest for ProgramTest { }); // Check that the outputs match. let expected_outputs = - self.expected.get(&Value::String("outputs".to_string())).unwrap().as_sequence().unwrap(); - let actual_outputs = output.get(&Value::String("outputs".to_string())).unwrap().as_sequence().unwrap(); + self.expected.get(Value::String("outputs".to_string())).unwrap().as_sequence().unwrap(); + let actual_outputs = output.get(Value::String("outputs".to_string())).unwrap().as_sequence().unwrap(); self.cases.iter().zip_eq(expected_outputs.iter().zip_eq(actual_outputs.iter())).for_each( |(test, (expected, actual))| { if expected != actual { diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index adeb7ac685..3477882213 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -13,12 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(feature = "network")] -pub use snarkvm_circuit_network as circuit_network; #[cfg(feature = "console")] pub use snarkvm_console as console; -#[cfg(feature = "network")] -pub use snarkvm_console::network as console_network; #[cfg(feature = "curves")] pub use snarkvm_curves as curves; #[cfg(feature = "fields")]