From eda937a5b19e8b125f852efd5636f48bf3ce5f5b Mon Sep 17 00:00:00 2001 From: evan-schott <53463459+evan-schott@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:14:25 -0700 Subject: [PATCH] fixes --- Cargo.lock | 114 +++++++++--------- Cargo.toml | 2 +- compiler/compiler/tests/utilities/mod.rs | 2 +- errors/src/errors/cli/cli_errors.rs | 20 ++- errors/src/errors/package/package_errors.rs | 14 +++ leo/cli/commands/account.rs | 26 +--- leo/cli/commands/build.rs | 7 +- leo/cli/commands/deploy.rs | 30 +++-- leo/cli/commands/execute.rs | 41 ++++--- leo/cli/commands/mod.rs | 3 +- leo/cli/commands/new.rs | 4 +- leo/cli/commands/query/mod.rs | 8 +- leo/cli/commands/run.rs | 6 +- leo/cli/helpers/context.rs | 32 +++-- .../retriever/src/program_context/manifest.rs | 2 +- 15 files changed, 163 insertions(+), 148 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75c111b688..210aef6332 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2851,7 +2851,7 @@ dependencies = [ [[package]] name = "snarkvm" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "anstyle", "anyhow", @@ -2880,7 +2880,7 @@ dependencies = [ [[package]] name = "snarkvm-algorithms" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -2910,7 +2910,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-account", "snarkvm-circuit-algorithms", @@ -2924,7 +2924,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-account" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-network", @@ -2935,7 +2935,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-algorithms" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-types", "snarkvm-console-algorithms", @@ -2945,7 +2945,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-collections" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-types", @@ -2955,7 +2955,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "itertools 0.11.0", @@ -2973,12 +2973,12 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment-witness" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" [[package]] name = "snarkvm-circuit-network" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-collections", @@ -2989,7 +2989,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-program" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "paste", "snarkvm-circuit-account", @@ -3004,7 +3004,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-address", @@ -3019,7 +3019,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-address" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3032,7 +3032,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-boolean" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-console-types-boolean", @@ -3041,7 +3041,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-field" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-group" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3063,7 +3063,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-integers" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3075,7 +3075,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-scalar" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-string" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3098,7 +3098,7 @@ dependencies = [ [[package]] name = "snarkvm-console" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-account", "snarkvm-console-algorithms", @@ -3111,7 +3111,7 @@ dependencies = [ [[package]] name = "snarkvm-console-account" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "bs58", "snarkvm-console-network", @@ -3122,7 +3122,7 @@ dependencies = [ [[package]] name = "snarkvm-console-algorithms" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "blake2s_simd", "smallvec", @@ -3135,7 +3135,7 @@ dependencies = [ [[package]] name = "snarkvm-console-collections" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "rayon", @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "snarkvm-console-network" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -3169,7 +3169,7 @@ dependencies = [ [[package]] name = "snarkvm-console-network-environment" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "anyhow", "bech32", @@ -3187,7 +3187,7 @@ dependencies = [ [[package]] name = "snarkvm-console-program" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "enum-iterator", "enum_index", @@ -3209,7 +3209,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-address", @@ -3224,7 +3224,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-address" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3235,7 +3235,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-boolean" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", ] @@ -3243,7 +3243,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-field" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3253,7 +3253,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-group" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3264,7 +3264,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-integers" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3275,7 +3275,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-scalar" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3286,7 +3286,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-string" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3297,7 +3297,7 @@ dependencies = [ [[package]] name = "snarkvm-curves" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "rand", "rayon", @@ -3311,7 +3311,7 @@ dependencies = [ [[package]] name = "snarkvm-fields" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -3328,7 +3328,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -3352,7 +3352,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-authority" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "anyhow", "rand", @@ -3364,7 +3364,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-block" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3383,7 +3383,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-committee" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3395,7 +3395,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-ledger-narwhal-batch-certificate", "snarkvm-ledger-narwhal-batch-header", @@ -3408,7 +3408,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-certificate" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3421,7 +3421,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-header" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3433,7 +3433,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-data" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "bytes", "serde_json", @@ -3444,7 +3444,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-subdag" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3459,7 +3459,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "bytes", "serde_json", @@ -3472,7 +3472,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission-id" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "snarkvm-console", "snarkvm-ledger-puzzle", @@ -3481,7 +3481,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -3501,7 +3501,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle-epoch" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "anyhow", "colored", @@ -3516,7 +3516,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-query" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "async-trait", "reqwest 0.11.27", @@ -3529,7 +3529,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-store" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std-storage", "anyhow", @@ -3552,7 +3552,7 @@ dependencies = [ [[package]] name = "snarkvm-parameters" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -3577,7 +3577,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -3607,7 +3607,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-process" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "colored", @@ -3630,7 +3630,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-program" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "indexmap 2.2.6", "paste", @@ -3644,7 +3644,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-snark" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "bincode", "once_cell", @@ -3657,7 +3657,7 @@ dependencies = [ [[package]] name = "snarkvm-utilities" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "aleo-std", "anyhow", @@ -3678,7 +3678,7 @@ dependencies = [ [[package]] name = "snarkvm-utilities-derives" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=8a05317#8a053177f46dc4383d5a8adcc6b14e4c73f34c82" dependencies = [ "proc-macro2", "quote 1.0.36", diff --git a/Cargo.toml b/Cargo.toml index 2084287362..8c41b5421b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ members = [ [workspace.dependencies.snarkvm] #version = "0.16.19" git = "https://github.com/AleoNet/snarkVM.git" -rev = "6d64025" +rev = "8a05317" [lib] path = "leo/lib.rs" diff --git a/compiler/compiler/tests/utilities/mod.rs b/compiler/compiler/tests/utilities/mod.rs index f0456cbc85..227e65fed0 100644 --- a/compiler/compiler/tests/utilities/mod.rs +++ b/compiler/compiler/tests/utilities/mod.rs @@ -138,7 +138,7 @@ pub fn setup_build_directory( let _manifest_file = Manifest::create(&directory, &program_id).unwrap(); // Create the environment file. - Env::::new(None, endpoint).unwrap().write_to(&directory).unwrap(); + Env::::new(None, endpoint).unwrap().write_to(&directory); if Env::::exists_at(&directory) { println!(".env file created at {:?}", &directory); } diff --git a/errors/src/errors/cli/cli_errors.rs b/errors/src/errors/cli/cli_errors.rs index 99c67120b1..634cb6551a 100644 --- a/errors/src/errors/cli/cli_errors.rs +++ b/errors/src/errors/cli/cli_errors.rs @@ -267,23 +267,23 @@ create_messages!( @backtraced failed_to_get_endpoint_from_env { - args: (command: impl Display), + args: (), msg: "Failed to get an endpoint.".to_string(), - help: Some(format!("Either make sure you have a `.env` file in current project directory with an `ENDPOINT` variable set, or set the `--endpoint` flag when invoking the CLI command.\n Example: `ENDPOINT=https://api.explorer.aleo.org/v1` or `leo {command} --endpoint \"https://api.explorer.aleo.org/v1\"`.")), + help: Some("Either make sure you have a `.env` file in current project directory with an `ENDPOINT` variable set, or set the `--endpoint` flag when invoking the CLI command.\n Example: `ENDPOINT=https://api.explorer.aleo.org/v1` or `leo build --endpoint \"https://api.explorer.aleo.org/v1\"`.".to_string()), } @backtraced failed_to_get_private_key_from_env { - args: (command: impl Display), + args: (), msg: "Failed to get a private key.".to_string(), - help: Some(format!("Either make sure you have a `.env` file in current project directory with a `PRIVATE_KEY` variable set, or set the `--private-key` flag when invoking the CLI command.\n Example: `PRIVATE_KEY=0x1234...` or `leo {command} --private-key \"APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH\"`.")), + help: Some("Either make sure you have a `.env` file in current project directory with a `PRIVATE_KEY` variable set, or set the `--private-key` flag when invoking the CLI command.\n Example: `PRIVATE_KEY=0x1234...` or `leo deploy --private-key \"APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH\"`.".to_string()), } @backtraced failed_to_get_network_from_env { - args: (command: impl Display), + args: (), msg: "Failed to get a network.".to_string(), - help: Some(format!("Either make sure you have a `.env` file in current project directory with a `NETWORK` variable set, or set the `--network` flag when invoking the CLI command.\n Example: `NETWORK=testnet` or `leo {command} --network testnet`.")), + help: Some("Either make sure you have a `.env` file in current project directory with a `NETWORK` variable set, or set the `--network` flag when invoking the CLI command.\n Example: `NETWORK=testnet` or `leo build --network testnet`.".to_string()), } @backtraced @@ -299,4 +299,12 @@ create_messages!( msg: format!("Program `{program}` exceeds the variable limit {limit} for deployment on network {network}."), help: Some("Reduce the number of variables in the program by reducing the number of instructions in transition functions.".to_string()), } + + @backtraced + confirmation_failed { + args: (), + msg: "Failed to confirm transaction".to_string(), + help: None, + } + ); diff --git a/errors/src/errors/package/package_errors.rs b/errors/src/errors/package/package_errors.rs index c33ca4accd..b5b7c93d2e 100644 --- a/errors/src/errors/package/package_errors.rs +++ b/errors/src/errors/package/package_errors.rs @@ -418,4 +418,18 @@ create_messages!( msg: format!("❌ Execution error: {error}"), help: Some("Make sure that you are using the right `--network` options.".to_string()), } + + @backtraced + snarkvm_error { + args: (error: impl Display), + msg: format!("{error}"), + help: None, + } + + @backtraced + failed_to_load_package { + args: (path: impl Display), + msg: format!("Failed to load leo project at path {path}"), + help: Some("Make sure that the path is correct and that the project exists.".to_string()), + } ); diff --git a/leo/cli/commands/account.rs b/leo/cli/commands/account.rs index b94c99209c..e9a36159c7 100644 --- a/leo/cli/commands/account.rs +++ b/leo/cli/commands/account.rs @@ -26,7 +26,7 @@ use crossterm::ExecutableCommand; use leo_retriever::NetworkName; use rand::SeedableRng; use rand_chacha::ChaChaRng; -use snarkvm::prelude::{MainnetV0, Network, TestnetV0}; +use snarkvm::prelude::{CanaryV0, MainnetV0, Network, TestnetV0}; use std::{ io::{self, Read, Write}, path::PathBuf, @@ -96,13 +96,6 @@ pub enum Account { raw: bool, #[clap(short = 'n', long, help = "Name of the network to use", default_value = "mainnet")] network: String, - #[clap( - short = 'e', - long, - help = "Endpoint to retrieve network state from.", - default_value = "https://api.explorer.aleo.org/v1" - )] - endpoint: String, }, /// Verify a message from an Aleo address. Verify { @@ -120,13 +113,6 @@ pub enum Account { raw: bool, #[clap(short = 'n', long, help = "Name of the network to use", default_value = "mainnet")] network: String, - #[clap( - short = 'e', - long, - help = "Endpoint to retrieve network state from.", - default_value = "https://api.explorer.aleo.org/v1" - )] - endpoint: String, }, } @@ -152,7 +138,7 @@ impl Command for Account { match network { NetworkName::MainnetV0 => generate_new_account::(seed, write, discreet, &ctx, endpoint), NetworkName::TestnetV0 => generate_new_account::(seed, write, discreet, &ctx, endpoint), - NetworkName::CanaryV0 => generate_new_account::(seed, write, discreet, &ctx, endpoint), + NetworkName::CanaryV0 => generate_new_account::(seed, write, discreet, &ctx, endpoint), }? } Account::Import { private_key, write, discreet, network, endpoint } => { @@ -161,10 +147,10 @@ impl Command for Account { match network { NetworkName::MainnetV0 => import_account::(private_key, write, discreet, &ctx, endpoint), NetworkName::TestnetV0 => import_account::(private_key, write, discreet, &ctx, endpoint), - NetworkName::CanaryV0 => import_account::(private_key, write, discreet, &ctx, endpoint), + NetworkName::CanaryV0 => import_account::(private_key, write, discreet, &ctx, endpoint), }? } - Self::Sign { message, seed, raw, private_key, private_key_file, network, endpoint: _ } => { + Self::Sign { message, seed, raw, private_key, private_key_file, network } => { // Parse the network. let network = NetworkName::try_from(network.as_str())?; let result = match network { @@ -180,13 +166,13 @@ impl Command for Account { }?; println!("{result}") } - Self::Verify { address, signature, message, raw, network, endpoint: _ } => { + Self::Verify { address, signature, message, raw, network } => { // Parse the network. let network = NetworkName::try_from(network.as_str())?; let result = match network { NetworkName::MainnetV0 => verify_message::(address, signature, message, raw), NetworkName::TestnetV0 => verify_message::(address, signature, message, raw), - NetworkName::CanaryV0 => verify_message::(address, signature, message, raw), + NetworkName::CanaryV0 => verify_message::(address, signature, message, raw), }?; println!("{result}") } diff --git a/leo/cli/commands/build.rs b/leo/cli/commands/build.rs index d367777926..bc9816df44 100644 --- a/leo/cli/commands/build.rs +++ b/leo/cli/commands/build.rs @@ -29,6 +29,7 @@ use snarkvm::{ }; use indexmap::IndexMap; +use snarkvm::prelude::CanaryV0; use std::{ io::Write, path::{Path, PathBuf}, @@ -93,11 +94,11 @@ impl Command for Build { fn apply(self, context: Context, _: Self::Input) -> Result { // Parse the network. - let network = NetworkName::try_from(context.get_network(&self.options.network, "build")?)?; + let network = NetworkName::try_from(context.get_network(&self.options.network)?)?; match network { NetworkName::MainnetV0 => handle_build::(&self, context), NetworkName::TestnetV0 => handle_build::(&self, context), - NetworkName::CanaryV0 => handle_build::(&self, context), + NetworkName::CanaryV0 => handle_build::(&self, context), } } } @@ -128,7 +129,7 @@ fn handle_build(command: &Build, context: Context) -> Result< Result { // Parse the network. - let network = NetworkName::try_from(context.get_network(&self.options.network, "deploy")?)?; - let endpoint = context.get_endpoint(&self.options.endpoint, "deploy")?; + let network = NetworkName::try_from(context.get_network(&self.options.network)?)?; + let endpoint = context.get_endpoint(&self.options.endpoint)?; match network { NetworkName::MainnetV0 => handle_deploy::(&self, context, network, &endpoint), NetworkName::TestnetV0 => handle_deploy::(&self, context, network, &endpoint), - NetworkName::CanaryV0 => handle_deploy::(&self, context, network, &endpoint), + NetworkName::CanaryV0 => handle_deploy::(&self, context, network, &endpoint), } } } @@ -91,7 +92,7 @@ fn handle_deploy, N: Network>( let project_name = context.open_manifest::()?.program_id().to_string(); // Get the private key. - let private_key = context.get_private_key(&command.fee_options.private_key, "deploy")?; + let private_key = context.get_private_key(&command.fee_options.private_key)?; let address = Address::try_from(&private_key)?; // Specify the query @@ -192,14 +193,17 @@ fn handle_deploy, N: Network>( "Do you want to submit deployment of program `{name}.aleo` to network {} via endpoint {} using address {}?", network, endpoint, address ); - let confirmation = Confirm::with_theme(&ColorfulTheme::default()) - .with_prompt(prompt) - .default(false) - .interact() - .unwrap(); - if !confirmation { - println!("✅ Successfully aborted the execution transaction for '{}'\n", name.bold()); - return Ok(()); + let confirmation = + Confirm::with_theme(&ColorfulTheme::default()).with_prompt(prompt).default(false).interact(); + + // Check if the user confirmed the transaction. + if let Ok(confirmation) = confirmation { + if !confirmation { + println!("✅ Successfully aborted the execution transaction for '{}'\n", name.bold()); + return Ok(()); + } + } else { + return Err(CliError::confirmation_failed().into()); } } println!("✅ Created deployment transaction for '{}'\n", name.bold()); diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index 35a1ac57bd..b37fd17941 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -27,7 +27,7 @@ use crate::cli::query::QueryCommands; use dialoguer::{theme::ColorfulTheme, Confirm}; use leo_retriever::NetworkName; use snarkvm::{ - circuit::{Aleo, AleoTestnetV0, AleoV0}, + circuit::{Aleo, AleoCanaryV0, AleoTestnetV0, AleoV0}, cli::LOCALE, ledger::Transaction::Execute as ExecuteTransaction, package::Package as SnarkVMPackage, @@ -87,12 +87,12 @@ impl Command for Execute { fn apply(self, context: Context, _input: Self::Input) -> Result { // Parse the network. - let network = NetworkName::try_from(context.get_network(&self.compiler_options.network, "deploy")?)?; - let endpoint = context.get_endpoint(&self.compiler_options.endpoint, "deploy")?; + let network = NetworkName::try_from(context.get_network(&self.compiler_options.network)?)?; + let endpoint = context.get_endpoint(&self.compiler_options.endpoint)?; match network { NetworkName::MainnetV0 => handle_execute::(self, context, network, &endpoint), NetworkName::TestnetV0 => handle_execute::(self, context, network, &endpoint), - NetworkName::CanaryV0 => handle_execute::(self, context, network, &endpoint), + NetworkName::CanaryV0 => handle_execute::(self, context, network, &endpoint), } } } @@ -221,14 +221,18 @@ fn handle_execute( "Do you want to submit execution of function `{}` on program `{program_name}.aleo` to network {} via endpoint {} using address {}?", &command.name, network, endpoint, address ); - let confirmation = Confirm::with_theme(&ColorfulTheme::default()) - .with_prompt(prompt) - .default(false) - .interact() - .unwrap(); - if !confirmation { - println!("✅ Successfully aborted the execution transaction for '{}'\n", program_name.bold()); - return Ok(()); + // Ask the user for confirmation of the transaction. + let confirmation = + Confirm::with_theme(&ColorfulTheme::default()).with_prompt(prompt).default(false).interact(); + + // Check if the user confirmed the transaction. + if let Ok(confirmation) = confirmation { + if !confirmation { + println!("✅ Successfully aborted the execution transaction for '{}'\n", program_name.bold()); + return Ok(()); + } + } else { + return Err(CliError::confirmation_failed().into()); } } println!("✅ Created execution transaction for '{}'\n", program_id.to_string().bold()); @@ -250,7 +254,10 @@ fn handle_execute( // Load the package. let package = SnarkVMPackage::open(&path)?; // Convert the inputs. - let inputs = inputs.iter().map(|input| Value::from_str(input).unwrap()).collect::>>(); + let inputs = inputs + .iter() + .map(|input| Value::from_str(input).map_err(PackageError::snarkvm_error).unwrap()) + .collect::>>(); // Execute the request. let (response, execution, metrics) = package .execute::(endpoint.to_string(), &private_key, Identifier::try_from(command.name.clone())?, &inputs, rng) @@ -332,11 +339,7 @@ fn load_program_from_network( endpoint: Some(endpoint.to_string()), network: Some(network.to_string()), command: QueryCommands::Program { - command: crate::cli::commands::query::Program { - name: program_id.to_string(), - mappings: false, - mapping_value: None, - }, + command: query::Program { name: program_id.to_string(), mappings: false, mapping_value: None }, }, } .execute(Context::new(context.path.clone(), context.home.clone(), true)?)?; @@ -377,5 +380,5 @@ fn execution_cost_breakdown(name: &String, total_cost: f64, storage_cost: f64, f ]; let mut out = Vec::new(); text_tables::render(&mut out, data).unwrap(); - println!("{}", ::std::str::from_utf8(&out).unwrap()); + println!("{}", std::str::from_utf8(&out).unwrap()); } diff --git a/leo/cli/commands/mod.rs b/leo/cli/commands/mod.rs index debb1aa57c..d1bc4dcd0e 100644 --- a/leo/cli/commands/mod.rs +++ b/leo/cli/commands/mod.rs @@ -261,8 +261,9 @@ fn check_balance( .execute(Context::new(context.path.clone(), context.home.clone(), true)?)?; // Remove the last 3 characters since they represent the `u64` suffix. public_balance.truncate(public_balance.len() - 3); - // Compare balance. + // This unwrap is safe as the Query will error if it cannot retrieve a public balance, and if it returns a balance that will be a u64. let balance = public_balance.parse::().unwrap(); + // Compare balance. if balance < total_cost { Err(PackageError::insufficient_balance(address, public_balance, total_cost).into()) } else { diff --git a/leo/cli/commands/new.rs b/leo/cli/commands/new.rs index 64c89050e7..df5fe53062 100644 --- a/leo/cli/commands/new.rs +++ b/leo/cli/commands/new.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use snarkvm::prelude::{MainnetV0, TestnetV0}; +use snarkvm::prelude::{CanaryV0, MainnetV0, TestnetV0}; use leo_retriever::NetworkName; @@ -62,7 +62,7 @@ impl Command for New { match network { NetworkName::MainnetV0 => Package::initialize::(&self.name, &package_path, self.endpoint), NetworkName::TestnetV0 => Package::initialize::(&self.name, &package_path, self.endpoint), - NetworkName::CanaryV0 => Package::initialize::(&self.name, &package_path, self.endpoint), + NetworkName::CanaryV0 => Package::initialize::(&self.name, &package_path, self.endpoint), }?; Ok(()) diff --git a/leo/cli/commands/query/mod.rs b/leo/cli/commands/query/mod.rs index c505d70213..591f935d32 100644 --- a/leo/cli/commands/query/mod.rs +++ b/leo/cli/commands/query/mod.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use snarkvm::prelude::{MainnetV0, TestnetV0}; +use snarkvm::prelude::{CanaryV0, MainnetV0, TestnetV0}; mod block; use block::Block; @@ -69,12 +69,12 @@ impl Command for Query { fn apply(self, context: Context, _: Self::Input) -> Result { // Parse the network. - let network = NetworkName::try_from(context.get_network(&self.network, "query")?)?; - let endpoint = context.get_endpoint(&self.endpoint, "query")?; + let network = NetworkName::try_from(context.get_network(&self.network)?)?; + let endpoint = context.get_endpoint(&self.endpoint)?; match network { NetworkName::MainnetV0 => handle_query::(self, context, &network.to_string(), &endpoint), NetworkName::TestnetV0 => handle_query::(self, context, &network.to_string(), &endpoint), - NetworkName::CanaryV0 => handle_query::(self, context, &network.to_string(), &endpoint), + NetworkName::CanaryV0 => handle_query::(self, context, &network.to_string(), &endpoint), } } } diff --git a/leo/cli/commands/run.rs b/leo/cli/commands/run.rs index 119fcccef5..2c1e348db8 100644 --- a/leo/cli/commands/run.rs +++ b/leo/cli/commands/run.rs @@ -19,7 +19,7 @@ use super::*; use leo_retriever::NetworkName; use snarkvm::{ cli::Run as SnarkVMRun, - prelude::{MainnetV0, Network, Parser as SnarkVMParser, TestnetV0}, + prelude::{CanaryV0, MainnetV0, Network, Parser as SnarkVMParser, TestnetV0}, }; /// Build, Prove and Run Leo program with inputs @@ -52,11 +52,11 @@ impl Command for Run { fn apply(self, context: Context, _: Self::Input) -> Result { // Parse the network. - let network = NetworkName::try_from(context.get_network(&self.compiler_options.network, "run")?)?; + let network = NetworkName::try_from(context.get_network(&self.compiler_options.network)?)?; match network { NetworkName::MainnetV0 => handle_run::(self, context), NetworkName::TestnetV0 => handle_run::(self, context), - NetworkName::CanaryV0 => handle_run::(self, context), + NetworkName::CanaryV0 => handle_run::(self, context), } } } diff --git a/leo/cli/helpers/context.rs b/leo/cli/helpers/context.rs index 2d367a8038..38309ce04e 100644 --- a/leo/cli/helpers/context.rs +++ b/leo/cli/helpers/context.rs @@ -143,54 +143,52 @@ impl Context { } /// Returns the private key from the .env file specified in the directory. - pub fn dotenv_private_key(&self, command: &str) -> Result> { - dotenvy::from_path(self.dir()?.join(".env")) - .map_err(|_| CliError::failed_to_get_private_key_from_env(command))?; + pub fn dotenv_private_key(&self) -> Result> { + dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_private_key_from_env())?; // Load the private key from the environment. - let private_key = - dotenvy::var("PRIVATE_KEY").map_err(|_| CliError::failed_to_get_private_key_from_env(command))?; + let private_key = dotenvy::var("PRIVATE_KEY").map_err(|_| CliError::failed_to_get_private_key_from_env())?; // Parse the private key. Ok(PrivateKey::::from_str(&private_key)?) } /// Returns the endpoint from the .env file specified in the directory. - pub fn dotenv_endpoint(&self, command: &str) -> Result { - dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_endpoint_from_env(command))?; + pub fn dotenv_endpoint(&self) -> Result { + dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_endpoint_from_env())?; // Load the endpoint from the environment. - Ok(dotenvy::var("ENDPOINT").map_err(|_| CliError::failed_to_get_endpoint_from_env(command))?) + Ok(dotenvy::var("ENDPOINT").map_err(|_| CliError::failed_to_get_endpoint_from_env())?) } /// Returns the network from the .env file specified in the directory. - pub fn dotenv_network(&self, command: &str) -> Result { - dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_network_from_env(command))?; + pub fn dotenv_network(&self) -> Result { + dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_network_from_env())?; // Load the network from the environment. - Ok(dotenvy::var("NETWORK").map_err(|_| CliError::failed_to_get_network_from_env(command))?) + Ok(dotenvy::var("NETWORK").map_err(|_| CliError::failed_to_get_network_from_env())?) } /// Returns the endpoint to interact with the network. /// If the `--endpoint` options is not provided, it will default to the one in the `.env` file. - pub fn get_endpoint(&self, endpoint: &Option, command: &str) -> Result { + pub fn get_endpoint(&self, endpoint: &Option) -> Result { match endpoint { Some(endpoint) => Ok(endpoint.clone()), - None => Ok(self.dotenv_endpoint(command)?), + None => Ok(self.dotenv_endpoint()?), } } /// Returns the network name. /// If the `--network` options is not provided, it will default to the one in the `.env` file. - pub fn get_network(&self, network: &Option, command: &str) -> Result { + pub fn get_network(&self, network: &Option) -> Result { match network { Some(network) => Ok(network.clone()), - None => Ok(self.dotenv_network(command)?), + None => Ok(self.dotenv_network()?), } } /// Returns the private key. /// If the `--private-key` options is not provided, it will default to the one in the `.env` file. - pub fn get_private_key(&self, private_key: &Option, command: &str) -> Result> { + pub fn get_private_key(&self, private_key: &Option) -> Result> { match private_key { Some(private_key) => Ok(PrivateKey::::from_str(private_key)?), - None => self.dotenv_private_key(command), + None => self.dotenv_private_key(), } } } diff --git a/utils/retriever/src/program_context/manifest.rs b/utils/retriever/src/program_context/manifest.rs index 076959371b..eef1c22120 100644 --- a/utils/retriever/src/program_context/manifest.rs +++ b/utils/retriever/src/program_context/manifest.rs @@ -87,7 +87,7 @@ impl Manifest { pub fn read_from_dir(path: &Path) -> Result { // Read the manifest file. let contents = std::fs::read_to_string(path.join("program.json")) - .map_err(|err| PackageError::failed_to_read_file(path.to_str().unwrap(), err))?; + .map_err(|_| PackageError::failed_to_load_package(path.to_str().unwrap()))?; // Deserialize the manifest. serde_json::from_str(&contents) .map_err(|err| PackageError::failed_to_deserialize_manifest_file(path.to_str().unwrap(), err))