Skip to content

Commit

Permalink
fix compatibility with 3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyShi22 committed Apr 11, 2024
1 parent 11a76f0 commit f219ec1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bcos-executor/src/executive/ExecutiveFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ExecutiveFactory
m_precompiledContract;
std::shared_ptr<std::map<std::string, std::shared_ptr<precompiled::Precompiled>>>
m_constantPrecompiled;
std::shared_ptr<const std::set<std::string>> m_builtInPrecompiled;
std::shared_ptr<std::set<std::string>> m_builtInPrecompiled;
std::weak_ptr<BlockContext> m_blockContext;
std::shared_ptr<wasm::GasInjector> m_gasInjector;
};
Expand Down
12 changes: 8 additions & 4 deletions bcos-executor/src/executive/TransactionExecutive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,26 @@ CallParameters::UniquePtr TransactionExecutive::start(CallParameters::UniquePtr

auto message = execute(std::move(callParameters));

message->contextID = contextID();
message->seq = seq();

EXECUTIVE_LOG(TRACE) << "Execute finish\t" << message->toFullString();

return message;
}

CallParameters::UniquePtr TransactionExecutive::externalCall(CallParameters::UniquePtr input)
{
if (c_fileLogLevel == LogLevel::TRACE) [[unlikely]]
{
EXECUTIVE_LOG(TRACE) << "externalCall start\t" << input->toFullString();
}
auto newSeq = seq() + 1;
bool isCreate = input->create;
input->seq = newSeq;
input->contextID = m_contextID;

if (c_fileLogLevel == LogLevel::TRACE) [[unlikely]]
{
EXECUTIVE_LOG(TRACE) << "externalCall start\t" << input->toFullString();
}

std::string newAddress;
// if internalCreate, sometimes it will use given address, if receiveAddress is empty then give
// a new address
Expand Down
2 changes: 1 addition & 1 deletion bcos-executor/src/executive/TransactionExecutive.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class TransactionExecutive : public std::enable_shared_from_this<TransactionExec
m_constantPrecompiled;
std::shared_ptr<const std::map<std::string, std::shared_ptr<PrecompiledContract>>>
m_evmPrecompiled;
std::shared_ptr<const std::set<std::string>> m_builtInPrecompiled;
std::shared_ptr<std::set<std::string>> m_builtInPrecompiled;

std::string m_contractAddress;
int64_t m_contextID;
Expand Down
9 changes: 9 additions & 0 deletions bcos-executor/src/executor/TransactionExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ void TransactionExecutor::initEvmEnvironment()
{RING_SIG_ADDRESS, std::make_shared<precompiled::RingSigPrecompiled>(m_hashImpl)});

set<string> builtIn = {CRYPTO_ADDRESS, GROUP_SIG_ADDRESS, RING_SIG_ADDRESS};

m_builtInPrecompiled = make_shared<set<string>>(builtIn);

// create the zkp-precompiled
Expand Down Expand Up @@ -486,6 +487,14 @@ void TransactionExecutor::nextBlockHeader(int64_t schedulerTermId,
blockHeader->number() - 1, (*parentInfoIt).blockHash);
}

if (m_blockContext->features().get(ledger::Features::Flag::bugfix_call_noaddr_return))
{
if (m_builtInPrecompiled->count(CAST_ADDRESS) == 0)
{
m_builtInPrecompiled->insert(CAST_ADDRESS);
}
}

EXECUTOR_NAME_LOG(DEBUG) << BLOCK_NUMBER(blockHeader->number()) << "NextBlockHeader success"
<< LOG_KV("number", blockHeader->number())
<< LOG_KV("parentHash", blockHeader->number() > 0 ?
Expand Down
2 changes: 1 addition & 1 deletion bcos-executor/src/executor/TransactionExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class TransactionExecutor : public ParallelTransactionExecutorInterface,
std::make_shared<std::map<std::string, std::shared_ptr<precompiled::Precompiled>>>();
mutable bcos::SharedMutex x_constantPrecompiled;

std::shared_ptr<const std::set<std::string>> m_builtInPrecompiled;
std::shared_ptr<std::set<std::string>> m_builtInPrecompiled;
unsigned int m_DAGThreadNum = std::max(std::thread::hardware_concurrency(), (unsigned int)1);
std::shared_ptr<wasm::GasInjector> m_gasInjector = nullptr;
mutable bcos::RecursiveMutex x_executiveFlowLock;
Expand Down

0 comments on commit f219ec1

Please sign in to comment.