Skip to content
Draft
2 changes: 1 addition & 1 deletion cmake/gitinfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ macro(get_git_info)
file(APPEND ${VersionInc} "const std::string TOP_GIT_BRANCH = \"${TOP_GIT_BRANCH}\";\n")
file(APPEND ${VersionInc} "const std::string TOP_GIT_HASH = \"${TOP_GIT_HASH}\";\n")
file(APPEND ${VersionInc} "const std::string TOP_GIT_DATE = \"${TOP_GIT_DATE}\";\n")
file(APPEND ${VersionInc} "const std::string TOP_GIT_LOG_LATEST = ${TOP_GIT_LOG_LATEST};\n") # multiline
file(APPEND ${VersionInc} "const std::string TOP_GIT_LOG_LATEST = \"${TOP_GIT_LOG_LATEST}\";\n") # multiline
file(APPEND ${VersionInc} "const std::string TOP_GIT_SUBMODULE = \"${TOP_GIT_SUBMODULE}\";\n")
file(APPEND ${VersionInc} "const std::string TOP_BUILD_DATE = __DATE__;\n")
file(APPEND ${VersionInc} "const std::string TOP_BUILD_TIME = __TIME__;\n")
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/xapplication/src/xapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ void xtop_application::on_election_data_updated(data::election::xelection_result
}

if (!updated_election_data2.empty()) {
auto outdated_xips_pair = m_vnode_manager->handle_election_data(updated_election_data2);
for (const auto & xip : outdated_xips_pair.first) {
auto const outdated_xips_pair = m_vnode_manager->handle_election_data(updated_election_data2);
for (auto const & xip : outdated_xips_pair.first) {
m_elect_main->GetElectManager()->OnElectQuit(xip);
}
for (const auto & xip : outdated_xips_pair.second) {
for (auto const & xip : outdated_xips_pair.second) {
// m_cons_mgr->destroy({xip.raw_low_part(), xip.raw_high_part()});
m_txpool_service_mgr->destroy({xip.raw_low_part(), xip.raw_high_part()});
}
Expand Down
1 change: 0 additions & 1 deletion src/libraries/xelect/src/xelect_client_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ void xelect_client_process::update_election_status(common::xlogic_time_t current
auto const update_exchange_interval = nonconsensus_group_update_interval; // for mainnet & bounty
#endif
process_election_contract(common::xaccount_address_t{sys_contract_rec_elect_exchange_addr}, current_time, update_exchange_interval);
// }
}

{
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/xvnode/src/xvnode_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ std::pair<std::vector<common::xip2_t>, std::vector<common::xip2_t>> xtop_vnode_m
xwarn("[vnode mgr] vnode (%p) at address %s will outdate at logic time %" PRIu64, vnode.get(), vnode->address().to_string().c_str(), vnode->outdate_time());
}

xwarn("[vnode mgr] vnode at address %s is outdated", cluster_address.to_string().c_str());
// xwarn("[vnode mgr] vnode at address %s is outdated", cluster_address.to_string().c_str());
common::xip2_t xip{
cluster_address.network_id(),
cluster_address.zone_id(),
cluster_address.cluster_id(),
cluster_address.group_id(),
outdated_group->group_size(),
outdated_group->associated_blk_height()};
purely_outdated_xips.push_back(std::move(xip));
purely_outdated_xips.push_back(xip);
}

if (faded_group != nullptr && faded_group->contains(account_address)) {
Expand Down Expand Up @@ -187,7 +187,7 @@ std::pair<std::vector<common::xip2_t>, std::vector<common::xip2_t>> xtop_vnode_m

common::xip2_t xip{cluster_address.network_id(), cluster_address.zone_id(), cluster_address.cluster_id(), cluster_address.group_id()};

logical_outdated_xips.push_back(std::move(xip));
logical_outdated_xips.push_back(xip);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libraries/xvnode/xvnode_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class xtop_vnode_manager : public xvnode_manager_face_t

xwarn("[vnode mgr] vnode (%p) at address %s starts at logic time %" PRIu64 " current logic time %" PRIu64 " %s",
vnode.get(),
vnode->address().to_string().c_str(),
vnode->address().to_string().c_str(),
vnode->start_time(),
time,
vnode->address().xip2().to_string().c_str());
Expand Down
12 changes: 9 additions & 3 deletions src/xtools/xscripts/xip_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def main(argv):
if zone_id == 0:
if cluster_id == 1:
if 1 <= group_id < 64:
print("\taddress type: auditor")
print("\taddress type: consensus.auditor")
elif 64 <= group_id < 127:
print("\taddress type: validator")
print("\taddress type: consensus.validator")
else:
print("\taddress type: unknown cluster id")
elif zone_id == 1:
Expand All @@ -108,7 +108,13 @@ def main(argv):
elif zone_id == 3:
print("\taddress type: frozen")
elif zone_id == 4:
print("\taddress type: evm")
if cluster_id == 1:
if 1 <= group_id < 64:
print("\taddress type: evm.auditor")
elif 64 <= group_id < 127:
print("\taddress type: evm.validator")
else:
print("\taddress type: unknown cluster id")
elif zone_id == 5:
print("\taddress type: relay")
elif zone_id == 13:
Expand Down
18 changes: 10 additions & 8 deletions src/xtopcom/xbasic/xbitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ class xtop_bitset {

public:
constexpr xtop_bitset() = default;
xtop_bitset(xtop_bitset const &) = default;
xtop_bitset(xtop_bitset&&) = default;
xtop_bitset& operator=(xtop_bitset const &) = default;
xtop_bitset& operator=(xtop_bitset&&) = default;
~xtop_bitset() = default;
//xtop_bitset(xtop_bitset const &) = default;
//xtop_bitset(xtop_bitset&&) = default;
//xtop_bitset& operator=(xtop_bitset const &) = default;
//xtop_bitset& operator=(xtop_bitset&&) = default;
//~xtop_bitset() = default;

using reference = typename std::bitset<N>::reference;

Expand All @@ -70,7 +70,7 @@ class xtop_bitset {
}

if (!is_hex_string_without_prefix(str_view)) {
ec = error::xbasic_errc_t::invalid_hex_string;
ec = error::xbasic_errc_t::invalid_hex_string;
return {};
}

Expand Down Expand Up @@ -99,11 +99,13 @@ class xtop_bitset {
return {};
}

std::string tmp;
if (sb == xsignificant_bit_t::lsb0) {
tmp = std::string{std::begin(str_view), std::end(str_view)};
auto tmp = std::string{std::begin(str_view), std::end(str_view)};
std::reverse(std::begin(tmp), std::end(tmp));
str_view = xstring_view_t{tmp};

str_view = str_view.substr(str_view.size() - std::min(N, str_view.size()));
return {std::bitset<N>{str_view.data(), str_view.size()}};
}

str_view = str_view.substr(str_view.size() - std::min(N, str_view.size()));
Expand Down
72 changes: 72 additions & 0 deletions src/xtopcom/xcommon/rlp.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ class RLP
/// Decodes data, remainder from RLP encoded data
static DecodedItem decode(xbytes_t const & input);
static DecodedItem decode_once(xbytes_t const & input);
static DecodedItem decode_once(xbytes_t const & input, std::error_code & ec);
static DecodedItem decode_list_once(xbytes_t const & input, std::error_code & ec);

static DecodedItem decode_list(xbytes_t const & input, std::error_code & ec);
static DecodedItem decode(xbytes_t const & input, std::error_code & ec);
Expand Down Expand Up @@ -613,6 +615,76 @@ extern xbytes_t RLPEmptyList;
/// Human readable version of RLP.
std::ostream& operator<<(std::ostream& _out, RLP const& _d);

enum class xenum_rlp_object_type {
invalid,
bytes,
list
};
using xrlp_object_type_t = xenum_rlp_object_type;

struct xtop_rlp_object;
using xrlp_object_t = xtop_rlp_object;

struct xtop_rlp_bytes {
std::size_t size{0};
xbyte_t const * ptr;
};

struct xtop_rlp_list {
std::size_t size{0};
xrlp_object_t * ptr;

};

//struct xtop_rlp_decoded_raw {
//
//};

struct xtop_rlp_decoded_raw {
std::size_t offset{0};
std::size_t length{0};
xrlp_object_type_t type{xenum_rlp_object_type::invalid};

xtop_rlp_decoded_raw() = default;
xtop_rlp_decoded_raw(std::size_t offset, std::size_t length, xrlp_object_type_t type);
};
using xrlp_decoded_raw_t = xtop_rlp_decoded_raw;

class xtop_rlp_decoder {
public:
static void decode(xspan_t<xbyte_t const> rlp_encoded_bytes, std::vector<xrlp_decoded_raw_t> & result, std::error_code & ec);

private:
static auto parse_length(xspan_t<xbyte_t const> rlp_encoded_bytes, std::error_code & ec) -> xrlp_decoded_raw_t;
static auto to_integer(xspan_t<xbyte_t const> rlp_encoded_bytes, std::error_code & ec) -> std::uint64_t;
static auto decode_list(xspan_t<xbyte_t const> rlp_encoded_bytes, std::error_code & ec) -> std::vector<xrlp_decoded_raw_t>;
};
using xrlp_object_parser_t = xtop_rlp_decoder;

class xtop_rlp_encoder {
public:
static auto encode(xbyte_t const * data, std::size_t length) -> xbytes_t;
static auto encode(char const * data, std::size_t length) -> xbytes_t;

static auto encode(std::uint64_t integer) -> xbytes_t;
static auto encode(u256 const & number) -> xbytes_t;

template <typename T>
static auto encode(T const & object) -> xbytes_t {
xbytes_t bytes = object.encode();

auto result = encode_length(bytes.size(), 0xC0);
std::copy(std::begin(bytes), std::end(bytes), std::back_inserter(result));

return result;
}

private:
static auto encode_length(std::size_t length, std::uint8_t offset) -> xbytes_t;
static auto to_big_ending(uint64_t integer) -> xbytes_t;
static auto to_big_endian(u256 const & number) -> xbytes_t;
};
using xrlp_encoder_t = xtop_rlp_encoder;

}
}
Loading