Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compute budget max fees calculation - convert microlamports to lamports #95

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ APPNAME = "Solana"
# Application version
APPVERSION_M = 1
APPVERSION_N = 5
APPVERSION_P = 2
APPVERSION_P = 3
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

# Application source files
Expand Down
3 changes: 2 additions & 1 deletion libsol/compute_budget_instruction.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ static uint32_t calculate_max_fee(const ComputeBudgetFeeInfo* info) {
max_compute =
MIN(info->instructions_count * MAX_CU_PER_INSTRUCTION, MAX_CU_PER_TRANSACTION);
}
return max_fee + (info->change_unit_price->units * max_compute);
return max_fee +
((info->change_unit_price->units * max_compute) / MICRO_LAMPORT_MULTIPLIER);
}
return max_fee;
}
Expand Down
1 change: 1 addition & 0 deletions libsol/compute_budget_instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define MAX_CU_PER_INSTRUCTION 200000
#define MAX_CU_PER_TRANSACTION 1400000
#define FEE_LAMPORTS_PER_SIGNATURE 5000
#define MICRO_LAMPORT_MULTIPLIER 1000000

extern const Pubkey compute_budget_program_id;

Expand Down
Loading