-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger. #28441
Draft
mikebenfield
wants to merge
28
commits into
mainnet
Choose a base branch
from
interpreter
base: mainnet
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Debugger. #28441
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
f2c0167
Interpreter.
mikebenfield eadf559
Breakpoints, mapping fixes, respect project structure, cleanup.
mikebenfield ce1ec05
support Rand core functions
mikebenfield f5bb2b1
version fix
mikebenfield 24254bf
some doc comments
mikebenfield 9ee9df6
some doc comments
mikebenfield 18818da
await
mikebenfield 4ad3ec7
check for empty frames
mikebenfield f6b27b6
fix
mikebenfield 4ee88a1
doc fix
mikebenfield fe2da9c
futures in tuple return
mikebenfield aa691db
Address review comments.
mikebenfield 8901f1d
Recursively destroy spans of REPL-read code.
mikebenfield 0f7a623
rename interpret to debug
mikebenfield 148183f
self.signer, self.caller, and block.height
mikebenfield b2f7fd7
Aleo VM interpretation and misc
mikebenfield 334881c
rest of Aleo commands
mikebenfield 94638be
setting top level values
mikebenfield 7b9e525
conditional fix
mikebenfield b2b0513
Use dialoguer for prompts with history.
mikebenfield a453ad3
use a default caller address if not using Leo project structure
mikebenfield fc08264
Interpreter struct into separate file
mikebenfield c48afb3
call SnarkVM's implementation of ToBits
mikebenfield 64c995b
prettier prompts
mikebenfield bc314c3
still prettier messages
mikebenfield d0ade71
interpreter testing
mikebenfield 18cf244
access registers using Register::Access
mikebenfield 358e6a6
track spans for code entered at the REPL
mikebenfield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (C) 2019-2024 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/>. | ||
|
||
use std::fmt; | ||
|
||
use leo_span::Span; | ||
|
||
/// Represents the interpreter halting, which should not be considered an | ||
/// actual runtime error. | ||
#[derive(Clone, Debug, Error)] | ||
pub struct InterpreterHalt { | ||
/// Optional Span where the halt occurred. | ||
span: Option<Span>, | ||
|
||
/// User visible message. | ||
message: String, | ||
} | ||
|
||
impl InterpreterHalt { | ||
pub fn new(message: String) -> Self { | ||
InterpreterHalt { span: None, message } | ||
} | ||
|
||
pub fn new_spanned(message: String, span: Span) -> Self { | ||
InterpreterHalt { span: Some(span), message } | ||
} | ||
|
||
pub fn span(&self) -> Option<Span> { | ||
self.span | ||
} | ||
} | ||
|
||
impl fmt::Display for InterpreterHalt { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
write!(f, "{}", self.message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[package] | ||
name = "leo-interpreter" | ||
version = "2.3.1" | ||
authors = [ "The Leo Team <leo@provable.com>" ] | ||
description = "Interpreter for the Leo programming language" | ||
homepage = "https://leo-lang.org" | ||
repository = "https://github.com/ProvableHQ/leo" | ||
keywords = [ | ||
"aleo", | ||
"cryptography", | ||
"leo", | ||
"programming-language", | ||
"zero-knowledge" | ||
] | ||
categories = [ "compilers", "cryptography", "web-programming" ] | ||
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ] | ||
license = "GPL-3.0" | ||
edition = "2021" | ||
rust-version = "1.82.0" | ||
|
||
[dependencies.snarkvm] | ||
workspace = true | ||
|
||
[dependencies.snarkvm-circuit] | ||
version = "1.0.0" | ||
|
||
[dependencies.snarkvm-synthesizer-program] | ||
version = "1.0.0" | ||
|
||
[dependencies.leo-ast] | ||
workspace = true | ||
|
||
[dependencies.leo-passes] | ||
workspace = true | ||
|
||
[dependencies.leo-errors] | ||
workspace = true | ||
|
||
[dependencies.leo-package] | ||
workspace = true | ||
|
||
[dependencies.leo-parser] | ||
workspace = true | ||
|
||
[dependencies.leo-span] | ||
workspace = true | ||
|
||
[dependencies.colored] | ||
workspace = true | ||
|
||
[dependencies.indexmap] | ||
workspace = true | ||
|
||
[dependencies.dialoguer] | ||
version = "0.11.0" | ||
features = [ "history" ] | ||
|
||
[dependencies.rand] | ||
workspace = true | ||
|
||
[dependencies.rand_chacha] | ||
workspace = true | ||
|
||
[dependencies.toml] | ||
workspace = true | ||
|
||
[dev-dependencies.leo-test-framework] | ||
path = "../tests/test-framework" | ||
|
||
[dev-dependencies.serial_test] | ||
version = "3.1.1" | ||
|
||
[dev-dependencies.tempfile] | ||
workspace = true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we give these a proper error code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. My thought is that unlike the other error variants, InterpreterHalt doesn't necessarily represent undesired/unexpected behavior - the user may be stepping through code perfectly well expecting that an assert may trigger (or whatever).