8namespace sysio {
namespace chain {
35 if(
a.version != b.
version )
return false;
36 if (
a.producers.size() != b.
producers.size() )
return false;
37 for(
uint32_t i = 0; i <
a.producers.size(); ++i )
38 if(
a.producers[i] != b.
producers[i] )
return false;
101 static constexpr std::string_view
abi_type_name() {
return "block_signing_authority_v0"; }
106 template<
typename Op>
108 for (
const auto& kw : keys ) {
114 size_t num_relevant_keys = 0;
116 for (
const auto& kw : keys ) {
117 const auto& iter = presented_keys.find(kw.key);
118 if (iter != presented_keys.end()) {
122 total_weight += std::min<uint32_t>(std::numeric_limits<uint32_t>::max() - total_weight, kw.weight);
127 return {total_weight >=
threshold, num_relevant_keys};
134 result.keys.reserve(keys.size());
135 for (
const auto& k: keys) {
145 result.keys.reserve(src.
keys.size());
146 for (
const auto& k: src.
keys) {
147 result.keys.push_back(k);
167 template<
typename Op>
169 std::visit([&
op](
const auto &
a){
170 a.for_each_key(std::forward<Op>(
op));
174 template<
typename Op>
180 return std::visit([&keys](
const auto &
a){
181 return a.keys_satisfy_and_relevant(keys);
190 auto shared_auth = std::visit([&alloc](
const auto&
a) {
191 return a.to_shared(alloc);
252 result.version = version;
253 result.producers.clear();
254 result.producers.reserve(
producers.size() );
256 result.producers.emplace_back(
p.to_shared(alloc));
264 result.producers.reserve(src.
producers.size());
277 if(
a.version != b.
version )
return false;
278 if (
a.producers.size() != b.
producers.size() )
return false;
279 for(
uint32_t i = 0; i <
a.producers.size(); ++i )
280 if( ! (
a.producers[i] == b.
producers[i]) )
return false;
315 bool authority_matches = std::visit([&pb](
const auto& lhs ){
316 return std::visit( [&lhs](
const auto& rhs ) {
317 if (lhs.threshold != rhs.threshold)
return false;
318 return std::equal(lhs.keys.cbegin(), lhs.keys.cend(), rhs.keys.cbegin(), rhs.keys.cend());
322 if (!authority_matches)
return false;
335FC_REFLECT(
sysio::chain::shared_block_signing_authority_v0, (threshold)(keys))
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
bip::allocator< T, pinnable_mapped_file::segment_manager > allocator
bool operator==(const permission_level &lhs, const permission_level &rhs)
std::variant< shared_block_signing_authority_v0 > shared_block_signing_authority
bool operator!=(const permission_level &lhs, const permission_level &rhs)
std::variant< block_signing_authority_v0 > block_signing_authority
boost::interprocess::vector< T, allocator< T > > shared_vector
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
schedule config_dir_name data_dir_name p2p_port http_port file_size name name keys peers producers(dont_start)) FC_REFLECT(testnet_def
producer_name(block_signing_key)) FC_REFLECT(producer_set_def
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
#define FC_REFLECT_DERIVED(TYPE, INHERITS, MEMBERS)
Specializes fc::reflector for TYPE where type inherits other reflected classes.
void for_each_key(Op &&op) const
auto to_shared(chainbase::allocator< char > alloc) const
static constexpr std::string_view abi_type_name()
vector< key_weight > keys
friend bool operator!=(const block_signing_authority_v0 &lhs, const block_signing_authority_v0 &rhs)
static auto from_shared(const shared_block_signing_authority_v0 &src)
friend bool operator==(const block_signing_authority_v0 &lhs, const block_signing_authority_v0 &rhs)
std::pair< bool, size_t > keys_satisfy_and_relevant(const std::set< public_key_type > &presented_keys) const
public_key_type block_signing_key
account_name producer_name
friend bool operator!=(const producer_key &lhs, const producer_key &rhs)
friend bool operator==(const producer_key &lhs, const producer_key &rhs)
friend bool operator==(const producer_schedule_type &a, const producer_schedule_type &b)
uint32_t version
sequentially incrementing version number
vector< producer_key > producers
friend bool operator!=(const producer_schedule_type &a, const producer_schedule_type &b)
Immutable except for fc::from_variant.
producer_authority_schedule(const legacy::producer_schedule_type &old)
uint32_t version
sequentially incrementing version number
static auto from_shared(const shared_producer_authority_schedule &src)
producer_authority_schedule()=default
producer_authority_schedule(uint32_t version, std::initializer_list< producer_authority > producers)
auto to_shared(chainbase::allocator< char > alloc) const
vector< producer_authority > producers
static auto from_shared(const shared_producer_authority &src)
block_signing_authority authority
friend bool operator==(const producer_authority &lhs, const producer_authority &rhs)
auto to_shared(chainbase::allocator< char > alloc) const
friend bool operator!=(const producer_authority &lhs, const producer_authority &rhs)
static std::pair< bool, size_t > keys_satisfy_and_relevant(const std::set< public_key_type > &keys, const block_signing_authority &authority)
void for_each_key(Op &&op) const
fc::variant get_abi_variant() const
static void for_each_key(const block_signing_authority &authority, Op &&op)
std::pair< bool, size_t > keys_satisfy_and_relevant(const std::set< public_key_type > &presented_keys) const
static constexpr uint16_t extension_id()
producer_schedule_change_extension()=default
producer_schedule_change_extension(const producer_authority_schedule &sched)
static constexpr bool enforce_unique()
producer_schedule_change_extension & operator=(const producer_schedule_change_extension &)=default
producer_schedule_change_extension(producer_schedule_change_extension &&)=default
producer_schedule_change_extension & operator=(producer_schedule_change_extension &&)=default
producer_schedule_change_extension(const producer_schedule_change_extension &)=default
shared_block_signing_authority_v0(const shared_block_signing_authority_v0 &)=default
shared_block_signing_authority_v0(chainbase::allocator< char > alloc)
shared_block_signing_authority_v0 & operator=(shared_block_signing_authority_v0 &&)=default
shared_vector< shared_key_weight > keys
shared_block_signing_authority_v0(shared_block_signing_authority_v0 &&)=default
shared_block_signing_authority_v0()=delete
static shared_key_weight convert(chainbase::allocator< char > allocator, const key_weight &k)
shared_producer_authority_schedule(shared_producer_authority_schedule &&)=default
shared_vector< shared_producer_authority > producers
shared_producer_authority_schedule(const shared_producer_authority_schedule &)=default
shared_producer_authority_schedule & operator=(shared_producer_authority_schedule &&)=default
uint32_t version
sequentially incrementing version number
shared_producer_authority_schedule(chainbase::allocator< char > alloc)
shared_producer_authority_schedule()=delete
shared_block_signing_authority authority
shared_producer_authority & operator=(shared_producer_authority &&)=default
shared_producer_authority(shared_producer_authority &&)=default
shared_producer_authority()=delete
shared_producer_authority(const name &producer_name, shared_block_signing_authority &&authority)
shared_producer_authority(const shared_producer_authority &)=default