Skip to content

Commit

Permalink
Merge branch 'feature-3.6.0' into feature-3.6.0
Browse files Browse the repository at this point in the history
Signed-off-by: jimmyshi <[email protected]>
  • Loading branch information
JimmyShi22 authored Nov 22, 2023
2 parents d92568e + 5e30730 commit ce01f60
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 135 deletions.
10 changes: 5 additions & 5 deletions bcos-executor/src/vm/VMInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ VMInstance::VMInstance(evmc_vm* instance, evmc_revision revision, bytes_view cod
// Set the options.
if (m_instance->set_option != nullptr)
{ // baseline interpreter could not work with precompiled
// m_instance->set_option(m_instance, "advanced", ""); // default is baseline interpreter
// m_instance->set_option(m_instance, "trace", "");
// m_instance->set_option(m_instance, "cgoto", "no");
// m_instance->set_option(m_instance, "advanced", ""); // default is baseline interpreter
// m_instance->set_option(m_instance, "trace", "");
// m_instance->set_option(m_instance, "cgoto", "no");
}
}

Expand All @@ -62,8 +62,8 @@ Result VMInstance::execute(HostContext& _hostContext, evmc_message* _msg)
}
auto state = std::make_unique<evmone::advanced::AdvancedExecutionState>(
*_msg, m_revision, *_hostContext.interface, &_hostContext, m_code);
{ // baseline
auto* evm = evmc_create_evmone(); // baseline use the vm to get options
{ // baseline
static auto* evm = evmc_create_evmone(); // baseline use the vm to get options
return Result(evmone::baseline::execute(
*static_cast<evmone::VM*>(evm), _msg->gas, *state, *m_analysis));
}
Expand Down
3 changes: 1 addition & 2 deletions bcos-framework/bcos-framework/ledger/Features.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
#include "../protocol/Protocol.h"
#include "../storage/Entry.h"
#include "../storage/LegacyStorageMethods.h"
#include "../storage/StorageInterface.h"
#include "../storage2/Storage.h"
#include "bcos-concepts/Exception.h"
#include "bcos-framework/ledger/LedgerTypeDef.h"
#include "bcos-task/Task.h"
#include <bcos-concepts/Exception.h>
#include <bcos-utilities/Ranges.h>
#include <boost/throw_exception.hpp>
#include <array>
Expand Down
7 changes: 4 additions & 3 deletions bcos-rpc/bcos-rpc/tarsRPC/RPCServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ bcostars::Error bcos::rpc::RPCServer::call(const bcostars::Transaction& request,
return;
}

auto receipt = dynamic_cast<bcostars::protocol::TransactionReceiptImpl const&>(
*transactionReceiptPtr);
auto const& receipt =
dynamic_cast<bcostars::protocol::TransactionReceiptImpl const&>(
*transactionReceiptPtr);
bcos::rpc::RPCServer::async_response_call(current, tarsError, receipt.inner());
}
catch (std::exception& e)
Expand Down Expand Up @@ -100,7 +101,7 @@ bcostars::Error bcos::rpc::RPCServer::sendTransaction(const bcostars::Transactio
auto& txpool = self->m_params.node->txpoolRef();
txpool.broadcastTransaction(*transaction);
auto submitResult = co_await txpool.submitTransaction(std::move(transaction));
auto receipt = dynamic_cast<bcostars::protocol::TransactionReceiptImpl const&>(
const auto& receipt = dynamic_cast<bcostars::protocol::TransactionReceiptImpl const&>(
*submitResult->transactionReceipt());

bcos::rpc::RPCServer::async_response_sendTransaction(current, error, receipt.inner());
Expand Down
1 change: 0 additions & 1 deletion bcos-sdk/sample/tars/performanceTransfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <bcos-crypto/hash/Keccak256.h>
#include <bcos-crypto/signature/secp256k1/Secp256k1Crypto.h>
#include <bcos-tars-protocol/protocol/TransactionFactoryImpl.h>
#include <bcos-utilities/ratelimiter/TimeWindowRateLimiter.h>
#include <oneapi/tbb/blocked_range.h>
#include <oneapi/tbb/parallel_for.h>
#include <boost/exception/diagnostic_information.hpp>
Expand Down
3 changes: 3 additions & 0 deletions libinitializer/PBFTInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ void PBFTInitializer::initChainNodeInfo(
auto nodeProtocolInfo = g_BCOSConfig.protocolInfo(ProtocolModuleID::NodeService);
m_nodeInfo->setNodeProtocol(*nodeProtocolInfo);
m_nodeInfo->setCompatibilityVersion(m_pbft->compatibilityVersion());
m_nodeInfo->setFeatureKeys(
ledger::Features::featureKeys() |
RANGES::views::transform([](std::string_view view) { return std::string(view); }));
m_groupInfo->appendNodeInfo(m_nodeInfo);
INITIALIZER_LOG(INFO) << LOG_DESC("PBFTInitializer::initChainNodeInfo")
<< LOG_KV("nodeType", m_nodeInfo->nodeType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class VMInstance
if constexpr (std::is_same_v<Instance, evmc_vm*>)
{
assert(instance->abi_version == EVMC_ABI_VERSION);
if (instance->set_option != nullptr)
{}
m_instance.emplace<EVMC_VM>(instance);
}
else
Expand Down
3 changes: 2 additions & 1 deletion transaction-executor/benchmark/benchmakrExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ struct Fixture
: m_cryptoSuite(std::make_shared<bcos::crypto::CryptoSuite>(
std::make_shared<bcos::crypto::Keccak256>(), nullptr, nullptr)),
m_receiptFactory(m_cryptoSuite),
m_executor(m_receiptFactory, bcos::executor::GlobalHashImpl::g_hashImpl),
m_executor(m_receiptFactory, std::make_shared<bcos::crypto::Keccak256>()),
blockHeader([inner = std::addressof(tarsBlockHeader)]() mutable { return inner; })
{
boost::log::core::get()->set_logging_enabled(false);
bcos::executor::GlobalHashImpl::g_hashImpl = std::make_shared<bcos::crypto::Keccak256>();
boost::algorithm::unhex(helloworldBytecode, std::back_inserter(m_helloworldBytecodeBinary));
blockHeader.setVersion((uint32_t)bcos::protocol::BlockVersion::V3_1_VERSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <chrono>
#include <exception>
#include <memory>
#include <range/v3/view/enumerate.hpp>
#include <type_traits>

namespace bcos::transaction_scheduler
Expand Down Expand Up @@ -216,15 +215,15 @@ class BaselineScheduler : public scheduler::SchedulerInterface
std::mutex m_executeMutex;
int64_t m_lastcommittedBlockNumber = -1;
std::mutex m_commitMutex;
tbb::task_group m_notifyGroup;
tbb::task_group m_asyncGroup;

struct ExecuteResult
{
protocol::TransactionsPtr m_transactions;
std::vector<protocol::TransactionReceipt::Ptr> m_receipts;
protocol::Block::Ptr m_block;
};
std::list<ExecuteResult> m_results;
std::deque<ExecuteResult> m_results;
std::mutex m_resultsMutex;

/**
Expand Down Expand Up @@ -302,6 +301,7 @@ class BaselineScheduler : public scheduler::SchedulerInterface

scheduler.m_multiLayerStorage.pushMutableToImmutableFront();
scheduler.m_lastExecutedBlockNumber = blockHeader->number();
scheduler.m_asyncGroup.run([view = std::move(view)]() {});

auto transactions =
RANGES::views::transform(constTransactions,
Expand Down Expand Up @@ -413,9 +413,9 @@ class BaselineScheduler : public scheduler::SchedulerInterface
<< " | elapsed: " << (current() - now) << "ms";
commitLock.unlock();

scheduler.m_notifyGroup.run([&, result = std::move(result),
blockHash = ledgerConfig->hash(),
blockNumber = ledgerConfig->blockNumber()]() {
scheduler.m_asyncGroup.run([&, result = std::move(result),
blockHash = ledgerConfig->hash(),
blockNumber = ledgerConfig->blockNumber()]() {
ittapi::Report report(ittapi::ITT_DOMAINS::instance().BASELINE_SCHEDULER,
ittapi::ITT_DOMAINS::instance().NOTIFY_RESULTS);

Expand Down Expand Up @@ -487,7 +487,7 @@ class BaselineScheduler : public scheduler::SchedulerInterface
BaselineScheduler(BaselineScheduler&&) noexcept = default;
BaselineScheduler& operator=(const BaselineScheduler&) = delete;
BaselineScheduler& operator=(BaselineScheduler&&) noexcept = default;
~BaselineScheduler() noexcept override = default;
~BaselineScheduler() noexcept override { m_asyncGroup.wait(); }

void executeBlock(bcos::protocol::Block::Ptr block, bool verify,
std::function<void(bcos::Error::Ptr&&, bcos::protocol::BlockHeader::Ptr&&, bool sysBlock)>
Expand Down
Loading

0 comments on commit ce01f60

Please sign in to comment.