diff --git a/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp b/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp index 69a8112e83..0a7252619b 100644 --- a/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp +++ b/bcos-executor/src/executive/CoroutineTransactionExecutive.cpp @@ -77,11 +77,11 @@ CallParameters::UniquePtr CoroutineTransactionExecutive::externalCall( if (output->delegateCall && output->type != CallParameters::FINISHED) { output->data = bytes(); - if (m_blockContext.features().get( - ledger::Features::Flag::bugfix_delegatecall_noaddr_return)) + if (m_blockContext.features().get(ledger::Features::Flag::bugfix_call_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->type = CallParameters::FINISHED; output->status = (int32_t)bcos::protocol::TransactionStatus::None; output->evmStatus = EVMC_SUCCESS; } diff --git a/bcos-executor/src/executive/TransactionExecutive.cpp b/bcos-executor/src/executive/TransactionExecutive.cpp index 9849c9e5a6..76d5a764aa 100644 --- a/bcos-executor/src/executive/TransactionExecutive.cpp +++ b/bcos-executor/src/executive/TransactionExecutive.cpp @@ -131,8 +131,7 @@ CallParameters::UniquePtr TransactionExecutive::externalCall(CallParameters::Uni << LOG_KV("codeAddress", input->codeAddress); output->data = bytes(); - if (m_blockContext.features().get( - ledger::Features::Flag::bugfix_delegatecall_noaddr_return)) + if (m_blockContext.features().get(ledger::Features::Flag::bugfix_call_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 @@ -265,7 +264,7 @@ CallParameters::UniquePtr TransactionExecutive::execute(CallParameters::UniquePt } } - else if (callParameters->create) + if (callParameters->create) { std::tie(hostContext, callResults) = create(std::move(callParameters)); } @@ -949,6 +948,24 @@ CallParameters::UniquePtr TransactionExecutive::go( { revert(); auto callResult = hostContext.takeCallParameters(); + + if (m_blockContext.features().get( + ledger::Features::Flag::bugfix_call_noaddr_return) && + callResult->staticCall) + { + // Note: to be the same as eth + // Just fix DMC: + // if bugfix_call_noaddr_return is not set, callResult->evmStatus is still + // default to EVMC_SUCCESS and serial mode is execute same as eth, but DMC is + // using callResult->status, so we need to compat with DMC here + + callResult->type = CallParameters::FINISHED; + callResult->evmStatus = EVMC_SUCCESS; + callResult->status = (int32_t)TransactionStatus::None; + callResult->message = "Error contract address."; + return callResult; + } + callResult->type = CallParameters::REVERT; callResult->status = (int32_t)TransactionStatus::CallAddressError; callResult->message = "Error contract address."; diff --git a/bcos-framework/bcos-framework/ledger/Features.h b/bcos-framework/bcos-framework/ledger/Features.h index 7a7be54ff9..d396e98ee7 100644 --- a/bcos-framework/bcos-framework/ledger/Features.h +++ b/bcos-framework/bcos-framework/ledger/Features.h @@ -34,7 +34,7 @@ class Features bugfix_statestorage_hash, bugfix_evm_create2_delegatecall_staticcall_codecopy, bugfix_event_log_order, - bugfix_delegatecall_noaddr_return, + bugfix_call_noaddr_return, bugfix_precompiled_codehash, feature_dmc2serial, feature_sharding, @@ -129,7 +129,7 @@ class Features if (version >= protocol::BlockVersion::V3_2_6_VERSION) { set(Flag::bugfix_event_log_order); - set(Flag::bugfix_delegatecall_noaddr_return); + set(Flag::bugfix_call_noaddr_return); set(Flag::bugfix_precompiled_codehash); }