Skip to content

Commit

Permalink
chore: remove failing request units test (#27735)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored Sep 12, 2022
1 parent ba3d9cd commit 8bb0acc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 45 deletions.
3 changes: 3 additions & 0 deletions web3.js/src/programs/compute-budget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ export class ComputeBudgetProgram {
'ComputeBudget111111111111111111111111111111',
);

/**
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
*/
static requestUnits(params: RequestUnitsParams): TransactionInstruction {
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
const data = encodeData(type, params);
Expand Down
45 changes: 0 additions & 45 deletions web3.js/test/program-tests/compute-budget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,51 +72,6 @@ describe('ComputeBudgetProgram', () => {
});

if (process.env.TEST_LIVE) {
it('send live request units ix', async () => {
const connection = new Connection(url, 'confirmed');
const FEE_AMOUNT = LAMPORTS_PER_SOL;
const STARTING_AMOUNT = 2 * LAMPORTS_PER_SOL;
const baseAccount = Keypair.generate();
const basePubkey = baseAccount.publicKey;
await helpers.airdrop({
connection,
address: basePubkey,
amount: STARTING_AMOUNT,
});

const additionalFeeTooHighTransaction = new Transaction().add(
ComputeBudgetProgram.requestUnits({
units: 150_000,
additionalFee: STARTING_AMOUNT,
}),
);

await expect(
sendAndConfirmTransaction(
connection,
additionalFeeTooHighTransaction,
[baseAccount],
{preflightCommitment: 'confirmed'},
),
).to.be.rejected;

const validAdditionalFeeTransaction = new Transaction().add(
ComputeBudgetProgram.requestUnits({
units: 150_000,
additionalFee: FEE_AMOUNT,
}),
);
await sendAndConfirmTransaction(
connection,
validAdditionalFeeTransaction,
[baseAccount],
{preflightCommitment: 'confirmed'},
);
expect(await connection.getBalance(baseAccount.publicKey)).to.be.at.most(
STARTING_AMOUNT - FEE_AMOUNT,
);
});

it('send live request heap ix', async () => {
const connection = new Connection(url, 'confirmed');
const STARTING_AMOUNT = 2 * LAMPORTS_PER_SOL;
Expand Down

0 comments on commit 8bb0acc

Please sign in to comment.