mirror of
https://github.com/ProvableHQ/leo.git
synced 2025-01-03 07:41:48 +03:00
[Update] snarkvm 0.11.0 (#2377)
* Remove gates from tests * Remove Finalize test namespace * Remove gates from examples * Remove gates from compiler * Regen expectations * Add test that gates is allowed as a standard field of a record * Update Rust version in CI * Add check for MAX_MAPPINGS
This commit is contained in:
parent
4a66d324d8
commit
d0c29ce8e0
@ -50,7 +50,7 @@ commands:
|
|||||||
jobs:
|
jobs:
|
||||||
check-style:
|
check-style:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.65
|
- image: cimg/rust:1.69
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@ -66,7 +66,7 @@ jobs:
|
|||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.65
|
- image: cimg/rust:1.69
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@ -83,7 +83,7 @@ jobs:
|
|||||||
|
|
||||||
leo-executable:
|
leo-executable:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.65
|
- image: cimg/rust:1.69
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@ -102,7 +102,7 @@ jobs:
|
|||||||
|
|
||||||
leo-new:
|
leo-new:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.65
|
- image: cimg/rust:1.69
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -115,7 +115,7 @@ jobs:
|
|||||||
|
|
||||||
leo-clean:
|
leo-clean:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.65
|
- image: cimg/rust:1.69
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
|
|
||||||
test-examples:
|
test-examples:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.65
|
- image: cimg/rust:1.69
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
|
391
Cargo.lock
generated
391
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -31,10 +31,10 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies.snarkvm]
|
[workspace.dependencies.snarkvm]
|
||||||
version = "0.10.3"
|
version = "0.11.0"
|
||||||
|
|
||||||
[workspace.dependencies.snarkvm-console]
|
[workspace.dependencies.snarkvm-console]
|
||||||
version = "0.10.3"
|
version = "0.11.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "leo/lib.rs"
|
path = "leo/lib.rs"
|
||||||
|
@ -57,7 +57,7 @@ impl StructExpression {
|
|||||||
pub fn check_record(&self) -> bool {
|
pub fn check_record(&self) -> bool {
|
||||||
let has_member = |symbol| self.members.iter().any(|variable| variable.identifier.name == symbol);
|
let has_member = |symbol| self.members.iter().any(|variable| variable.identifier.name == symbol);
|
||||||
|
|
||||||
has_member(sym::owner) && has_member(sym::gates) && has_member(sym::_nonce)
|
has_member(sym::owner) && has_member(sym::_nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the struct as a record interface with visibility.
|
/// Returns the struct as a record interface with visibility.
|
||||||
|
@ -1,262 +0,0 @@
|
|||||||
// Copyright (C) 2019-2023 Aleo Systems Inc.
|
|
||||||
// This file is part of the Leo library.
|
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// The Leo library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
mod utilities;
|
|
||||||
use utilities::{buffer_if_err, compile_and_process, get_cwd_option, parse_program, BufferEmitter, Network};
|
|
||||||
|
|
||||||
use crate::utilities::{get_build_options, hash_asts, hash_content, Aleo};
|
|
||||||
|
|
||||||
use leo_errors::emitter::Handler;
|
|
||||||
use leo_span::symbol::create_session_if_not_set_then;
|
|
||||||
use leo_test_framework::{
|
|
||||||
runner::{Namespace, ParseType, Runner},
|
|
||||||
Test,
|
|
||||||
};
|
|
||||||
|
|
||||||
use snarkvm::{console, prelude::*};
|
|
||||||
|
|
||||||
use leo_compiler::{CompilerOptions, OutputOptions};
|
|
||||||
use leo_test_framework::test::TestExpectationMode;
|
|
||||||
use regex::Regex;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use serde_yaml::Value;
|
|
||||||
use std::{collections::BTreeMap, fs, path::Path, rc::Rc};
|
|
||||||
|
|
||||||
struct FinalizeNamespace;
|
|
||||||
|
|
||||||
impl Namespace for FinalizeNamespace {
|
|
||||||
fn parse_type(&self) -> ParseType {
|
|
||||||
ParseType::Whole
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_test(&self, test: Test) -> Result<Value, String> {
|
|
||||||
let buf = BufferEmitter(Rc::default(), Rc::default());
|
|
||||||
let handler = Handler::new(Box::new(buf.clone()));
|
|
||||||
create_session_if_not_set_then(|_| {
|
|
||||||
run_test(test, &handler, &buf).map_err(|()| buf.0.take().to_string() + &buf.1.take().to_string())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Format this better.
|
|
||||||
#[derive(Deserialize, PartialEq, Eq, Serialize)]
|
|
||||||
struct FinalizeOutput {
|
|
||||||
pub initial_ast: String,
|
|
||||||
pub unrolled_ast: String,
|
|
||||||
pub ssa_ast: String,
|
|
||||||
pub flattened_ast: String,
|
|
||||||
pub inlined_ast: String,
|
|
||||||
pub dce_ast: String,
|
|
||||||
pub bytecode: String,
|
|
||||||
pub warnings: String,
|
|
||||||
pub initial_state: String,
|
|
||||||
pub results: BTreeMap<String, Vec<BTreeMap<String, String>>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result<Value, ()> {
|
|
||||||
// Check that config expectation is always pass.
|
|
||||||
if test.config.expectation != TestExpectationMode::Pass {
|
|
||||||
buffer_if_err(err_buf, Err("Test expectation must be `Pass` for `Finalize` tests.".to_string()))?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for CWD option:
|
|
||||||
let cwd = get_cwd_option(&test);
|
|
||||||
|
|
||||||
// Extract the compiler build configurations from the config file.
|
|
||||||
let build_options = get_build_options(&test.config);
|
|
||||||
|
|
||||||
let mut outputs = Vec::with_capacity(build_options.len());
|
|
||||||
|
|
||||||
for build in build_options {
|
|
||||||
let compiler_options = CompilerOptions {
|
|
||||||
build,
|
|
||||||
output: OutputOptions {
|
|
||||||
spans_enabled: false,
|
|
||||||
initial_input_ast: true,
|
|
||||||
initial_ast: true,
|
|
||||||
unrolled_ast: true,
|
|
||||||
ssa_ast: true,
|
|
||||||
flattened_ast: true,
|
|
||||||
inlined_ast: true,
|
|
||||||
dce_ast: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Parse the program.
|
|
||||||
let mut parsed =
|
|
||||||
handler.extend_if_error(parse_program(handler, &test.content, cwd.clone(), Some(compiler_options)))?;
|
|
||||||
|
|
||||||
// Compile the program to bytecode.
|
|
||||||
let bytecode = handler.extend_if_error(compile_and_process(&mut parsed))?;
|
|
||||||
println!("Bytecode: {}", bytecode);
|
|
||||||
let program = Program::<Network>::from_str(&bytecode).unwrap();
|
|
||||||
let program_id = program.id();
|
|
||||||
|
|
||||||
// Extract the cases from the test config.
|
|
||||||
let all_cases = test
|
|
||||||
.config
|
|
||||||
.extra
|
|
||||||
.get("cases")
|
|
||||||
.expect("An `Finalize` config must have a `cases` field.")
|
|
||||||
.as_mapping()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Extract the initial state from the test config.
|
|
||||||
let initial_state = test
|
|
||||||
.config
|
|
||||||
.extra
|
|
||||||
.get("initial_state")
|
|
||||||
.expect("A `Finalize` config must have a `initial_state` field.")
|
|
||||||
.as_mapping()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Initialize the program storage.
|
|
||||||
let store = ProgramStore::<_, ProgramMemory<Network>>::open(None).unwrap();
|
|
||||||
for (mapping_id, key_value_pairs) in initial_state {
|
|
||||||
// Initialize the mapping.
|
|
||||||
let mapping_name = Identifier::from_str(mapping_id.as_str().unwrap()).unwrap();
|
|
||||||
store.initialize_mapping(program_id, &mapping_name).unwrap();
|
|
||||||
|
|
||||||
// Insert the key value pairs.
|
|
||||||
let key_value_pairs = key_value_pairs.as_sequence().unwrap();
|
|
||||||
for pair in key_value_pairs {
|
|
||||||
let pair = pair.as_sequence().unwrap();
|
|
||||||
assert!(pair.len() == 2);
|
|
||||||
store
|
|
||||||
.insert_key_value(
|
|
||||||
program_id,
|
|
||||||
&mapping_name,
|
|
||||||
Plaintext::<Network>::from_str(pair[0].as_str().unwrap()).unwrap(),
|
|
||||||
console::program::Value::<Network>::from_str(pair[1].as_str().unwrap()).unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize a process.
|
|
||||||
let mut process = Process::load().unwrap();
|
|
||||||
process.add_program(&program).unwrap();
|
|
||||||
|
|
||||||
// Initialize an rng.
|
|
||||||
let rng = &mut TestRng::default();
|
|
||||||
|
|
||||||
// Initialize a private key.
|
|
||||||
let private_key = PrivateKey::<Network>::new(rng).unwrap();
|
|
||||||
|
|
||||||
// Initialize a map for the expected results.
|
|
||||||
let mut results = BTreeMap::new();
|
|
||||||
|
|
||||||
// Run each test case for each function.
|
|
||||||
for (function_name, function_cases) in all_cases {
|
|
||||||
let function_name = Identifier::from_str(function_name.as_str().unwrap()).unwrap();
|
|
||||||
let cases = function_cases.as_sequence().unwrap();
|
|
||||||
let mut function_results = Vec::with_capacity(cases.len());
|
|
||||||
|
|
||||||
for case in cases {
|
|
||||||
let case = case.as_mapping().unwrap();
|
|
||||||
let inputs: Vec<_> = case
|
|
||||||
.get(&Value::from("input"))
|
|
||||||
.unwrap()
|
|
||||||
.as_sequence()
|
|
||||||
.unwrap()
|
|
||||||
.iter()
|
|
||||||
.map(|input| console::program::Value::<Network>::from_str(input.as_str().unwrap()).unwrap())
|
|
||||||
.collect();
|
|
||||||
let input_string = format!("[{}]", inputs.iter().map(|input| input.to_string()).join(", "));
|
|
||||||
|
|
||||||
// Authorize the function call.
|
|
||||||
let authorization =
|
|
||||||
process.authorize::<Aleo, _>(&private_key, program_id, function_name, inputs.iter(), rng).unwrap();
|
|
||||||
// Execute the function call.
|
|
||||||
let (response, execution, _, _) = process.execute::<Aleo, _>(authorization, rng).unwrap();
|
|
||||||
// Finalize the function call.
|
|
||||||
let finalize_output_string = match process.finalize_execution(&store, &execution) {
|
|
||||||
Ok(_) => "Finalize was successful.".to_string(),
|
|
||||||
Err(err) => format!("SnarkVMError({err})"),
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: Add support for custom config like custom private keys.
|
|
||||||
// Execute the program and get the outputs.
|
|
||||||
let execute_output = format!(
|
|
||||||
"[{}]",
|
|
||||||
response
|
|
||||||
.outputs()
|
|
||||||
.iter()
|
|
||||||
.map(|output| {
|
|
||||||
match output {
|
|
||||||
// Remove the `_nonce` from the record string.
|
|
||||||
console::program::Value::Record(record) => {
|
|
||||||
let pattern = Regex::new(r"_nonce: \d+group.public").unwrap();
|
|
||||||
pattern.replace(&record.to_string(), "").to_string()
|
|
||||||
}
|
|
||||||
_ => output.to_string(),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.join(", ")
|
|
||||||
);
|
|
||||||
|
|
||||||
// Store the inputs and outputs in a map.
|
|
||||||
let mut result = BTreeMap::new();
|
|
||||||
result.insert("input".to_string(), input_string);
|
|
||||||
result.insert("execute_output".to_string(), execute_output);
|
|
||||||
result.insert("finalize_output".to_string(), finalize_output_string);
|
|
||||||
|
|
||||||
// Add the hashes of the inputs and outputs to the function results.
|
|
||||||
function_results.push(result);
|
|
||||||
}
|
|
||||||
results.insert(function_name.to_string(), function_results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hash the ast files.
|
|
||||||
let (initial_ast, unrolled_ast, ssa_ast, flattened_ast, inlined_ast, dce_ast) = hash_asts();
|
|
||||||
|
|
||||||
// Clean up the output directory.
|
|
||||||
if fs::read_dir("/tmp/output").is_ok() {
|
|
||||||
fs::remove_dir_all(Path::new("/tmp/output")).expect("Error failed to clean up output dir.");
|
|
||||||
}
|
|
||||||
|
|
||||||
let final_output = FinalizeOutput {
|
|
||||||
initial_ast,
|
|
||||||
unrolled_ast,
|
|
||||||
ssa_ast,
|
|
||||||
flattened_ast,
|
|
||||||
inlined_ast,
|
|
||||||
dce_ast,
|
|
||||||
bytecode: hash_content(&bytecode),
|
|
||||||
warnings: err_buf.1.take().to_string(),
|
|
||||||
initial_state: hash_content(&serde_yaml::to_string(&initial_state).unwrap()),
|
|
||||||
results,
|
|
||||||
};
|
|
||||||
outputs.push(final_output)
|
|
||||||
}
|
|
||||||
Ok(serde_yaml::to_value(outputs).expect("serialization failed"))
|
|
||||||
}
|
|
||||||
|
|
||||||
struct TestRunner;
|
|
||||||
|
|
||||||
impl Runner for TestRunner {
|
|
||||||
fn resolve_namespace(&self, name: &str) -> Option<Box<dyn Namespace>> {
|
|
||||||
Some(match name {
|
|
||||||
"Finalize" => Box::new(FinalizeNamespace),
|
|
||||||
_ => return None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
pub fn finalize_tests() {
|
|
||||||
leo_test_framework::run_tests(&TestRunner, "finalize");
|
|
||||||
}
|
|
@ -193,21 +193,18 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
|||||||
let mut member_map: IndexMap<Symbol, StructVariableInitializer> =
|
let mut member_map: IndexMap<Symbol, StructVariableInitializer> =
|
||||||
members.into_iter().map(|member| (member.identifier.name, member)).collect();
|
members.into_iter().map(|member| (member.identifier.name, member)).collect();
|
||||||
|
|
||||||
// If we are initializing a record, add the `owner` and `gates` fields, first and second respectively.
|
// If we are initializing a record, add the `owner` first.
|
||||||
// Note that type checking guarantees that the above fields exist.
|
// Note that type checking guarantees that the above fields exist.
|
||||||
if struct_definition.is_record {
|
if struct_definition.is_record {
|
||||||
// Add the `owner` field.
|
// Add the `owner` field.
|
||||||
// Note that the `unwrap` is safe, since type checking guarantees that the member exists.
|
// Note that the `unwrap` is safe, since type checking guarantees that the member exists.
|
||||||
reordered_members.push(member_map.remove(&sym::owner).unwrap());
|
reordered_members.push(member_map.remove(&sym::owner).unwrap());
|
||||||
// Add the `gates` field.
|
|
||||||
// Note that the `unwrap` is safe, since type checking guarantees that the member exists.
|
|
||||||
reordered_members.push(member_map.remove(&sym::gates).unwrap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each member of the struct definition, push the corresponding member of the init expression.
|
// For each member of the struct definition, push the corresponding member of the init expression.
|
||||||
for member in &struct_definition.members {
|
for member in &struct_definition.members {
|
||||||
// If the member is part of a record and it is `owner` or `gates`, then we have already added it.
|
// If the member is part of a record and it is `owner` then we have already added it.
|
||||||
if !(struct_definition.is_record && matches!(member.identifier.name, sym::owner | sym::gates)) {
|
if !(struct_definition.is_record && matches!(member.identifier.name, sym::owner)) {
|
||||||
// Lookup and push the member of the init expression.
|
// Lookup and push the member of the init expression.
|
||||||
// Note that the `unwrap` is safe, since type checking guarantees that the member exists.
|
// Note that the `unwrap` is safe, since type checking guarantees that the member exists.
|
||||||
reordered_members.push(member_map.remove(&member.identifier.name).unwrap());
|
reordered_members.push(member_map.remove(&member.identifier.name).unwrap());
|
||||||
|
@ -37,7 +37,7 @@ use indexmap::IndexMap;
|
|||||||
impl StructConsumer for StaticSingleAssigner<'_> {
|
impl StructConsumer for StaticSingleAssigner<'_> {
|
||||||
type Output = Struct;
|
type Output = Struct;
|
||||||
|
|
||||||
/// Reconstructs records in the program, ordering its fields such that `owner` and `gates` are the first and second fields, respectively.
|
/// Reconstructs records in the program, ordering its fields such that `owner` and is the first field.
|
||||||
fn consume_struct(&mut self, struct_: Struct) -> Self::Output {
|
fn consume_struct(&mut self, struct_: Struct) -> Self::Output {
|
||||||
match struct_.is_record {
|
match struct_.is_record {
|
||||||
false => struct_,
|
false => struct_,
|
||||||
@ -50,10 +50,6 @@ impl StructConsumer for StaticSingleAssigner<'_> {
|
|||||||
// Note that type checking ensures that the owner field exists.
|
// Note that type checking ensures that the owner field exists.
|
||||||
members.push(member_map.shift_remove(&sym::owner).unwrap());
|
members.push(member_map.shift_remove(&sym::owner).unwrap());
|
||||||
|
|
||||||
// Add the gates field to the beginning of the members list.
|
|
||||||
// Note that type checking ensures that the gates field exists.
|
|
||||||
members.push(member_map.shift_remove(&sym::gates).unwrap());
|
|
||||||
|
|
||||||
// Add the remaining fields to the members list.
|
// Add the remaining fields to the members list.
|
||||||
members.extend(member_map.into_iter().map(|(_, member)| member));
|
members.extend(member_map.into_iter().map(|(_, member)| member));
|
||||||
|
|
||||||
|
@ -62,7 +62,19 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Typecheck each mapping definition.
|
// Typecheck each mapping definition.
|
||||||
input.mappings.values().for_each(|mapping| self.visit_mapping(mapping));
|
let mut mapping_count = 0;
|
||||||
|
for mapping in input.mappings.values() {
|
||||||
|
self.visit_mapping(mapping);
|
||||||
|
mapping_count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the number of mappings does not exceed the maximum.
|
||||||
|
if mapping_count > Testnet3::MAX_MAPPINGS {
|
||||||
|
self.emit_err(TypeCheckerError::too_many_mappings(
|
||||||
|
Testnet3::MAX_MAPPINGS,
|
||||||
|
input.program_id.name.span + input.program_id.network.span,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// Typecheck each function definitions.
|
// Typecheck each function definitions.
|
||||||
let mut transition_count = 0;
|
let mut transition_count = 0;
|
||||||
@ -104,7 +116,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// For records, enforce presence of `owner: Address` and `gates: u64` members.
|
// For records, enforce presence of the `owner: Address` member.
|
||||||
if input.is_record {
|
if input.is_record {
|
||||||
let check_has_field =
|
let check_has_field =
|
||||||
|need, expected_ty: Type| match input.members.iter().find_map(|Member { identifier, type_, .. }| {
|
|need, expected_ty: Type| match input.members.iter().find_map(|Member { identifier, type_, .. }| {
|
||||||
|
@ -219,7 +219,6 @@ symbols! {
|
|||||||
public,
|
public,
|
||||||
private,
|
private,
|
||||||
owner,
|
owner,
|
||||||
gates,
|
|
||||||
_nonce,
|
_nonce,
|
||||||
program,
|
program,
|
||||||
|
|
||||||
|
@ -594,4 +594,11 @@ create_messages!(
|
|||||||
msg: format!("A finalize block cannot return a value."),
|
msg: format!("A finalize block cannot return a value."),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@formatted
|
||||||
|
too_many_mappings {
|
||||||
|
args: (max: impl Display),
|
||||||
|
msg: format!("The number of mappings exceeds the maximum. snarkVM allows up to {max} mappings within a single program."),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
@ -9,7 +9,6 @@ amount: u64 = 90u64;
|
|||||||
[resolve]
|
[resolve]
|
||||||
first: Bid = Bid {
|
first: Bid = Bid {
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
gates: 0u64,
|
|
||||||
bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
amount: 10u64,
|
amount: 10u64,
|
||||||
is_winner: false,
|
is_winner: false,
|
||||||
@ -17,7 +16,6 @@ first: Bid = Bid {
|
|||||||
};
|
};
|
||||||
second: Bid = Bid {
|
second: Bid = Bid {
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
gates: 0u64,
|
|
||||||
bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
amount: 90u64,
|
amount: 90u64,
|
||||||
is_winner: false,
|
is_winner: false,
|
||||||
@ -27,7 +25,6 @@ second: Bid = Bid {
|
|||||||
[finish]
|
[finish]
|
||||||
bid: Bid = Bid {
|
bid: Bid = Bid {
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
gates: 0u64,
|
|
||||||
bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
amount: 90u64,
|
amount: 90u64,
|
||||||
is_winner: false,
|
is_winner: false,
|
||||||
|
@ -112,14 +112,12 @@ echo "
|
|||||||
"
|
"
|
||||||
leo run resolve "{
|
leo run resolve "{
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
|
||||||
gates: 0u64.private,
|
|
||||||
bidder: aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke.private,
|
bidder: aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke.private,
|
||||||
amount: 10u64.private,
|
amount: 10u64.private,
|
||||||
is_winner: false.private,
|
is_winner: false.private,
|
||||||
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
|
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
|
||||||
}" "{
|
}" "{
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
|
||||||
gates: 0u64.private,
|
|
||||||
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
|
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
|
||||||
amount: 90u64.private,
|
amount: 90u64.private,
|
||||||
is_winner: false.private,
|
is_winner: false.private,
|
||||||
@ -142,7 +140,6 @@ echo "
|
|||||||
"
|
"
|
||||||
leo run finish "{
|
leo run finish "{
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
|
||||||
gates: 0u64.private,
|
|
||||||
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
|
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
|
||||||
amount: 90u64.private,
|
amount: 90u64.private,
|
||||||
is_winner: false.private,
|
is_winner: false.private,
|
||||||
|
@ -2,13 +2,11 @@ program auction.aleo {
|
|||||||
// A bid in an auction.
|
// A bid in an auction.
|
||||||
// - `owner` : The address of the account that owns the record associated with this bid.
|
// - `owner` : The address of the account that owns the record associated with this bid.
|
||||||
// This is separate from the address of the account that placed the bid.
|
// This is separate from the address of the account that placed the bid.
|
||||||
// - `gates` : The value associated with the record (always zero).
|
|
||||||
// - `bidder` : The address of the account that placed the bid.
|
// - `bidder` : The address of the account that placed the bid.
|
||||||
// - `amount` : The amount of the bid.
|
// - `amount` : The amount of the bid.
|
||||||
// - `is_winner` : Whether the bid is the winning bid.
|
// - `is_winner` : Whether the bid is the winning bid.
|
||||||
record Bid {
|
record Bid {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
bidder: address,
|
bidder: address,
|
||||||
amount: u64,
|
amount: u64,
|
||||||
is_winner: bool,
|
is_winner: bool,
|
||||||
@ -26,7 +24,6 @@ program auction.aleo {
|
|||||||
// Return a new 'Bid' record for the auction bidder.
|
// Return a new 'Bid' record for the auction bidder.
|
||||||
return Bid {
|
return Bid {
|
||||||
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
|
||||||
gates: 0u64,
|
|
||||||
bidder: bidder,
|
bidder: bidder,
|
||||||
amount: amount,
|
amount: amount,
|
||||||
is_winner: false,
|
is_winner: false,
|
||||||
@ -60,7 +57,6 @@ program auction.aleo {
|
|||||||
// Return 'is_winner' as 'true' in the winning 'Bid'.
|
// Return 'is_winner' as 'true' in the winning 'Bid'.
|
||||||
return Bid {
|
return Bid {
|
||||||
owner: bid.bidder,
|
owner: bid.bidder,
|
||||||
gates: bid.gates,
|
|
||||||
bidder: bid.bidder,
|
bidder: bid.bidder,
|
||||||
amount: bid.amount,
|
amount: bid.amount,
|
||||||
is_winner: true,
|
is_winner: true,
|
||||||
|
@ -7,7 +7,6 @@ amount: u64 = 1234u64;
|
|||||||
[deposit]
|
[deposit]
|
||||||
token: Token = Token {
|
token: Token = Token {
|
||||||
owner: aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a,
|
owner: aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a,
|
||||||
gates: 0u64,
|
|
||||||
amount: 1234u64,
|
amount: 1234u64,
|
||||||
_nonce: 0group,
|
_nonce: 0group,
|
||||||
};
|
};
|
||||||
|
@ -118,7 +118,6 @@ echo "
|
|||||||
"
|
"
|
||||||
leo run deposit "{
|
leo run deposit "{
|
||||||
owner: aleo1zeklp6dd8e764spe74xez6f8w27dlua3w7hl4z2uln03re52egpsv46ngg.private,
|
owner: aleo1zeklp6dd8e764spe74xez6f8w27dlua3w7hl4z2uln03re52egpsv46ngg.private,
|
||||||
gates: 0u64.private,
|
|
||||||
amount: 100u64.private,
|
amount: 100u64.private,
|
||||||
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
|
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
|
||||||
}" 50u64 || exit
|
}" 50u64 || exit
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
program basic_bank.aleo {
|
program basic_bank.aleo {
|
||||||
// A token, issued by a bank.
|
// A token, issued by a bank.
|
||||||
// - 'owner' : The address of the account that owns the record associated with this token.
|
// - 'owner' : The address of the account that owns the record associated with this token.
|
||||||
// - 'gates' : The value associated with the record (always zero).
|
|
||||||
// - 'amount' : The amount of tokens owned by the account.
|
// - 'amount' : The amount of tokens owned by the account.
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +20,6 @@ program basic_bank.aleo {
|
|||||||
assert_eq(self.caller, aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a);
|
assert_eq(self.caller, aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a);
|
||||||
return Token {
|
return Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -36,7 +33,6 @@ program basic_bank.aleo {
|
|||||||
|
|
||||||
let remaining: Token = Token {
|
let remaining: Token = Token {
|
||||||
owner: token.owner,
|
owner: token.owner,
|
||||||
gates: token.gates,
|
|
||||||
amount: difference,
|
amount: difference,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -68,7 +64,6 @@ program basic_bank.aleo {
|
|||||||
|
|
||||||
let token: Token = Token {
|
let token: Token = Token {
|
||||||
owner: recipient,
|
owner: recipient,
|
||||||
gates: 0u64,
|
|
||||||
amount: total,
|
amount: total,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +88,6 @@ leo run initialize_board 34084860461056u64 551911718912u64 7u64 1157425104234217
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -122,7 +121,6 @@ Now, we can offer a battleship game to player 2. Run `leo run offer_battleship '
|
|||||||
```
|
```
|
||||||
leo run offer_battleship '{
|
leo run offer_battleship '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -139,7 +137,6 @@ leo run offer_battleship '{
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -150,7 +147,6 @@ leo run offer_battleship '{
|
|||||||
}
|
}
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 0u64.private,
|
incoming_fire_coordinate: 0u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -198,7 +194,6 @@ leo run initialize_board 31u64 2207646875648u64 224u64 9042383626829824u64 aleo1
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -228,7 +223,6 @@ Now, we can accept Player 1's offer. Run `leo run start_battleship 'board_state.
|
|||||||
```bash
|
```bash
|
||||||
leo run start_battleship '{
|
leo run start_battleship '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -238,7 +232,6 @@ leo run start_battleship '{
|
|||||||
_nonce: 1549419609469324182591325047490602235361156298832591378925133482196483208807group.public
|
_nonce: 1549419609469324182591325047490602235361156298832591378925133482196483208807group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 0u64.private,
|
incoming_fire_coordinate: 0u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -253,7 +246,6 @@ leo run start_battleship '{
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -264,7 +256,6 @@ leo run start_battleship '{
|
|||||||
}
|
}
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 0u64.private,
|
incoming_fire_coordinate: 0u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
@ -287,7 +278,6 @@ Player 1 now makes the first real move: `leo run play 'board_state.record' 'move
|
|||||||
```bash
|
```bash
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -297,7 +287,6 @@ leo run play '{
|
|||||||
_nonce: 6563064852163330630334088854834332804417910882908622526775624018226782316843group.public
|
_nonce: 6563064852163330630334088854834332804417910882908622526775624018226782316843group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 0u64.private,
|
incoming_fire_coordinate: 0u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
@ -311,7 +300,6 @@ leo run play '{
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 1u64.private,
|
played_tiles: 1u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -322,7 +310,6 @@ leo run play '{
|
|||||||
}
|
}
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 1u64.private,
|
incoming_fire_coordinate: 1u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -346,7 +333,6 @@ and they will also let Player 1 know whether their fire coordinate hit or miss P
|
|||||||
```bash
|
```bash
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -356,7 +342,6 @@ leo run play '{
|
|||||||
_nonce: 6222383571142756260765569201308836492199048237638652378826141459336360362251group.public
|
_nonce: 6222383571142756260765569201308836492199048237638652378826141459336360362251group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 1u64.private,
|
incoming_fire_coordinate: 1u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -372,7 +357,6 @@ leo run play '{
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 2048u64.private,
|
played_tiles: 2048u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -383,7 +367,6 @@ leo run play '{
|
|||||||
}
|
}
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 2048u64.private,
|
incoming_fire_coordinate: 2048u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
@ -416,7 +399,6 @@ For example, running `aleo run play 'board_state.record' 'move.record' 1u64` wil
|
|||||||
```bash
|
```bash
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 1u64.private,
|
played_tiles: 1u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -426,7 +408,6 @@ leo run play '{
|
|||||||
_nonce: 1474170213684980843727833284550698461565286563122422722760769547002894080093group.public
|
_nonce: 1474170213684980843727833284550698461565286563122422722760769547002894080093group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 2048u64.private,
|
incoming_fire_coordinate: 2048u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
@ -441,7 +422,6 @@ leo run play '{
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 1u64.private,
|
hits_and_misses: 1u64.private,
|
||||||
played_tiles: 3u64.private,
|
played_tiles: 3u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -452,7 +432,6 @@ leo run play '{
|
|||||||
}
|
}
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 2u64.private,
|
incoming_fire_coordinate: 2u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -485,7 +464,6 @@ The `board_state` record `hits_and_misses` component has also been updated with
|
|||||||
```bash
|
```bash
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 2048u64.private,
|
played_tiles: 2048u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -495,7 +473,6 @@ leo run play '{
|
|||||||
_nonce: 5254963165391133332409074172682159033621708071536429341861038147524454777097group.public
|
_nonce: 5254963165391133332409074172682159033621708071536429341861038147524454777097group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 2u64.private,
|
incoming_fire_coordinate: 2u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -510,7 +487,6 @@ leo run play '{
|
|||||||
|
|
||||||
• {
|
• {
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 2052u64.private,
|
played_tiles: 2052u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -521,7 +497,6 @@ leo run play '{
|
|||||||
}
|
}
|
||||||
• {
|
• {
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 4u64.private,
|
incoming_fire_coordinate: 4u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
|
@ -8,7 +8,6 @@ program board.aleo {
|
|||||||
// unplayed squares.
|
// unplayed squares.
|
||||||
record board_state {
|
record board_state {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
// The hits and misses registered on the opponent's board.
|
// The hits and misses registered on the opponent's board.
|
||||||
hits_and_misses: u64,
|
hits_and_misses: u64,
|
||||||
// The squares that have been played on the opponent's board.
|
// The squares that have been played on the opponent's board.
|
||||||
@ -27,7 +26,6 @@ program board.aleo {
|
|||||||
) -> board_state {
|
) -> board_state {
|
||||||
return board_state {
|
return board_state {
|
||||||
owner: self.caller,
|
owner: self.caller,
|
||||||
gates: 0u64,
|
|
||||||
hits_and_misses: 0u64,
|
hits_and_misses: 0u64,
|
||||||
played_tiles: 0u64,
|
played_tiles: 0u64,
|
||||||
ships,
|
ships,
|
||||||
@ -48,7 +46,6 @@ program board.aleo {
|
|||||||
|
|
||||||
return board_state {
|
return board_state {
|
||||||
owner: board.owner,
|
owner: board.owner,
|
||||||
gates: board.gates,
|
|
||||||
hits_and_misses: board.hits_and_misses,
|
hits_and_misses: board.hits_and_misses,
|
||||||
played_tiles: board.played_tiles,
|
played_tiles: board.played_tiles,
|
||||||
ships: board.ships,
|
ships: board.ships,
|
||||||
@ -81,7 +78,6 @@ program board.aleo {
|
|||||||
|
|
||||||
return board_state {
|
return board_state {
|
||||||
owner: board.owner,
|
owner: board.owner,
|
||||||
gates: board.gates,
|
|
||||||
hits_and_misses: board.hits_and_misses,
|
hits_and_misses: board.hits_and_misses,
|
||||||
played_tiles,
|
played_tiles,
|
||||||
ships: board.ships,
|
ships: board.ships,
|
||||||
@ -103,7 +99,6 @@ program board.aleo {
|
|||||||
|
|
||||||
return board_state {
|
return board_state {
|
||||||
owner: board.owner,
|
owner: board.owner,
|
||||||
gates: board.gates,
|
|
||||||
hits_and_misses,
|
hits_and_misses,
|
||||||
played_tiles: board.played_tiles,
|
played_tiles: board.played_tiles,
|
||||||
ships: board.ships,
|
ships: board.ships,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
program move.aleo {
|
program move.aleo {
|
||||||
record move {
|
record move {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
incoming_fire_coordinate: u64,
|
incoming_fire_coordinate: u64,
|
||||||
player_1: address,
|
player_1: address,
|
||||||
player_2: address,
|
player_2: address,
|
||||||
@ -24,7 +23,6 @@ program move.aleo {
|
|||||||
|
|
||||||
return move {
|
return move {
|
||||||
owner: opponent,
|
owner: opponent,
|
||||||
gates: move_record.gates,
|
|
||||||
incoming_fire_coordinate,
|
incoming_fire_coordinate,
|
||||||
player_1: move_record.player_2,
|
player_1: move_record.player_2,
|
||||||
player_2: move_record.player_1,
|
player_2: move_record.player_1,
|
||||||
@ -37,7 +35,6 @@ program move.aleo {
|
|||||||
transition start_game(player_2: address) -> move {
|
transition start_game(player_2: address) -> move {
|
||||||
return move {
|
return move {
|
||||||
owner: player_2,
|
owner: player_2,
|
||||||
gates: 0u64,
|
|
||||||
incoming_fire_coordinate: 0u64,
|
incoming_fire_coordinate: 0u64,
|
||||||
player_1: self.caller,
|
player_1: self.caller,
|
||||||
player_2: player_2,
|
player_2: player_2,
|
||||||
|
@ -45,7 +45,6 @@ echo "
|
|||||||
"
|
"
|
||||||
leo run offer_battleship '{
|
leo run offer_battleship '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -94,7 +93,6 @@ echo "
|
|||||||
"
|
"
|
||||||
leo run start_battleship '{
|
leo run start_battleship '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -104,7 +102,6 @@ leo run start_battleship '{
|
|||||||
_nonce: 1549419609469324182591325047490602235361156298832591378925133482196483208807group.public
|
_nonce: 1549419609469324182591325047490602235361156298832591378925133482196483208807group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 0u64.private,
|
incoming_fire_coordinate: 0u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -137,7 +134,6 @@ echo "
|
|||||||
|
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -147,7 +143,6 @@ echo "
|
|||||||
_nonce: 6563064852163330630334088854834332804417910882908622526775624018226782316843group.public
|
_nonce: 6563064852163330630334088854834332804417910882908622526775624018226782316843group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 0u64.private,
|
incoming_fire_coordinate: 0u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
@ -181,7 +176,6 @@ echo "
|
|||||||
|
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 0u64.private,
|
played_tiles: 0u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -191,7 +185,6 @@ echo "
|
|||||||
_nonce: 6222383571142756260765569201308836492199048237638652378826141459336360362251group.public
|
_nonce: 6222383571142756260765569201308836492199048237638652378826141459336360362251group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 1u64.private,
|
incoming_fire_coordinate: 1u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
@ -225,7 +218,6 @@ echo "
|
|||||||
|
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 1u64.private,
|
played_tiles: 1u64.private,
|
||||||
ships: 1157459741006397447u64.private,
|
ships: 1157459741006397447u64.private,
|
||||||
@ -235,7 +227,6 @@ echo "
|
|||||||
_nonce: 1474170213684980843727833284550698461565286563122422722760769547002894080093group.public
|
_nonce: 1474170213684980843727833284550698461565286563122422722760769547002894080093group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 2048u64.private,
|
incoming_fire_coordinate: 2048u64.private,
|
||||||
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_1: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
@ -269,7 +260,6 @@ echo "
|
|||||||
|
|
||||||
leo run play '{
|
leo run play '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
hits_and_misses: 0u64.private,
|
hits_and_misses: 0u64.private,
|
||||||
played_tiles: 2048u64.private,
|
played_tiles: 2048u64.private,
|
||||||
ships: 9044591273705727u64.private,
|
ships: 9044591273705727u64.private,
|
||||||
@ -279,7 +269,6 @@ echo "
|
|||||||
_nonce: 5254963165391133332409074172682159033621708071536429341861038147524454777097group.public
|
_nonce: 5254963165391133332409074172682159033621708071536429341861038147524454777097group.public
|
||||||
}' '{
|
}' '{
|
||||||
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
owner: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
gates: 0u64.private,
|
|
||||||
incoming_fire_coordinate: 2u64.private,
|
incoming_fire_coordinate: 2u64.private,
|
||||||
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
|
||||||
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
player_2: aleo1wyvu96dvv0auq9e4qme54kjuhzglyfcf576h0g3nrrmrmr0505pqd6wnry.private,
|
||||||
|
@ -6,7 +6,6 @@ amount: u64 = 100u64;
|
|||||||
[transfer]
|
[transfer]
|
||||||
token: Token = Token {
|
token: Token = Token {
|
||||||
owner: aleo1ht2a9q0gsd38j0se4t9lsfulxgqrens2vgzgry3pkvs93xrrzu8s892zn7,
|
owner: aleo1ht2a9q0gsd38j0se4t9lsfulxgqrens2vgzgry3pkvs93xrrzu8s892zn7,
|
||||||
gates: 0u64,
|
|
||||||
amount: 100u64,
|
amount: 100u64,
|
||||||
_nonce: 0group,
|
_nonce: 0group,
|
||||||
};
|
};
|
||||||
|
@ -4,8 +4,6 @@ program simple_token.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -15,7 +13,6 @@ program simple_token.aleo {
|
|||||||
transition mint(owner: address, amount: u64) -> Token {
|
transition mint(owner: address, amount: u64) -> Token {
|
||||||
return Token {
|
return Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -33,14 +30,12 @@ program simple_token.aleo {
|
|||||||
// Produce a token record with the change amount for the sender.
|
// Produce a token record with the change amount for the sender.
|
||||||
let remaining: Token = Token {
|
let remaining: Token = Token {
|
||||||
owner: token.owner,
|
owner: token.owner,
|
||||||
gates: token.gates,
|
|
||||||
amount: difference,
|
amount: difference,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Produce a token record for the specified receiver.
|
// Produce a token record for the specified receiver.
|
||||||
let transferred: Token = Token {
|
let transferred: Token = Token {
|
||||||
owner: to,
|
owner: to,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
program token.aleo;
|
|
||||||
|
|
||||||
record token:
|
|
||||||
owner as address.private;
|
|
||||||
gates as u64.private;
|
|
||||||
amount as u64.private;
|
|
||||||
|
|
||||||
mapping account:
|
|
||||||
key left as address.public;
|
|
||||||
value right as u64.public;
|
|
||||||
function mint_public:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as u64.public;
|
|
||||||
|
|
||||||
finalize r0 r1;
|
|
||||||
|
|
||||||
finalize mint_public:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as u64.public;
|
|
||||||
increment account[r0] by r1;
|
|
||||||
|
|
||||||
function mint_private:
|
|
||||||
input r0 as address.private;
|
|
||||||
input r1 as u64.private;
|
|
||||||
cast r0 0u64 r1 into r2 as token.record;
|
|
||||||
output r2 as token.record;
|
|
||||||
|
|
||||||
function transfer_public:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as u64.public;
|
|
||||||
|
|
||||||
finalize self.caller r0 r1;
|
|
||||||
|
|
||||||
finalize transfer_public:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as address.public;
|
|
||||||
input r2 as u64.public;
|
|
||||||
decrement account[r0] by r2;
|
|
||||||
increment account[r1] by r2;
|
|
||||||
|
|
||||||
function transfer_private:
|
|
||||||
input r0 as token.record;
|
|
||||||
input r1 as address.private;
|
|
||||||
input r2 as u64.private;
|
|
||||||
sub r0.amount r2 into r3;
|
|
||||||
cast r0.owner r0.gates r3 into r4 as token.record;
|
|
||||||
cast r1 0u64 r2 into r5 as token.record;
|
|
||||||
output r4 as token.record;
|
|
||||||
output r5 as token.record;
|
|
||||||
|
|
||||||
function transfer_private_to_public:
|
|
||||||
input r0 as token.record;
|
|
||||||
input r1 as address.public;
|
|
||||||
input r2 as u64.public;
|
|
||||||
sub r0.amount r2 into r3;
|
|
||||||
cast r0.owner r0.gates r3 into r4 as token.record;
|
|
||||||
output r4 as token.record;
|
|
||||||
|
|
||||||
finalize r1 r2;
|
|
||||||
|
|
||||||
finalize transfer_private_to_public:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as u64.public;
|
|
||||||
increment account[r0] by r1;
|
|
||||||
|
|
||||||
function transfer_public_to_private:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as u64.public;
|
|
||||||
cast r0 0u64 r1 into r2 as token.record;
|
|
||||||
output r2 as token.record;
|
|
||||||
|
|
||||||
finalize self.caller r1;
|
|
||||||
|
|
||||||
finalize transfer_public_to_private:
|
|
||||||
input r0 as address.public;
|
|
||||||
input r1 as u64.public;
|
|
||||||
decrement account[r0] by r1;
|
|
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"program": "token.aleo",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"description": "",
|
|
||||||
"development": {
|
|
||||||
"private_key": "APrivateKey1zkpBdMNxDsVVK1nHykGg6tKCpuqN6f1QqbKSMvL22BnmjGA",
|
|
||||||
"address": "aleo1pvmhrzm5tevxg7rrj65z6txpvm9stfgex05v4lfs05677n7e0cxqdk46jr"
|
|
||||||
},
|
|
||||||
"license": "MIT"
|
|
||||||
}
|
|
@ -14,7 +14,6 @@ amount: u64 = 50u64;
|
|||||||
[transfer_private]
|
[transfer_private]
|
||||||
sender: token = token {
|
sender: token = token {
|
||||||
owner: aleo1pvmhrzm5tevxg7rrj65z6txpvm9stfgex05v4lfs05677n7e0cxqdk46jr,
|
owner: aleo1pvmhrzm5tevxg7rrj65z6txpvm9stfgex05v4lfs05677n7e0cxqdk46jr,
|
||||||
gates: 0u64,
|
|
||||||
amount: 100u64,
|
amount: 100u64,
|
||||||
_nonce: 0group,
|
_nonce: 0group,
|
||||||
};
|
};
|
||||||
@ -24,7 +23,6 @@ amount: u64 = 50u64;
|
|||||||
[transfer_private_to_public]
|
[transfer_private_to_public]
|
||||||
sender: token = token {
|
sender: token = token {
|
||||||
owner: aleo1pvmhrzm5tevxg7rrj65z6txpvm9stfgex05v4lfs05677n7e0cxqdk46jr,
|
owner: aleo1pvmhrzm5tevxg7rrj65z6txpvm9stfgex05v4lfs05677n7e0cxqdk46jr,
|
||||||
gates: 0u64,
|
|
||||||
amount: 100u64,
|
amount: 100u64,
|
||||||
_nonce: 0group,
|
_nonce: 0group,
|
||||||
};
|
};
|
||||||
|
@ -6,8 +6,6 @@ program token.aleo {
|
|||||||
record token {
|
record token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -32,7 +30,6 @@ program token.aleo {
|
|||||||
transition mint_private(receiver: address, amount: u64) -> token {
|
transition mint_private(receiver: address, amount: u64) -> token {
|
||||||
return token {
|
return token {
|
||||||
owner: receiver,
|
owner: receiver,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -66,14 +63,12 @@ program token.aleo {
|
|||||||
// Produce a token record with the change amount for the sender.
|
// Produce a token record with the change amount for the sender.
|
||||||
let remaining: token = token {
|
let remaining: token = token {
|
||||||
owner: sender.owner,
|
owner: sender.owner,
|
||||||
gates: sender.gates,
|
|
||||||
amount: difference,
|
amount: difference,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Produce a token record for the specified receiver.
|
// Produce a token record for the specified receiver.
|
||||||
let transferred: token = token {
|
let transferred: token = token {
|
||||||
owner: receiver,
|
owner: receiver,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,7 +87,6 @@ program token.aleo {
|
|||||||
// Produces a token record with the change amount for the caller.
|
// Produces a token record with the change amount for the caller.
|
||||||
let remaining: token = token {
|
let remaining: token = token {
|
||||||
owner: sender.owner,
|
owner: sender.owner,
|
||||||
gates: sender.gates,
|
|
||||||
amount: difference,
|
amount: difference,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,7 +109,6 @@ program token.aleo {
|
|||||||
// Produces a token record for the token receiver.
|
// Produces a token record for the token receiver.
|
||||||
let transferred: token = token {
|
let transferred: token = token {
|
||||||
owner: receiver,
|
owner: receiver,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ Output sample:
|
|||||||
```
|
```
|
||||||
{
|
{
|
||||||
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2.private,
|
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2.private,
|
||||||
gates: 0u64.private,
|
|
||||||
id: 2805252584833208809872967597325381727971256629741137995614832105537063464740field.private,
|
id: 2805252584833208809872967597325381727971256629741137995614832105537063464740field.private,
|
||||||
info: {
|
info: {
|
||||||
title: 2077160157502449938194577302446444field.private,
|
title: 2077160157502449938194577302446444field.private,
|
||||||
@ -70,7 +69,6 @@ Output sample:
|
|||||||
```
|
```
|
||||||
{
|
{
|
||||||
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2.private,
|
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2.private,
|
||||||
gates: 0u64.private,
|
|
||||||
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private,
|
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private,
|
||||||
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public
|
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ voter: address = aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2
|
|||||||
[agree]
|
[agree]
|
||||||
ticket: Ticket = Ticket {
|
ticket: Ticket = Ticket {
|
||||||
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2,
|
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2,
|
||||||
gates: 0u64,
|
|
||||||
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field,
|
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field,
|
||||||
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group
|
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group
|
||||||
};
|
};
|
||||||
@ -21,7 +20,6 @@ ticket: Ticket = Ticket {
|
|||||||
[disagree]
|
[disagree]
|
||||||
ticket: Ticket = Ticket {
|
ticket: Ticket = Ticket {
|
||||||
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2,
|
owner: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2,
|
||||||
gates: 0u64,
|
|
||||||
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field,
|
pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field,
|
||||||
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group
|
_nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,6 @@ program vote.aleo {
|
|||||||
// Proposal record records proposal info publicly
|
// Proposal record records proposal info publicly
|
||||||
record Proposal {
|
record Proposal {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
id: field,
|
id: field,
|
||||||
info: ProposalInfo,
|
info: ProposalInfo,
|
||||||
}
|
}
|
||||||
@ -21,7 +20,6 @@ program vote.aleo {
|
|||||||
// Privacy tickets to vote
|
// Privacy tickets to vote
|
||||||
record Ticket {
|
record Ticket {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
pid: field,
|
pid: field,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +43,6 @@ program vote.aleo {
|
|||||||
// Finalize the proposal id.
|
// Finalize the proposal id.
|
||||||
return Proposal {
|
return Proposal {
|
||||||
owner: self.caller,
|
owner: self.caller,
|
||||||
gates: 0u64,
|
|
||||||
id,
|
id,
|
||||||
info,
|
info,
|
||||||
} then finalize(id);
|
} then finalize(id);
|
||||||
@ -64,7 +61,6 @@ program vote.aleo {
|
|||||||
// Finalize the proposal id for the ticket.
|
// Finalize the proposal id for the ticket.
|
||||||
return Ticket {
|
return Ticket {
|
||||||
owner: voter,
|
owner: voter,
|
||||||
gates: 0u64,
|
|
||||||
pid,
|
pid,
|
||||||
} then finalize(pid);
|
} then finalize(pid);
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: 75a36838e40b40528abbeb2a752b51db98a9eb6537aa3ec5d812a0e0ce3c64b9
|
- - initial_ast: 2fcf759a6b067a1ab144a067c2a4ea41c49499febb7e6a5056dc25db633dd37c
|
||||||
unrolled_ast: 75a36838e40b40528abbeb2a752b51db98a9eb6537aa3ec5d812a0e0ce3c64b9
|
unrolled_ast: 2fcf759a6b067a1ab144a067c2a4ea41c49499febb7e6a5056dc25db633dd37c
|
||||||
ssa_ast: 0c66a00da3384b853fd83ecb3747abf1101af0c39849fd75af793a68537f714d
|
ssa_ast: a55cc6f9a1abaaa66e51ee6e9e946f6fbab282cc2e0ea1a48d6f1aa7da88dda1
|
||||||
flattened_ast: 7a2b73a748d86babab5ca7a4f9e513cfd028dcbadc7df8baeb7774ffb54c1b43
|
flattened_ast: fbb82b282d5fb0864a21f3a0f0271fdefa2b58fe80a3aba5c7307d5a9c5bfa68
|
||||||
inlined_ast: 7a2b73a748d86babab5ca7a4f9e513cfd028dcbadc7df8baeb7774ffb54c1b43
|
inlined_ast: fbb82b282d5fb0864a21f3a0f0271fdefa2b58fe80a3aba5c7307d5a9c5bfa68
|
||||||
dce_ast: 7a2b73a748d86babab5ca7a4f9e513cfd028dcbadc7df8baeb7774ffb54c1b43
|
dce_ast: fbb82b282d5fb0864a21f3a0f0271fdefa2b58fe80a3aba5c7307d5a9c5bfa68
|
||||||
bytecode: 2d96971b7ff11cd865ed1b79ca417d062b970f3442cf9e6f53f033b5f258c556
|
bytecode: 3c391009be59588562aa4a34d1b00508cd253c94d35a66741962352c76a92633
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [EPAR0370021]: The type of `tokens` has no associated function `get` that takes 2 argument(s).\n --> compiler-test:19:9\n |\n 19 | tokens.get(true, true);\n | ^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `get` that takes 0 argument(s).\n --> compiler-test:21:9\n |\n 21 | amounts.get();\n | ^^^^^^^^^^^^^"
|
- "Error [EPAR0370021]: The type of `tokens` has no associated function `get` that takes 2 argument(s).\n --> compiler-test:18:9\n |\n 18 | tokens.get(true, true);\n | ^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `get` that takes 0 argument(s).\n --> compiler-test:20:9\n |\n 20 | amounts.get();\n | ^^^^^^^^^^^^^"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:11:5\n |\n 11 | mapping tokens: address => Token;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `boolean`\n --> compiler-test:18:30\n |\n 18 | Mapping::get(tokens, true);\n | ^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `boolean`\n --> compiler-test:19:20\n |\n 19 | tokens.get(true);\n | ^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:31\n |\n 20 | Mapping::get(amounts, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:21:21\n |\n 21 | amounts.get(1u8);\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 `address`, but got `boolean`\n --> compiler-test:17:30\n |\n 17 | Mapping::get(tokens, true);\n | ^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `boolean`\n --> compiler-test:18:20\n |\n 18 | tokens.get(true);\n | ^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:19:31\n |\n 19 | Mapping::get(amounts, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:21\n |\n 20 | amounts.get(1u8);\n | ^^^\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [EPAR0370021]: The type of `tokens` has no associated function `get_or_init` that takes 3 argument(s).\n --> compiler-test:19:9\n |\n 19 | 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:21:9\n |\n 21 | 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:23:9\n |\n 23 | amounts.get_or_init();\n | ^^^^^^^^^^^^^^^^^^^^^"
|
- "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 | ^^^^^^^^^^^^^^^^^^^^^"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:11:5\n |\n 11 | mapping tokens: address => Token;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:18:44\n |\n 18 | Mapping::get_or_init(tokens, addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:19:34\n |\n 19 | tokens.get_or_init(addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:39\n |\n 20 | Mapping::get_or_init(amounts, 1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:21:29\n |\n 21 | amounts.get_or_init(1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:22:45\n |\n 22 | Mapping::get_or_init(amounts, addr, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:23:35\n |\n 23 | amounts.get_or_init(addr, 1u8);\n | ^^^\nError [ETYC0372003]: Expected type `u64` but type `u8` was found\n --> compiler-test:24:72\n |\n 24 | Mapping::get_or_init(tokens, addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:24:85\n |\n 24 | Mapping::get_or_init(tokens, addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u64` but type `u8` was found\n --> compiler-test:25:62\n |\n 25 | tokens.get_or_init(addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:25:75\n |\n 25 | tokens.get_or_init(addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:26:30\n |\n 26 | Mapping::get_or_init(foo, addr, amount);\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:27:9\n |\n 27 | 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: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"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372030]: A mapping's key cannot be a tuple\n --> compiler-test:4:5\n |\n 4 | mapping foo: (u32, u32) => u32;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:6:5\n |\n 6 | mapping floo: baz => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:21:5\n |\n 21 | mapping real_tokens: address => RealToken;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372030]: A mapping's key cannot be a record\n --> compiler-test:23:5\n |\n 23 | mapping owners: RealToken => address;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
|
- "Error [ETYC0372030]: A mapping's key cannot be a tuple\n --> compiler-test:4:5\n |\n 4 | mapping foo: (u32, u32) => u32;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:6:5\n |\n 6 | mapping floo: baz => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:19:5\n |\n 19 | mapping real_tokens: address => RealToken;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372030]: A mapping's key cannot be a record\n --> compiler-test:21:5\n |\n 21 | mapping owners: RealToken => address;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [EPAR0370021]: The type of `tokens` has no associated function `set` that takes 3 argument(s).\n --> compiler-test:19:9\n |\n 19 | tokens.set(addr, amount, 1u128);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `set` that takes 1 argument(s).\n --> compiler-test:21:9\n |\n 21 | amounts.set(1u8);\n | ^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `set` that takes 0 argument(s).\n --> compiler-test:23:9\n |\n 23 | amounts.set();\n | ^^^^^^^^^^^^^"
|
- "Error [EPAR0370021]: The type of `tokens` has no associated function `set` that takes 3 argument(s).\n --> compiler-test:18:9\n |\n 18 | tokens.set(addr, amount, 1u128);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `set` that takes 1 argument(s).\n --> compiler-test:20:9\n |\n 20 | amounts.set(1u8);\n | ^^^^^^^^^^^^^^^^\nError [EPAR0370021]: The type of `amounts` has no associated function `set` that takes 0 argument(s).\n --> compiler-test:22:9\n |\n 22 | amounts.set();\n | ^^^^^^^^^^^^^"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:11:5\n |\n 11 | mapping tokens: address => Token;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:18:36\n |\n 18 | Mapping::set(tokens, addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:19:26\n |\n 19 | tokens.set(addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:31\n |\n 20 | Mapping::set(amounts, 1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:21:21\n |\n 21 | amounts.set(1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:22:37\n |\n 22 | Mapping::set(amounts, addr, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:23:27\n |\n 23 | amounts.set(addr, 1u8);\n | ^^^\nError [ETYC0372003]: Expected type `u64` but type `u8` was found\n --> compiler-test:24:64\n |\n 24 | Mapping::set(tokens, addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:24:77\n |\n 24 | Mapping::set(tokens, addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u64` but type `u8` was found\n --> compiler-test:25:54\n |\n 25 | tokens.set(addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:25:67\n |\n 25 | tokens.set(addr, Token { owner: addr, gates: 1u8, amount: 1u8 });\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:26:22\n |\n 26 | Mapping::set(foo, addr, amount);\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:27:9\n |\n 27 | foo.set(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:36\n |\n 17 | Mapping::set(tokens, addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `Token`, but got `u128`\n --> compiler-test:18:26\n |\n 18 | tokens.set(addr, amount);\n | ^^^^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:19:31\n |\n 19 | Mapping::set(amounts, 1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:20:21\n |\n 20 | amounts.set(1u8, amount);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:21:37\n |\n 21 | Mapping::set(amounts, addr, 1u8);\n | ^^^\nError [ETYC0372007]: Expected one type from `u128`, but got `u8`\n --> compiler-test:22:27\n |\n 22 | amounts.set(addr, 1u8);\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:23:65\n |\n 23 | Mapping::set(tokens, addr, Token { owner: addr, amount: 1u8 });\n | ^^^\nError [ETYC0372003]: Expected type `u128` but type `u8` was found\n --> compiler-test:24:55\n |\n 24 | tokens.set(addr, Token { owner: addr, amount: 1u8 });\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:25:22\n |\n 25 | Mapping::set(foo, addr, amount);\n | ^^^\nError [ETYC0372005]: Unknown variable `foo`\n --> compiler-test:26:9\n |\n 26 | foo.set(addr, amount);\n | ^^^\n"
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: d7414ef76b5d83ba8daed6e65487425048596937d5a6f783a313d3264d5db267
|
- - initial_ast: b9322b2961727d9350f00a48e478cd7cc3305e8b24d1a95f3daebb89979cdcd4
|
||||||
unrolled_ast: d7414ef76b5d83ba8daed6e65487425048596937d5a6f783a313d3264d5db267
|
unrolled_ast: b9322b2961727d9350f00a48e478cd7cc3305e8b24d1a95f3daebb89979cdcd4
|
||||||
ssa_ast: 6722ef50ccdf19eaaa57f68a249a6eb01ba78ec8ec60da0d8d664613324287aa
|
ssa_ast: a68e5b3047e2ae4e8a1a3293210794c1009a8cf85aee9f5a27f844c7e55b6ac4
|
||||||
flattened_ast: 58ed29011b87aad89fe50f62402f441c9aa53fc2e18c3a188d94d0a88734236d
|
flattened_ast: f9b740fe83fe345f9341ba97ee2704917bf57f65ac442c98aca90f41457c8726
|
||||||
inlined_ast: 7ce8d6b0f22068cd9cf428040b3b55f08f7f890b09ed77c5f35d4ce10ed9232b
|
inlined_ast: 98140fbd0bbf811404a993d34c80b08e352196fdfceec3e77683f7e78559f75b
|
||||||
dce_ast: 48e52aa4ba7d5f4c5126ec93a14ec29772f80c73cc2d6ab5c77001f920b4c65b
|
dce_ast: 97bf25a5c2d84cec2332dbda4c1803c33abcc37eedfcabfb2019f42bf3b075ca
|
||||||
bytecode: 737502f330fc737a1341eec9a9ac6c0abfc6a97e7ea588b082e4300ffb62380f
|
bytecode: 68f3c939bd54966a95293dd018927a50887a633eea6d5dc60fca8a1ba5400607
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372064]: A `function` cannot output a record.\n --> compiler-test:10:45\n |\n 10 | function foo(board: Board, data: u8) -> Board {\n | ^^^^^\n"
|
- "Error [ETYC0372064]: A `function` cannot output a record.\n --> compiler-test:9:45\n |\n 9 | function foo(board: Board, data: u8) -> Board {\n | ^^^^^\n"
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: ab72e59b7e40857582bf8889a6e55d742d5c06dc7097883a25e040a8fe59ecb7
|
- - initial_ast: 1c9131af8bec6870a83ff8bf17753dc991709a9b89fadc15759f2910ef0f2f76
|
||||||
unrolled_ast: ab72e59b7e40857582bf8889a6e55d742d5c06dc7097883a25e040a8fe59ecb7
|
unrolled_ast: 1c9131af8bec6870a83ff8bf17753dc991709a9b89fadc15759f2910ef0f2f76
|
||||||
ssa_ast: e106c271385dba67b63dbaca5e89089ba7a311daaf82df652e61dab290e744a1
|
ssa_ast: 998f181b5d511b7de65ce5adc45128ed1bb179556379a8fe54536e88f9a6c961
|
||||||
flattened_ast: 0aac34997b32ff0aff5cdb3f62d6e5abe3de9bbb692ca8715d98b234b0e09633
|
flattened_ast: eec4e32ae81554f04f5fd719f84ebc31570a2354af0d8ba06c8368f08c3202b9
|
||||||
inlined_ast: 0aac34997b32ff0aff5cdb3f62d6e5abe3de9bbb692ca8715d98b234b0e09633
|
inlined_ast: eec4e32ae81554f04f5fd719f84ebc31570a2354af0d8ba06c8368f08c3202b9
|
||||||
dce_ast: 0aac34997b32ff0aff5cdb3f62d6e5abe3de9bbb692ca8715d98b234b0e09633
|
dce_ast: eec4e32ae81554f04f5fd719f84ebc31570a2354af0d8ba06c8368f08c3202b9
|
||||||
bytecode: e6c71668ee7ddf9c510f9e4ab97c58fdff6c19cfd9923565a354e068d1439e55
|
bytecode: df0b33177844b8a8ca6a013bcf1de0535bb8b38b16bfcc9766d120af2bfc98d1
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
12
tests/expectations/compiler/mappings/max_mappings.out
Normal file
12
tests/expectations/compiler/mappings/max_mappings.out
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Pass
|
||||||
|
outputs:
|
||||||
|
- - initial_ast: 439b99c38658af7a6e0a44900fd711923b4da86aed80839bc627fe210ba3ec26
|
||||||
|
unrolled_ast: 439b99c38658af7a6e0a44900fd711923b4da86aed80839bc627fe210ba3ec26
|
||||||
|
ssa_ast: 3cc47540dd38142f6f31534e0c55e3011c2b194bbe2069c9bcf68e58fa40d9b2
|
||||||
|
flattened_ast: a9e8114a3220086ec1268259ddc538ec62abc68b20a0eaaf79228af03c8d5007
|
||||||
|
inlined_ast: a9e8114a3220086ec1268259ddc538ec62abc68b20a0eaaf79228af03c8d5007
|
||||||
|
dce_ast: a9e8114a3220086ec1268259ddc538ec62abc68b20a0eaaf79228af03c8d5007
|
||||||
|
bytecode: b9f4013449f0c0c754435af754f6c68df5c36f26454f2a054e72e08e452cb891
|
||||||
|
warnings: ""
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [ETYC0372072]: The number of mappings exceeds the maximum. snarkVM allows up to 31 mappings within a single program.\n --> compiler-test:3:9\n |\n 3 | program test.aleo {\n | ^^^^^^^^^\n"
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: bc6c3d26d53e50c2d9e55ca513f9f9ca5a51243e168abdabc519b6ab284ab4ca
|
- - initial_ast: d10773343fac6c3799d719a277bcc88acba4dceadd46beb8243dd77bad469994
|
||||||
unrolled_ast: bc6c3d26d53e50c2d9e55ca513f9f9ca5a51243e168abdabc519b6ab284ab4ca
|
unrolled_ast: d10773343fac6c3799d719a277bcc88acba4dceadd46beb8243dd77bad469994
|
||||||
ssa_ast: 9dec3f9ffc327edcbca8cd41fc43ed0ea547b2a21a83011561dcfa4eddc6f805
|
ssa_ast: 4c59ee1269dbd8a5e5b48192d93d427abe2f06f20bb1cc41d895bc620ba730a3
|
||||||
flattened_ast: 14a0045dc7123f83d6ab8563c0ea931de77226a5debb18eb4f897e3a94c271ed
|
flattened_ast: ad850f9ef141493ca7ce60c03e46ebf9ddc2aaf7bceed3f6592bad2849846f47
|
||||||
inlined_ast: 14a0045dc7123f83d6ab8563c0ea931de77226a5debb18eb4f897e3a94c271ed
|
inlined_ast: ad850f9ef141493ca7ce60c03e46ebf9ddc2aaf7bceed3f6592bad2849846f47
|
||||||
dce_ast: 14a0045dc7123f83d6ab8563c0ea931de77226a5debb18eb4f897e3a94c271ed
|
dce_ast: ad850f9ef141493ca7ce60c03e46ebf9ddc2aaf7bceed3f6592bad2849846f47
|
||||||
bytecode: 4352ef3dcfd2e624a555a365a9f307cee9a66cf0efb3c7681eb4c0b0014fa403
|
bytecode: c0e06b094899a8b986048ec322e2fccaf4812febf185e635cb734797a25a7626
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: 706d6b698209729ccc81f63bfe77a4baf572bfbda4d4165b51ed2fd1bbf34442
|
- - initial_ast: d916e07c1b3a408ea44688618ba390cfe2e96122204a09ef7ea95aecf5b39153
|
||||||
unrolled_ast: 706d6b698209729ccc81f63bfe77a4baf572bfbda4d4165b51ed2fd1bbf34442
|
unrolled_ast: d916e07c1b3a408ea44688618ba390cfe2e96122204a09ef7ea95aecf5b39153
|
||||||
ssa_ast: 06ce227a097baf4d7c73465d58710ab217a1ce7c8d49c8e9ca644627e607703a
|
ssa_ast: 9f7aafbfadc1500c575646f76695393748b81686ba78ae356a58ab93b4afd257
|
||||||
flattened_ast: 2f2798034c971938c91ed4422def44932cb6f657c62a56b79de431ca1f542fc2
|
flattened_ast: 6b35d3908459a4dc46ea617bfba1fab4bf1519fcfb0728f8fda1a4bb6bc903e1
|
||||||
inlined_ast: 2f2798034c971938c91ed4422def44932cb6f657c62a56b79de431ca1f542fc2
|
inlined_ast: 6b35d3908459a4dc46ea617bfba1fab4bf1519fcfb0728f8fda1a4bb6bc903e1
|
||||||
dce_ast: 2f2798034c971938c91ed4422def44932cb6f657c62a56b79de431ca1f542fc2
|
dce_ast: 6b35d3908459a4dc46ea617bfba1fab4bf1519fcfb0728f8fda1a4bb6bc903e1
|
||||||
bytecode: 07dc4694b8c8cff94cef0a4ea9ed3aaf27e874d9b26a91d8d5784cab20187bfb
|
bytecode: 567f936a9f498a3648860fa0c7028b9fe84c93e9843fc82865e39298bc99c525
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372016]: Record Token defined with more than one variable with the same name.\n --> compiler-test:4:5\n |\n 4 | record Token {\n 5 | // The token owner.\n 6 | owner: address,\n 7 | // The token owner.\n 8 | owner: address, // Cannot define two record variables with the same name.\n 9 | // The Aleo balance (in gates).\n 10 | gates: u64,\n 11 | // The token amount.\n 12 | amount: u64,\n 13 | }\n | ^\n"
|
- "Error [ETYC0372016]: Record Token defined with more than one variable with the same name.\n --> compiler-test:4:5\n |\n 4 | record Token {\n 5 | // The token owner.\n 6 | owner: address,\n 7 | // The token owner.\n 8 | owner: address, // Cannot define two record variables with the same name.\n 9 | // The token amount.\n 10 | amount: u64,\n 11 | }\n | ^\n"
|
||||||
|
12
tests/expectations/compiler/records/gates_is_allowed.out
Normal file
12
tests/expectations/compiler/records/gates_is_allowed.out
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Pass
|
||||||
|
outputs:
|
||||||
|
- - initial_ast: 3f8867e359f2447722d16322559bb75874ab823ebfb80f75b538865f64d28d93
|
||||||
|
unrolled_ast: 3f8867e359f2447722d16322559bb75874ab823ebfb80f75b538865f64d28d93
|
||||||
|
ssa_ast: 01d8390308277d2711be544ca4c4bf536df6a7a9ad5662093ae0635a50050d59
|
||||||
|
flattened_ast: 72ba7fc102711bf3cb4f9d8c987edc766e7876bd24a0ec7794f6ddced0d35026
|
||||||
|
inlined_ast: 72ba7fc102711bf3cb4f9d8c987edc766e7876bd24a0ec7794f6ddced0d35026
|
||||||
|
dce_ast: 72ba7fc102711bf3cb4f9d8c987edc766e7876bd24a0ec7794f6ddced0d35026
|
||||||
|
bytecode: 48e7881ab72ea8eaea757488386d315e8b5572f7ed34a5f1c70a5d19b2c4c481
|
||||||
|
warnings: ""
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: befe0cc5d37e961c86223e95440fc29b8eeda7f9e7b0573dc6d3f956d8a3ece6
|
- - initial_ast: e4233d80b488f02084141d66b4d3ad7ae78ad502d351801246f5d15b4cf838d7
|
||||||
unrolled_ast: befe0cc5d37e961c86223e95440fc29b8eeda7f9e7b0573dc6d3f956d8a3ece6
|
unrolled_ast: e4233d80b488f02084141d66b4d3ad7ae78ad502d351801246f5d15b4cf838d7
|
||||||
ssa_ast: d32dc9d291fad7846b373e76610e5e83f396126a90f40a7cf2f673cff6159a36
|
ssa_ast: 8b4cd0a125a03d6d3ac37a577ec589fb0a1f03e5ecfd4d93efced590b4442f0c
|
||||||
flattened_ast: 93a108cdde1ece68c4c7c4a4f061bd14104dc985fda2fedaa3f4deab5dad6565
|
flattened_ast: ce4433d4704259a6d569754a02bf47dca1b9324a787dd9c7a15118bf78b6b1db
|
||||||
inlined_ast: 93a108cdde1ece68c4c7c4a4f061bd14104dc985fda2fedaa3f4deab5dad6565
|
inlined_ast: ce4433d4704259a6d569754a02bf47dca1b9324a787dd9c7a15118bf78b6b1db
|
||||||
dce_ast: 93a108cdde1ece68c4c7c4a4f061bd14104dc985fda2fedaa3f4deab5dad6565
|
dce_ast: 2aa5077b720b603dcc110365523db70743938b53bcfe017dc3ba3e54806709b2
|
||||||
bytecode: a040c0026210ca23cfd255c7854d9ea01f1eebfaa58033a9ffb7f8dd99a4c8bb
|
bytecode: f243717a23b7bcbf2e4656d741a9e43b8a60184892683964efb628e22e36e7f1
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: 5095cc2534f53b3d89023c125c9103d76ca3c32135c97cadb949db4474a28309
|
- - initial_ast: a25c7677daae998b8d02bf909af9d1c2c801dc8a9f4add7e5b0aa41f8a189330
|
||||||
unrolled_ast: 5095cc2534f53b3d89023c125c9103d76ca3c32135c97cadb949db4474a28309
|
unrolled_ast: a25c7677daae998b8d02bf909af9d1c2c801dc8a9f4add7e5b0aa41f8a189330
|
||||||
ssa_ast: 9cecc0f8f61a79f6c87a2c813e3af44ddd194a3433720689dcd5679d2a788443
|
ssa_ast: a73b178cb60383c00720f4c5c708ca4ec57f27c195edecbe14f9f043a816881d
|
||||||
flattened_ast: d6db91d569b87edba60124cabfa970485d6dd0bc1767bf39109e91d2742eb22a
|
flattened_ast: ad5af5e933d455ebd4cac33b02cddd682900375eda223f905a5ee7d940d99800
|
||||||
inlined_ast: d6db91d569b87edba60124cabfa970485d6dd0bc1767bf39109e91d2742eb22a
|
inlined_ast: ad5af5e933d455ebd4cac33b02cddd682900375eda223f905a5ee7d940d99800
|
||||||
dce_ast: d6db91d569b87edba60124cabfa970485d6dd0bc1767bf39109e91d2742eb22a
|
dce_ast: cc5a25c7cee7a62ec59af5de109aa28d0013fd93648a28b20b13d6115884d81d
|
||||||
bytecode: a040c0026210ca23cfd255c7854d9ea01f1eebfaa58033a9ffb7f8dd99a4c8bb
|
bytecode: 0df6e3d77f2b3503e1b948582ccf17e40ef1cc0ba784bfb0ee91dd6388003630
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372064]: A `function` cannot output a record.\n --> compiler-test:13:44\n |\n 13 | function mint(r0: address, r1: u64) -> Token {\n | ^^^^^\nError [ETYC0372003]: Expected type `address` but type `u64` was found\n --> compiler-test:15:20\n |\n 15 | owner: r1, // This variable should be type address.\n | ^^\nError [ETYC0372003]: Expected type `u64` but type `address` was found\n --> compiler-test:17:21\n |\n 17 | amount: r0, // This variable should be type u64.\n | ^^\nError [ETYC0372047]: Only `inline` can be called from a `function` or `inline`.\n --> compiler-test:23:24\n |\n 23 | let t: Token = mint(x, c);\n | ^^^^^^^^^^\n"
|
- "Error [ETYC0372064]: A `function` cannot output a record.\n --> compiler-test:11:44\n |\n 11 | function mint(r0: address, r1: u64) -> Token {\n | ^^^^^\nError [ETYC0372003]: Expected type `address` but type `u64` was found\n --> compiler-test:13:20\n |\n 13 | owner: r1, // This variable should be type address.\n | ^^\nError [ETYC0372003]: Expected type `u64` but type `address` was found\n --> compiler-test:14:21\n |\n 14 | amount: r0, // This variable should be type u64.\n | ^^\nError [ETYC0372047]: Only `inline` can be called from a `function` or `inline`.\n --> compiler-test:20:24\n |\n 20 | let t: Token = mint(x, c);\n | ^^^^^^^^^^\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372064]: A `function` cannot output a record.\n --> compiler-test:13:44\n |\n 13 | function mint(r0: address, r1: u64) -> Token {\n | ^^^^^\nError [ETYC0372013]: Struct initialization expression for `Token` is missing member `owner`.\n --> compiler-test:14:16\n |\n 14 | return Token {\n 15 | sender: r0, // This variable should be named `owner`.\n 16 | gates: 0u64,\n 17 | amount: r1,\n 18 | };\n | ^^^^^^\nError [ETYC0372047]: Only `inline` can be called from a `function` or `inline`.\n --> compiler-test:23:24\n |\n 23 | let t: Token = mint(x, c);\n | ^^^^^^^^^^\n"
|
- "Error [ETYC0372064]: A `function` cannot output a record.\n --> compiler-test:11:44\n |\n 11 | function mint(r0: address, r1: u64) -> Token {\n | ^^^^^\nError [ETYC0372013]: Struct initialization expression for `Token` is missing member `owner`.\n --> compiler-test:12:16\n |\n 12 | return Token {\n 13 | sender: r0, // This variable should be named `owner`.\n 14 | amount: r1,\n 15 | };\n | ^^^^^^\nError [ETYC0372047]: Only `inline` can be called from a `function` or `inline`.\n --> compiler-test:20:24\n |\n 20 | let t: Token = mint(x, c);\n | ^^^^^^^^^^\n"
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: c134c752949c62a183432f6a7f466e8270be5592ade20d634a99796689d6db30
|
- - initial_ast: d879f1239bcfd241d83aa9b047ae7db135192b9db7e62329ffb3ee2fd61e6b4d
|
||||||
unrolled_ast: c134c752949c62a183432f6a7f466e8270be5592ade20d634a99796689d6db30
|
unrolled_ast: d879f1239bcfd241d83aa9b047ae7db135192b9db7e62329ffb3ee2fd61e6b4d
|
||||||
ssa_ast: 8e601ac48d9fddfdae521a6ffaedfed1cbfaa802bf1b81530f58f26d5cf67ead
|
ssa_ast: dfdc551d05a705f9048a3621d204e3f5a745ac83724366f797269416236c21da
|
||||||
flattened_ast: f88ab1e7c351cd90b5f49150df221c7c53e032e166e9d178a4d3524084e66b17
|
flattened_ast: ef37b08dd44f8827bb3b3828f01fccb04ef39ebaf0352d1235c2a8009aa6d196
|
||||||
inlined_ast: f88ab1e7c351cd90b5f49150df221c7c53e032e166e9d178a4d3524084e66b17
|
inlined_ast: ef37b08dd44f8827bb3b3828f01fccb04ef39ebaf0352d1235c2a8009aa6d196
|
||||||
dce_ast: f88ab1e7c351cd90b5f49150df221c7c53e032e166e9d178a4d3524084e66b17
|
dce_ast: bc021a92a42dee742df74b827a22ec7336c325d0a497dc13362de6b4fbf67864
|
||||||
bytecode: cf5ec964f29718bf4af63705e5037202cc0f007a9bd6fa6fc510ecbbd66cd401
|
bytecode: 9477487eb30939ab953ae2b069d924cc89d50b2b1062bfad64dcb7c79d817b6f
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:13:9\n |\n 13 | foo: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Token`.\n"
|
- "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | foo: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Token`.\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n"
|
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:7:9\n |\n 7 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:7:9\n |\n 7 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:12:9\n |\n 12 | bar: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Bar`.\n"
|
- "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Bar`.\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n"
|
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:6:9\n |\n 6 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:10:9\n |\n 10 | bar: (Token, Token),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:10:9\n |\n 10 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:10:9\n |\n 10 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372019]: The `record` type requires the variable `owner: address`.\n --> compiler-test:5:5\n |\n 5 | record Token {\n 6 | // The Aleo balance (in gates).\n 7 | gates: u64,\n 8 | // The token amount.\n 9 | amount: u64,\n 10 | }\n | ^\n"
|
- "Error [ETYC0372019]: The `record` type requires the variable `owner: address`.\n --> compiler-test:5:5\n |\n 5 | record Token {\n 6 | // The token amount.\n 7 | amount: u64,\n 8 | }\n | ^\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372020]: The field `owner` in a `record` must have type `address`.\n --> compiler-test:5:5\n |\n 5 | record Token {\n 6 | gates: u64,\n 7 | owner: bool,\n 8 | }\n | ^\n"
|
- "Error [ETYC0372020]: The field `owner` in a `record` must have type `address`.\n --> compiler-test:5:5\n |\n 5 | record Token {\n 6 | owner: bool,\n 7 | }\n | ^\n"
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: 2752eaa8193dc950ae07dbd8277c03fb924546879912afdc7c4709eb92155a1d
|
- - initial_ast: d0efb41bcfc2af8a34bd42fdcb3c45700737427977c4738fd70eb5d1379a9d02
|
||||||
unrolled_ast: 2752eaa8193dc950ae07dbd8277c03fb924546879912afdc7c4709eb92155a1d
|
unrolled_ast: d0efb41bcfc2af8a34bd42fdcb3c45700737427977c4738fd70eb5d1379a9d02
|
||||||
ssa_ast: 03392a93fef2cf4ac477a5850335d8a37939903c92ea49e58974ac0573dd447a
|
ssa_ast: b844a3275485038f2488afc671ab7e7b581a6ec8009a297993766fb6ac1477f0
|
||||||
flattened_ast: ea4f399821484f56da2ed384f7530428dcf91f5dfd227c83a785d6a50f33167f
|
flattened_ast: 518269a0d8fb855e056c6b0bbc7439e68120ef8cf1eb393376efe2d5fba0f939
|
||||||
inlined_ast: ea4f399821484f56da2ed384f7530428dcf91f5dfd227c83a785d6a50f33167f
|
inlined_ast: 518269a0d8fb855e056c6b0bbc7439e68120ef8cf1eb393376efe2d5fba0f939
|
||||||
dce_ast: ea4f399821484f56da2ed384f7530428dcf91f5dfd227c83a785d6a50f33167f
|
dce_ast: 518269a0d8fb855e056c6b0bbc7439e68120ef8cf1eb393376efe2d5fba0f939
|
||||||
bytecode: 07dc4694b8c8cff94cef0a4ea9ed3aaf27e874d9b26a91d8d5784cab20187bfb
|
bytecode: 567f936a9f498a3648860fa0c7028b9fe84c93e9843fc82865e39298bc99c525
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: 20ad25142425e428387351b1eae95763cd2bafc2aea81270944cca08c058ece4
|
- - initial_ast: 7c49d3c6a73a533f42970d6c0eb9068d75922a6cf6b6cf366a80c083dc65c42d
|
||||||
unrolled_ast: 20ad25142425e428387351b1eae95763cd2bafc2aea81270944cca08c058ece4
|
unrolled_ast: 7c49d3c6a73a533f42970d6c0eb9068d75922a6cf6b6cf366a80c083dc65c42d
|
||||||
ssa_ast: a87e55fe349912264137c0ac31434a9b0623c8701997d6930ab6e3e04f67bbe3
|
ssa_ast: 61053db22674f27f7f2cefefda51fd0cbb1bfd1f69511e81399ead44b8df4194
|
||||||
flattened_ast: 265092b725660652360db1d5995f28356d800d264a512511dbc70d31068e4e77
|
flattened_ast: d390010c4fc85bbf35c9bf6c9b4dd6cfed81b4c743a052d613bd2231a2e78c22
|
||||||
inlined_ast: 265092b725660652360db1d5995f28356d800d264a512511dbc70d31068e4e77
|
inlined_ast: d390010c4fc85bbf35c9bf6c9b4dd6cfed81b4c743a052d613bd2231a2e78c22
|
||||||
dce_ast: 265092b725660652360db1d5995f28356d800d264a512511dbc70d31068e4e77
|
dce_ast: d390010c4fc85bbf35c9bf6c9b4dd6cfed81b4c743a052d613bd2231a2e78c22
|
||||||
bytecode: 6e6bc5ede7d5fe2fe82ca47f48097138485a6f8f2e4fe3649d23f67a5ef32173
|
bytecode: 8c8992021f4a3ff29c9d5b1ddb3a34e14878b9cd822ac6e470018a4e268b2769
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: e48fe7856ecd5c90b2e8d425feb01da0f0876cca5385a8d1757beb5cbbb63564
|
- - initial_ast: 2690be4baa2d9b376942d0a10e0d2c152a5230d7c9d2aebff8ac9b3a3d62751e
|
||||||
unrolled_ast: e48fe7856ecd5c90b2e8d425feb01da0f0876cca5385a8d1757beb5cbbb63564
|
unrolled_ast: 2690be4baa2d9b376942d0a10e0d2c152a5230d7c9d2aebff8ac9b3a3d62751e
|
||||||
ssa_ast: f32921e1ad3a516b4b01cf14c25416dac730e600fdc85c7d35328a4e5e74d62c
|
ssa_ast: 45ad49325c4442c88f674bacd4291b674d10bede9940e23847593dba58bba75b
|
||||||
flattened_ast: 365d9ac45a96dfdb3fd84bd8d01e0e0ace194c61fb9acf901756cea7c7be402b
|
flattened_ast: f49cfa1d664d35e6840d75ecf216b0e0f86572977c0bcad9a7a9fd08c8d8fec2
|
||||||
inlined_ast: 365d9ac45a96dfdb3fd84bd8d01e0e0ace194c61fb9acf901756cea7c7be402b
|
inlined_ast: f49cfa1d664d35e6840d75ecf216b0e0f86572977c0bcad9a7a9fd08c8d8fec2
|
||||||
dce_ast: 365d9ac45a96dfdb3fd84bd8d01e0e0ace194c61fb9acf901756cea7c7be402b
|
dce_ast: f49cfa1d664d35e6840d75ecf216b0e0f86572977c0bcad9a7a9fd08c8d8fec2
|
||||||
bytecode: 76d814dbae331736a5349613302761136daa646913749a981d84983f56a7ed72
|
bytecode: b028178300130b3ccbbce4d1d496a8feb1e4ac876572588e646c6e220105ff70
|
||||||
warnings: ""
|
warnings: ""
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372003]: Expected type `()` but type `test_credits` was found\n --> compiler-test:11:16\n |\n 11 | return test_credits {\n | ^^^^^^^^^^^^\n"
|
- "Error [ETYC0372003]: Expected type `()` but type `test_credits` was found\n --> compiler-test:10:16\n |\n 10 | return test_credits {\n | ^^^^^^^^^^^^\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372049]: Loop bound must be a literal.\n --> compiler-test:12:28\n |\n 12 | for i:u64 in 0u64..amount {\n | ^^^^^^\n"
|
- "Error [ETYC0372049]: Loop bound must be a literal.\n --> compiler-test:11:28\n |\n 11 | for i:u64 in 0u64..amount {\n | ^^^^^^\n"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | amounts: (u64, u64),\n | ^^^^^^^\n"
|
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:6:9\n |\n 6 | amounts: (u64, u64),\n | ^^^^^^^\n"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
namespace: Finalize
|
namespace: Execute
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: 26abbb0ef61c47bd69f82f4ed0357583bad2ba031ee028400504bfc1f856e0bb
|
- - initial_ast: 26abbb0ef61c47bd69f82f4ed0357583bad2ba031ee028400504bfc1f856e0bb
|
||||||
@ -10,18 +10,13 @@ outputs:
|
|||||||
dce_ast: 5cef23d00b994c5f0dc715ede94edae006730bebec809d1425d83418b287a811
|
dce_ast: 5cef23d00b994c5f0dc715ede94edae006730bebec809d1425d83418b287a811
|
||||||
bytecode: 2f96ec3248782d1a90f9b223eb25bce3770fb9894ecd8ee89d685936ba1ea86b
|
bytecode: 2f96ec3248782d1a90f9b223eb25bce3770fb9894ecd8ee89d685936ba1ea86b
|
||||||
warnings: ""
|
warnings: ""
|
||||||
initial_state: c9ec5ff008d56bc287af2e780cc50f7132cc8c1feea397a90f86ed825e782454
|
|
||||||
results:
|
results:
|
||||||
dubble:
|
dubble:
|
||||||
- execute_output: "[]"
|
- input: "[]"
|
||||||
finalize_output: Finalize was successful.
|
output: "[]"
|
||||||
input: "[]"
|
- input: "[]"
|
||||||
- execute_output: "[]"
|
output: "[]"
|
||||||
finalize_output: Finalize was successful.
|
- input: "[]"
|
||||||
input: "[]"
|
output: "[]"
|
||||||
- execute_output: "[]"
|
- input: "[]"
|
||||||
finalize_output: Finalize was successful.
|
output: "[]"
|
||||||
input: "[]"
|
|
||||||
- execute_output: "[]"
|
|
||||||
finalize_output: Finalize was successful.
|
|
||||||
input: "[]"
|
|
@ -2,17 +2,17 @@
|
|||||||
namespace: Execute
|
namespace: Execute
|
||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- - initial_ast: e192c70186fda9dc009e023b648bf336b7ebdfed0ec157fdaa7990776a3cbd89
|
- - initial_ast: d280acb4697e7a9ec03f4d4e59857240a0e5da3eabd475b0c24d3f40fc3eed92
|
||||||
unrolled_ast: e192c70186fda9dc009e023b648bf336b7ebdfed0ec157fdaa7990776a3cbd89
|
unrolled_ast: d280acb4697e7a9ec03f4d4e59857240a0e5da3eabd475b0c24d3f40fc3eed92
|
||||||
ssa_ast: 558e95d5d2b7baa877a0ad1278dfda0df761be90c58721fe3210fe4a89469a73
|
ssa_ast: 1e5b51578e41dff5543775bf266034e7b502d48393a7c841e07583fac9949755
|
||||||
flattened_ast: 23880e52eb60934d5bbf37d7a404435ff54f12eba673787df7c844dc37035f80
|
flattened_ast: 808ad6aad5b5dc657fd57540169f09b9dcbace46e39df88a4ce9e31802273aff
|
||||||
inlined_ast: 23880e52eb60934d5bbf37d7a404435ff54f12eba673787df7c844dc37035f80
|
inlined_ast: 808ad6aad5b5dc657fd57540169f09b9dcbace46e39df88a4ce9e31802273aff
|
||||||
dce_ast: 23880e52eb60934d5bbf37d7a404435ff54f12eba673787df7c844dc37035f80
|
dce_ast: 808ad6aad5b5dc657fd57540169f09b9dcbace46e39df88a4ce9e31802273aff
|
||||||
bytecode: d1f79755d5d49e093fefa3bed2a2e81482a103f4f0411fe8989868a3ac4fcf4c
|
bytecode: d47819ba59e730eb159ee9e33fef5a35aac6062e70c743a749157d54824a45d9
|
||||||
warnings: ""
|
warnings: ""
|
||||||
results:
|
results:
|
||||||
mint:
|
mint:
|
||||||
- input: "[aleo14lskz87tkqwwkyt2z44h64ave5gcwqs6yyfdztus37nupxsj8ypsmqsqcs, 0u64]"
|
- input: "[aleo14lskz87tkqwwkyt2z44h64ave5gcwqs6yyfdztus37nupxsj8ypsmqsqcs, 0u64]"
|
||||||
output: "[{\n owner: aleo14lskz87tkqwwkyt2z44h64ave5gcwqs6yyfdztus37nupxsj8ypsmqsqcs.private,\n gates: 0u64.public,\n amount: 0u64.private,\n flag: true.constant,\n \n}]"
|
output: "[{\n owner: aleo14lskz87tkqwwkyt2z44h64ave5gcwqs6yyfdztus37nupxsj8ypsmqsqcs.private,\n amount: 0u64.private,\n flag: true.constant,\n \n}]"
|
||||||
- input: "[aleo12keuztkg4cjzxx7hwwmrnnv85dkeqf8pjm877lf6f6lupma2pqrqcl2d8q, 1u64]"
|
- input: "[aleo12keuztkg4cjzxx7hwwmrnnv85dkeqf8pjm877lf6f6lupma2pqrqcl2d8q, 1u64]"
|
||||||
output: "[{\n owner: aleo12keuztkg4cjzxx7hwwmrnnv85dkeqf8pjm877lf6f6lupma2pqrqcl2d8q.private,\n gates: 0u64.public,\n amount: 1u64.private,\n flag: true.constant,\n \n}]"
|
output: "[{\n owner: aleo12keuztkg4cjzxx7hwwmrnnv85dkeqf8pjm877lf6f6lupma2pqrqcl2d8q.private,\n amount: 1u64.private,\n flag: true.constant,\n \n}]"
|
||||||
|
@ -16,19 +16,12 @@ outputs:
|
|||||||
span:
|
span:
|
||||||
lo: 57
|
lo: 57
|
||||||
hi: 71
|
hi: 71
|
||||||
- mode: Private
|
|
||||||
identifier: "{\"name\":\"gates\",\"span\":\"{\\\"lo\\\":89,\\\"hi\\\":94}\"}"
|
|
||||||
type_:
|
|
||||||
Integer: U64
|
|
||||||
span:
|
|
||||||
lo: 89
|
|
||||||
hi: 99
|
|
||||||
is_record: true
|
is_record: true
|
||||||
span:
|
span:
|
||||||
lo: 26
|
lo: 26
|
||||||
hi: 106
|
hi: 78
|
||||||
mappings: {}
|
mappings: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
span:
|
span:
|
||||||
lo: 2
|
lo: 2
|
||||||
hi: 108
|
hi: 80
|
||||||
|
@ -11,8 +11,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -27,7 +25,6 @@ program test.aleo {
|
|||||||
|
|
||||||
assert_neq(token, Token {
|
assert_neq(token, Token {
|
||||||
owner: aleo1lfapwg53y5enqpt0d8cnef4g8lj7l6g9uhkkma23qyv6jm4ppyfq50regr,
|
owner: aleo1lfapwg53y5enqpt0d8cnef4g8lj7l6g9uhkkma23qyv6jm4ppyfq50regr,
|
||||||
gates: 0u64,
|
|
||||||
amount: 0u64,
|
amount: 0u64,
|
||||||
});
|
});
|
||||||
return a == true;
|
return a == true;
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u128,
|
amount: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u128,
|
amount: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u128,
|
amount: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u128,
|
amount: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,8 +23,8 @@ program test.aleo {
|
|||||||
amounts.get_or_init(1u8, amount);
|
amounts.get_or_init(1u8, amount);
|
||||||
Mapping::get_or_init(amounts, addr, 1u8);
|
Mapping::get_or_init(amounts, addr, 1u8);
|
||||||
amounts.get_or_init(addr, 1u8);
|
amounts.get_or_init(addr, 1u8);
|
||||||
Mapping::get_or_init(tokens, addr, Token { owner: addr, gates: 1u8, amount: 1u8 });
|
Mapping::get_or_init(tokens, addr, Token { owner: addr, amount: 1u8 });
|
||||||
tokens.get_or_init(addr, Token { owner: addr, gates: 1u8, amount: 1u8 });
|
tokens.get_or_init(addr, Token { owner: addr, amount: 1u8 });
|
||||||
Mapping::get_or_init(foo, addr, amount);
|
Mapping::get_or_init(foo, addr, amount);
|
||||||
foo.get_or_init(addr, amount);
|
foo.get_or_init(addr, amount);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ program test.aleo {
|
|||||||
record RealToken {
|
record RealToken {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u128,
|
amount: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u128,
|
amount: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,8 +23,8 @@ program test.aleo {
|
|||||||
amounts.set(1u8, amount);
|
amounts.set(1u8, amount);
|
||||||
Mapping::set(amounts, addr, 1u8);
|
Mapping::set(amounts, addr, 1u8);
|
||||||
amounts.set(addr, 1u8);
|
amounts.set(addr, 1u8);
|
||||||
Mapping::set(tokens, addr, Token { owner: addr, gates: 1u8, amount: 1u8 });
|
Mapping::set(tokens, addr, Token { owner: addr, amount: 1u8 });
|
||||||
tokens.set(addr, Token { owner: addr, gates: 1u8, amount: 1u8 });
|
tokens.set(addr, Token { owner: addr, amount: 1u8 });
|
||||||
Mapping::set(foo, addr, amount);
|
Mapping::set(foo, addr, amount);
|
||||||
foo.set(addr, amount);
|
foo.set(addr, amount);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ program test.aleo;
|
|||||||
|
|
||||||
record dummy:
|
record dummy:
|
||||||
owner as address.private;
|
owner as address.private;
|
||||||
gates as u64.private;
|
|
||||||
data as u8.private;
|
data as u8.private;
|
||||||
|
|
||||||
closure eliminate_unused_function_call:
|
closure eliminate_unused_function_call:
|
||||||
@ -30,7 +29,6 @@ program test.aleo {
|
|||||||
|
|
||||||
record dummy {
|
record dummy {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
data: u8,
|
data: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +49,6 @@ program test.aleo {
|
|||||||
}
|
}
|
||||||
let f: dummy = dummy {
|
let f: dummy = dummy {
|
||||||
owner: self.caller,
|
owner: self.caller,
|
||||||
gates: 0u64,
|
|
||||||
data: e,
|
data: e,
|
||||||
};
|
};
|
||||||
return a + b;
|
return a + b;
|
||||||
|
@ -6,20 +6,18 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Board {
|
record Board {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
data: u8,
|
data: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo(board: Board, data: u8) -> Board {
|
function foo(board: Board, data: u8) -> Board {
|
||||||
return Board {
|
return Board {
|
||||||
owner: board.owner,
|
owner: board.owner,
|
||||||
gates: board.gates,
|
|
||||||
data: data,
|
data: data,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function bar(board: Board) {
|
function bar(board: Board) {
|
||||||
assert_eq(board.gates, 0u64);
|
assert_eq(board.data, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
transition main(board: Board) -> Board {
|
transition main(board: Board) -> Board {
|
||||||
|
@ -6,7 +6,6 @@ expectation: Pass
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64
|
amount: u64
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,14 +17,12 @@ program test.aleo {
|
|||||||
if(password_hash == password_hash_from_input){
|
if(password_hash == password_hash_from_input){
|
||||||
return Token {
|
return Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount
|
amount: amount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Token {
|
return Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: 0u64
|
amount: 0u64
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -39,14 +36,12 @@ program test.aleo {
|
|||||||
if(password_hash == password_hash_from_input){
|
if(password_hash == password_hash_from_input){
|
||||||
let token: Token = Token {
|
let token: Token = Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount
|
amount: amount
|
||||||
};
|
};
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
return Token {
|
return Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: 0u64
|
amount: 0u64
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
43
tests/tests/compiler/mappings/max_mappings.leo
Normal file
43
tests/tests/compiler/mappings/max_mappings.leo
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Pass
|
||||||
|
*/
|
||||||
|
|
||||||
|
program test.aleo {
|
||||||
|
|
||||||
|
mapping one: field => field;
|
||||||
|
mapping two: field => field;
|
||||||
|
mapping three: field => field;
|
||||||
|
mapping four: field => field;
|
||||||
|
mapping five: field => field;
|
||||||
|
mapping six: field => field;
|
||||||
|
mapping seven: field => field;
|
||||||
|
mapping eight: field => field;
|
||||||
|
mapping nine: field => field;
|
||||||
|
mapping ten: field => field;
|
||||||
|
mapping eleven: field => field;
|
||||||
|
mapping twelve: field => field;
|
||||||
|
mapping thirteen: field => field;
|
||||||
|
mapping fourteen: field => field;
|
||||||
|
mapping fifteen: field => field;
|
||||||
|
mapping sixteen: field => field;
|
||||||
|
mapping seventeen: field => field;
|
||||||
|
mapping eighteen: field => field;
|
||||||
|
mapping nineteen: field => field;
|
||||||
|
mapping twenty: field => field;
|
||||||
|
mapping twentyone: field => field;
|
||||||
|
mapping twentytwo: field => field;
|
||||||
|
mapping twentythree: field => field;
|
||||||
|
mapping twentyfour: field => field;
|
||||||
|
mapping twentyfive: field => field;
|
||||||
|
mapping twentysix: field => field;
|
||||||
|
mapping twentyseven: field => field;
|
||||||
|
mapping twentyeight: field => field;
|
||||||
|
mapping twentynine: field => field;
|
||||||
|
mapping thirty: field => field;
|
||||||
|
mapping thirtyone: field => field;
|
||||||
|
|
||||||
|
transition foo() -> u8 {
|
||||||
|
return 1u8 + 1u8;
|
||||||
|
}
|
||||||
|
}
|
44
tests/tests/compiler/mappings/too_many_mappings_fail.leo
Normal file
44
tests/tests/compiler/mappings/too_many_mappings_fail.leo
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
program test.aleo {
|
||||||
|
|
||||||
|
mapping one: field => field;
|
||||||
|
mapping two: field => field;
|
||||||
|
mapping three: field => field;
|
||||||
|
mapping four: field => field;
|
||||||
|
mapping five: field => field;
|
||||||
|
mapping six: field => field;
|
||||||
|
mapping seven: field => field;
|
||||||
|
mapping eight: field => field;
|
||||||
|
mapping nine: field => field;
|
||||||
|
mapping ten: field => field;
|
||||||
|
mapping eleven: field => field;
|
||||||
|
mapping twelve: field => field;
|
||||||
|
mapping thirteen: field => field;
|
||||||
|
mapping fourteen: field => field;
|
||||||
|
mapping fifteen: field => field;
|
||||||
|
mapping sixteen: field => field;
|
||||||
|
mapping seventeen: field => field;
|
||||||
|
mapping eighteen: field => field;
|
||||||
|
mapping nineteen: field => field;
|
||||||
|
mapping twenty: field => field;
|
||||||
|
mapping twentyone: field => field;
|
||||||
|
mapping twentytwo: field => field;
|
||||||
|
mapping twentythree: field => field;
|
||||||
|
mapping twentyfour: field => field;
|
||||||
|
mapping twentyfive: field => field;
|
||||||
|
mapping twentysix: field => field;
|
||||||
|
mapping twentyseven: field => field;
|
||||||
|
mapping twentyeight: field => field;
|
||||||
|
mapping twentynine: field => field;
|
||||||
|
mapping thirty: field => field;
|
||||||
|
mapping thirtyone: field => field;
|
||||||
|
mapping thirtytwo: field => field;
|
||||||
|
|
||||||
|
transition foo() -> u8 {
|
||||||
|
return 1u8 + 1u8;
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,6 @@ expectation: Pass
|
|||||||
|
|
||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
gates: address,
|
|
||||||
owner: address,
|
owner: address,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ program test.aleo {
|
|||||||
owner: address,
|
owner: address,
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address, // Cannot define two record variables with the same name.
|
owner: address, // Cannot define two record variables with the same name.
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
19
tests/tests/compiler/records/gates_is_allowed.leo
Normal file
19
tests/tests/compiler/records/gates_is_allowed.leo
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Pass
|
||||||
|
*/
|
||||||
|
|
||||||
|
program test.aleo {
|
||||||
|
record Token {
|
||||||
|
// The token owner.
|
||||||
|
owner: address,
|
||||||
|
// The token amount.
|
||||||
|
amount: u64,
|
||||||
|
// `gates` as a normal field.
|
||||||
|
gates: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
transition main(a: u8, b:u8) -> u8 {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
}
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -16,14 +14,13 @@ program test.aleo {
|
|||||||
transition mint(r0: address, r1: u64) -> Token {
|
transition mint(r0: address, r1: u64) -> Token {
|
||||||
return Token {
|
return Token {
|
||||||
owner: r0,
|
owner: r0,
|
||||||
gates: 0u64,
|
|
||||||
amount: r1,
|
amount: r1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
transition main(x: address) -> u64 {
|
transition main(x: address) -> u64 {
|
||||||
let c: u64 = 1u64;
|
let c: u64 = 1u64;
|
||||||
let t: Token = Token { owner: x, gates: 0u64, amount: c};
|
let t: Token = Token { owner: x, amount: c};
|
||||||
|
|
||||||
return t.gates;
|
return c * c;
|
||||||
}}
|
}}
|
||||||
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -16,14 +14,13 @@ program test.aleo {
|
|||||||
transition mint(owner: address, amount: u64) -> Token {
|
transition mint(owner: address, amount: u64) -> Token {
|
||||||
return Token {
|
return Token {
|
||||||
owner,
|
owner,
|
||||||
gates: 0u64,
|
|
||||||
amount,
|
amount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
transition main(x: address) -> u64 {
|
transition main(x: address) -> u64 {
|
||||||
let c: u64 = 1u64;
|
let c: u64 = 1u64;
|
||||||
let t: Token = Token { owner: x, gates: 0u64, amount: c};
|
let t: Token = Token { owner: x, amount: c};
|
||||||
|
|
||||||
return t.gates;
|
return c + c;
|
||||||
}}
|
}}
|
||||||
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -16,7 +14,6 @@ program test.aleo {
|
|||||||
function mint(r0: address, r1: u64) -> Token {
|
function mint(r0: address, r1: u64) -> Token {
|
||||||
return Token {
|
return Token {
|
||||||
owner: r1, // This variable should be type address.
|
owner: r1, // This variable should be type address.
|
||||||
gates: 0u64,
|
|
||||||
amount: r0, // This variable should be type u64.
|
amount: r0, // This variable should be type u64.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -24,6 +21,6 @@ program test.aleo {
|
|||||||
function main(x: address) -> u64 {
|
function main(x: address) -> u64 {
|
||||||
let c: u64 = 1u64;
|
let c: u64 = 1u64;
|
||||||
let t: Token = mint(x, c);
|
let t: Token = mint(x, c);
|
||||||
|
|
||||||
return t.gates;
|
return c;
|
||||||
}}
|
}}
|
||||||
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -16,7 +14,6 @@ program test.aleo {
|
|||||||
function mint(r0: address, r1: u64) -> Token {
|
function mint(r0: address, r1: u64) -> Token {
|
||||||
return Token {
|
return Token {
|
||||||
sender: r0, // This variable should be named `owner`.
|
sender: r0, // This variable should be named `owner`.
|
||||||
gates: 0u64,
|
|
||||||
amount: r1,
|
amount: r1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -24,6 +21,6 @@ program test.aleo {
|
|||||||
function main(x: address) -> u64 {
|
function main(x: address) -> u64 {
|
||||||
let c: u64 = 1u64;
|
let c: u64 = 1u64;
|
||||||
let t: Token = mint(x, c);
|
let t: Token = mint(x, c);
|
||||||
|
|
||||||
return t.gates;
|
return c;
|
||||||
}}
|
}}
|
||||||
|
@ -12,8 +12,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: Amount,
|
amount: Amount,
|
||||||
}
|
}
|
||||||
@ -21,15 +19,14 @@ program test.aleo {
|
|||||||
transition mint(r0: address, r1: u64) -> Token {
|
transition mint(r0: address, r1: u64) -> Token {
|
||||||
return Token {
|
return Token {
|
||||||
owner: r0,
|
owner: r0,
|
||||||
gates: 0u64,
|
|
||||||
amount: Amount { amount: r1, amt: r1 },
|
amount: Amount { amount: r1, amt: r1 },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
transition main(x: address) -> u64 {
|
transition main(x: address) -> u64 {
|
||||||
let c: u64 = 1u64;
|
let c: u64 = 1u64;
|
||||||
let t: Token = Token { owner: x, gates: 0u64, amount: Amount { amount: c, amt: c } };
|
let t: Token = Token { owner: x, amount: Amount { amount: c, amt: c } };
|
||||||
|
|
||||||
return t.gates;
|
return c + c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,11 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Foo {
|
record Foo {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
foo: Foo,
|
foo: Foo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,11 @@ program test.aleo {
|
|||||||
|
|
||||||
record Token2 {
|
record Token2 {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
foo: (Foo, Foo),
|
foo: (Foo, Foo),
|
||||||
}
|
}
|
||||||
|
|
||||||
record Foo {
|
record Foo {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
bar: Bar,
|
bar: Bar,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ program test.aleo {
|
|||||||
|
|
||||||
record Foo {
|
record Foo {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token3 {
|
record Token3 {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
bar: (Bar, Bar),
|
bar: (Bar, Bar),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +15,6 @@ program test.aleo {
|
|||||||
|
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
// This record does not define the `owner` variable required for a record type.
|
// This record does not define the `owner` variable required for a record type.
|
||||||
record Token {
|
record Token {
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
// This record does define the `owner` variable but with the wrong type.
|
// This record does define the `owner` variable but with the wrong type.
|
||||||
record Token {
|
record Token {
|
||||||
gates: u64,
|
|
||||||
owner: bool,
|
owner: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
}
|
}
|
||||||
@ -16,4 +14,4 @@ program test.aleo {
|
|||||||
transition main(a: u8, b:u8) -> u8 {
|
transition main(a: u8, b:u8) -> u8 {
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token owner.
|
// The token owner.
|
||||||
owner: address,
|
owner: address,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
gates: u64,
|
|
||||||
// The token amount.
|
// The token amount.
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
@ -19,8 +17,7 @@ program test.aleo {
|
|||||||
let amount: u64 = a * a;
|
let amount: u64 = a * a;
|
||||||
return Token {
|
return Token {
|
||||||
amount,
|
amount,
|
||||||
gates: 0u64,
|
|
||||||
owner,
|
owner,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ program test.aleo {
|
|||||||
record Token {
|
record Token {
|
||||||
// The token amount.
|
// The token amount.
|
||||||
private amount: u64,
|
private amount: u64,
|
||||||
// The Aleo balance (in gates).
|
|
||||||
public gates: u64,
|
|
||||||
// The token owner.
|
// The token owner.
|
||||||
private owner: address,
|
private owner: address,
|
||||||
// A constant value.
|
// A constant value.
|
||||||
|
@ -6,15 +6,13 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record test_credits {
|
record test_credits {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64
|
amount: u64
|
||||||
}
|
}
|
||||||
|
|
||||||
transition mint_credits(to: address, amount: u64) {
|
transition mint_credits(to: address, amount: u64) {
|
||||||
return test_credits {
|
return test_credits {
|
||||||
owner: self.caller,
|
owner: self.caller,
|
||||||
gates: 0u64,
|
|
||||||
amount
|
amount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ expectation: Fail
|
|||||||
program test.aleo {
|
program test.aleo {
|
||||||
record Token {
|
record Token {
|
||||||
owner: address,
|
owner: address,
|
||||||
gates: u64,
|
|
||||||
amount: u64,
|
amount: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ program test.aleo {
|
|||||||
}
|
}
|
||||||
return Token {
|
return Token {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
gates: 0u64,
|
|
||||||
amount: amount,
|
amount: amount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user