Skip to content

Commit

Permalink
Merge pull request #789 from eosnetworkfoundation/elmato/update-silkw…
Browse files Browse the repository at this point in the history
…orm-discount-factor

Update silkworm (last gas v3)
  • Loading branch information
elmato authored Jan 24, 2025
2 parents 059e388 + 12dbca3 commit cdb28b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions tests/gas_prices_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ struct gas_prices_evm_tester : basic_evm_tester
auto effective_gas_price = inclusion_price + static_cast<uint64_t>(gas_prices.get_base_price());
auto cost = *pre - *post - txn.value;
auto total_gas_used = cost/effective_gas_price;
auto scaled_gp = evmone::gas_parameters::apply_discount_factor(inclusion_price, gas_prices.get_base_price(), gas_prices.storage_price, gas_params);
const intx::uint256 factor_num{gas_prices.storage_price};
const intx::uint256 factor_den{gas_prices.get_base_price() + inclusion_price};
auto scaled_gp = evmone::gas_parameters::apply_discount_factor(factor_num, factor_den, gas_params);
return std::make_tuple(cost, inclusion_price, effective_gas_price, total_gas_used, scaled_gp);
}

Expand Down Expand Up @@ -162,7 +164,9 @@ BOOST_FIXTURE_TEST_CASE(gas_param_scale, gas_prices_evm_tester) try {
auto effective_gas_price = inclusion_price + base_fee_per_gas;
auto cost = *pre - *post;
auto total_gas_used = cost/effective_gas_price;
auto scaled_gp = evmone::gas_parameters::apply_discount_factor(inclusion_price, gas_prices.get_base_price(), gas_prices.storage_price, gas_params);
const intx::uint256 factor_num{gas_prices.storage_price};
const intx::uint256 factor_den{gas_prices.get_base_price() + inclusion_price};
auto scaled_gp = evmone::gas_parameters::apply_discount_factor(factor_num, factor_den, gas_params);
return std::make_tuple(std::make_tuple(cost, inclusion_price, effective_gas_price, total_gas_used, scaled_gp), contract_address);
};

Expand Down

0 comments on commit cdb28b3

Please sign in to comment.