Skip to content

Commit

Permalink
fix imports and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Nov 6, 2024
1 parent 8b11455 commit e232b10
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

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

14 changes: 14 additions & 0 deletions programs/sbf/Cargo.lock

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

2 changes: 2 additions & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ full = [
"solana-commitment-config",
"digest",
"solana-pubkey/rand",
"dep:solana-ed25519-instructions",
"dep:solana-keypair",
"dep:solana-precompile-error",
"dep:solana-presigner",
Expand Down Expand Up @@ -98,6 +99,7 @@ solana-bn254 = { workspace = true }
solana-commitment-config = { workspace = true, optional = true, features = ["serde"] }
solana-decode-error = { workspace = true }
solana-derivation-path = { workspace = true }
solana-ed25519-instructions = { workspace = true, optional = true }
solana-feature-set = { workspace = true }
solana-fee-structure = { workspace = true, features = ["serde"] }
solana-frozen-abi = { workspace = true, optional = true, features = [
Expand Down
12 changes: 10 additions & 2 deletions sdk/ed25519-instructions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "solana-ed25519-instruction"
name = "solana-ed25519-instructions"
description = "Instructions for the Solana ed25519 native program"
documentation = "https://docs.rs/solana-ed25519-instruction"
documentation = "https://docs.rs/solana-ed25519-instructions"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
Expand All @@ -16,6 +16,14 @@ ed25519-dalek = { workspace = true }
solana-feature-set = { workspace = true }
solana-instruction = { workspace = true, features = ["std"] }
solana-precompile-error = { workspace = true }
solana-pubkey = { workspace = true }

[dev-dependencies]
hex = { workspace = true }
rand0-7 = { workspace = true }
solana-hash = { workspace = true }
solana-logger = { workspace = true }
solana-sdk = { path = ".." }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
23 changes: 15 additions & 8 deletions sdk/ed25519-instructions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use {
solana_feature_set::{ed25519_precompile_verify_strict, FeatureSet},
solana_instruction::Instruction,
solana_precompile_error::PrecompileError,
solana_pubkey::{pubkey, Pubkey},
};

pub const PUBKEY_SERIALIZED_SIZE: usize = 32;
Expand All @@ -17,6 +18,8 @@ pub const SIGNATURE_OFFSETS_SERIALIZED_SIZE: usize = 14;
// bytemuck requires structures to be aligned
pub const SIGNATURE_OFFSETS_START: usize = 2;
pub const DATA_START: usize = SIGNATURE_OFFSETS_SERIALIZED_SIZE + SIGNATURE_OFFSETS_START;
// copied from solana_sdk::ed25519_program to avoid solana_sdk dependency
const ED25519_PROGRAM_ID: Pubkey = pubkey!("Ed25519SigVerify111111111111111111111111111");

#[derive(Default, Debug, Copy, Clone, Zeroable, Pod, Eq, PartialEq)]
#[repr(C)]
Expand Down Expand Up @@ -77,7 +80,7 @@ pub fn new_ed25519_instruction(keypair: &ed25519_dalek::Keypair, message: &[u8])
instruction_data.extend_from_slice(message);

Instruction {
program_id: solana_sdk::ed25519_program::id(),
program_id: ED25519_PROGRAM_ID,
accounts: vec![],
data: instruction_data,
}
Expand Down Expand Up @@ -188,15 +191,14 @@ fn get_data_slice<'a>(
pub mod test {
use {
super::*,
crate::{
ed25519_instruction::new_ed25519_instruction,
hash::Hash,
signature::{Keypair, Signer},
transaction::Transaction,
},
hex,
rand0_7::{thread_rng, Rng},
solana_feature_set::FeatureSet,
solana_hash::Hash,
solana_sdk::{
signer::{keypair::Keypair, Signer},
transaction::Transaction,
},
};

pub fn new_ed25519_instruction_raw(
Expand Down Expand Up @@ -247,7 +249,7 @@ pub mod test {
instruction_data.extend_from_slice(message);

Instruction {
program_id: solana_sdk::ed25519_program::id(),
program_id: ED25519_PROGRAM_ID,
accounts: vec![],
data: instruction_data,
}
Expand Down Expand Up @@ -487,4 +489,9 @@ pub mod test {
let feature_set = FeatureSet::all_enabled();
assert!(tx.verify_precompiles(&feature_set).is_err()); // verify_strict does NOT pass
}

#[test]
fn test_inlined_program_id() {
assert_eq!(ED25519_PROGRAM_ID, solana_sdk::ed25519_program::id())
}
}

0 comments on commit e232b10

Please sign in to comment.