-
Notifications
You must be signed in to change notification settings - Fork 705
[Feature] Leo Devnode #28982
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
Closed
Closed
[Feature] Leo Devnode #28982
Changes from 32 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
c0a78b0
Support leo execute --authorization-only and --skip-proving
d0cd 96a4635
added devnode server code
Roee-87 9bdaa2e
updated licenses
Roee-87 2f55dad
added command for advancing blocks
Roee-87 5a5e5a2
debugging errors
Roee-87 7b53849
leo devnode compiler
Roee-87 32be2b6
modifed start.rs to use correct path for genesis block file
Roee-87 f4eda07
fixed logging for devnode
Roee-87 8f5dce8
added default block creation to broadcast endpoint
Roee-87 92f076b
modified create_block handler and advance.rs to advance multiple bloc…
Roee-87 2e41949
added transaction check logic
Roee-87 7d1383f
ran cargo fmt
Roee-87 8c5ff5d
removed deadcode
Roee-87 82d97ed
ran cargo fmt
Roee-87 5fa7542
updated to Leo staging and snarkVM staging
Roee-87 cac897c
added skip-proving feature to execute.rs
Roee-87 f287986
added endpoint and cv 12
Roee-87 18facd4
added Operand::BlockTimestamp to cursor_aleo.rs
Roee-87 758abf2
changed default setting for txn check from false to true
Roee-87 d38f1fc
enabled confirmed txn endpoint and mapping data endpoint
Roee-87 0695769
addressed compiler warning
Roee-87 b7c082a
renamed genesis binary file
Roee-87 dca6bb5
cleanup
Roee-87 48bb48d
removed version.rs
Roee-87 ce5dbdb
updated Cargo.toml
Roee-87 ef8730a
addressed review comments
Roee-87 369bb21
replaced private_key fetch method
Roee-87 4a4e28c
added test_target feature back in
Roee-87 a6bf938
added unconfirmed txn route + minor refactor in rest mod.rs
Roee-87 d4a5c39
logging output changed to leo_devnode_*
Roee-87 ad99794
added flags for devnode start
Roee-87 7b9b01e
added genesis-path CLI flag
Roee-87 e759331
added spawn_blocking to ledger methods
Roee-87 29ca7f1
patch for genesis block path
Roee-87 97ee933
optional dummy vkeys and certificate for deploy transactions
Roee-87 3859a89
upgrade proofless
Roee-87 f10c202
added fast-forward default to latest CV
Roee-87 218f84e
modified feature flag name for skipping execution proofs
Roee-87 1aa3b77
ran cargo fmt
Roee-87 be283b1
minor refactor in routes.rs
Roee-87 3cbef96
clippy cleanup
Roee-87 0255866
updated private-key passing and error managment
Roee-87 5baf94e
refactored private key management to avoid env var dependency
Roee-87 a78c8aa
Fix a bug where skipped programs did not get added to the VM
eranrund 58553e4
Merge pull request #29006 from eranrund/eran/fix-skip-indentation-bug
Roee-87 faab636
set fast-forward height to use TEST_CONSENSUS_VERSION_HEIGHTS var
Roee-87 f6eb08d
docstring and comment cleanup
Roee-87 865e50d
clippy cleanup
Roee-87 feb2081
ran cargo fmt
Roee-87 10763d6
updated to snarkVM 4.4.0
Roee-87 254d7f5
fixed operand_value method
Roee-87 9cbd359
fixed logging for execute.rs
Roee-87 326cef8
fixed cursor_aleo.rs
Roee-87 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,70 @@ | ||
| // Copyright (C) 2019-2025 Provable 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 super::*; | ||
| use serde_json::json; | ||
| use snarkvm::prelude::{PrivateKey, TestnetV0}; | ||
|
|
||
| // Advance the Devnode ledger by a specified number of blocks. The default value is 1. | ||
| #[derive(Parser, Debug)] | ||
| pub struct Advance { | ||
| #[clap(help = "The number of blocks to advance the ledger by", default_value = "1")] | ||
| pub num_blocks: u32, | ||
| #[clap(flatten)] | ||
| pub(crate) env_override: EnvOptions, | ||
| } | ||
|
|
||
| impl Command for Advance { | ||
| type Input = (); | ||
| type Output = (); | ||
|
|
||
| fn log_span(&self) -> Span { | ||
| tracing::span!(tracing::Level::INFO, "Leo") | ||
| } | ||
|
|
||
| fn prelude(&self, _context: Context) -> Result<Self::Input> { | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn apply(self, _context: Context, _: Self::Input) -> Result<Self::Output> { | ||
|
|
||
| tokio::runtime::Runtime::new() | ||
| .unwrap() | ||
| .block_on(async { handle_advance_devnode::<TestnetV0>(self).await }) | ||
| } | ||
| } | ||
|
|
||
| async fn handle_advance_devnode<N: Network>(command: Advance) -> Result<()> { | ||
| let private_key: PrivateKey<N> = get_private_key(&command.env_override.private_key)?; | ||
|
|
||
| tracing::info!("Advancing the Devnode ledger by {} block(s)", command.num_blocks,); | ||
|
|
||
| // Call the REST API to advance the ledger by one block. | ||
| let client = reqwest::blocking::Client::new(); | ||
|
|
||
| let payload = json!({ | ||
| "private_key": private_key.to_string(), | ||
| "num_blocks": command.num_blocks, | ||
| }); | ||
|
|
||
| let _response = client | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we care about reporting errors?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you elaborate on this? |
||
| .post("http://localhost:3030/testnet/block/create") | ||
| .header("Content-Type", "application/json") | ||
| .json(&payload) | ||
| .send(); | ||
|
|
||
| Ok(()) | ||
| } | ||
This file contains hidden or 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,63 @@ | ||
| // Copyright (C) 2019-2025 Provable 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 is_terminal::IsTerminal; | ||
| use std::{io, str::FromStr}; | ||
| use tracing_subscriber::{EnvFilter, prelude::*}; | ||
|
|
||
| use super::*; | ||
|
|
||
| pub fn initialize_terminal_logger(verbosity: u8) -> Result<()> { | ||
| let stdout_filter = parse_log_verbosity(verbosity)?; | ||
|
|
||
| // At high verbosity or when there is a custom log filter we show the target | ||
| // of the log event, i.e., the file/module where the log message was created. | ||
| let show_target = verbosity > 2; | ||
|
|
||
| // Initialize tracing. | ||
| let _ = tracing_subscriber::registry() | ||
| .with( | ||
| // Add layer using LogWriter for stdout / terminal | ||
| tracing_subscriber::fmt::Layer::default() | ||
| .with_ansi(io::stdout().is_terminal()) | ||
| .with_target(show_target) | ||
| // .event_format(DynamicFormatter::new(Arc::new(AtomicBool::new(false)))) | ||
| .with_filter(stdout_filter), | ||
| ) | ||
| .try_init(); | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| fn parse_log_verbosity(verbosity: u8) -> Result<EnvFilter> { | ||
| // First, set default log verbosity. | ||
| // Note, that this must not be prefixed with `RUST_LOG=`. | ||
| let default_log_str = match verbosity { | ||
| 0 => "info", | ||
| 1 => "debug", | ||
| 2.. => "trace", | ||
| }; | ||
| let filter = EnvFilter::from_str(default_log_str).unwrap(); | ||
|
|
||
|
|
||
| let filter = if verbosity >= 3 { | ||
| filter.add_directive("leo_devnode_tcp=trace".parse().unwrap()) | ||
| } else { | ||
| filter.add_directive("leo_devnode_tcp=off".parse().unwrap()) | ||
| }; | ||
|
|
||
| Ok(filter) | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.