Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove minimum_gas_price from consensus_parameter_data_type #211

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion src/block_conversion_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ class block_conversion_plugin_impl : std::enable_shared_from_this<block_conversi
}
auto new_config = deserialize_config(new_block->new_config.value());
auto consensus_param = eosevm::ConsensusParameters {
.min_gas_price = std::visit([](auto&& arg) -> auto& { return arg.minimum_gas_price; }, new_config),
.gas_fee_parameters = eosevm::GasFeeParameters {
.gas_txnewaccount = std::visit([](auto&& arg) -> auto& { return arg.gas_parameter.gas_txnewaccount; }, new_config),
.gas_newaccount = std::visit([](auto&& arg) -> auto& { return arg.gas_parameter.gas_newaccount; }, new_config),
Expand Down
5 changes: 2 additions & 3 deletions src/block_conversion_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ struct gas_parameter_type {
EOSIO_REFLECT(gas_parameter_type, gas_txnewaccount, gas_newaccount, gas_txcreate, gas_codedeposit, gas_sset)

struct consensus_parameter_data_v0 {
uint64_t minimum_gas_price = 0;
gas_parameter_type gas_parameter;
gas_parameter_type gas_parameter;
};
using consensus_parameter_data_type = std::variant<consensus_parameter_data_v0>;
EOSIO_REFLECT(consensus_parameter_data_v0, minimum_gas_price, gas_parameter)
EOSIO_REFLECT(consensus_parameter_data_v0, gas_parameter)

class block_conversion_plugin : public appbase::plugin<block_conversion_plugin> {
public:
Expand Down
9 changes: 3 additions & 6 deletions tests/nodeos_eos_evm_gasparam_fork_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def makeReservedEvmAddress(account):

# update gas parameter
Utils.Print("Update gas parameter: ram price = 5 EOS per MB, gas price = 10Gwei")
trans = prodNode.pushMessage(evmAcc.name, "updtgasparam", json.dumps({"ram_price_mb":"5.0000 EOS","minimum_gas_price":10000000000}), '-p {0}'.format(evmAcc.name), silentErrors=False)
trans = prodNode.pushMessage(evmAcc.name, "updtgasparam", json.dumps({"ram_price_mb":"5.0000 EOS","gas_price":10000000000}), '-p {0}'.format(evmAcc.name), silentErrors=False)
prodNode.waitForTransBlockIfNeeded(trans[1], True);
time.sleep(2)

Expand Down Expand Up @@ -714,7 +714,7 @@ def makeReservedEvmAddress(account):
assert(row4["eth_address"] == "9e126c57330fa71556628e0aabd6b6b6783d99fa")
assert(row4["balance"] == "0000000000000000000000000000000000000000000000024c923bc3177b4c00")
# diff = 3,173,650,000,000,000 = 3,173,650 (Gwei) = (100,000 + (183910 + 21000) * 15) (Gwei)
# {"ram_price_mb":"5.0000 EOS","minimum_gas_price":10000000000}
# {"ram_price_mb":"5.0000 EOS","gas_price":10000000000}
# {'consensusParameter': AttributeDict({'gasFeeParameters': AttributeDict({'gasCodedeposit': 530, 'gasNewaccount': 183910, 'gasSset': 186280, 'gasTxcreate': 321180, 'gasTxnewaccount': 183910}

# Launch eos-evm-node
Expand Down Expand Up @@ -753,7 +753,6 @@ def makeReservedEvmAddress(account):
Utils.Print("before fork, the latest evm block is:" + str(evm_block))
assert(evm_block["nonce"].hex() == "0x0000000000000001")
assert("consensusParameter" in evm_block)
assert(evm_block["consensusParameter"]["minGasPrice"] == 10000000000)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasCodedeposit"] == 530)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasNewaccount"] == 183910)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasSset"] == 186280)
Expand Down Expand Up @@ -890,7 +889,7 @@ def makeReservedEvmAddress(account):

# update gas parameter in minor fork (node0), but not node1
Utils.Print("Update gas parameter in minor fork: ram price = 6 EOS per MB, gas price = 10Gwei")
trans = prodNode.pushMessage(evmAcc.name, "updtgasparam", json.dumps({"ram_price_mb":"6.0000 EOS","minimum_gas_price":10000000000}), '-p {0}'.format(evmAcc.name), silentErrors=False)
trans = prodNode.pushMessage(evmAcc.name, "updtgasparam", json.dumps({"ram_price_mb":"6.0000 EOS","gas_price":10000000000}), '-p {0}'.format(evmAcc.name), silentErrors=False)
prodNode.waitForTransBlockIfNeeded(trans[1], True);
time.sleep(2)

Expand Down Expand Up @@ -937,7 +936,6 @@ def makeReservedEvmAddress(account):
Utils.Print("in minor fork, the latest evm block is:" + str(evm_block))
assert(evm_block["nonce"].hex() == "0x0000000000000001")
assert("consensusParameter" in evm_block)
assert(evm_block["consensusParameter"]["minGasPrice"] == 10000000000)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasCodedeposit"] == 636)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasNewaccount"] == 220692)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasSset"] == 222956)
Expand Down Expand Up @@ -1040,7 +1038,6 @@ def makeReservedEvmAddress(account):
Utils.Print("after fork resolved, the latest evm block is:" + str(evm_block))
assert(evm_block["nonce"].hex() == "0x0000000000000001")
assert("consensusParameter" in evm_block)
assert(evm_block["consensusParameter"]["minGasPrice"] == 10000000000)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasCodedeposit"] == 530)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasNewaccount"] == 183910)
assert(evm_block["consensusParameter"]["gasFeeParameters"]["gasSset"] == 186280)
Expand Down
6 changes: 3 additions & 3 deletions tests/nodeos_eos_evm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ def get_block(num):

# update gas parameter
Utils.Print("Update gas parameter: ram price = 100 EOS per MB, gas price = 900Gwei")
trans = prodNode.pushMessage(evmAcc.name, "updtgasparam", json.dumps({"ram_price_mb":"100.0000 EOS","minimum_gas_price":900000000000}), '-p {0}'.format(evmAcc.name), silentErrors=False)
trans = prodNode.pushMessage(evmAcc.name, "updtgasparam", json.dumps({"ram_price_mb":"100.0000 EOS","gas_price":900000000000}), '-p {0}'.format(evmAcc.name), silentErrors=False)
prodNode.waitForTransBlockIfNeeded(trans[1], True);
time.sleep(2)

Expand All @@ -882,10 +882,10 @@ def get_block(num):
time.sleep(2)

b = get_block("latest")
# 'consensusParameter': {'gasFeeParameters': {'gasCodedeposit': 118, 'gasNewaccount': 40946, 'gasSset': 43728, 'gasTxcreate': 71508, 'gasTxnewaccount': 40946}, 'minGasPrice': 900000000000}
Utils.Print("get_block_latest: " + json.dumps(b))
# 'consensusParameter': {'gasFeeParameters': {'gasCodedeposit': 118, 'gasNewaccount': 40946, 'gasSset': 43728, 'gasTxcreate': 71508, 'gasTxnewaccount': 40946}}

assert("consensusParameter" in b)
assert(b["consensusParameter"]["minGasPrice"] == 900000000000)
assert(b["consensusParameter"]["gasFeeParameters"]["gasCodedeposit"] == 118)
assert(b["consensusParameter"]["gasFeeParameters"]["gasNewaccount"] == 40946)
assert(b["consensusParameter"]["gasFeeParameters"]["gasSset"] == 43728)
Expand Down
Loading