Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 7172b32

Browse files
authored
Same thing as in #3637 but for with_upgrade_program_transaction(). (#3642)
1 parent 410390b commit 7172b32

File tree

1 file changed

+17
-12
lines changed
  • governance/program/tests/program_test

1 file changed

+17
-12
lines changed

governance/program/tests/program_test/mod.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@ impl GovernanceProgramTest {
25832583
program_data.len(),
25842584
));
25852585

2586-
let mut instructions = bpf_loader_upgradeable::create_buffer(
2586+
let instructions = bpf_loader_upgradeable::create_buffer(
25872587
&self.bench.payer.pubkey(),
25882588
&program_buffer_keypair.pubkey(),
25892589
&buffer_authority_keypair.pubkey(),
@@ -2592,28 +2592,33 @@ impl GovernanceProgramTest {
25922592
)
25932593
.unwrap();
25942594

2595-
let chunk_size = 800;
2595+
self.bench
2596+
.process_transaction(&instructions, Some(&[&program_buffer_keypair]))
2597+
.await
2598+
.unwrap();
25962599

2597-
for (chunk, i) in program_data.chunks(chunk_size).zip(0..) {
2598-
instructions.push(bpf_loader_upgradeable::write(
2600+
const CHUNK_SIZE: usize = 800;
2601+
for (i, chunk) in program_data.chunks(CHUNK_SIZE).enumerate() {
2602+
let instruction = bpf_loader_upgradeable::write(
25992603
&program_buffer_keypair.pubkey(),
26002604
&buffer_authority_keypair.pubkey(),
2601-
(i * chunk_size) as u32,
2605+
(i * CHUNK_SIZE) as u32,
26022606
chunk.to_vec(),
2603-
));
2607+
);
2608+
self.bench
2609+
.process_transaction(&[instruction], Some(&[&buffer_authority_keypair]))
2610+
.await
2611+
.unwrap();
26042612
}
26052613

2606-
instructions.push(bpf_loader_upgradeable::set_buffer_authority(
2614+
let set_authority_ixs = bpf_loader_upgradeable::set_buffer_authority(
26072615
&program_buffer_keypair.pubkey(),
26082616
&buffer_authority_keypair.pubkey(),
26092617
&governance_cookie.address,
2610-
));
2618+
);
26112619

26122620
self.bench
2613-
.process_transaction(
2614-
&instructions[..],
2615-
Some(&[&program_buffer_keypair, &buffer_authority_keypair]),
2616-
)
2621+
.process_transaction(&[set_authority_ixs], Some(&[&buffer_authority_keypair]))
26172622
.await
26182623
.unwrap();
26192624

0 commit comments

Comments
 (0)