Skip to content

Commit

Permalink
fix: properly fund BPF payer accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Dec 11, 2019
1 parent 3d888ad commit 4fd916c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/bpf-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ test('load BPF C program', async () => {
const fees =
feeCalculator.lamportsPerSignature *
(BpfLoader.getMinNumSignatures(data.length) + NUM_RETRIES);
const from = await newAccountWithLamports(connection, fees);
const balanceNeeded = await connection.getMinimumBalanceForRentExemption(
data.length,
);
const from = await newAccountWithLamports(connection, fees + balanceNeeded);

const programId = await BpfLoader.load(connection, from, data);
const transaction = new Transaction().add({
Expand All @@ -57,7 +60,10 @@ test('load BPF Rust program', async () => {
const fees =
feeCalculator.lamportsPerSignature *
(BpfLoader.getMinNumSignatures(data.length) + NUM_RETRIES);
const from = await newAccountWithLamports(connection, fees);
const balanceNeeded = await connection.getMinimumBalanceForRentExemption(
data.length,
);
const from = await newAccountWithLamports(connection, fees + balanceNeeded);

const programId = await BpfLoader.load(connection, from, data);
const transaction = new Transaction().add({
Expand Down

0 comments on commit 4fd916c

Please sign in to comment.