add canary + clippy

This commit is contained in:
evan-schott 2024-06-20 14:20:31 -07:00
parent 31aa70dab1
commit ecac53ef94
15 changed files with 157 additions and 137 deletions

136
Cargo.lock generated
View File

@ -871,6 +871,26 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "enum-iterator"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c280b9e6b3ae19e152d8e31cf47f18389781e119d4013a2a2bb0180e5facc635"
dependencies = [
"enum-iterator-derive",
]
[[package]]
name = "enum-iterator-derive"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b"
dependencies = [
"proc-macro2",
"quote 1.0.36",
"syn 2.0.66",
]
[[package]]
name = "enum_index"
version = "0.2.0"
@ -2831,7 +2851,7 @@ dependencies = [
[[package]]
name = "snarkvm"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"anstyle",
"anyhow",
@ -2860,7 +2880,7 @@ dependencies = [
[[package]]
name = "snarkvm-algorithms"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -2890,7 +2910,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-account",
"snarkvm-circuit-algorithms",
@ -2904,7 +2924,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-account"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-algorithms",
"snarkvm-circuit-network",
@ -2915,7 +2935,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-algorithms"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-types",
"snarkvm-console-algorithms",
@ -2925,7 +2945,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-collections"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-algorithms",
"snarkvm-circuit-types",
@ -2935,7 +2955,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-environment"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"itertools 0.11.0",
@ -2953,12 +2973,12 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-environment-witness"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
[[package]]
name = "snarkvm-circuit-network"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-algorithms",
"snarkvm-circuit-collections",
@ -2969,7 +2989,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-program"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"paste",
"snarkvm-circuit-account",
@ -2984,7 +3004,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-address",
@ -2999,7 +3019,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-address"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@ -3012,7 +3032,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-boolean"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-console-types-boolean",
@ -3021,7 +3041,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-field"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@ -3031,7 +3051,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-group"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@ -3043,7 +3063,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-integers"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@ -3055,7 +3075,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-scalar"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@ -3066,7 +3086,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-string"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@ -3078,7 +3098,7 @@ dependencies = [
[[package]]
name = "snarkvm-console"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-account",
"snarkvm-console-algorithms",
@ -3091,7 +3111,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-account"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"bs58",
"snarkvm-console-network",
@ -3102,7 +3122,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-algorithms"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"blake2s_simd",
"smallvec",
@ -3115,7 +3135,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-collections"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"rayon",
@ -3126,7 +3146,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-network"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"anyhow",
"indexmap 2.2.6",
@ -3149,7 +3169,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-network-environment"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"anyhow",
"bech32",
@ -3167,8 +3187,9 @@ dependencies = [
[[package]]
name = "snarkvm-console-program"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"enum-iterator",
"enum_index",
"enum_index_derive",
"indexmap 2.2.6",
@ -3188,7 +3209,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-address",
@ -3203,7 +3224,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-address"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@ -3214,7 +3235,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-boolean"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
]
@ -3222,7 +3243,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-field"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@ -3232,7 +3253,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-group"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@ -3243,7 +3264,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-integers"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@ -3254,7 +3275,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-scalar"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@ -3265,7 +3286,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-string"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@ -3276,7 +3297,7 @@ dependencies = [
[[package]]
name = "snarkvm-curves"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"rand",
"rayon",
@ -3290,7 +3311,7 @@ dependencies = [
[[package]]
name = "snarkvm-fields"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -3307,7 +3328,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -3331,7 +3352,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-authority"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"anyhow",
"rand",
@ -3343,7 +3364,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-block"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"rayon",
@ -3362,7 +3383,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-committee"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"rayon",
@ -3374,7 +3395,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-ledger-narwhal-batch-certificate",
"snarkvm-ledger-narwhal-batch-header",
@ -3387,7 +3408,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-batch-certificate"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"rayon",
@ -3400,7 +3421,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-batch-header"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"rayon",
@ -3412,7 +3433,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-data"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"bytes",
"serde_json",
@ -3423,7 +3444,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-subdag"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"rayon",
@ -3438,7 +3459,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-transmission"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"bytes",
"serde_json",
@ -3451,7 +3472,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-transmission-id"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"snarkvm-console",
"snarkvm-ledger-puzzle",
@ -3460,7 +3481,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-puzzle"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -3480,7 +3501,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-puzzle-epoch"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"anyhow",
"colored",
@ -3495,7 +3516,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-query"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"async-trait",
"reqwest 0.11.27",
@ -3508,7 +3529,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-store"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std-storage",
"anyhow",
@ -3531,7 +3552,7 @@ dependencies = [
[[package]]
name = "snarkvm-parameters"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -3556,7 +3577,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -3566,6 +3587,7 @@ dependencies = [
"parking_lot",
"rand",
"rayon",
"serde_json",
"snarkvm-algorithms",
"snarkvm-circuit",
"snarkvm-console",
@ -3585,7 +3607,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-process"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"colored",
@ -3608,7 +3630,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-program"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"indexmap 2.2.6",
"paste",
@ -3622,7 +3644,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-snark"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"bincode",
"once_cell",
@ -3635,7 +3657,7 @@ dependencies = [
[[package]]
name = "snarkvm-utilities"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"aleo-std",
"anyhow",
@ -3656,7 +3678,7 @@ dependencies = [
[[package]]
name = "snarkvm-utilities-derives"
version = "0.16.19"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=fddd8b9#fddd8b92b4c6417e37d62722b3b937534dc4fb26"
source = "git+https://github.com/AleoNet/snarkVM.git?rev=6d64025#6d64025f3f775fa164d70d9a8177ec93c97cd36e"
dependencies = [
"proc-macro2",
"quote 1.0.36",

View File

@ -46,7 +46,7 @@ members = [
[workspace.dependencies.snarkvm]
#version = "0.16.19"
git = "https://github.com/AleoNet/snarkVM.git"
rev = "fddd8b9"
rev = "6d64025"
[lib]
path = "leo/lib.rs"

View File

@ -284,5 +284,3 @@ pub fn compile_and_process<'a>(parsed: &'a mut Compiler<'a, CurrentNetwork>) ->
Ok(bytecode)
}

View File

@ -264,35 +264,35 @@ create_messages!(
msg: format!("{error}"),
help: None,
}
@backtraced
failed_to_get_endpoint_from_env {
args: (command: impl Display),
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\"`.")),
}
@backtraced
failed_to_get_private_key_from_env {
args: (command: impl Display),
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\"`.")),
}
@backtraced
failed_to_get_network_from_env {
args: (command: impl Display),
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`.")),
}
@backtraced
constraint_limit_exceeded {
args: (program: impl Display, limit: u64, network: impl Display),
msg: format!("Program `{program}` exceeds the constraint limit {limit} for deployment on network {network}."),
help: Some("Reduce the number of constraints in the program by reducing the number of instructions in transition functions.".to_string()),
}
@backtraced
variable_limit_exceeded {
args: (program: impl Display, limit: u64, network: impl Display),

View File

@ -152,6 +152,7 @@ impl Command for Account {
match network {
NetworkName::MainnetV0 => generate_new_account::<MainnetV0>(seed, write, discreet, &ctx, endpoint),
NetworkName::TestnetV0 => generate_new_account::<TestnetV0>(seed, write, discreet, &ctx, endpoint),
NetworkName::CanaryV0 => generate_new_account::<MainnetV0>(seed, write, discreet, &ctx, endpoint),
}?
}
Account::Import { private_key, write, discreet, network, endpoint } => {
@ -160,6 +161,7 @@ impl Command for Account {
match network {
NetworkName::MainnetV0 => import_account::<MainnetV0>(private_key, write, discreet, &ctx, endpoint),
NetworkName::TestnetV0 => import_account::<TestnetV0>(private_key, write, discreet, &ctx, endpoint),
NetworkName::CanaryV0 => import_account::<MainnetV0>(private_key, write, discreet, &ctx, endpoint),
}?
}
Self::Sign { message, seed, raw, private_key, private_key_file, network, endpoint: _ } => {
@ -172,6 +174,9 @@ impl Command for Account {
NetworkName::TestnetV0 => {
sign_message::<TestnetV0>(message, seed, raw, private_key, private_key_file)
}
NetworkName::CanaryV0 => {
sign_message::<MainnetV0>(message, seed, raw, private_key, private_key_file)
}
}?;
println!("{result}")
}
@ -181,6 +186,7 @@ impl Command for Account {
let result = match network {
NetworkName::MainnetV0 => verify_message::<MainnetV0>(address, signature, message, raw),
NetworkName::TestnetV0 => verify_message::<TestnetV0>(address, signature, message, raw),
NetworkName::CanaryV0 => verify_message::<MainnetV0>(address, signature, message, raw),
}?;
println!("{result}")
}

View File

@ -97,6 +97,7 @@ impl Command for Build {
match network {
NetworkName::MainnetV0 => handle_build::<MainnetV0>(&self, context),
NetworkName::TestnetV0 => handle_build::<TestnetV0>(&self, context),
NetworkName::CanaryV0 => handle_build::<MainnetV0>(&self, context),
}
}
}
@ -123,8 +124,13 @@ fn handle_build<N: Network>(command: &Build, context: Context) -> Result<<Build
// Retrieve all local dependencies in post order
let main_sym = Symbol::intern(&program_id.name().to_string());
let mut retriever = Retriever::<N>::new(main_sym, &package_path, &home_path, context.get_endpoint(&command.options.endpoint, "build")?.to_string())
.map_err(|err| UtilError::failed_to_retrieve_dependencies(err, Default::default()))?;
let mut retriever = Retriever::<N>::new(
main_sym,
&package_path,
&home_path,
context.get_endpoint(&command.options.endpoint, "build")?.to_string(),
)
.map_err(|err| UtilError::failed_to_retrieve_dependencies(err, Default::default()))?;
let mut local_dependencies =
retriever.retrieve().map_err(|err| UtilError::failed_to_retrieve_dependencies(err, Default::default()))?;

View File

@ -20,20 +20,18 @@ use dialoguer::{theme::ColorfulTheme, Confirm};
use leo_retriever::NetworkName;
use snarkvm::{
circuit::{Aleo, AleoTestnetV0, AleoV0},
cli::helpers::dotenv_private_key,
ledger::query::Query as SnarkVMQuery,
package::Package as SnarkVMPackage,
prelude::{
deployment_cost,
store::{helpers::memory::ConsensusMemory, ConsensusStore},
MainnetV0,
PrivateKey,
ProgramOwner,
TestnetV0,
VM,
},
};
use std::{path::PathBuf, str::FromStr};
use std::path::PathBuf;
use text_tables;
/// Deploys an Aleo program.
@ -77,6 +75,7 @@ impl Command for Deploy {
match network {
NetworkName::MainnetV0 => handle_deploy::<AleoV0, MainnetV0>(&self, context, network, &endpoint),
NetworkName::TestnetV0 => handle_deploy::<AleoTestnetV0, TestnetV0>(&self, context, network, &endpoint),
NetworkName::CanaryV0 => handle_deploy::<AleoV0, MainnetV0>(&self, context, network, &endpoint),
}
}
}
@ -120,15 +119,15 @@ fn handle_deploy<A: Aleo<Network = N, BaseField = N::Field>, N: Network>(
// Generate the deployment
let deployment = package.deploy::<A>(None)?;
// Check if the number of variables and constraints are within the limits.
if deployment.num_combined_variables()? > N::MAX_DEPLOYMENT_VARIABLES {
return Err(CliError::variable_limit_exceeded(name, N::MAX_DEPLOYMENT_VARIABLES, network).into());
}
}
if deployment.num_combined_constraints()? > N::MAX_DEPLOYMENT_CONSTRAINTS {
return Err(CliError::constraint_limit_exceeded(name, N::MAX_DEPLOYMENT_CONSTRAINTS, network).into());
}
let deployment_id = deployment.to_deployment_id()?;
let store = ConsensusStore::<N, ConsensusMemory<N>>::open(StorageMode::Production)?;
@ -169,13 +168,7 @@ fn handle_deploy<A: Aleo<Network = N, BaseField = N::Field>, N: Network>(
}
None => {
// Make sure the user has enough public balance to pay for the deployment.
check_balance(
&private_key,
&endpoint,
&network.to_string(),
context.clone(),
total_cost,
)?;
check_balance(&private_key, endpoint, &network.to_string(), context.clone(), total_cost)?;
let fee_authorization = vm.authorize_fee_public(
&private_key,
total_cost,
@ -210,11 +203,7 @@ fn handle_deploy<A: Aleo<Network = N, BaseField = N::Field>, N: Network>(
}
}
println!("✅ Created deployment transaction for '{}'\n", name.bold());
handle_broadcast(
&format!("{}/{}/transaction/broadcast", endpoint, network),
transaction,
name,
)?;
handle_broadcast(&format!("{}/{}/transaction/broadcast", endpoint, network), transaction, name)?;
// Wait between successive deployments to prevent out of order deployments.
if index < all_paths.len() - 1 {
std::thread::sleep(std::time::Duration::from_secs(command.wait));

View File

@ -92,12 +92,18 @@ impl Command for Execute {
match network {
NetworkName::MainnetV0 => handle_execute::<AleoV0>(self, context, network, &endpoint),
NetworkName::TestnetV0 => handle_execute::<AleoTestnetV0>(self, context, network, &endpoint),
NetworkName::CanaryV0 => handle_execute::<AleoV0>(self, context, network, &endpoint),
}
}
}
// A helper function to handle the `execute` command.
fn handle_execute<A: Aleo>(command: Execute, context: Context, network: NetworkName, endpoint: &str) -> Result<<Execute as Command>::Output> {
fn handle_execute<A: Aleo>(
command: Execute,
context: Context,
network: NetworkName,
endpoint: &str,
) -> Result<<Execute as Command>::Output> {
// If input values are provided, then run the program with those inputs.
// Otherwise, use the input file.
let mut inputs = command.inputs.clone();
@ -156,8 +162,7 @@ fn handle_execute<A: Aleo>(command: Execute, context: Context, network: NetworkN
};
// Specify the query
let query =
SnarkVMQuery::<A::Network, BlockMemory<A::Network>>::from(endpoint);
let query = SnarkVMQuery::<A::Network, BlockMemory<A::Network>>::from(endpoint);
// Initialize the storage.
let store = ConsensusStore::<A::Network, ConsensusMemory<A::Network>>::open(StorageMode::Production)?;
@ -207,13 +212,7 @@ fn handle_execute<A: Aleo>(command: Execute, context: Context, network: NetworkN
// Check if the public balance is sufficient.
if fee_record.is_none() {
check_balance::<A::Network>(
&private_key,
endpoint,
&network.to_string(),
context,
total_cost,
)?;
check_balance::<A::Network>(&private_key, endpoint, &network.to_string(), context, total_cost)?;
}
// Broadcast the execution transaction.
@ -234,14 +233,7 @@ fn handle_execute<A: Aleo>(command: Execute, context: Context, network: NetworkN
}
}
println!("✅ Created execution transaction for '{}'\n", program_id.to_string().bold());
handle_broadcast(
&format!(
"{}/{}/transaction/broadcast",
endpoint, network
),
transaction,
&program_name,
)?;
handle_broadcast(&format!("{}/{}/transaction/broadcast", endpoint, network), transaction, &program_name)?;
} else {
println!("✅ Successful dry run execution for '{}'\n", program_id.to_string().bold());
}
@ -262,13 +254,7 @@ fn handle_execute<A: Aleo>(command: Execute, context: Context, network: NetworkN
let inputs = inputs.iter().map(|input| Value::from_str(input).unwrap()).collect::<Vec<Value<A::Network>>>();
// Execute the request.
let (response, execution, metrics) = package
.execute::<A, _>(
endpoint.to_string(),
&private_key,
Identifier::try_from(command.name.clone())?,
&inputs,
rng,
)
.execute::<A, _>(endpoint.to_string(), &private_key, Identifier::try_from(command.name.clone())?, &inputs, rng)
.map_err(PackageError::execution_error)?;
let fee = None;

View File

@ -133,11 +133,9 @@ pub trait Command {
/// require Build command output as their input.
#[derive(Parser, Clone, Debug)]
pub struct BuildOptions {
#[clap(
long,
help = "Endpoint to retrieve network state from. Overrides setting in `.env`.")]
#[clap(long, help = "Endpoint to retrieve network state from. Overrides setting in `.env`.")]
pub endpoint: Option<String>,
#[clap(long, help = "Network to broadcast to. Overrides setting in `.env`.")]
#[clap(long, help = "Network to broadcast to. Overrides setting in `.env`.")]
pub(crate) network: Option<String>,
#[clap(long, help = "Does not recursively compile dependencies.")]
pub non_recursive: bool,
@ -181,7 +179,7 @@ impl Default for BuildOptions {
fn default() -> Self {
Self {
endpoint: None,
network:None,
network: None,
non_recursive: false,
offline: false,
enable_symbol_table_spans: false,

View File

@ -62,6 +62,7 @@ impl Command for New {
match network {
NetworkName::MainnetV0 => Package::initialize::<MainnetV0>(&self.name, &package_path, self.endpoint),
NetworkName::TestnetV0 => Package::initialize::<TestnetV0>(&self.name, &package_path, self.endpoint),
NetworkName::CanaryV0 => Package::initialize::<TestnetV0>(&self.name, &package_path, self.endpoint),
}?;
Ok(())

View File

@ -47,12 +47,7 @@ use leo_retriever::{fetch_from_network, verify_valid_program, NetworkName};
/// Query live data from the Aleo network.
#[derive(Parser, Debug)]
pub struct Query {
#[clap(
short,
long,
global = true,
help = "Endpoint to retrieve network state from. Defaults to entry in `.env`.",
)]
#[clap(short, long, global = true, help = "Endpoint to retrieve network state from. Defaults to entry in `.env`.")]
pub endpoint: Option<String>,
#[clap(short, long, global = true, help = "Network to use. Defaults to entry in `.env`.")]
pub(crate) network: Option<String>,
@ -79,12 +74,18 @@ impl Command for Query {
match network {
NetworkName::MainnetV0 => handle_query::<MainnetV0>(self, context, &network.to_string(), &endpoint),
NetworkName::TestnetV0 => handle_query::<TestnetV0>(self, context, &network.to_string(), &endpoint),
NetworkName::CanaryV0 => handle_query::<MainnetV0>(self, context, &network.to_string(), &endpoint),
}
}
}
// A helper function to handle the `query` command.
fn handle_query<N: Network>(query: Query, context: Context, network: &str, endpoint: &str) -> Result<<Query as Command>::Output> {
fn handle_query<N: Network>(
query: Query,
context: Context,
network: &str,
endpoint: &str,
) -> Result<<Query as Command>::Output> {
let recursive = context.recursive;
let (program, output) = match query.command {
QueryCommands::Block { command } => (None, command.apply(context, ())?),

View File

@ -56,6 +56,7 @@ impl Command for Run {
match network {
NetworkName::MainnetV0 => handle_run::<MainnetV0>(self, context),
NetworkName::TestnetV0 => handle_run::<TestnetV0>(self, context),
NetworkName::CanaryV0 => handle_run::<TestnetV0>(self, context),
}
}
}

View File

@ -23,14 +23,14 @@ use snarkvm::file::Manifest;
use aleo_std::aleo_dir;
use indexmap::IndexMap;
use snarkvm::prelude::{anyhow, Itertools, Network, PrivateKey};
use snarkvm::prelude::{Itertools, Network, PrivateKey};
use std::{
env::current_dir,
fs::File,
io::Write,
path::{Path, PathBuf},
str::FromStr,
};
use std::str::FromStr;
/// Project context, manifest, current directory etc
/// All the info that is relevant in most of the commands
@ -144,27 +144,29 @@ impl Context {
/// Returns the private key from the .env file specified in the directory.
pub fn dotenv_private_key<N: Network>(&self, command: &str) -> Result<PrivateKey<N>> {
dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_private_key_from_env(command))?;
dotenvy::from_path(self.dir()?.join(".env"))
.map_err(|_| CliError::failed_to_get_private_key_from_env(command))?;
// 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(command))?;
// Parse the private key.
Ok(PrivateKey::<N>::from_str(&private_key)?)
}
/// Returns the endpoint from the .env file specified in the directory.
pub fn dotenv_endpoint(&self, command: &str) -> Result<String> {
dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_endpoint_from_env(command))?;
// Load the endpoint from the environment.
Ok(dotenvy::var("ENDPOINT").map_err(|_| CliError::failed_to_get_endpoint_from_env(command))?)
}
/// Returns the network from the .env file specified in the directory.
pub fn dotenv_network(&self, command: &str) -> Result<String> {
dotenvy::from_path(self.dir()?.join(".env")).map_err(|_| CliError::failed_to_get_network_from_env(command))?;
// Load the network from the environment.
Ok(dotenvy::var("NETWORK").map_err(|_| CliError::failed_to_get_network_from_env(command))?)
}
/// 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<String>, command: &str) -> Result<String> {
@ -173,7 +175,7 @@ impl Context {
None => Ok(self.dotenv_endpoint(command)?),
}
}
/// 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<String>, command: &str) -> Result<String> {
@ -182,12 +184,12 @@ impl Context {
None => Ok(self.dotenv_network(command)?),
}
}
/// 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<N: Network>(&self, private_key: &Option<String>, command: &str) -> Result<PrivateKey<N>> {
match private_key {
Some(private_key) => Ok(PrivateKey::<N>::from_str(&private_key)?),
Some(private_key) => Ok(PrivateKey::<N>::from_str(private_key)?),
None => self.dotenv_private_key(command),
}
}

View File

@ -23,8 +23,7 @@ use leo_errors::{PackageError, Result};
use leo_retriever::{Manifest, NetworkName};
use serde::Deserialize;
use snarkvm::prelude::{Network, PrivateKey};
use std::path::Path;
use std::str::FromStr;
use std::{path::Path, str::FromStr};
#[derive(Deserialize)]
pub struct Package {
@ -147,9 +146,13 @@ impl Package {
// Create the .gitignore file.
Gitignore::new().write_to(&path)?;
// Create the .env file.
// Create the .env file.
// Include the private key of validator 0 for ease of use with local devnets, as it will automatically be seeded with funds.
Env::<N>::new(Some(PrivateKey::<N>::from_str("APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH")?), endpoint)?.write_to(&path)?;
Env::<N>::new(
Some(PrivateKey::<N>::from_str("APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH")?),
endpoint,
)?
.write_to(&path)?;
// Create a manifest.
let manifest = Manifest::default(package_name);

View File

@ -16,7 +16,7 @@
use leo_errors::{CliError, LeoError};
use serde::{Deserialize, Serialize};
use snarkvm::prelude::{MainnetV0, Network, TestnetV0};
use snarkvm::prelude::{CanaryV0, MainnetV0, Network, TestnetV0};
use std::fmt;
// Retrievable networks for an external program
@ -26,6 +26,8 @@ pub enum NetworkName {
TestnetV0,
#[serde(rename = "mainnet")]
MainnetV0,
#[serde(rename = "canary")]
CanaryV0,
}
impl NetworkName {
@ -33,6 +35,7 @@ impl NetworkName {
match self {
NetworkName::TestnetV0 => TestnetV0::ID,
NetworkName::MainnetV0 => MainnetV0::ID,
NetworkName::CanaryV0 => CanaryV0::ID,
}
}
}
@ -44,6 +47,7 @@ impl TryFrom<&str> for NetworkName {
match network {
"testnet" => Ok(NetworkName::TestnetV0),
"mainnet" => Ok(NetworkName::MainnetV0),
"canary" => Ok(NetworkName::CanaryV0),
_ => Err(LeoError::CliError(CliError::invalid_network_name(network))),
}
}
@ -56,6 +60,8 @@ impl TryFrom<String> for NetworkName {
Ok(NetworkName::TestnetV0)
} else if network == "mainnet" {
Ok(NetworkName::MainnetV0)
} else if network == "canary" {
Ok(NetworkName::CanaryV0)
} else {
Err(LeoError::CliError(CliError::invalid_network_name(&network)))
}
@ -67,6 +73,7 @@ impl fmt::Display for NetworkName {
match self {
NetworkName::TestnetV0 => write!(f, "testnet"),
NetworkName::MainnetV0 => write!(f, "mainnet"),
NetworkName::CanaryV0 => write!(f, "canary"),
}
}
}