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

program: reorder lamport deduction on close #46

Merged
merged 2 commits into from
Nov 13, 2024
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
26 changes: 26 additions & 0 deletions program/benches/compute_units.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
#### Compute Units: 2024-11-13 16:51:07.839873 UTC

| Name | CUs | Delta |
|------|------|-------|
| create_lookup_table | 10756 | -- |
| freeze_lookup_table | 1518 | -- |
| extend_lookup_table_from_0_to_1 | 6227 | -- |
| extend_lookup_table_from_0_to_10 | 8846 | -- |
| extend_lookup_table_from_0_to_38 | 17082 | -- |
| extend_lookup_table_from_1_to_2 | 6227 | -- |
| extend_lookup_table_from_1_to_10 | 8552 | -- |
| extend_lookup_table_from_1_to_39 | 17082 | -- |
| extend_lookup_table_from_5_to_6 | 6227 | -- |
| extend_lookup_table_from_5_to_15 | 8847 | -- |
| extend_lookup_table_from_5_to_43 | 17082 | -- |
| extend_lookup_table_from_25_to_26 | 6230 | -- |
| extend_lookup_table_from_25_to_35 | 8849 | -- |
| extend_lookup_table_from_25_to_63 | 17085 | -- |
| extend_lookup_table_from_50_to_88 | 17088 | -- |
| extend_lookup_table_from_100_to_138 | 17094 | -- |
| extend_lookup_table_from_150_to_188 | 17101 | -- |
| extend_lookup_table_from_200_to_238 | 17107 | -- |
| extend_lookup_table_from_255_to_256 | 6259 | -- |
| deactivate_lookup_table | 3152 | -- |
| close_lookup_table | 2227 | -1 |

#### Compute Units: 2024-11-13 09:15:26.655388 UTC

| Name | CUs | Delta |
Expand Down
3 changes: 1 addition & 2 deletions program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,10 @@ fn process_close_lookup_table(program_id: &Pubkey, accounts: &[AccountInfo]) ->
.lamports()
.checked_add(recipient_info.lamports())
.ok_or::<ProgramError>(ProgramError::ArithmeticOverflow)?;

**lookup_table_info.try_borrow_mut_lamports()? = 0;
**recipient_info.try_borrow_mut_lamports()? = new_recipient_lamports;

// Lookup tables are _not_ reassigned when closed.
**lookup_table_info.try_borrow_mut_lamports()? = 0;
lookup_table_info.realloc(0, true)?;

Ok(())
Expand Down