Skip to content

Commit

Permalink
Merge pull request solana-labs#81 from jarry-xiao/gummyroll
Browse files Browse the repository at this point in the history
Add Gummyroll instructions
  • Loading branch information
ngundotra authored Jun 2, 2022
2 parents cc8bca2 + 56482ec commit 45c2a50
Show file tree
Hide file tree
Showing 7 changed files with 293 additions and 123 deletions.
35 changes: 35 additions & 0 deletions lib/concurrent-merkle-tree/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/concurrent-merkle-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ version = "0.1.0"
edition = "2021"

[features]
sol-log = []
log = []
sol-log = [ "log" ]

[dependencies]
solana-program = "1.10.10"
Expand All @@ -16,3 +17,4 @@ thiserror = "1.0.30"
rand_distr = "0.4.3"
rand = "0.7"
merkle-tree-reference = { path = "../merkle-tree-reference" }
tokio = { version = "0.2", features = ["macros"] }
6 changes: 6 additions & 0 deletions lib/concurrent-merkle-tree/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ pub enum CMTError {
LeafAlreadyUpdated,
#[error("Invalid number of bytes passed for node (expected 32 bytes)")]
InvalidNodeByteLength,
#[error("Root not found in changelog buffer")]
RootNotFound,
#[error(
"Valid proof was passed to an empty leaf, but it was filled since the proof was issued"
)]
EmptyLeafSpotTaken,
}
20 changes: 3 additions & 17 deletions lib/concurrent-merkle-tree/src/log.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
#[cfg(feature = "sol-log")]
use solana_program::{log::sol_log_compute_units, msg};

#[cfg(feature = "sol-log")]
macro_rules! solana_logging {
($message:literal, $($arg:tt)*) => {
#[cfg(feature = "log")]
msg!($message, $($arg)*);
};
($message:literal) => {
#[cfg(feature = "log")]
msg!($message);
};
}

#[cfg(not(feature = "sol-log"))]
macro_rules! solana_logging {
($message:literal, $($arg:tt)*) => {
println!($message, $($arg)*);
};
($message:literal) => {
println!($message);
};
}

#[cfg(feature = "sol-log")]
macro_rules! log_compute {
() => {
#[cfg(all(feature = "sol-log", feature = "log"))]
sol_log_compute_units();
};
}

#[cfg(not(feature = "sol-log"))]
macro_rules! log_compute {
() => {};
}
Loading

0 comments on commit 45c2a50

Please sign in to comment.