mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 23:23:50 +03:00
fix import example and logging output
This commit is contained in:
parent
bef473b656
commit
f0a6e9421b
@ -1,16 +1,18 @@
|
|||||||
// A (x, y) coordinate point
|
// A (x, y) coordinate point.
|
||||||
circuit Point {
|
circuit Point {
|
||||||
x: u32,
|
x: u32,
|
||||||
y: u32,
|
y: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a new point.
|
||||||
function new(x: u32, y: u32) -> Point {
|
function new(x: u32, y: u32) -> Point {
|
||||||
return Point {x, y};
|
return Point {x, y};
|
||||||
}
|
}
|
||||||
|
|
||||||
function add(a: Point, b: Point) -> Point {
|
// Returns the sum of two points.
|
||||||
|
function sum(a: Point, b: Point) -> Point {
|
||||||
return Point {
|
return Point {
|
||||||
x: a.x + b.x,
|
x: a.x + b.x,
|
||||||
y: a.y + b.y,
|
y: a.y + b.y,
|
||||||
}
|
};
|
||||||
}
|
}
|
@ -1,7 +1,4 @@
|
|||||||
// The program input for point/src/main.leo
|
// The program input for import_point/src/main.leo
|
||||||
[main]
|
[main]
|
||||||
public a: u32 = 1u32;
|
public a: u32 = 1u32;
|
||||||
b: u32 = 2u32; // Input variable `b` is private by default.
|
b: u32 = 2u32; // Input variable `b` is private by default.
|
||||||
|
|
||||||
[foo]
|
|
||||||
x: u64 = 5u64;
|
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"program": "helloworld.aleo",
|
"program": "import_point.aleo",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"development": {
|
"development": {
|
@ -2,7 +2,7 @@
|
|||||||
// In testnet3, Leo imports all symbols from a file by default.
|
// In testnet3, Leo imports all symbols from a file by default.
|
||||||
import point.leo;
|
import point.leo;
|
||||||
|
|
||||||
// The 'point' main function.
|
// The main function.
|
||||||
function main(public a: u32, b: u32) -> u32 {
|
function main(public a: u32, b: u32) -> u32 {
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
@ -27,13 +27,9 @@ pub use new::New;
|
|||||||
pub mod run;
|
pub mod run;
|
||||||
pub use run::Run;
|
pub use run::Run;
|
||||||
|
|
||||||
// pub mod init;
|
|
||||||
// pub use init::Init;
|
|
||||||
|
|
||||||
use crate::context::*;
|
use crate::context::*;
|
||||||
use leo_errors::Result;
|
use leo_errors::Result;
|
||||||
|
|
||||||
use std::time::Instant;
|
|
||||||
use tracing::span::Span;
|
use tracing::span::Span;
|
||||||
|
|
||||||
pub(crate) type Network = snarkvm::prelude::Testnet3;
|
pub(crate) type Network = snarkvm::prelude::Testnet3;
|
||||||
@ -83,16 +79,10 @@ pub trait Command {
|
|||||||
let span = span.enter();
|
let span = span.enter();
|
||||||
|
|
||||||
// Calculate the execution time for this command.
|
// Calculate the execution time for this command.
|
||||||
let timer = Instant::now();
|
|
||||||
let out = self.apply(context, input);
|
let out = self.apply(context, input);
|
||||||
|
|
||||||
drop(span);
|
drop(span);
|
||||||
|
|
||||||
// Use the done context to print the execution time for this command.
|
|
||||||
tracing::span!(tracing::Level::INFO, "Done").in_scope(|| {
|
|
||||||
tracing::info!("Finished in {} milliseconds \n", timer.elapsed().as_millis());
|
|
||||||
});
|
|
||||||
|
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user