@@ -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