Skip to content

Commit f60012c

Browse files
authored
Merge pull request #363 from eosnetworkfoundation/kayan_v3_fix
fix gas v3
2 parents f1d34c1 + 0bed121 commit f60012c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

external/silkworm

src/block_conversion_plugin.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,20 @@ class block_conversion_plugin_impl : std::enable_shared_from_this<block_conversi
314314
auto dtx = deserialize_tx(act);
315315
auto& rlpx_ref = std::visit([](auto&& arg) -> auto& { return arg.rlpx; }, dtx);
316316

317+
auto tx_version = std::visit([](auto&& arg) -> auto { return arg.eos_evm_version; }, dtx);
318+
if (tx_version < block_version) {
319+
SILK_CRIT << "tx_version < block_version";
320+
throw std::runtime_error("tx_version < block_version");
321+
} else if (tx_version > block_version) {
322+
if(curr.transactions.empty()) {
323+
curr.header.nonce = eosevm::version_to_nonce(tx_version);
324+
block_version = tx_version;
325+
} else {
326+
SILK_CRIT << "tx_version > block_version";
327+
throw std::runtime_error("tx_version > block_version");
328+
}
329+
}
330+
317331
if(block_version >= 3) {
318332
SILKWORM_ASSERT(std::holds_alternative<evmtx_v3>(dtx));
319333
const auto& dtx_v3 = std::get<evmtx_v3>(dtx);
@@ -349,20 +363,6 @@ class block_conversion_plugin_impl : std::enable_shared_from_this<block_conversi
349363
SILK_CRIT << "Failed to decode transaction in block: " << curr.header.number;
350364
throw std::runtime_error("Failed to decode transaction");
351365
}
352-
auto tx_version = std::visit([](auto&& arg) -> auto { return arg.eos_evm_version; }, dtx);
353-
354-
if(tx_version < block_version) {
355-
SILK_CRIT << "tx_version < block_version";
356-
throw std::runtime_error("tx_version < block_version");
357-
} else if (tx_version > block_version) {
358-
if(curr.transactions.empty()) {
359-
curr.header.nonce = eosevm::version_to_nonce(tx_version);
360-
block_version = tx_version;
361-
} else {
362-
SILK_CRIT << "tx_version > block_version";
363-
throw std::runtime_error("tx_version > block_version");
364-
}
365-
}
366366

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

0 commit comments

Comments
 (0)