Skip to content

Commit

Permalink
Fix gas price used in evm_contract::call_
Browse files Browse the repository at this point in the history
  • Loading branch information
elmato committed Dec 16, 2024
1 parent 4558425 commit aed4588
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,22 @@ bool evm_contract::gc(uint32_t max) {
}

void evm_contract::call_(const runtime_config& rc, intx::uint256 s, const bytes& to, intx::uint256 value, const bytes& data, uint64_t gas_limit, uint64_t nonce) {
if(_config->get_evm_version() >= 1) _config->process_price_queue();
auto current_version = _config->get_evm_version();
if(current_version >= 1) _config->process_price_queue();

uint64_t gas_price_for_tx{0};
if( current_version >= 3) {
auto gas_prices = _config->get_gas_prices();
gas_price_for_tx = gas_prices.get_base_price();
} else {
gas_price_for_tx = _config->get_gas_price();
}

Transaction txn;
txn.type = TransactionType::kLegacy;
txn.nonce = nonce;
txn.max_priority_fee_per_gas = _config->get_gas_price();
txn.max_fee_per_gas = _config->get_gas_price();
txn.max_priority_fee_per_gas = gas_price_for_tx;
txn.max_fee_per_gas = gas_price_for_tx;
txn.gas_limit = gas_limit;
txn.value = value;
txn.data = Bytes{(const uint8_t*)data.data(), data.size()};
Expand Down

0 comments on commit aed4588

Please sign in to comment.