Skip to content

Commit 702abc7

Browse files
committed
fix: E2E test corrections and manage_authority Secp256r1 space bug
- Fix happy_path.rs compact instruction indices (program_id_index 0→4, accounts 1,2→5,6) - Fix manage_authority.rs Secp256r1 space calculation (add 4-byte counter prefix) - Fix failures.rs signing (remove owner_keypair from sign) - All Happy Path tests now pass - Failures scenarios 1-2 now pass
1 parent efde3fc commit 702abc7

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

program/src/processor/manage_authority.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ pub fn process_add_authority(
203203
check_zero_data(new_auth_pda, ProgramError::AccountAlreadyInitialized)?;
204204

205205
let header_size = std::mem::size_of::<AuthorityAccountHeader>();
206-
let space = header_size + full_auth_data.len();
206+
// Secp256r1 needs extra 4 bytes for counter prefix
207+
let variable_size = if args.authority_type == 1 {
208+
4 + full_auth_data.len()
209+
} else {
210+
full_auth_data.len()
211+
};
212+
let space = header_size + variable_size;
207213
let rent = (space as u64)
208214
.checked_mul(6960)
209215
.and_then(|val| val.checked_add(897840))

tests-e2e/src/scenarios/failures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn run(ctx: &mut TestContext) -> Result<()> {
6060
Some(&Signer::pubkey(&ctx.payer).to_address()),
6161
);
6262
let mut create_wallet_tx = Transaction::new_unsigned(message);
63-
create_wallet_tx.sign(&[&ctx.payer, &owner_keypair], latest_blockhash);
63+
create_wallet_tx.sign(&[&ctx.payer], latest_blockhash);
6464

6565
ctx.execute_tx(create_wallet_tx)?;
6666

tests-e2e/src/scenarios/happy_path.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,14 @@ pub fn run(ctx: &mut TestContext) -> Result<()> {
9191
inner_ix_data.extend_from_slice(&2u32.to_le_bytes()); // SystemInstruction::Transfer
9292
inner_ix_data.extend_from_slice(&5000u64.to_le_bytes()); // Amount
9393

94+
// Account indices in execute accounts list:
95+
// 0: payer, 1: wallet_pda, 2: authority, 3: vault
96+
// 4: system_program, 5: vault (inner), 6: payer (inner), 7: owner signer
9497
let mut compact_bytes = Vec::new();
95-
compact_bytes.push(0); // Program Index (SystemProgram)
98+
compact_bytes.push(4); // Program Index = system_program (index 4)
9699
compact_bytes.push(2); // Num Accounts
97-
compact_bytes.push(1); // Vault (Inner Index 1)
98-
compact_bytes.push(2); // Payer (Inner Index 2)
100+
compact_bytes.push(5); // Vault (inner) - index 5
101+
compact_bytes.push(6); // Payer (inner) - index 6
99102
compact_bytes.extend_from_slice(&(inner_ix_data.len() as u16).to_le_bytes());
100103
compact_bytes.extend_from_slice(&inner_ix_data);
101104

0 commit comments

Comments
 (0)