Skip to content

Inconsistent CU charging for ELF size across loaders #10659

@procdump

Description

@procdump

Problem

While debugging into LiteSVM/litesvm#297 I would like to share the following observation.
CPI Callee programs charge differently according to the loader they're loaded with. The code snippet under scrutiny -

#[allow(deprecated)]
if callee_account.is_executable() {
// Use the known account
consume_compute_meter(
invoke_context,
(callee_account.get_data().len() as u64)
.checked_div(invoke_context.get_execution_cost().cpi_bytes_per_unit)
.unwrap_or(u64::MAX),
)?;
} else if let Some(caller_account_index) =

This seems unfair. Now provided that the majority of deployed programs use BPFLoaderUpgradeab1e11111111111111111111111 and that 36 / 250 calculation always results to 0 and hence nothing is charged here why the BPFLoader2111111111111111111111111111111111 loaded programs get so badly treated with full_program_len / 250?

Proposed Solution

Isn't it fair to actually remove the consume_compute_meter call here? If you like I can file a PR doing the change but I believe it's first best to share as you have more context.

cc @Lichtso @LucasSte @nagisa @buffalojoec @kevinheavey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions