diff --git a/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp b/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp index eb1a8d6250..b35fa2a7ab 100644 --- a/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp +++ b/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp @@ -76,11 +76,24 @@ CallParameters::UniquePtr CoroutineTransactionExecutive::externalCall( if (output->delegateCall && output->type != CallParameters::FINISHED) { - EXECUTIVE_LOG(DEBUG) << "Could not getCode during DMC externalCall" - << LOG_KV("codeAddress", output->codeAddress); output->data = bytes(); - output->status = (int32_t)bcos::protocol::TransactionStatus::RevertInstruction; - output->evmStatus = EVMC_REVERT; + if (m_blockContext.lock()->features().get( + ledger::Features::Flag::bugfix_delegatecall_noaddr_return)) + { + // This is eth's bug, but we still need to compat with it :) + // https://docs.soliditylang.org/en/v0.8.17/control-structures.html#error-handling-assert-require-revert-and-exceptions + output->status = (int32_t)bcos::protocol::TransactionStatus::None; + output->evmStatus = EVMC_SUCCESS; + } + else + { + output->status = (int32_t)bcos::protocol::TransactionStatus::RevertInstruction; + output->evmStatus = EVMC_REVERT; + } + EXECUTIVE_LOG(DEBUG) << "Could not getCode during DMC externalCall" + << LOG_KV("codeAddress", output->codeAddress) + << LOG_KV("status", output->status) + << LOG_KV("evmStatus", output->evmStatus); } if (versionCompareTo( diff --git a/bcos-executor/src/executive/TransactionExecutive.cpp b/bcos-executor/src/executive/TransactionExecutive.cpp index 82ed8dc721..4d3ab1bb89 100644 --- a/bcos-executor/src/executive/TransactionExecutive.cpp +++ b/bcos-executor/src/executive/TransactionExecutive.cpp @@ -129,9 +129,21 @@ CallParameters::UniquePtr TransactionExecutive::externalCall(CallParameters::Uni auto& output = input; EXECUTIVE_LOG(DEBUG) << "Could not getCodeHash during externalCall" << LOG_KV("codeAddress", input->codeAddress); + output->data = bytes(); - output->status = (int32_t)TransactionStatus::RevertInstruction; - output->evmStatus = EVMC_REVERT; + if (m_blockContext.lock()->features().get( + ledger::Features::Flag::bugfix_delegatecall_noaddr_return)) + { + // This is eth's bug, but we still need to compat with it :) + // https://docs.soliditylang.org/en/v0.8.17/control-structures.html#error-handling-assert-require-revert-and-exceptions + output->status = (int32_t)TransactionStatus::None; + output->evmStatus = EVMC_SUCCESS; + } + else + { + output->status = (int32_t)TransactionStatus::RevertInstruction; + output->evmStatus = EVMC_REVERT; + } return std::move(output); } diff --git a/bcos-executor/src/vm/HostContext.cpp b/bcos-executor/src/vm/HostContext.cpp index bb6b7b6a44..d3f4f7409c 100644 --- a/bcos-executor/src/vm/HostContext.cpp +++ b/bcos-executor/src/vm/HostContext.cpp @@ -237,6 +237,11 @@ evmc_result HostContext::externalRequest(const evmc_message* _msg) .create_address = toEvmC(boost::algorithm::unhex(response->newEVMContractAddress)), .padding = {}}; + if (features().get(ledger::Features::Flag::bugfix_event_log_order)) + { + // put event log by stack(dfs) order + m_callParameters->logEntries = std::move(response->logEntries); + } // Put response to store in order to avoid data lost m_responseStore.emplace_back(std::move(response)); diff --git a/bcos-framework/bcos-framework/ledger/Features.h b/bcos-framework/bcos-framework/ledger/Features.h index f27c0ce951..03f5f0ac5c 100644 --- a/bcos-framework/bcos-framework/ledger/Features.h +++ b/bcos-framework/bcos-framework/ledger/Features.h @@ -33,6 +33,8 @@ class Features bugfix_revert, // https://github.com/FISCO-BCOS/FISCO-BCOS/issues/3629 bugfix_statestorage_hash, bugfix_evm_create2_delegatecall_staticcall_codecopy, + bugfix_event_log_order, + bugfix_delegatecall_noaddr_return, feature_dmc2serial, feature_sharding, feature_rpbft, @@ -63,7 +65,7 @@ class Features { BOOST_THROW_EXCEPTION(NoSuchFeatureError{}); } - + validate(*value); } @@ -122,6 +124,12 @@ class Features set(Flag::bugfix_statestorage_hash); set(Flag::bugfix_evm_create2_delegatecall_staticcall_codecopy); } + if (version >= protocol::BlockVersion::V3_6_0_VERSION) + { + set(Flag::bugfix_event_log_order); + set(Flag::bugfix_delegatecall_noaddr_return); + } + setToShardingDefault(version); }