Skip to content

Commit d3561b7

Browse files
authored
sync code from 3.15.1 to master (FISCO-BCOS#4875)
2 parents b738d1e + 50ab15f commit d3561b7

File tree

56 files changed

+946
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+946
-815
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ endif()
66

77
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
88

9-
set(VERSION "3.15.0")
9+
set(VERSION "3.15.1")
1010
set(VERSION_SUFFIX "")
1111
include(Options)
1212
configure_project()

bcos-crypto/bcos-crypto/KeyCompareTools.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,27 @@
2323

2424
#include "bcos-crypto/interfaces/crypto/CommonType.h"
2525
#include "bcos-utilities/FixedBytes.h"
26-
#include "bcos-utilities/Ranges.h"
2726

2827
namespace bcos::crypto
2928
{
3029
template <class NodeType>
31-
concept Node = requires(NodeType node)
32-
{
33-
node->data();
34-
};
30+
concept Node = requires(NodeType node) { node->data(); };
3531
template <class NodesType>
36-
concept Nodes = requires(NodesType nodesType)
37-
{
38-
requires RANGES::bidirectional_range<NodesType>;
39-
requires Node<RANGES::range_value_t<NodesType>>;
32+
concept Nodes = requires(NodesType nodesType) {
33+
requires ::ranges::bidirectional_range<NodesType>;
34+
requires Node<::ranges::range_value_t<NodesType>>;
4035
};
4136
class KeyCompareTools
4237
{
4338
public:
4439
static bool compareTwoNodeIDs(Nodes auto const& nodes1, Nodes auto const& nodes2)
4540
{
46-
if (RANGES::size(nodes1) != RANGES::size(nodes2))
41+
if (::ranges::size(nodes1) != ::ranges::size(nodes2))
4742
{
4843
return false;
4944
}
5045

51-
for (auto const& [idx, value] : nodes1 | RANGES::views::enumerate)
46+
for (auto const& [idx, value] : nodes1 | ::ranges::views::enumerate)
5247
{
5348
if (nodes2[idx]->data() != value->data())
5449
{
@@ -60,8 +55,8 @@ class KeyCompareTools
6055

6156
static bool isNodeIDExist(Node auto const& node, Nodes auto const& nodes)
6257
{
63-
return RANGES::find_if(RANGES::begin(nodes), RANGES::end(nodes),
64-
[&node](auto&& n) { return n->data() == node->data(); }) != RANGES::end(nodes);
58+
return ::ranges::find_if(::ranges::begin(nodes), ::ranges::end(nodes),
59+
[&node](auto&& n) { return n->data() == node->data(); }) != ::ranges::end(nodes);
6560
}
6661
};
6762
} // namespace bcos::crypto

bcos-crypto/bcos-crypto/hasher/Hasher.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#include <bcos-utilities/Ranges.h>
32
#include <concepts>
43
#include <span>
54
#include <type_traits>

bcos-executor/src/precompiled/ShardingPrecompiled.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <bcos-framework/executor/PrecompiledTypeDef.h>
2727
#include <bcos-framework/protocol/Protocol.h>
2828
#include <bcos-tool/BfsFileFactory.h>
29-
#include <bcos-utilities/Ranges.h>
3029
#include <boost/algorithm/string/split.hpp>
3130
#include <boost/archive/binary_iarchive.hpp>
3231
#include <boost/archive/binary_oarchive.hpp>
@@ -92,7 +91,7 @@ inline bool isFromThisOrGovernors(std::shared_ptr<executor::TransactionExecutive
9291
auto codec = CodecWrapper(blockContext.hashHandler(), blockContext.isWasm());
9392

9493
auto governors = getGovernorList(_executive, _callParameters, codec);
95-
return (RANGES::find_if(governors, [&_callParameters](const Address& address) {
94+
return (::ranges::find_if(governors, [&_callParameters](const Address& address) {
9695
return address.hex() == _callParameters->m_sender;
9796
}) != governors.end());
9897
}

bcos-executor/src/precompiled/SystemConfigPrecompiled.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ int64_t SystemConfigPrecompiled::validate(
267267
int64_t configuredValue = 0;
268268
std::string key = std::string(_key);
269269
auto featureKeys = ledger::Features::featureKeys();
270-
bool setFeature = (RANGES::find(featureKeys, key) != featureKeys.end());
270+
bool setFeature = (::ranges::find(featureKeys, key) != featureKeys.end());
271271
if (!m_sysValueCmp.contains(key) && !m_valueConverter.contains(key) && !setFeature)
272272
{
273273
BOOST_THROW_EXCEPTION(PrecompiledError("unsupported key " + key));
@@ -485,18 +485,15 @@ void SystemConfigPrecompiled::registerGovernorToCaller(
485485
}
486486
return;
487487
}
488-
else
488+
489+
for (auto const& address : governorAddress)
489490
{
490-
for (auto const& address : governorAddress)
491+
auto entry = table->getRow(address.hex());
492+
if (!entry)
491493
{
492-
auto entry = table->getRow(address.hex());
493-
if (!entry)
494-
{
495-
Entry CallerEntry;
496-
CallerEntry.importFields({"1"});
497-
_executive->storage().setRow(
498-
SYS_BALANCE_CALLER, address.hex(), std::move(CallerEntry));
499-
}
494+
Entry CallerEntry;
495+
CallerEntry.importFields({"1"});
496+
_executive->storage().setRow(SYS_BALANCE_CALLER, address.hex(), std::move(CallerEntry));
500497
}
501498
}
502499
}

bcos-executor/src/precompiled/extension/BalancePrecompiled.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <bcos-tool/BfsFileFactory.h>
2424
#include <boost/archive/binary_iarchive.hpp>
2525
#include <boost/archive/binary_oarchive.hpp>
26-
#include <boost/core/ignore_unused.hpp>
2726
#include <boost/serialization/vector.hpp>
2827

2928
using namespace bcos;
@@ -119,7 +118,7 @@ void BalancePrecompiled::checkOriginAuth(
119118
<< LOG_BADGE("BalancePrecompiled") << LOG_DESC("checkOriginAuth")
120119
<< LOG_KV("governors size", governors.size())
121120
<< LOG_KV("origin address", origin);
122-
if (RANGES::find(governors, Address(origin)) == governors.end())
121+
if (::ranges::find(governors, Address(origin)) == governors.end())
123122
{
124123
PRECOMPILED_LOG(TRACE)
125124
<< BLOCK_NUMBER(_executive->blockContext().number()) << LOG_BADGE("BalancePrecompiled")
@@ -576,7 +575,7 @@ void BalancePrecompiled::listCaller(
576575
auto entry = table->getRow(it);
577576
if (entry)
578577
{
579-
addresses.emplace_back(Address(it));
578+
addresses.emplace_back(it);
580579
}
581580
}
582581
PRECOMPILED_LOG(INFO) << BLOCK_NUMBER(blockContext.number()) << LOG_BADGE("BalancePrecompiled")

bcos-framework/bcos-framework/ledger/Features.h

Lines changed: 92 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Features
4646
bugfix_precompiled_gasused,
4747
bugfix_nonce_not_increase_when_revert,
4848
bugfix_set_contract_nonce_when_create,
49+
bugfix_precompiled_gascalc,
4950
feature_dmc2serial,
5051
feature_sharding,
5152
feature_rpbft,
@@ -178,90 +179,91 @@ class Features
178179
protocol::BlockVersion to;
179180
std::vector<Flag> flags;
180181
};
181-
const static auto upgradeRoadmap = std::to_array<UpgradeFeatures>({
182-
{.to = protocol::BlockVersion::V3_2_3_VERSION,
183-
.flags =
184-
{
185-
Flag::bugfix_revert,
186-
}},
187-
{.to = protocol::BlockVersion::V3_2_4_VERSION,
188-
.flags =
189-
{
190-
Flag::bugfix_statestorage_hash,
191-
Flag::bugfix_evm_create2_delegatecall_staticcall_codecopy,
192-
}},
193-
{.to = protocol::BlockVersion::V3_2_7_VERSION,
194-
.flags =
195-
{
196-
Flag::bugfix_event_log_order,
197-
Flag::bugfix_call_noaddr_return,
198-
Flag::bugfix_precompiled_codehash,
199-
Flag::bugfix_dmc_revert,
200-
}},
201-
{.to = protocol::BlockVersion::V3_5_VERSION,
202-
.flags =
203-
{
204-
Flag::bugfix_revert,
205-
Flag::bugfix_statestorage_hash,
206-
}},
207-
{.to = protocol::BlockVersion::V3_6_VERSION,
208-
.flags =
209-
{
210-
Flag::bugfix_statestorage_hash,
211-
Flag::bugfix_evm_create2_delegatecall_staticcall_codecopy,
212-
Flag::bugfix_event_log_order,
213-
Flag::bugfix_call_noaddr_return,
214-
Flag::bugfix_precompiled_codehash,
215-
Flag::bugfix_dmc_revert,
216-
}},
217-
{.to = protocol::BlockVersion::V3_6_1_VERSION,
218-
.flags =
219-
{
220-
Flag::bugfix_keypage_system_entry_hash,
221-
Flag::bugfix_internal_create_redundant_storage,
222-
}},
223-
{.to = protocol::BlockVersion::V3_7_0_VERSION,
224-
.flags =
225-
{
226-
Flag::bugfix_empty_abi_reset,
227-
Flag::bugfix_eip55_addr,
228-
Flag::bugfix_sharding_call_in_child_executive,
229-
Flag::bugfix_internal_create_permission_denied,
230-
}},
231-
{.to = protocol::BlockVersion::V3_8_0_VERSION,
232-
.flags =
233-
{
234-
Flag::bugfix_eoa_as_contract,
235-
Flag::bugfix_dmc_deploy_gas_used,
236-
Flag::bugfix_evm_exception_gas_used,
237-
Flag::bugfix_set_row_with_dirty_flag,
238-
}},
239-
{.to = protocol::BlockVersion::V3_9_0_VERSION,
240-
.flags =
241-
{
242-
Flag::bugfix_staticcall_noaddr_return,
243-
Flag::bugfix_support_transfer_receive_fallback,
244-
Flag::bugfix_eoa_match_failed,
245-
}},
246-
{.to = protocol::BlockVersion::V3_12_0_VERSION,
247-
.flags =
248-
{
249-
Flag::bugfix_rpbft_vrf_blocknumber_input,
250-
}},
251-
{.to = protocol::BlockVersion::V3_13_0_VERSION,
252-
.flags =
253-
{
254-
Flag::bugfix_delete_account_code,
255-
Flag::bugfix_policy1_empty_code_address,
256-
Flag::bugfix_precompiled_gasused,
257-
}},
258-
{.to = protocol::BlockVersion::V3_14_0_VERSION,
259-
.flags =
260-
{
261-
Flag::bugfix_nonce_not_increase_when_revert,
262-
Flag::bugfix_set_contract_nonce_when_create,
263-
}},
264-
});
182+
const static auto upgradeRoadmap =
183+
std::to_array<UpgradeFeatures>({{.to = protocol::BlockVersion::V3_2_3_VERSION,
184+
.flags =
185+
{
186+
Flag::bugfix_revert,
187+
}},
188+
{.to = protocol::BlockVersion::V3_2_4_VERSION,
189+
.flags =
190+
{
191+
Flag::bugfix_statestorage_hash,
192+
Flag::bugfix_evm_create2_delegatecall_staticcall_codecopy,
193+
}},
194+
{.to = protocol::BlockVersion::V3_2_7_VERSION,
195+
.flags =
196+
{
197+
Flag::bugfix_event_log_order,
198+
Flag::bugfix_call_noaddr_return,
199+
Flag::bugfix_precompiled_codehash,
200+
Flag::bugfix_dmc_revert,
201+
}},
202+
{.to = protocol::BlockVersion::V3_5_VERSION,
203+
.flags =
204+
{
205+
Flag::bugfix_revert,
206+
Flag::bugfix_statestorage_hash,
207+
}},
208+
{.to = protocol::BlockVersion::V3_6_VERSION,
209+
.flags =
210+
{
211+
Flag::bugfix_statestorage_hash,
212+
Flag::bugfix_evm_create2_delegatecall_staticcall_codecopy,
213+
Flag::bugfix_event_log_order,
214+
Flag::bugfix_call_noaddr_return,
215+
Flag::bugfix_precompiled_codehash,
216+
Flag::bugfix_dmc_revert,
217+
}},
218+
{.to = protocol::BlockVersion::V3_6_1_VERSION,
219+
.flags =
220+
{
221+
Flag::bugfix_keypage_system_entry_hash,
222+
Flag::bugfix_internal_create_redundant_storage,
223+
}},
224+
{.to = protocol::BlockVersion::V3_7_0_VERSION,
225+
.flags =
226+
{
227+
Flag::bugfix_empty_abi_reset,
228+
Flag::bugfix_eip55_addr,
229+
Flag::bugfix_sharding_call_in_child_executive,
230+
Flag::bugfix_internal_create_permission_denied,
231+
}},
232+
{.to = protocol::BlockVersion::V3_8_0_VERSION,
233+
.flags =
234+
{
235+
Flag::bugfix_eoa_as_contract,
236+
Flag::bugfix_dmc_deploy_gas_used,
237+
Flag::bugfix_evm_exception_gas_used,
238+
Flag::bugfix_set_row_with_dirty_flag,
239+
}},
240+
{.to = protocol::BlockVersion::V3_9_0_VERSION,
241+
.flags =
242+
{
243+
Flag::bugfix_staticcall_noaddr_return,
244+
Flag::bugfix_support_transfer_receive_fallback,
245+
Flag::bugfix_eoa_match_failed,
246+
}},
247+
{.to = protocol::BlockVersion::V3_12_0_VERSION,
248+
.flags =
249+
{
250+
Flag::bugfix_rpbft_vrf_blocknumber_input,
251+
}},
252+
{.to = protocol::BlockVersion::V3_13_0_VERSION,
253+
.flags =
254+
{
255+
Flag::bugfix_delete_account_code,
256+
Flag::bugfix_policy1_empty_code_address,
257+
Flag::bugfix_precompiled_gasused,
258+
}},
259+
{.to = protocol::BlockVersion::V3_14_0_VERSION,
260+
.flags =
261+
{
262+
Flag::bugfix_nonce_not_increase_when_revert,
263+
Flag::bugfix_set_contract_nonce_when_create,
264+
}},
265+
{.to = protocol::BlockVersion::V3_15_1_VERSION,
266+
.flags = {Flag::bugfix_precompiled_gascalc}}});
265267
for (const auto& upgradeFeatures : upgradeRoadmap)
266268
{
267269
if (((toVersion < protocol::BlockVersion::V3_2_7_VERSION) &&
@@ -335,15 +337,15 @@ class Features
335337
{
336338
for (auto [flag, name, value] : flags())
337339
{
338-
if (value && !(ignoreDuplicate &&
339-
co_await storage2::existsOne(storage,
340-
executor_v1::StateKeyView(ledger::SYS_CONFIG, name))))
340+
if (value &&
341+
!(ignoreDuplicate && co_await storage2::existsOne(storage,
342+
executor_v1::StateKeyView(ledger::SYS_CONFIG, name))))
341343
{
342344
storage::Entry entry;
343345
entry.setObject(
344346
SystemConfigEntry{boost::lexical_cast<std::string>((int)value), blockNumber});
345-
co_await storage2::writeOne(storage,
346-
executor_v1::StateKey(ledger::SYS_CONFIG, name), std::move(entry));
347+
co_await storage2::writeOne(
348+
storage, executor_v1::StateKey(ledger::SYS_CONFIG, name), std::move(entry));
347349
}
348350
}
349351
}
@@ -379,8 +381,7 @@ inline task::Task<void> writeToStorage(Features const& features, auto&& storage,
379381
entry.setObject(SystemConfigEntry{
380382
boost::lexical_cast<std::string>((int)std::get<2>(tuple)), blockNumber});
381383
return std::make_tuple(
382-
executor_v1::StateKey(ledger::SYS_CONFIG, std::get<1>(tuple)),
383-
std::move(entry));
384+
executor_v1::StateKey(ledger::SYS_CONFIG, std::get<1>(tuple)), std::move(entry));
384385
}));
385386
}
386387

bcos-framework/bcos-framework/ledger/LedgerTypeDef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ inline task::Task<void> readFromStorage(
167167
{
168168
decltype(auto) keys = bcos::ledger::SystemConfigs::supportConfigs();
169169
auto entries = co_await storage2::readSome(std::forward<decltype(storage)>(storage),
170-
keys | RANGES::views::transform([](std::string_view key) {
170+
keys | ::ranges::views::transform([](std::string_view key) {
171171
return executor_v1::StateKeyView(ledger::SYS_CONFIG, key);
172172
}));
173-
for (auto&& [key, entry] : RANGES::views::zip(keys, entries))
173+
for (auto&& [key, entry] : ::ranges::views::zip(keys, entries))
174174
{
175175
if (entry)
176176
{

bcos-framework/bcos-framework/protocol/Protocol.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ enum ProtocolVersion : uint32_t
115115

116116
enum class BlockVersion : uint32_t
117117
{
118+
V3_15_1_VERSION = 0x030f0100, // 3.15.1
118119
V3_15_0_VERSION = 0x030f0000, // 3.15.0
119120
V3_14_0_VERSION = 0x030e0000, // 3.14.0
120121
V3_13_0_VERSION = 0x030d0000, // 3.13.0
@@ -150,7 +151,7 @@ enum class BlockVersion : uint32_t
150151
V3_0_VERSION = 0x03000000,
151152
RC4_VERSION = 4,
152153
MIN_VERSION = RC4_VERSION,
153-
MAX_VERSION = V3_15_0_VERSION, // 3.14.0
154+
MAX_VERSION = V3_15_1_VERSION, // 3.15.1
154155
};
155156

156157
enum class TransactionVersion : uint32_t
@@ -165,7 +166,7 @@ const std::string RC4_VERSION_STR = "3.0.0-rc4";
165166
const std::string RC_VERSION_PREFIX = "3.0.0-rc";
166167
const std::string V3_9_VERSION_STR = "3.9.0";
167168

168-
constexpr BlockVersion DEFAULT_VERSION = bcos::protocol::BlockVersion::V3_15_0_VERSION; // 3.14.0
169+
constexpr BlockVersion DEFAULT_VERSION = bcos::protocol::BlockVersion::V3_15_1_VERSION; // 3.15.1
169170
const std::string DEFAULT_VERSION_STR = V3_9_VERSION_STR;
170171
constexpr uint8_t MAX_MAJOR_VERSION = std::numeric_limits<uint8_t>::max();
171172
constexpr uint8_t MIN_MAJOR_VERSION = 3;

0 commit comments

Comments
 (0)