Skip to content

Commit

Permalink
Adapt zk-token-{sdk,proof-program} for use in the monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jan 5, 2022
1 parent e1848ec commit 69e632a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ members = [
"test-validator",
"rpc-test",
"client-test",
"zk-token-sdk",
"programs/zk-token-proof",
]

exclude = [
Expand Down
15 changes: 7 additions & 8 deletions programs/zk-token-proof/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
[package]
name = "spl-zk-token-proof-program"
description = "Solana Program Library ZkToken Proof Program"
name = "solana-zk-token-proof-program"
description = "Solana Zk Token Proof Program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana-program-library"
version = "0.1.0"
repository = "https://github.com/solana-labs/solana"
version = "1.10.0"
license = "Apache-2.0"
edition = "2021"
publish = false

[dependencies]
bytemuck = { version = "1.7.2", features = ["derive"] }
getrandom = { version = "0.1", features = ["dummy"] }
num-derive = "0.3"
num-traits = "0.2"
solana-sdk = "=1.9.1"
solana-program-runtime = "=1.9.1"
spl-zk-token-sdk = { path = "../sdk" }
solana-program-runtime = { path = "../../program-runtime", version = "=1.10.0" }
solana-sdk = { path = "../../sdk", version = "=1.10.0" }
solana-zk-token-sdk = { path = "../../zk-token-sdk", version = "=1.10.0" }
5 changes: 3 additions & 2 deletions programs/zk-token-proof/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use {
bytemuck::Pod,
solana_program_runtime::{ic_msg, invoke_context::InvokeContext},
solana_sdk::instruction::InstructionError,
spl_zk_token_sdk::zk_token_proof_instruction::*,
solana_zk_token_sdk::zk_token_proof_instruction::*,
std::result::Result,
};

Expand Down Expand Up @@ -36,7 +36,8 @@ pub fn process_instruction(
// Consume compute units since proof verification is an expensive operation
{
let compute_meter = invoke_context.get_compute_meter();
compute_meter.borrow_mut().consume(25_000)?; // TODO: Tune the number of units consumed?
// TODO: Tune the number of units consumed. The current value is just a rough estimate
compute_meter.borrow_mut().consume(100_000)?;
}

match ProofInstruction::decode_type(input).ok_or(InstructionError::InvalidInstructionData)? {
Expand Down
12 changes: 6 additions & 6 deletions zk-token-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "spl-zk-token-sdk"
description = "Solana Program Library ZkToken SDK"
name = "solana-zk-token-sdk"
description = "Solana Zk Token SDK"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana-program-library"
version = "0.1.0"
repository = "https://github.com/solana-labs/solana"
version = "1.10.0"
license = "Apache-2.0"
edition = "2021"

Expand All @@ -12,7 +12,7 @@ base64 = "0.13"
bytemuck = { version = "1.7.2", features = ["derive"] }
num-derive = "0.3"
num-traits = "0.2"
solana-program = "=1.9.1"
solana-program = { path = "../sdk/program", version = "=1.10.0" }

[target.'cfg(not(target_arch = "bpf"))'.dependencies]
aes-gcm-siv = "0.10.3"
Expand All @@ -28,7 +28,7 @@ rand = "0.7"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha3 = "0.9"
solana-sdk = "=1.9.1"
solana-sdk = { path = "../sdk", version = "=1.10.0" }
subtle = "2"
thiserror = "1"
zeroize = { version = "1.2.0", default-features = false, features = ["zeroize_derive"] }
Expand Down
2 changes: 2 additions & 0 deletions zk-token-sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::integer_arithmetic)]

#[cfg(not(target_arch = "bpf"))]
#[macro_use]
pub(crate) mod macros;
Expand Down

0 comments on commit 69e632a

Please sign in to comment.