Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

setComputeUnitPrice param asks for microlamports when in reality the function requires lamports/ #3434

Closed
mrpathfindr opened this issue Oct 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@mrpathfindr
Copy link

mrpathfindr commented Oct 23, 2024

Overview

Trying to set setComputeUnitPrice

ComputeBudgetProgram.setComputeUnitPrice({
    microLamports: priority_fee, 
});

Steps to reproduce

Try to make a transaction and add an instruction

ComputeBudgetProgram.setComputeUnitPrice({
    microLamports: priority_fee, 
});

The value will ask you for the amount you want to set in micro lamports.

But this is not correct as the actual result of the transaction shows to use lamports

I.e If I want to set 0.01 sol as unit price I need to send $$0.01 {\times} 10^9$$ not $$10^{15}$$

Description of bug

The wrong term has been used as the parameter for

ComputeBudgetProgram.setComputeUnitPrice({
    microLamports: priority_fee, 
});

It should be

ComputeBudgetProgram.setComputeUnitPrice({
   lamports: priority_fee, 
});
@mrpathfindr mrpathfindr added the bug Something isn't working label Oct 23, 2024
@steveluscher
Copy link
Contributor

But this is not correct as the actual result of the transaction shows to use lamports

Can you explain this further?

Related: https://github.com/anza-xyz/agave/blob/b7bbe36918f23d98e2e73502e3c4cba78d395ba9/sdk/src/compute_budget.rs#L52-L55

@steveluscher
Copy link
Contributor

Feel free to reopen this if you are convinced that there is a bug here. Be aware that the value in question is measured in microlamports per compute unit. That is if you set 10 and the transaction consumes 100,000 compute units, the priority fee paid will be one Lamport.

@steveluscher steveluscher closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2024
Copy link
Contributor

github-actions bot commented Nov 1, 2024

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants