mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-23 18:41:39 +03:00
Implement Mapping::get_or_use (#2413)
* get_or_init -> get_or_use * use mapping get_or_use in examples * fix codegen for Mapping::get_or_use * fix tests for Mapping::get_or_use * fix warnings, update snarvm rev * bump circle rust img v1.70 * fix codegen * update snarkvm rev and regen tests * Update compiler/parser/src/parser/expression.rs Co-authored-by: d0cd <pranavsaig@gmail.com> Signed-off-by: Collin Chin <16715212+collinc97@users.noreply.github.com> * Delete program.json Signed-off-by: Collin Chin <16715212+collinc97@users.noreply.github.com> * Delete program.json Signed-off-by: Collin Chin <16715212+collinc97@users.noreply.github.com> --------- Signed-off-by: Collin Chin <16715212+collinc97@users.noreply.github.com> Co-authored-by: d0cd <pranavsaig@gmail.com>
This commit is contained in:
parent
bb73b9fa31
commit
d83c4be330
@ -50,7 +50,7 @@ commands:
|
||||
jobs:
|
||||
check-style:
|
||||
docker:
|
||||
- image: cimg/rust:1.69
|
||||
- image: cimg/rust:1.70
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
clippy:
|
||||
docker:
|
||||
- image: cimg/rust:1.69
|
||||
- image: cimg/rust:1.70
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -83,7 +83,7 @@ jobs:
|
||||
|
||||
leo-executable:
|
||||
docker:
|
||||
- image: cimg/rust:1.69
|
||||
- image: cimg/rust:1.70
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -102,7 +102,7 @@ jobs:
|
||||
|
||||
leo-new:
|
||||
docker:
|
||||
- image: cimg/rust:1.69
|
||||
- image: cimg/rust:1.70
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -115,7 +115,7 @@ jobs:
|
||||
|
||||
leo-clean:
|
||||
docker:
|
||||
- image: cimg/rust:1.69
|
||||
- image: cimg/rust:1.70
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -128,7 +128,7 @@ jobs:
|
||||
|
||||
test-examples:
|
||||
docker:
|
||||
- image: cimg/rust:1.69
|
||||
- image: cimg/rust:1.70
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
|
87
Cargo.lock
generated
87
Cargo.lock
generated
@ -2348,7 +2348,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anyhow",
|
||||
@ -2376,7 +2376,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-algorithms"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"anyhow",
|
||||
@ -2403,7 +2403,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-account",
|
||||
"snarkvm-circuit-algorithms",
|
||||
@ -2417,7 +2417,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-account"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-algorithms",
|
||||
"snarkvm-circuit-network",
|
||||
@ -2428,7 +2428,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-algorithms"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-types",
|
||||
"snarkvm-console-algorithms",
|
||||
@ -2438,7 +2438,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-collections"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-algorithms",
|
||||
"snarkvm-circuit-types",
|
||||
@ -2448,7 +2448,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-environment"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itertools",
|
||||
@ -2466,12 +2466,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-environment-witness"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-network"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-algorithms",
|
||||
"snarkvm-circuit-collections",
|
||||
@ -2482,7 +2482,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-program"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-account",
|
||||
"snarkvm-circuit-collections",
|
||||
@ -2495,7 +2495,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-address",
|
||||
@ -2510,7 +2510,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-address"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-boolean",
|
||||
@ -2523,7 +2523,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-boolean"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2532,7 +2532,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-field"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-boolean",
|
||||
@ -2542,7 +2542,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-group"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-boolean",
|
||||
@ -2554,7 +2554,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-integers"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-boolean",
|
||||
@ -2565,7 +2565,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-scalar"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-boolean",
|
||||
@ -2576,7 +2576,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-circuit-types-string"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-circuit-environment",
|
||||
"snarkvm-circuit-types-boolean",
|
||||
@ -2588,7 +2588,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-account",
|
||||
"snarkvm-console-algorithms",
|
||||
@ -2601,7 +2601,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-account"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"bs58",
|
||||
"snarkvm-console-network",
|
||||
@ -2611,7 +2611,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-algorithms"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"blake2s_simd",
|
||||
"smallvec",
|
||||
@ -2623,7 +2623,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-collections"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"rayon",
|
||||
@ -2634,7 +2634,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-network"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"indexmap",
|
||||
@ -2657,7 +2657,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-network-environment"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bech32",
|
||||
@ -2674,7 +2674,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-program"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"enum_index",
|
||||
"enum_index_derive",
|
||||
@ -2693,7 +2693,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-address",
|
||||
@ -2708,7 +2708,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-address"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2719,7 +2719,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-boolean"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
]
|
||||
@ -2727,7 +2727,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-field"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2736,7 +2736,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-group"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2747,7 +2747,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-integers"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2757,7 +2757,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-scalar"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2767,7 +2767,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-console-types-string"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"snarkvm-console-network-environment",
|
||||
"snarkvm-console-types-boolean",
|
||||
@ -2778,7 +2778,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-curves"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"rayon",
|
||||
@ -2792,7 +2792,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-fields"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"anyhow",
|
||||
@ -2809,7 +2809,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-ledger"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"anyhow",
|
||||
@ -2820,13 +2820,14 @@ dependencies = [
|
||||
"rayon",
|
||||
"snarkvm-console",
|
||||
"snarkvm-synthesizer",
|
||||
"time",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-parameters"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"anyhow",
|
||||
@ -2850,7 +2851,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-r1cs"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cfg-if",
|
||||
@ -2866,7 +2867,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-synthesizer"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"anyhow",
|
||||
@ -2898,7 +2899,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-synthesizer-coinbase"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -2917,7 +2918,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-synthesizer-snark"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"once_cell",
|
||||
@ -2930,7 +2931,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-utilities"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"aleo-std",
|
||||
"anyhow",
|
||||
@ -2949,7 +2950,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkvm-utilities-derives"
|
||||
version = "0.11.7"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=f69dc53#f69dc53bf3243eb92c3cf8e9d5fdced3ca00d182"
|
||||
source = "git+https://github.com/AleoHQ/snarkvm.git?rev=bad00c6#bad00c6f7279e0ff4c76afc46d024584ea4d147f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.28",
|
||||
|
@ -31,14 +31,14 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.dependencies.snarkvm]
|
||||
rev = "f69dc53"
|
||||
rev = "bad00c6"
|
||||
git = "https://github.com/AleoHQ/snarkvm.git"
|
||||
#version = "=0.11.7"
|
||||
#version = "=0.11.12"
|
||||
|
||||
[workspace.dependencies.snarkvm-console]
|
||||
rev = "f69dc53"
|
||||
rev = "bad00c6"
|
||||
git = "https://github.com/AleoHQ/snarkvm.git"
|
||||
#version = "=0.11.7"
|
||||
#version = "=0.11.12"
|
||||
|
||||
[lib]
|
||||
path = "leo/lib.rs"
|
||||
|
@ -62,7 +62,7 @@ pub enum CoreFunction {
|
||||
Poseidon8HashToScalar,
|
||||
|
||||
MappingGet,
|
||||
MappingGetOrInit,
|
||||
MappingGetOrUse,
|
||||
MappingSet,
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ impl CoreFunction {
|
||||
(sym::Poseidon8, sym::hash_to_scalar) => Self::Poseidon8HashToScalar,
|
||||
|
||||
(sym::Mapping, sym::get) => Self::MappingGet,
|
||||
(sym::Mapping, sym::get_or_init) => Self::MappingGetOrInit,
|
||||
(sym::Mapping, sym::get_or_use) => Self::MappingGetOrUse,
|
||||
(sym::Mapping, sym::set) => Self::MappingSet,
|
||||
_ => return None,
|
||||
})
|
||||
@ -165,7 +165,7 @@ impl CoreFunction {
|
||||
Self::Poseidon8HashToScalar => 1,
|
||||
|
||||
Self::MappingGet => 2,
|
||||
Self::MappingGetOrInit => 3,
|
||||
Self::MappingGetOrUse => 3,
|
||||
Self::MappingSet => 3,
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@
|
||||
//! The [`Ast`] type is intended to be parsed and modified by different passes
|
||||
//! of the Leo compiler. The Leo compiler can generate a set of R1CS constraints from any [`Ast`].
|
||||
|
||||
#![allow(ambiguous_glob_reexports)]
|
||||
|
||||
pub mod access;
|
||||
pub use self::access::*;
|
||||
|
||||
|
@ -51,7 +51,6 @@ default-features = false
|
||||
|
||||
[dev-dependencies.snarkvm]
|
||||
workspace = true
|
||||
default-features = false
|
||||
features = [ "circuit", "console" ]
|
||||
|
||||
[dev-dependencies.regex]
|
||||
|
@ -32,7 +32,6 @@ version = "1.7.2"
|
||||
|
||||
[dependencies.snarkvm-console]
|
||||
workspace = true
|
||||
default-features = false
|
||||
features = [ "account", "network" ]
|
||||
|
||||
[dependencies.clap]
|
||||
|
@ -320,9 +320,9 @@ impl ParserContext<'_> {
|
||||
// Attempt to parse the method call as a mapping operation.
|
||||
match (args.len(), CoreFunction::from_symbols(sym::Mapping, method.name)) {
|
||||
(1, Some(CoreFunction::MappingGet))
|
||||
| (2, Some(CoreFunction::MappingGetOrInit))
|
||||
| (2, Some(CoreFunction::MappingGetOrUse))
|
||||
| (2, Some(CoreFunction::MappingSet)) => {
|
||||
// Found an instance of `<mapping>.get`, `<mapping>.get_or`, or `<mapping>.set`
|
||||
// Found an instance of `<mapping>.get`, `<mapping>.get_or_use`, or `<mapping>.set`
|
||||
Ok(Expression::Access(AccessExpression::AssociatedFunction(AssociatedFunction {
|
||||
ty: Type::Identifier(Identifier::new(sym::Mapping)),
|
||||
name: method,
|
||||
|
@ -135,14 +135,14 @@ impl ParserContext<'_> {
|
||||
Expression::Identifier(Identifier { name: sym::decrement, .. }) => {
|
||||
self.emit_warning(ParserWarning::deprecated(
|
||||
"decrement",
|
||||
"Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings.",
|
||||
"Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings.",
|
||||
place.span(),
|
||||
));
|
||||
}
|
||||
Expression::Identifier(Identifier { name: sym::increment, .. }) => {
|
||||
self.emit_warning(ParserWarning::deprecated(
|
||||
"increment",
|
||||
"Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings.",
|
||||
"Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings.",
|
||||
place.span(),
|
||||
));
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies.snarkvm-console]
|
||||
workspace = true
|
||||
default-features = false
|
||||
features = [ "network" ]
|
||||
|
||||
[dependencies.leo-ast]
|
||||
|
@ -311,8 +311,8 @@ impl<'a> CodeGenerator<'a> {
|
||||
.expect("failed to write to string");
|
||||
(destination_register, instruction)
|
||||
}
|
||||
sym::get_or_init => {
|
||||
let mut instruction = " get.or_init".to_string();
|
||||
sym::get_or_use => {
|
||||
let mut instruction = " get.or_use".to_string();
|
||||
let destination_register = get_destination_register();
|
||||
// Write the mapping name, the key, and the default value.
|
||||
writeln!(
|
||||
|
@ -41,7 +41,7 @@ impl ExpressionReconstructor for DeadCodeEliminator {
|
||||
// If the associated function manipulates a mapping, mark the statement as necessary.
|
||||
match (&function.ty, function.name.name) {
|
||||
(Type::Identifier(Identifier { name: sym::Mapping, .. }), sym::get)
|
||||
| (Type::Identifier(Identifier { name: sym::Mapping, .. }), sym::get_or_init)
|
||||
| (Type::Identifier(Identifier { name: sym::Mapping, .. }), sym::get_or_use)
|
||||
| (Type::Identifier(Identifier { name: sym::Mapping, .. }), sym::set) => {
|
||||
self.is_necessary = true;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ impl<'a> TypeChecker<'a> {
|
||||
None
|
||||
}
|
||||
}
|
||||
CoreFunction::MappingGetOrInit => {
|
||||
CoreFunction::MappingGetOrUse => {
|
||||
// Check that the operation is invoked in a `finalize` block.
|
||||
if !self.is_finalize {
|
||||
self.handler.emit_err(TypeCheckerError::invalid_operation_outside_finalize(
|
||||
|
@ -152,7 +152,7 @@ symbols! {
|
||||
commit,
|
||||
commit_to_group,
|
||||
get,
|
||||
get_or_init,
|
||||
get_or_use,
|
||||
hash,
|
||||
hash_to_group,
|
||||
hash_to_scalar,
|
||||
|
@ -46,7 +46,7 @@ program basic_bank.aleo {
|
||||
// - `hash` : The hash of the token owner.
|
||||
// - `amount`: The amount of tokens that were deposited.
|
||||
finalize deposit(hash: field, amount: u64) {
|
||||
let current_amount: u64 = Mapping::get_or_init(balances, hash, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(balances, hash, 0u64);
|
||||
Mapping::set(balances, hash, current_amount + amount);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ program basic_bank.aleo {
|
||||
// - `hash` : The hash of the token owner.
|
||||
// - `amount`: The amount of tokens that were withdrawn.
|
||||
finalize withdraw(hash: field, amount: u64) {
|
||||
let current_amount: u64 = Mapping::get_or_init(balances, hash, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(balances, hash, 0u64);
|
||||
Mapping::set(balances, hash, current_amount - amount);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ program token.aleo {
|
||||
// Increments `account[receiver]` by `amount`.
|
||||
// If `account[receiver]` does not exist, it will be created.
|
||||
// If `account[receiver] + amount` overflows, `mint_public` is reverted.
|
||||
let current_amount: u64 = Mapping::get_or_init(account, receiver, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(account, receiver, 0u64);
|
||||
Mapping::set(account, receiver, current_amount + amount);
|
||||
}
|
||||
|
||||
@ -44,12 +44,12 @@ program token.aleo {
|
||||
// Decrements `account[sender]` by `amount`.
|
||||
// If `account[sender]` does not exist, it will be created.
|
||||
// If `account[sender] - amount` underflows, `transfer_public` is reverted.
|
||||
let sender_amount: u64 = Mapping::get_or_init(account, sender, 0u64);
|
||||
let sender_amount: u64 = Mapping::get_or_use(account, sender, 0u64);
|
||||
Mapping::set(account, sender, sender_amount - amount);
|
||||
// Increments `account[receiver]` by `amount`.
|
||||
// If `account[receiver]` does not exist, it will be created.
|
||||
// If `account[receiver] + amount` overflows, `transfer_public` is reverted.
|
||||
let receiver_amount: u64 = Mapping::get_or_init(account, receiver, 0u64);
|
||||
let receiver_amount: u64 = Mapping::get_or_use(account, receiver, 0u64);
|
||||
Mapping::set(account, receiver, receiver_amount + amount);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ program token.aleo {
|
||||
// Increments `account[receiver]` by `amount`.
|
||||
// If `account[receiver]` does not exist, it will be created.
|
||||
// If `account[receiver] + amount` overflows, `transfer_private_to_public` is reverted.
|
||||
let current_amount: u64 = Mapping::get_or_init(account, receiver, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(account, receiver, 0u64);
|
||||
Mapping::set(account, receiver, current_amount + amount);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ program token.aleo {
|
||||
// Decrements `account[sender]` by `amount`.
|
||||
// If `account[sender]` does not exist, it will be created.
|
||||
// If `account[sender] - amount` underflows, `transfer_public_to_private` is reverted.
|
||||
let current_amount: u64 = Mapping::get_or_init(account, sender, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(account, sender, 0u64);
|
||||
Mapping::set(account, sender, current_amount - amount);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ program vote.aleo {
|
||||
}
|
||||
// Create a new ticket on a proposal in the "tickets" mapping.
|
||||
finalize new_ticket(public pid: field) {
|
||||
let current: u64 = Mapping::get_or_init(tickets, pid, 0u64);
|
||||
let current: u64 = Mapping::get_or_use(tickets, pid, 0u64);
|
||||
Mapping::set(tickets, pid, current + 1u64);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ program vote.aleo {
|
||||
}
|
||||
finalize agree(public pid: field) {
|
||||
// Publicly increment the number of agree votes.
|
||||
let current: u64 = Mapping::get_or_init(agree_votes, pid, 0u64);
|
||||
let current: u64 = Mapping::get_or_use(agree_votes, pid, 0u64);
|
||||
Mapping::set(agree_votes, pid, current + 1u64);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ program vote.aleo {
|
||||
}
|
||||
finalize disagree(pid: field) {
|
||||
// Publicly increment the number of disagree votes.
|
||||
let current: u64 = Mapping::get_or_init(disagree_votes, pid, 0u64);
|
||||
let current: u64 = Mapping::get_or_use(disagree_votes, pid, 0u64);
|
||||
Mapping::set(disagree_votes, pid, current + 1u64);
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372005]: Unknown function `decrement`\n --> compiler-test:11:9\n |\n 11 | decrement(amounts, addr, amount);\n | ^^^^^^^^^\nWarning [WPAR0370001]: The keyword `decrement` is deprecated.\n --> compiler-test:11:9\n |\n 11 | decrement(amounts, addr, amount);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings."
|
||||
- "Error [ETYC0372005]: Unknown function `decrement`\n --> compiler-test:11:9\n |\n 11 | decrement(amounts, addr, amount);\n | ^^^^^^^^^\nWarning [WPAR0370001]: The keyword `decrement` is deprecated.\n --> compiler-test:11:9\n |\n 11 | decrement(amounts, addr, amount);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings."
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 3e22803ffa4b6e0b59c8ea8841052dfbb7a007c8874b52641593130013031668
|
||||
unrolled_ast: 3e22803ffa4b6e0b59c8ea8841052dfbb7a007c8874b52641593130013031668
|
||||
ssa_ast: ae75694a0d9507b6196155274f3900697147c8e878c672786800e6b7d94f12c8
|
||||
flattened_ast: e076afdbdd27dccbeaf4b9508048119fc1205d3cfee9523e11ec1eedd9d05e8e
|
||||
inlined_ast: e076afdbdd27dccbeaf4b9508048119fc1205d3cfee9523e11ec1eedd9d05e8e
|
||||
dce_ast: e076afdbdd27dccbeaf4b9508048119fc1205d3cfee9523e11ec1eedd9d05e8e
|
||||
bytecode: 6c0d7a2fb3131bdfbaa8706f700ef39dfda0788c26e888a312d64508b8beef1d
|
||||
- - initial_ast: a51e10a6d34d4d22e2da59399b390a38f8681cdbcaf1c64ea716b3170b881e97
|
||||
unrolled_ast: a51e10a6d34d4d22e2da59399b390a38f8681cdbcaf1c64ea716b3170b881e97
|
||||
ssa_ast: 61e7f390a6fbf11e26e0afe0952fd26362fb998208072dee6d077882409cdbf6
|
||||
flattened_ast: d049d89474f2ea2274645657ca5b67f39456640a8d844a171d66d1117f494a89
|
||||
inlined_ast: d049d89474f2ea2274645657ca5b67f39456640a8d844a171d66d1117f494a89
|
||||
dce_ast: d049d89474f2ea2274645657ca5b67f39456640a8d844a171d66d1117f494a89
|
||||
bytecode: 934e0fc8c35f7f0ac3e0403f24f1581573ba6742e9693f9d2a2b56c86e3a6281
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: fcd68f96639b0180cab2adaf2bad1baf463e80359676c8abb16c40100018f5c0
|
||||
unrolled_ast: fcd68f96639b0180cab2adaf2bad1baf463e80359676c8abb16c40100018f5c0
|
||||
ssa_ast: e0b9b619abe1a0cbec79d24272d4569d6b1421e49739a5dd4eabb76b73a3e16f
|
||||
flattened_ast: 9f3a96f7d13e1fd03b5386f2da85b010c75f5d4f2a6ceef3ed74a95dd07778b3
|
||||
inlined_ast: 9f3a96f7d13e1fd03b5386f2da85b010c75f5d4f2a6ceef3ed74a95dd07778b3
|
||||
dce_ast: 9f3a96f7d13e1fd03b5386f2da85b010c75f5d4f2a6ceef3ed74a95dd07778b3
|
||||
bytecode: 5d42290d1854d07a43649ef59b4c88d3881bc15af1409706fc2bac2b733125db
|
||||
- - initial_ast: 20d9459dda23b73da42124af0310e3ced7f71935ffa0d01bbc94c544ea1c7a16
|
||||
unrolled_ast: 20d9459dda23b73da42124af0310e3ced7f71935ffa0d01bbc94c544ea1c7a16
|
||||
ssa_ast: d32ace89f1a341ae14263f41fdd5412cca6a969e8026baece6679aaa36d43f27
|
||||
flattened_ast: 8f60e9c615bbbf32f1178f459b2940ad1b1cc9cb143a766c1ea7f20a7d9dd986
|
||||
inlined_ast: 8f60e9c615bbbf32f1178f459b2940ad1b1cc9cb143a766c1ea7f20a7d9dd986
|
||||
dce_ast: 8f60e9c615bbbf32f1178f459b2940ad1b1cc9cb143a766c1ea7f20a7d9dd986
|
||||
bytecode: aadf7f5dc9714bb97efa3a492e833d993197a1c0a260c81cbdc055d45e2cc8dc
|
||||
warnings: ""
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372005]: Unknown function `increment`\n --> compiler-test:12:9\n |\n 12 | increment(account, receiver, amount);\n | ^^^^^^^^^\nError [ETYC0372071]: A finalize block cannot return a value.\n --> compiler-test:19:5\n |\n 19 | finalize public_adder(a: u8, b: u8) -> public u8 {\n 20 | return a + b;\n 21 | }\n | ^\nError [ETYC0372005]: Unknown function `increment`\n --> compiler-test:28:9\n |\n 28 | increment(values, 0u8, 1u8);\n | ^^^^^^^^^\nError [ETYC0372005]: Unknown function `increment`\n --> compiler-test:29:9\n |\n 29 | increment(account, self.caller, 1u64);\n | ^^^^^^^^^\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:12:9\n |\n 12 | increment(account, receiver, amount);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings.\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:28:9\n |\n 28 | increment(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings.\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:29:9\n |\n 29 | increment(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings."
|
||||
- "Error [ETYC0372005]: Unknown function `increment`\n --> compiler-test:12:9\n |\n 12 | increment(account, receiver, amount);\n | ^^^^^^^^^\nError [ETYC0372071]: A finalize block cannot return a value.\n --> compiler-test:19:5\n |\n 19 | finalize public_adder(a: u8, b: u8) -> public u8 {\n 20 | return a + b;\n 21 | }\n | ^\nError [ETYC0372005]: Unknown function `increment`\n --> compiler-test:28:9\n |\n 28 | increment(values, 0u8, 1u8);\n | ^^^^^^^^^\nError [ETYC0372005]: Unknown function `increment`\n --> compiler-test:29:9\n |\n 29 | increment(account, self.caller, 1u64);\n | ^^^^^^^^^\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:12:9\n |\n 12 | increment(account, receiver, amount);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings.\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:28:9\n |\n 28 | increment(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings.\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:29:9\n |\n 29 | increment(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings."
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 3f1a59f06b2fbb178108e941fa045659525d3aa2f240195b64b5c11c61bc531e
|
||||
unrolled_ast: 3f1a59f06b2fbb178108e941fa045659525d3aa2f240195b64b5c11c61bc531e
|
||||
ssa_ast: 13c427894fa29a6ba0b1b04de888f553dbb973862b826cf89e13e5e660b9d068
|
||||
flattened_ast: 23b5297a87260e4f4fbdb7f70222809207dca126b0bf756ae69ac324341ca621
|
||||
inlined_ast: 23b5297a87260e4f4fbdb7f70222809207dca126b0bf756ae69ac324341ca621
|
||||
dce_ast: 23b5297a87260e4f4fbdb7f70222809207dca126b0bf756ae69ac324341ca621
|
||||
bytecode: 4bd391305131d1a4fccf1012b7831222d6dbb0daae6c0b1ff12af0d17778831c
|
||||
- - initial_ast: 880584c50619ddd37f041cf506396ea6c96e37b5271e839cf872b34119898eef
|
||||
unrolled_ast: 880584c50619ddd37f041cf506396ea6c96e37b5271e839cf872b34119898eef
|
||||
ssa_ast: 187378e5729e306f817e221aef4e4d9e4929a18b89ff73adb09c1949f10efefd
|
||||
flattened_ast: 011e3507a2b2ac58f5d7fc9c6d4a92639af2a5deaf980145b4bfcfa9663efc02
|
||||
inlined_ast: 011e3507a2b2ac58f5d7fc9c6d4a92639af2a5deaf980145b4bfcfa9663efc02
|
||||
dce_ast: 011e3507a2b2ac58f5d7fc9c6d4a92639af2a5deaf980145b4bfcfa9663efc02
|
||||
bytecode: 9fb8466fb6fcf666af985ae722b1742e0beb3f8b2c660c2dcc41212c9b3cc8c3
|
||||
warnings: ""
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370021]: The type of `tokens` has no associated function `get_or_init` that takes 3 argument(s).\n --> compiler-test:18:9\n |\n 18 | tokens.get_or_init(addr, amount, 1u128);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `get_or_init` that takes 1 argument(s).\n --> compiler-test:20:9\n |\n 20 | amounts.get_or_init(1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `get_or_init` that takes 0 argument(s).\n --> compiler-test:22:9\n |\n 22 | amounts.get_or_init();\n | ^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370021]: The type of `tokens` has no associated function `get_or_use` that takes 3 argument(s).\n --> compiler-test:18:9\n |\n 18 | tokens.get_or_use(addr, amount, 1u128);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `get_or_use` that takes 1 argument(s).\n --> compiler-test:20:9\n |\n 20 | amounts.get_or_use(1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `get_or_use` that takes 0 argument(s).\n --> compiler-test:22:9\n |\n 22 | amounts.get_or_use();\n | ^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:10:5\n |\n 10 | mapping tokens: address => Token;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:17:44\n |\n 17 | Mapping::get_or_init(tokens, addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:18:34\n |\n 18 | tokens.get_or_init(addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:19:39\n |\n 19 | Mapping::get_or_init(amounts, 1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:29\n |\n 20 | amounts.get_or_init(1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:21:45\n |\n 21 | Mapping::get_or_init(amounts, addr, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:22:35\n |\n 22 | amounts.get_or_init(addr, 1u8);\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:23:73\n |\n 23 | Mapping::get_or_init(tokens, addr, Token { owner: addr, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:24:63\n |\n 24 | tokens.get_or_init(addr, Token { owner: addr, amount: 1u8 });\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:25:30\n |\n 25 | Mapping::get_or_init(foo, addr, amount);\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:26:9\n |\n 26 | foo.get_or_init(addr, amount);\n | ^^^\n"
|
||||
- "Error [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:10:5\n |\n 10 | mapping tokens: address => Token;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:17:43\n |\n 17 | Mapping::get_or_use(tokens, addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:18:33\n |\n 18 | tokens.get_or_use(addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:19:38\n |\n 19 | Mapping::get_or_use(amounts, 1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:28\n |\n 20 | amounts.get_or_use(1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:21:44\n |\n 21 | Mapping::get_or_use(amounts, addr, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:22:34\n |\n 22 | amounts.get_or_use(addr, 1u8);\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:23:72\n |\n 23 | Mapping::get_or_use(tokens, addr, Token { owner: addr, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:24:62\n |\n 24 | tokens.get_or_use(addr, Token { owner: addr, amount: 1u8 });\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:25:29\n |\n 25 | Mapping::get_or_use(foo, addr, amount);\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:26:9\n |\n 26 | foo.get_or_use(addr, amount);\n | ^^^\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372005]: Unknown function `increment`\n --> compiler-test:11:9\n |\n 11 | increment(amounts, addr, amount);\n | ^^^^^^^^^\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:11:9\n |\n 11 | increment(amounts, addr, amount);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings."
|
||||
- "Error [ETYC0372005]: Unknown function `increment`\n --> compiler-test:11:9\n |\n 11 | increment(amounts, addr, amount);\n | ^^^^^^^^^\nWarning [WPAR0370001]: The keyword `increment` is deprecated.\n --> compiler-test:11:9\n |\n 11 | increment(amounts, addr, amount);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings."
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 1fa1805ab763ad1d48c40a68cefd3afec6cfd51bd652dde40f31c19568351b04
|
||||
unrolled_ast: 1fa1805ab763ad1d48c40a68cefd3afec6cfd51bd652dde40f31c19568351b04
|
||||
ssa_ast: 8d608145548c0fff4016772a969bbbeb4d761f78f4893200462649d163d501b4
|
||||
flattened_ast: 0ad36a07c16792a97cc1e13a2ecc6adffaa1c4d0bfede4161e8328c2deb509d4
|
||||
inlined_ast: 0ad36a07c16792a97cc1e13a2ecc6adffaa1c4d0bfede4161e8328c2deb509d4
|
||||
dce_ast: 0ad36a07c16792a97cc1e13a2ecc6adffaa1c4d0bfede4161e8328c2deb509d4
|
||||
bytecode: 1594fae22250347f7dd1b8b6ddd346c0b510138efa17be448b9b98a93e030d21
|
||||
- - initial_ast: efa3b3caffb241fd5688a8c6a8b509567c01ccdd119c65c67fa2959785b430dc
|
||||
unrolled_ast: efa3b3caffb241fd5688a8c6a8b509567c01ccdd119c65c67fa2959785b430dc
|
||||
ssa_ast: f61f67ac024e3b0785f4c98b4fe585d1c0711abd33e431826215d759e52c7ad1
|
||||
flattened_ast: dee140aba976f7508bbf9d27fdda61c1ffdf0ed123e5299177e293274b6923bb
|
||||
inlined_ast: dee140aba976f7508bbf9d27fdda61c1ffdf0ed123e5299177e293274b6923bb
|
||||
dce_ast: dee140aba976f7508bbf9d27fdda61c1ffdf0ed123e5299177e293274b6923bb
|
||||
bytecode: df488c3c9cd967cc6c7edb491bc348fda4341d88b90887168ae50f2f047ac17c
|
||||
warnings: ""
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372035]: `Mapping::set` must be inside a finalize block.\n --> compiler-test:8:9\n |\n 8 | Mapping::set(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get_or` must be inside a finalize block.\n --> compiler-test:9:9\n |\n 9 | Mapping::get_or_init(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get` must be inside a finalize block.\n --> compiler-test:10:9\n |\n 10 | Mapping::get(values, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::set` must be inside a finalize block.\n --> compiler-test:14:9\n |\n 14 | Mapping::set(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get_or` must be inside a finalize block.\n --> compiler-test:15:9\n |\n 15 | Mapping::get_or_init(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get` must be inside a finalize block.\n --> compiler-test:16:9\n |\n 16 | Mapping::get(values, 0u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372044]: Function must contain a `finalize` statement on all execution paths.\n --> compiler-test:13:5\n |\n 13 | inline bar() {\n 14 | Mapping::set(values, 0u8, 1u8);\n 15 | Mapping::get_or_init(account, self.caller, 1u64);\n 16 | Mapping::get(values, 0u8);\n 17 | }\n | ^\nError [ETYC0372031]: Only transition functions can have a `finalize` block.\n --> compiler-test:19:5\n |\n 19 | finalize finalize_no_params() {\n 20 | foo();\n 21 | bar();\n 22 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372045]: `finalize` name `bar` does not match function name `finalize_no_params`\n --> compiler-test:19:5\n |\n 19 | finalize finalize_no_params() {\n 20 | foo();\n 21 | bar();\n 22 | }\n | ^\nError [ETYC0372066]: Cyclic dependency between functions: `bar` --> `bar`\n"
|
||||
- "Error [ETYC0372035]: `Mapping::set` must be inside a finalize block.\n --> compiler-test:8:9\n |\n 8 | Mapping::set(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get_or` must be inside a finalize block.\n --> compiler-test:9:9\n |\n 9 | Mapping::get_or_use(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get` must be inside a finalize block.\n --> compiler-test:10:9\n |\n 10 | Mapping::get(values, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::set` must be inside a finalize block.\n --> compiler-test:14:9\n |\n 14 | Mapping::set(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get_or` must be inside a finalize block.\n --> compiler-test:15:9\n |\n 15 | Mapping::get_or_use(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `Mapping::get` must be inside a finalize block.\n --> compiler-test:16:9\n |\n 16 | Mapping::get(values, 0u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372044]: Function must contain a `finalize` statement on all execution paths.\n --> compiler-test:13:5\n |\n 13 | inline bar() {\n 14 | Mapping::set(values, 0u8, 1u8);\n 15 | Mapping::get_or_use(account, self.caller, 1u64);\n 16 | Mapping::get(values, 0u8);\n 17 | }\n | ^\nError [ETYC0372031]: Only transition functions can have a `finalize` block.\n --> compiler-test:19:5\n |\n 19 | finalize finalize_no_params() {\n 20 | foo();\n 21 | bar();\n 22 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372045]: `finalize` name `bar` does not match function name `finalize_no_params`\n --> compiler-test:19:5\n |\n 19 | finalize finalize_no_params() {\n 20 | foo();\n 21 | bar();\n 22 | }\n | ^\nError [ETYC0372066]: Cyclic dependency between functions: `bar` --> `bar`\n"
|
||||
|
@ -2,13 +2,13 @@
|
||||
namespace: Execute
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 26abbb0ef61c47bd69f82f4ed0357583bad2ba031ee028400504bfc1f856e0bb
|
||||
unrolled_ast: 26abbb0ef61c47bd69f82f4ed0357583bad2ba031ee028400504bfc1f856e0bb
|
||||
ssa_ast: 8458015258bcc66300b90e61050dad3175ca46babfd3e35205cabc61fa6c34a8
|
||||
flattened_ast: 5cef23d00b994c5f0dc715ede94edae006730bebec809d1425d83418b287a811
|
||||
inlined_ast: 5cef23d00b994c5f0dc715ede94edae006730bebec809d1425d83418b287a811
|
||||
dce_ast: 5cef23d00b994c5f0dc715ede94edae006730bebec809d1425d83418b287a811
|
||||
bytecode: 2f96ec3248782d1a90f9b223eb25bce3770fb9894ecd8ee89d685936ba1ea86b
|
||||
- - initial_ast: 5f8ab884bb9ecd9711292436b320f4da9edb789a71c1f03ebb68103c781b9a25
|
||||
unrolled_ast: 5f8ab884bb9ecd9711292436b320f4da9edb789a71c1f03ebb68103c781b9a25
|
||||
ssa_ast: 1c444b53e6488c43c36bdb122eba014ac62025baf8670a5e80230335bb776ce6
|
||||
flattened_ast: 7522b89ea087ec0266471c1192ca3f12a2172fc070d92ed1509b0016c8def62f
|
||||
inlined_ast: 7522b89ea087ec0266471c1192ca3f12a2172fc070d92ed1509b0016c8def62f
|
||||
dce_ast: 7522b89ea087ec0266471c1192ca3f12a2172fc070d92ed1509b0016c8def62f
|
||||
bytecode: f6055195b401bef6fe1e686a256bb743941b1945b7fd4b8f1800aa83dc3b7495
|
||||
warnings: ""
|
||||
results:
|
||||
dubble:
|
||||
|
@ -3,5 +3,5 @@ namespace: ParseStatement
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370005]: expected ; -- found '['\n --> test:1:10\n |\n 1 | decrement[foo, bar, baz];\n | ^"
|
||||
- "Error [EPAR0370005]: expected ; -- found '<eof>'\n --> test:1:15\n |\n 1 | decrement(floo)\n | ^Warning [WPAR0370001]: The keyword `decrement` is deprecated.\n --> test:1:1\n |\n 1 | decrement(floo)\n | ^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings."
|
||||
- "Error [EPAR0370005]: expected ; -- found '<eof>'\n --> test:1:15\n |\n 1 | decrement(floo)\n | ^Warning [WPAR0370001]: The keyword `decrement` is deprecated.\n --> test:1:1\n |\n 1 | decrement(floo)\n | ^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings."
|
||||
- "Error [EPAR0370005]: expected ; -- found 'foo'\n --> test:1:11\n |\n 1 | decrement foo[bar] by baz;\n | ^^^"
|
||||
|
@ -3,5 +3,5 @@ namespace: ParseStatement
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370005]: expected ; -- found '['\n --> test:1:10\n |\n 1 | increment[foo, bar, baz];\n | ^"
|
||||
- "Error [EPAR0370005]: expected ; -- found '<eof>'\n --> test:1:15\n |\n 1 | increment(floo)\n | ^Warning [WPAR0370001]: The keyword `increment` is deprecated.\n --> test:1:1\n |\n 1 | increment(floo)\n | ^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_init, set}` for manipulating on-chain mappings."
|
||||
- "Error [EPAR0370005]: expected ; -- found '<eof>'\n --> test:1:15\n |\n 1 | increment(floo)\n | ^Warning [WPAR0370001]: The keyword `increment` is deprecated.\n --> test:1:1\n |\n 1 | increment(floo)\n | ^^^^^^^^^^^^^^^\n |\n = Use `Mapping::{get, get_or_use, set}` for manipulating on-chain mappings."
|
||||
- "Error [EPAR0370005]: expected ; -- found 'foo'\n --> test:1:11\n |\n 1 | increment foo[bar] by baz;\n | ^^^"
|
||||
|
@ -11,7 +11,7 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize decrease_self(addr: address, amount: u128) {
|
||||
let current_amount: u128 = Mapping::get_or_init(amounts, addr, 0u128);
|
||||
let current_amount: u128 = Mapping::get_or_use(amounts, addr, 0u128);
|
||||
Mapping::set(amounts, addr, current_amount - amount);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize mint_public (public receiver: address, public amount: u64) {
|
||||
let current_amount: u64 = Mapping::get_or_init(account, receiver, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(account, receiver, 0u64);
|
||||
Mapping::set(account, receiver, current_amount + amount);
|
||||
}
|
||||
|
||||
@ -21,9 +21,9 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize finalize_no_params() -> () {
|
||||
let current_value: u8 = Mapping::get_or_init(values, 0u8, 0u8);
|
||||
let current_value: u8 = Mapping::get_or_use(values, 0u8, 0u8);
|
||||
Mapping::set(values, 0u8, current_value + 1u8);
|
||||
let current_amount: u64 = Mapping::get_or_init(account, self.caller, 0u64);
|
||||
let current_amount: u64 = Mapping::get_or_use(account, self.caller, 0u64);
|
||||
Mapping::set(account, self.caller, current_amount + 1u64);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize mint_public (public receiver: address, public amount: u64) {
|
||||
let current_amount: u64 = account.get_or_init(receiver, 0u64);
|
||||
let current_amount: u64 = account.get_or_use(receiver, 0u64);
|
||||
account.set(receiver, current_amount + amount);
|
||||
}
|
||||
|
||||
@ -21,9 +21,9 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize finalize_no_params() {
|
||||
let current_value: u8 = values.get_or_init(0u8, 0u8);
|
||||
let current_value: u8 = values.get_or_use(0u8, 0u8);
|
||||
values.set(0u8, current_value + 1u8);
|
||||
let current_amount: u64 = account.get_or_init(self.caller, 0u64);
|
||||
let current_amount: u64 = account.get_or_use(self.caller, 0u64);
|
||||
account.set(self.caller, current_amount + 1u64);
|
||||
current_amount = account.get(self.caller);
|
||||
account.set(self.caller, current_amount + 1u64);
|
||||
|
@ -17,11 +17,11 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize decrease_self(addr: address, amount: u128) {
|
||||
Mapping::get_or_init(tokens, addr, amount, 1u128);
|
||||
tokens.get_or_init(addr, amount, 1u128);
|
||||
Mapping::get_or_init(amounts, 1u8);
|
||||
amounts.get_or_init(1u8);
|
||||
Mapping::get_or_init(amounts);
|
||||
amounts.get_or_init();
|
||||
Mapping::get_or_use(tokens, addr, amount, 1u128);
|
||||
tokens.get_or_use(addr, amount, 1u128);
|
||||
Mapping::get_or_use(amounts, 1u8);
|
||||
amounts.get_or_use(1u8);
|
||||
Mapping::get_or_use(amounts);
|
||||
amounts.get_or_use();
|
||||
}
|
||||
}
|
||||
|
@ -17,15 +17,15 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize decrease_self(addr: address, amount: u128) {
|
||||
Mapping::get_or_init(tokens, addr, amount);
|
||||
tokens.get_or_init(addr, amount);
|
||||
Mapping::get_or_init(amounts, 1u8, amount);
|
||||
amounts.get_or_init(1u8, amount);
|
||||
Mapping::get_or_init(amounts, addr, 1u8);
|
||||
amounts.get_or_init(addr, 1u8);
|
||||
Mapping::get_or_init(tokens, addr, Token { owner: addr, amount: 1u8 });
|
||||
tokens.get_or_init(addr, Token { owner: addr, amount: 1u8 });
|
||||
Mapping::get_or_init(foo, addr, amount);
|
||||
foo.get_or_init(addr, amount);
|
||||
Mapping::get_or_use(tokens, addr, amount);
|
||||
tokens.get_or_use(addr, amount);
|
||||
Mapping::get_or_use(amounts, 1u8, amount);
|
||||
amounts.get_or_use(1u8, amount);
|
||||
Mapping::get_or_use(amounts, addr, 1u8);
|
||||
amounts.get_or_use(addr, 1u8);
|
||||
Mapping::get_or_use(tokens, addr, Token { owner: addr, amount: 1u8 });
|
||||
tokens.get_or_use(addr, Token { owner: addr, amount: 1u8 });
|
||||
Mapping::get_or_use(foo, addr, amount);
|
||||
foo.get_or_use(addr, amount);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize increase_self(addr: address, amount: u128) {
|
||||
let current_amount: u128 = Mapping::get_or_init(amounts, addr, 0u128);
|
||||
let current_amount: u128 = Mapping::get_or_use(amounts, addr, 0u128);
|
||||
Mapping::set(amounts, addr, current_amount + amount);
|
||||
}
|
||||
}
|
@ -9,13 +9,13 @@ program test.aleo {
|
||||
|
||||
inline foo() {
|
||||
Mapping::set(values, 0u8, 1u8);
|
||||
Mapping::get_or_init(account, self.caller, 1u64);
|
||||
Mapping::get_or_use(account, self.caller, 1u64);
|
||||
Mapping::get(values, 1u8);
|
||||
}
|
||||
|
||||
inline bar() {
|
||||
Mapping::set(values, 0u8, 1u8);
|
||||
Mapping::get_or_init(account, self.caller, 1u64);
|
||||
Mapping::get_or_use(account, self.caller, 1u64);
|
||||
Mapping::get(values, 0u8);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ program test.aleo {
|
||||
}
|
||||
|
||||
finalize dubble(addr: address) {
|
||||
let current_value: u64 = Mapping::get_or_init(counter, addr, 0u64);
|
||||
let current_value: u64 = Mapping::get_or_use(counter, addr, 0u64);
|
||||
Mapping::set(counter, addr, current_value + 1u64);
|
||||
current_value = Mapping::get(counter, addr);
|
||||
Mapping::set(counter, addr, current_value + 1u64);
|
||||
|
Loading…
Reference in New Issue
Block a user