From cc550dfb08cd7e37a971f6afd4c4bdc1276de0d0 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Wed, 11 Dec 2019 00:38:20 -0700 Subject: [PATCH] fix: properly fund BPF payer accounts --- web3.js/test/bpf-loader.test.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web3.js/test/bpf-loader.test.js b/web3.js/test/bpf-loader.test.js index 3eeeb065e4..67b8e3e81c 100644 --- a/web3.js/test/bpf-loader.test.js +++ b/web3.js/test/bpf-loader.test.js @@ -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({ @@ -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({