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 gas price used in evm_contract::call_ #783

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
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
Loading