Skip to content

Commit

Permalink
Merge pull request #363 from eosnetworkfoundation/kayan_v3_fix
Browse files Browse the repository at this point in the history
fix gas v3
  • Loading branch information
taokayan authored Mar 5, 2025
2 parents f1d34c1 + 0bed121 commit f60012c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion external/silkworm
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

0 comments on commit f60012c

Please sign in to comment.