-
Notifications
You must be signed in to change notification settings - Fork 15
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
gas param config change event #682
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But I would like @elmato to review as well before merging this in.
@@ -43,6 +42,11 @@ struct config_wrapper { | |||
void set_fee_parameters(const fee_parameters& fee_params, | |||
bool allow_any_to_be_unspecified); | |||
|
|||
void update_gas_params(eosio::asset ram_price_mb, uint64_t minimum_gas_price); | |||
void update_gas_params2(std::optional<uint64_t> gas_txnewaccount, std::optional<uint64_t> gas_newaccount, std::optional<uint64_t> gas_txcreate, std::optional<uint64_t> gas_codedeposit, std::optional<uint64_t> gas_sset, std::optional<uint64_t> minimum_gas_price); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this function be be update_consensus_parameters
since minimum_gas_price
was moved away from the gas_parameter_type
?
struct gas_parameter_type {
uint64_t gas_txnewaccount = 0;
uint64_t gas_newaccount = 25000;
uint64_t gas_txcreate = 32000;
uint64_t gas_codedeposit = 200;
uint64_t gas_sset = 20000;
};
struct consensus_parameter_data_v0 {
uint64_t minimum_gas_price = 0;
gas_parameter_type gas_parameter;
};
src/config_wrapper.cpp
Outdated
@@ -121,14 +126,29 @@ void config_wrapper::set_fee_parameters(const fee_parameters& fee_params, | |||
bool allow_any_to_be_unspecified) | |||
{ | |||
if (fee_params.gas_price.has_value()) { | |||
_cached_config.gas_price = *fee_params.gas_price; | |||
eosio::check(*fee_params.gas_price >= one_gwei, "gas_price must >= 1Gwei"); | |||
if (_cached_config.evm_version.has_value() && _cached_config.evm_version->cached_version >= 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not doing ?
if(get_evm_version() >= 1) {...
src/config_wrapper.cpp
Outdated
constexpr uint64_t storage_slot_bytes = 346; | ||
|
||
eosio::check(gas_per_byte_f >= 0.0, "gas_per_byte must >= 0"); | ||
eosio::check(gas_per_byte_f * contract_fixed_bytes < (double)(0x7ffffffffffull), "gas_per_byte too big"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change 0x7ffffffffffull
to
constexpr uint64_t max_gas_per_byte = (1ull << 43) - 1;
src/config_wrapper.cpp
Outdated
void config_wrapper::update_gas_params2(std::optional<uint64_t> gas_txnewaccount, std::optional<uint64_t> gas_newaccount, std::optional<uint64_t> gas_txcreate, std::optional<uint64_t> gas_codedeposit, std::optional<uint64_t> gas_sset, std::optional<uint64_t> minimum_gas_price) | ||
{ | ||
// for simplicity, ensure last (cached) evm_version >= 1, not touching promote logic | ||
eosio::check(_cached_config.evm_version.has_value() && _cached_config.evm_version->cached_version >= 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not doing ?
if(get_evm_version() >= 1) {...
src/config_wrapper.cpp
Outdated
if (gas_txcreate.has_value()) v.gas_parameter.gas_txcreate = *gas_txcreate; | ||
if (gas_codedeposit.has_value()) v.gas_parameter.gas_codedeposit = *gas_codedeposit; | ||
if (gas_sset.has_value()) { | ||
eosio::check(*gas_sset >= 2900, "G_sset must >= 2900"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2900
is used in many places, we should create a constant
Resolves #679