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 v3 #363

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions src/block_conversion_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,20 @@ class block_conversion_plugin_impl : std::enable_shared_from_this<block_conversi
auto dtx = deserialize_tx(act);
auto& rlpx_ref = std::visit([](auto&& arg) -> auto& { return arg.rlpx; }, dtx);

auto tx_version = std::visit([](auto&& arg) -> auto { return arg.eos_evm_version; }, dtx);
if (tx_version < block_version) {
SILK_CRIT << "tx_version < block_version";
throw std::runtime_error("tx_version < block_version");
} else if (tx_version > block_version) {
if(curr.transactions.empty()) {
curr.header.nonce = eosevm::version_to_nonce(tx_version);
block_version = tx_version;
} else {
SILK_CRIT << "tx_version > block_version";
throw std::runtime_error("tx_version > block_version");
}
}

if(block_version >= 3) {
SILKWORM_ASSERT(std::holds_alternative<evmtx_v3>(dtx));
const auto& dtx_v3 = std::get<evmtx_v3>(dtx);
Expand Down Expand Up @@ -349,20 +363,6 @@ class block_conversion_plugin_impl : std::enable_shared_from_this<block_conversi
SILK_CRIT << "Failed to decode transaction in block: " << curr.header.number;
throw std::runtime_error("Failed to decode transaction");
}
auto tx_version = std::visit([](auto&& arg) -> auto { return arg.eos_evm_version; }, dtx);

if(tx_version < block_version) {
SILK_CRIT << "tx_version < block_version";
throw std::runtime_error("tx_version < block_version");
} else if (tx_version > block_version) {
if(curr.transactions.empty()) {
curr.header.nonce = eosevm::version_to_nonce(tx_version);
block_version = tx_version;
} else {
SILK_CRIT << "tx_version > block_version";
throw std::runtime_error("tx_version > block_version");
}
}

if(block_version >= 1 && block_version < 3) {
auto tx_base_fee = std::get<evmtx_v1>(dtx).base_fee_per_gas;
Expand Down