Skip to content

Commit fd824e1

Browse files
committed
Fix secp256k1 doctests
1 parent 5f527ca commit fd824e1

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/secp256k1-program/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ solana-program-error = { workspace = true }
3535
solana-sdk = { path = ".." }
3636
solana-secp256k1-program = { path = ".", features = ["dev-context-only-utils"] }
3737
solana-signer = { workspace = true }
38-
solana-sysvar = { workspace = true }
38+
solana-instructions-sysvar = { workspace = true }
3939

4040
[features]
4141
bincode = [

sdk/secp256k1-program/src/lib.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326
//! use solana_msg::msg;
327327
//! use solana_program_error::{ProgramError, ProgramResult};
328328
//! use solana_sdk_ids::secp256k1_program;
329-
//! use solana_sysvar::instructions;
329+
//! use solana_instructions_sysvar::load_instruction_at_checked;
330330
//!
331331
//! /// An Ethereum address corresponding to a secp256k1 secret key that is
332332
//! /// authorized to sign our messages.
@@ -354,7 +354,7 @@
354354
//! // Load the secp256k1 instruction.
355355
//! // `new_secp256k1_instruction` generates an instruction that must be at index 0.
356356
//! let secp256k1_instr =
357-
//! instructions::load_instruction_at_checked(0, instructions_sysvar_account)?;
357+
//! solana_instructions_sysvar::load_instruction_at_checked(0, instructions_sysvar_account)?;
358358
//!
359359
//! // Verify it is a secp256k1 instruction.
360360
//! // This is security-critical - what if the transaction uses an imposter secp256k1 program?
@@ -533,7 +533,7 @@
533533
//! use solana_program_error::{ProgramError, ProgramResult};
534534
//! use solana_msg::msg;
535535
//! use solana_sdk_ids::secp256k1_program;
536-
//! use solana_sysvar::instructions;
536+
//! use solana_instructions_sysvar::{get_instruction_relative, load_instruction_at_checked};
537537
//!
538538
//! /// A struct to hold the values specified in the `SecpSignatureOffsets` struct.
539539
//! struct SecpSignature {
@@ -553,15 +553,15 @@
553553
//! ) -> Result<Vec<SecpSignature>, ProgramError> {
554554
//! let mut sigs = vec![];
555555
//! for offsets in secp256k1_defs::iter_signature_offsets(secp256k1_instr_data)? {
556-
//! let signature_instr = instructions::load_instruction_at_checked(
556+
//! let signature_instr = load_instruction_at_checked(
557557
//! offsets.signature_instruction_index as usize,
558558
//! instructions_sysvar_account,
559559
//! )?;
560-
//! let eth_address_instr = instructions::load_instruction_at_checked(
560+
//! let eth_address_instr = load_instruction_at_checked(
561561
//! offsets.eth_address_instruction_index as usize,
562562
//! instructions_sysvar_account,
563563
//! )?;
564-
//! let message_instr = instructions::load_instruction_at_checked(
564+
//! let message_instr = load_instruction_at_checked(
565565
//! offsets.message_instruction_index as usize,
566566
//! instructions_sysvar_account,
567567
//! )?;
@@ -603,7 +603,7 @@
603603
//! ));
604604
//!
605605
//! let secp256k1_instr =
606-
//! instructions::get_instruction_relative(-1, instructions_sysvar_account)?;
606+
//! solana_instructions_sysvar::get_instruction_relative(-1, instructions_sysvar_account)?;
607607
//!
608608
//! assert!(secp256k1_program::check_id(&secp256k1_instr.program_id));
609609
//!
@@ -635,7 +635,6 @@
635635
//! };
636636
//! use solana_signer::Signer;
637637
//! use solana_keypair::Keypair;
638-
//! use solana_sysvar::instructions;
639638
//! use solana_sdk::transaction::Transaction;
640639
//!
641640
//! /// A struct to hold the values specified in the `SecpSignatureOffsets` struct.

0 commit comments

Comments
 (0)