Skip to content

Commit

Permalink
Release 3.10.0 (FISCO-BCOS#4564)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenlinlee authored Aug 6, 2024
2 parents dce491b + 45f37a4 commit 1505644
Show file tree
Hide file tree
Showing 102 changed files with 3,385 additions and 1,587 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/workflow-self-hosted-centos-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ on:
branches:
- release-3.*
- feature-3.*
- bugfix-3.*
- master
release:
types: [push]
types: [ push ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -73,7 +74,7 @@ jobs:
. /opt/rh/rh-perl530/enable
export LIBCLANG_PATH=/opt/rh/llvm-toolset-7.0/root/lib64/
. /opt/rh/llvm-toolset-7.0/enable
cd build && cmake -DALLOCATOR=jemalloc -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DTESTS=ON -DWITH_LIGHTNODE=OFF -DWITH_CPPSDK=OFF -DWITH_TIKV=OFF -DWITH_TARS_SERVICES=OFF .. || cat *.log
cd build && cmake -DALLOCATOR=defalut -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DTESTS=ON -DWITH_LIGHTNODE=OFF -DWITH_CPPSDK=OFF -DWITH_TIKV=OFF -DWITH_TARS_SERVICES=OFF .. || cat *.log
make -j8
chmod +x ./fisco-bcos-air/fisco-bcos
./fisco-bcos-air/fisco-bcos -v
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

set(VERSION "3.9.0")
set(VERSION "3.10.0")
set(VERSION_SUFFIX "")
include(Options)
configure_project()
Expand Down Expand Up @@ -36,7 +36,6 @@ include(BuildInfoGenerator)

include(IncludeDirectories)
include(TargetSettings)
include(PrecompiledHeaders)

add_subdirectory(bcos-boostssl)
add_subdirectory(bcos-framework)
Expand All @@ -62,6 +61,7 @@ if(FULLNODE)
endif()
include(ProjectGroupSig)
include(ProjectPaillier)
include(ProjectBLST)

add_subdirectory(bcos-sealer)
add_subdirectory(bcos-security)
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ FISCO BCOS(读作/ˈfɪskl bi:ˈkɒz/) 是一个稳定、高效、安全的
单链配置下,性能TPS可达10万+。全面支持国密算法、国产操作系统与国产CPU架构。包含区块流水线、可拔插共识机制、全方位并行计算、区块链文件系统、权限治理框架、分布式存储等特性。

## 版本信息
- 稳定版本(生产环境使用):v3.2.7,版本内容可参考[《FISCO-BCOS v3.2.7版本说明》](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.2.7)
- 最新版本(用户体验新特性):v3.9.0,版本内容可参考 [《FISCO-BCOS v3.9.0版本说明》](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.9.0)
-
稳定版本(生产环境使用):v3.7.3,版本内容可参考[《FISCO-BCOS v3.7.3版本说明》](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.7.3)
-
最新版本(用户体验新特性):v3.10.0,版本内容可参考 [《FISCO-BCOS v3.10.0版本说明》](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.10.0)

## 系统概述
FISCO BCOS系统架构包括基础层、核心层、服务层、用户层和接入层提供稳定、安全的区块链底层服务。中间件层通过可视化界面,简化了用户管理区块链系统的流程。右侧配套相关开发、运维、安全控制的组件,辅助应用落地过程中不同角色的需要;同时,提供隐私保护和跨链相关的技术组件,满足不同场景的应用诉求。
Expand Down Expand Up @@ -68,31 +70,34 @@ FISCO BCOS系统架构包括基础层、核心层、服务层、用户层和接
- 乡村振兴:智慧农业养殖大数据云平台、数字化平台建设等。
- 智慧政务:城市大脑、公积金区块链平台、证书电子化项目等

FISCO BCOS已在领域创建了诸多标杆应用示范,涵盖19类场景的252个典型应用案例,产业应用具体信息可参考[《2023 FISCO BCOS 产业应用发展报告》](https://mp.weixin.qq.com/s/hyEdSluUSG-iUZDR2PO_Ew)

FISCO
BCOS已在领域创建了诸多标杆应用示范,涵盖19类场景的252个典型应用案例,产业应用具体信息可参考[《2023 FISCO BCOS 产业应用发展报告》](https://mp.weixin.qq.com/s/hyEdSluUSG-iUZDR2PO_Ew)

## 加入我们的社区

**FISCO BCOS开源社区**
FISCO BCOS是由深圳市金融区块链发展促进会(以下简称“金链盟”)开源工作组牵头研发的金融级、国产安全可控的区块链底层平台。作为最早开源的国产联盟链底层平台之一,FISCO BCOS于2017年面向全球开源。
FISCO BCOS是由深圳市金融区块链发展促进会(以下简称“金链盟”)开源工作组牵头研发的金融级、国产安全可控的区块链底层平台。作为最早开源的国产联盟链底层平台之一,FISCO
BCOS于2017年面向全球开源。

开源六周年至今,FISCO BCOS开源社区在技术创新、应用产业以及开源生态均取得了非凡成绩。

FISCO BCOS持续攻关核心关键技术,单链性能突破10万TPS。首创DMC算法大幅度提升性能、推出三种架构形态灵活适配业务需求;全链路国产化,采用国密算法与软硬件体系,支持国产OS,适配国产芯片和服务器,支持多语言多终端国密接入。拥有覆盖底层+中间件+应用组件的丰富周边组件。
FISCO
BCOS持续攻关核心关键技术,单链性能突破10万TPS。首创DMC算法大幅度提升性能、推出三种架构形态灵活适配业务需求;全链路国产化,采用国密算法与软硬件体系,支持国产OS,适配国产芯片和服务器,支持多语言多终端国密接入。拥有覆盖底层+中间件+应用组件的丰富周边组件。

底层平台可用性已经广泛应用实践检验,支撑政务、金融、医疗、双碳、跨境数据通等关乎国计民生的重点领域落地超过400个标杆应用,在助力实体经济发展、促进公平与可持续等方面贡献力量。

社区以开源链接多方,截止2023年12月,围绕FISCO BCOS构建的国产开源联盟链生态圈已汇聚了超过5000家机构、超10万名个人成员,以及50家认证合作伙伴、500余名核心贡献者。社区认证了63位FISCO BCOS MVP, 发展了12个专项兴趣小组SIG,此外与上百所知名院校开展人才共育合作,培育区块链产业人才超8万人次,已发展成为最大最活跃的国产开源联盟链生态圈之一。

社区以开源链接多方,截止2023年12月,围绕FISCO
BCOS构建的国产开源联盟链生态圈已汇聚了超过5000家机构、超10万名个人成员,以及50家认证合作伙伴、500余名核心贡献者。社区认证了63位FISCO
BCOS MVP, 发展了12个专项兴趣小组SIG,此外与上百所知名院校开展人才共育合作,培育区块链产业人才超8万人次,已发展成为最大最活跃的国产开源联盟链生态圈之一。

如您对FISCO BCOS开源技术及应用感兴趣,欢迎加入社区获得更多支持与帮助。

- [2023年度MVP](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/community/MVP_list_new.html)
- [2023年度贡献者](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/community/contributor_list_new.html)
- [FISCO BCOS 认证合作伙伴名单](https://mp.weixin.qq.com/s/A-gH2SJNQPDLgnhSGyuYDg)
- [2023 FISCO BCOS产业应用发展报告](https://mp.weixin.qq.com/s/hyEdSluUSG-iUZDR2PO_Ew)
- [社区历史文章资源](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/articles/index.html)


![](https://raw.githubusercontent.com/FISCO-BCOS/LargeFiles/master/images/QR_image.png)

## 贡献代码
Expand Down
17 changes: 8 additions & 9 deletions bcos-crypto/bcos-crypto/hasher/Hasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ namespace bcos::crypto::hasher
{

template <class HasherType>
concept Hasher =
requires(HasherType hasher, std::span<std::byte> out) {
// requires std::move_constructible<HasherType>;
hasher.update(std::span<std::byte const>{});
hasher.final(out);
requires std::same_as<std::decay_t<std::invoke_result_t<
decltype(&std::decay_t<HasherType>::clone), HasherType>>,
std::decay_t<HasherType>>;
};
concept Hasher = requires(HasherType hasher, std::span<std::byte> out) {
// requires std::move_constructible<HasherType>;
hasher.update(std::span<std::byte const>{});
hasher.final(out);
requires std::same_as<
std::decay_t<std::invoke_result_t<decltype(&std::decay_t<HasherType>::clone), HasherType>>,
std::decay_t<HasherType>>;
};

} // namespace bcos::crypto::hasher
21 changes: 21 additions & 0 deletions bcos-crypto/test/unittests/HashTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <bcos-crypto/hash/Keccak256.h>
#include <bcos-crypto/hash/SM3.h>
#include <bcos-crypto/hash/Sha3.h>
#include <bcos-crypto/hash/Sha256.h>
#include <bcos-crypto/interfaces/crypto/CryptoSuite.h>
#include <bcos-utilities/ThreadPool.h>
#include <bcos-utilities/testutils/TestPromptFixture.h>
Expand Down Expand Up @@ -122,6 +123,26 @@ BOOST_AUTO_TEST_CASE(testSha3)
BOOST_REQUIRE_EQUAL(cryptoSuite->hash("hello"sv),
h256("3338be694f50c5f338814986cdf0686453a888b84f424d792af4b9202398f392"));
}

BOOST_AUTO_TEST_CASE(SHA256_test)
{
HashType hash;
auto sha256 = std::make_shared<Sha256>();
bcos::bytes input{};
hash = sha256->hash(bcos::ref(input));
BCOS_LOG(DEBUG) << "hash: " << hash.hex();
BOOST_CHECK_EQUAL(
hash.hex(), "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");

std::string data =
"123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812"
"3456781234567812345678";
input += bcos::fromHex(data);
hash = sha256->hash(bcos::ref(input));
BCOS_LOG(DEBUG) << "hash: " << hash.hex();
BOOST_REQUIRE_EQUAL(
hash.hex(), "7303caef875be8c39b2c2f1905ea24adcc024bef6830a965fe05370f3170dc52");
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace test
} // namespace bcos
4 changes: 2 additions & 2 deletions bcos-executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ file(GLOB_RECURSE SRCS src/*.cpp)
add_library(${EXECUTOR_TARGET} ${SRCS})
if(WITH_WASM)
target_link_libraries(${EXECUTOR_TARGET} PUBLIC jsoncpp_static ${CODEC_TARGET} ${TOOL_TARGET} ${CRYPTO_TARGET} ${TABLE_TARGET} wedprcrypto::fisco-bcos bcos-protocol
Boost::context evmone fbwasm evmc::loader evmc::instructions wabt GroupSig Paillier)
Boost::context evmone fbwasm evmc::loader evmc::instructions wabt GroupSig Paillier blst)
else()
target_link_libraries(${EXECUTOR_TARGET} PUBLIC jsoncpp_static ${CODEC_TARGET} ${TOOL_TARGET} ${CRYPTO_TARGET} ${TABLE_TARGET} wedprcrypto::fisco-bcos bcos-protocol
Boost::context evmone evmc::loader evmc::instructions GroupSig Paillier)
Boost::context evmone evmc::loader evmc::instructions GroupSig Paillier blst)
endif()

if (TOOLS)
Expand Down
9 changes: 9 additions & 0 deletions bcos-executor/src/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct VMSchedule
bool exceptionalFailedCodeDeposit = true;
bool enableLondon = true;
bool enablePairs = false;
bool enableCanCun = false;
unsigned sstoreRefundGas = 15000;
unsigned suicideRefundGas = 24000;
unsigned createDataGas = 20;
Expand All @@ -185,6 +186,14 @@ static const VMSchedule FiscoBcosScheduleV320 = [] {
return schedule;
}();

static const VMSchedule FiscoBcosScheduleCancun = [] {
VMSchedule schedule = VMSchedule();
schedule.enableCanCun = true;
schedule.maxEvmCodeSize = 0x100000; // 1MB
schedule.maxWasmCodeSize = 0xF00000; // 15MB
return schedule;
}();

static const int64_t BALANCE_TRANSFER_GAS = 21000;

constexpr evmc_gas_metrics ethMetrics{32000, 20000, 5000, 200, 9000, 2300, 25000};
Expand Down
26 changes: 21 additions & 5 deletions bcos-executor/src/executive/BlockContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ using namespace std;
BlockContext::BlockContext(std::shared_ptr<storage::StateStorageInterface> storage,
LedgerCache::Ptr ledgerCache, crypto::Hash::Ptr _hashImpl,
bcos::protocol::BlockNumber blockNumber, h256 blockHash, uint64_t timestamp,
uint32_t blockVersion, const VMSchedule& _schedule, bool _isWasm, bool _isAuthCheck,
uint32_t blockVersion, bool _isWasm, bool _isAuthCheck,
storage::StorageInterface::Ptr backendStorage)
: m_blockNumber(blockNumber),
m_blockHash(blockHash),
m_timeStamp(timestamp),
m_blockVersion(blockVersion),
m_schedule(_schedule),
m_isWasm(_isWasm),
m_isAuthCheck(_isAuthCheck),
m_storage(std::move(storage)),
m_transientStorageMap(std::make_shared<transientStorageMap>(10)),
m_hashImpl(std::move(_hashImpl)),
m_ledgerCache(std::move(ledgerCache)),
m_backendStorage(std::move(backendStorage))
Expand All @@ -61,15 +61,15 @@ BlockContext::BlockContext(std::shared_ptr<storage::StateStorageInterface> stora
}

task::syncWait(readFromStorage(m_features, *m_storage, m_blockNumber));
setVMSchedule();
}

BlockContext::BlockContext(std::shared_ptr<storage::StateStorageInterface> storage,
LedgerCache::Ptr ledgerCache, crypto::Hash::Ptr _hashImpl, protocol::BlockHeader const& current,
const VMSchedule& _schedule, bool _isWasm, bool _isAuthCheck,
storage::StorageInterface::Ptr backendStorage,
bool _isWasm, bool _isAuthCheck, storage::StorageInterface::Ptr backendStorage,
std::shared_ptr<std::set<std::string, std::less<>>> _keyPageIgnoreTables)
: BlockContext(std::move(storage), std::move(ledgerCache), std::move(_hashImpl), current.number(),
current.hash(), current.timestamp(), current.version(), _schedule, _isWasm, _isAuthCheck,
current.hash(), current.timestamp(), current.version(), _isWasm, _isAuthCheck,
std::move(backendStorage))
{
if (current.number() > 0 && !current.parentInfo().empty())
Expand Down Expand Up @@ -97,6 +97,7 @@ BlockContext::BlockContext(std::shared_ptr<storage::StateStorageInterface> stora
}
}
}
setVMSchedule();
}


Expand All @@ -123,6 +124,21 @@ void BlockContext::setExecutiveFlow(
bcos::ReadGuard l(x_executiveFlows);
m_executiveFlows.emplace(codeAddress, executiveFlow);
}
void BlockContext::setVMSchedule()
{
if (m_features.get(ledger::Features::Flag::feature_evm_cancun))
{
m_schedule = FiscoBcosScheduleCancun;
}
else if (m_blockVersion >= (uint32_t)bcos::protocol::BlockVersion::V3_2_VERSION)
{
m_schedule = FiscoBcosScheduleV320;
}
else
{
m_schedule = FiscoBcosSchedule;
}
}

void BlockContext::suicide(std::string_view contract2Suicide)
{
Expand Down
16 changes: 13 additions & 3 deletions bcos-executor/src/executive/BlockContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#include "bcos-framework/protocol/ProtocolTypeDef.h"
#include "bcos-framework/protocol/Transaction.h"
#include "bcos-framework/storage/EntryCache.h"
#include "bcos-framework/storage/Table.h"
#include "bcos-table/src/StateStorage.h"
#include "bcos-utilities/BucketMap.h"
#include <tbb/concurrent_unordered_map.h>
#include <functional>
#include <memory>
Expand All @@ -46,20 +49,25 @@ class BlockContext : public std::enable_shared_from_this<BlockContext>
BlockContext(std::shared_ptr<storage::StateStorageInterface> storage,
LedgerCache::Ptr ledgerCache, crypto::Hash::Ptr _hashImpl,
bcos::protocol::BlockNumber blockNumber, h256 blockHash, uint64_t timestamp,
uint32_t blockVersion, const VMSchedule& _schedule, bool _isWasm, bool _isAuthCheck,
uint32_t blockVersion, bool _isWasm, bool _isAuthCheck,
storage::StorageInterface::Ptr backendStorage = nullptr);

BlockContext(std::shared_ptr<storage::StateStorageInterface> storage,
LedgerCache::Ptr ledgerCache, crypto::Hash::Ptr _hashImpl,
protocol::BlockHeader const& current, const VMSchedule& _schedule, bool _isWasm,
bool _isAuthCheck, storage::StorageInterface::Ptr backendStorage = nullptr,
protocol::BlockHeader const& current, bool _isWasm, bool _isAuthCheck,
storage::StorageInterface::Ptr backendStorage = nullptr,
std::shared_ptr<std::set<std::string, std::less<>>> = nullptr);

using getTxCriticalsHandler = std::function<std::shared_ptr<std::vector<std::string>>(
const protocol::Transaction::ConstPtr& _tx)>;
virtual ~BlockContext() = default;

std::shared_ptr<storage::StateStorageInterface> storage() const { return m_storage; }
using transientStorageMap = BucketMap<int64_t, std::shared_ptr<storage::StateStorageInterface>>;
std::shared_ptr<transientStorageMap> getTransientStorageMap() const
{
return m_transientStorageMap;
}

uint64_t txGasLimit() const { return m_ledgerCache->fetchTxGasLimit(); }

Expand All @@ -86,6 +94,7 @@ class BlockContext : public std::enable_shared_from_this<BlockContext>
void setExecutiveFlow(std::string codeAddress, ExecutiveFlowInterface::Ptr executiveFlow);

std::shared_ptr<VMFactory> getVMFactory() const { return m_vmFactory; }
void setVMSchedule();
void setVMFactory(std::shared_ptr<VMFactory> factory) { m_vmFactory = factory; }

void stop()
Expand Down Expand Up @@ -147,6 +156,7 @@ class BlockContext : public std::enable_shared_from_this<BlockContext>
bool m_isWasm = false;
bool m_isAuthCheck = false;
std::shared_ptr<storage::StateStorageInterface> m_storage;
transientStorageMap::Ptr m_transientStorageMap;
crypto::Hash::Ptr m_hashImpl;
std::function<void()> f_onNeedSwitchEvent;
std::shared_ptr<std::set<std::string, std::less<>>> m_keyPageIgnoreTables;
Expand Down
39 changes: 39 additions & 0 deletions bcos-executor/src/executive/TransactionExecutive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ CallParameters::UniquePtr TransactionExecutive::execute(CallParameters::UniquePt
<< LOG_KV("blockNumber", m_blockContext.number());
}
m_storageWrapper->setRecoder(m_recoder);
auto transientStorage = getTransientStateStorage(m_contextID);
transientStorage->setRecoder(m_transientRecoder);
std::unique_ptr<HostContext> hostContext;
CallParameters::UniquePtr callResults;
if (c_fileLogLevel <= LogLevel::TRACE)
Expand Down Expand Up @@ -1391,6 +1393,8 @@ void TransactionExecutive::revert()
}

m_blockContext.storage()->rollback(*m_recoder);
auto transientStateStorage = getTransientStateStorage(m_contextID);
transientStateStorage->rollback(*m_transientRecoder);
m_recoder->clear();
}

Expand Down Expand Up @@ -1936,3 +1940,38 @@ std::string TransactionExecutive::getContractTableName(

return std::string(USER_APPS_PREFIX).append(formatAddress);
}

std::shared_ptr<storage::StateStorageInterface> TransactionExecutive::getTransientStateStorage(
int64_t contextID)
{
auto transientStorageMap = blockContext().getTransientStorageMap();
bcos::storage::StateStorageInterface::Ptr transientStorage;
bool has;
{
tssMap::ReadAccessor::Ptr readAccessor;
has = transientStorageMap->find<tssMap::ReadAccessor>(readAccessor, contextID);
if (has)
{
transientStorage = readAccessor->value();
}
}
if (!has)
{
{
tssMap::WriteAccessor::Ptr writeAccessor;
auto hasWrite =
transientStorageMap->find<tssMap::WriteAccessor>(writeAccessor, contextID);

if (!hasWrite)
{
transientStorage = std::make_shared<bcos::storage::StateStorage>(nullptr, true);
transientStorageMap->insert(writeAccessor, {contextID, transientStorage});
}
else
{
transientStorage = writeAccessor->value();
}
}
}
return transientStorage;
}
Loading

0 comments on commit 1505644

Please sign in to comment.