Skip to content

Commit

Permalink
Hook on phonics
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay committed May 25, 2020
1 parent 3b5f856 commit 5c17768
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions programs/bpf/rust/invoke/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use solana_sdk::{
};

const TEST_SUCCESS: u8 = 1;
const TEST_PRIVILEDGE_ESCALATION_SIGNER: u8 = 2;
const TEST_PRIVILEDGE_ESCALATION_WRITABLE: u8 = 3;
const TEST_PRIVILEGE_ESCALATION_SIGNER: u8 = 2;
const TEST_PRIVILEGE_ESCALATION_WRITABLE: u8 = 3;

// const MINT_INDEX: usize = 0;
const ARGUMENT_INDEX: usize = 1;
Expand Down Expand Up @@ -165,12 +165,12 @@ fn process_instruction(
}
}
}
TEST_PRIVILEDGE_ESCALATION_SIGNER => {
info!("Test priviledge escalation signer");
TEST_PRIVILEGE_ESCALATION_SIGNER => {
info!("Test privilege escalation signer");
let mut invoked_instruction = create_instruction(
*accounts[INVOKED_PROGRAM_INDEX].key,
&[(accounts[DERIVED_KEY3_INDEX].key, false, false)],
vec![TEST_VERIFY_PRIVILEDGE_ESCALATION],
vec![TEST_VERIFY_PRIVILEGE_ESCALATION],
);
invoke(&invoked_instruction, accounts)?;

Expand All @@ -180,12 +180,12 @@ fn process_instruction(
Err(ProgramError::Custom(0x0b9f_0002))
);
}
TEST_PRIVILEDGE_ESCALATION_WRITABLE => {
info!("Test priviledge escalation writable");
TEST_PRIVILEGE_ESCALATION_WRITABLE => {
info!("Test privilege escalation writable");
let mut invoked_instruction = create_instruction(
*accounts[INVOKED_PROGRAM_INDEX].key,
&[(accounts[DERIVED_KEY3_INDEX].key, false, false)],
vec![TEST_VERIFY_PRIVILEDGE_ESCALATION],
vec![TEST_VERIFY_PRIVILEGE_ESCALATION],
);
invoke(&invoked_instruction, accounts)?;

Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/rust/invoked/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub const TEST_RETURN_ERROR: u8 = 1;
pub const TEST_DERIVED_SIGNERS: u8 = 2;
pub const TEST_VERIFY_NESTED_SIGNERS: u8 = 3;
pub const TEST_VERIFY_WRITER: u8 = 4;
pub const TEST_VERIFY_PRIVILEDGE_ESCALATION: u8 = 5;
pub const TEST_VERIFY_PRIVILEGE_ESCALATION: u8 = 5;
pub const TEST_NESTED_INVOKE: u8 = 6;

pub fn create_instruction(
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/rust/invoked/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn process_instruction(

assert!(!accounts[ARGUMENT_INDEX].is_writable);
}
TEST_VERIFY_PRIVILEDGE_ESCALATION => {
TEST_VERIFY_PRIVILEGE_ESCALATION => {
info!("Success");
}
TEST_NESTED_INVOKE => {
Expand Down
8 changes: 4 additions & 4 deletions programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ mod bpf {
solana_logger::setup();

const TEST_SUCCESS: u8 = 1;
const TEST_PRIVILEDGE_ESCALATION_SIGNER: u8 = 2;
const TEST_PRIVILEDGE_ESCALATION_WRITABLE: u8 = 3;
const TEST_PRIVILEGE_ESCALATION_SIGNER: u8 = 2;
const TEST_PRIVILEGE_ESCALATION_WRITABLE: u8 = 3;

let mut programs = Vec::new();
#[cfg(feature = "bpf_c")]
Expand Down Expand Up @@ -394,7 +394,7 @@ mod bpf {

let instruction = Instruction::new(
invoke_program_id,
&TEST_PRIVILEDGE_ESCALATION_SIGNER,
&TEST_PRIVILEGE_ESCALATION_SIGNER,
account_metas.clone(),
);
let message = Message::new(&[instruction]);
Expand All @@ -416,7 +416,7 @@ mod bpf {

let instruction = Instruction::new(
invoke_program_id,
&TEST_PRIVILEDGE_ESCALATION_WRITABLE,
&TEST_PRIVILEGE_ESCALATION_WRITABLE,
account_metas.clone(),
);
let message = Message::new(&[instruction]);
Expand Down

0 comments on commit 5c17768

Please sign in to comment.