Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Suspicious gas calculation at pallet_ethereum::Pallet::store_block #1558

@MOZGIII

Description

@MOZGIII

Found this code while doing the code review on frontier.

let mut cumulative_gas_used = U256::zero();
for (transaction, status, receipt) in Pending::<T>::get() {
transactions.push(transaction);
statuses.push(status);
receipts.push(receipt.clone());
let (logs, used_gas) = match receipt {
Receipt::Legacy(d) | Receipt::EIP2930(d) | Receipt::EIP1559(d) => {
(d.logs.clone(), d.used_gas)
}
};
cumulative_gas_used = used_gas;
Self::logs_bloom(logs, &mut logs_bloom);
}

Why cumulative_gas_used = used_gas?

I'd think it should be something like cumulative_gas_used += used_gas?

Unless used_gas already includes the gas of all previous txs (which doesn't seem to be the case) - this is a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions