8namespace sysio {
namespace chain {
10using shared_public_key_data = std::variant<fc::ecc::public_key_shim, fc::crypto::r1::public_key_shim, shared_string, fc::em::public_key_shim>;
19 [&](
const auto& k1r1em) {
20 public_key_storage = k1r1em;
26 public_key_storage =
pub;
29 return std::move(public_key_storage);
44 return k1._data == std::get<fc::ecc::public_key_shim>(rhs.
pubkey)._data;
47 return em._data == std::get<fc::em::public_key_shim>(rhs.
pubkey)._data;
50 return r1._data == std::get<fc::crypto::r1::public_key_shim>(rhs.
pubkey)._data;
53 return wa == std::get<shared_string>(rhs.
pubkey);
59 if(
l.pubkey.index() !=
r._storage.index())
64 return k1._data == std::get<fc::ecc::public_key_shim>(
r._storage)._data;
67 return em._data == std::get<fc::em::public_key_shim>(
r._storage)._data;
70 return r1._data == std::get<fc::crypto::r1::public_key_shim>(
r._storage)._data;
76 return pub == std::get<fc::crypto::webauthn::public_key>(
r._storage);
115 [&](
const auto& k1r1em) {
169 if( delay_sec > 0 ) {
178 if( delay_sec > 0 ) {
210 keys.reserve(
a.keys.size());
228 auth.
keys.reserve(keys.size());
231 for(
const auto& k : keys ) { auth.
keys.emplace_back( k ); }
233 for(
const auto& w :
waits ) { auth.
waits.emplace_back( w ); }
240 size_t keys_size = 0;
241 for (
const auto& k: keys) {
246 return accounts_size + waits_size + keys_size;
253 static const uint64_t value = (3 * config::fixed_overhead_shared_vector_ram_bytes) + 4;
261template<
typename Authority>
263 decltype(auth.threshold) total_weight = 0;
265 static_assert( std::is_same<
decltype(auth.threshold),
uint32_t>
::value &&
266 std::is_same<weight_type, uint16_t>::value &&
270 "unexpected type for threshold and/or weight in authority" );
272 if( ( auth.keys.size() + auth.accounts.size() + auth.waits.size() ) > (1 << 16) )
275 if( auth.threshold == 0 )
280 for(
const auto& k : auth.keys ) {
281 if( prev && !(prev->
key < k.key) )
return false;
282 total_weight += k.weight;
288 for(
const auto&
a : auth.accounts ) {
290 total_weight +=
a.weight;
296 if( auth.waits.size() > 0 && auth.waits.front().wait_sec == 0 )
298 for(
const auto& w : auth.waits ) {
299 if( prev && ( prev->
wait_sec >= w.wait_sec ) )
return false;
300 total_weight += w.weight;
void resize_and_fill(std::size_t new_size, F &&f)
std::variant< ecc::public_key_shim, r1::public_key_shim, webauthn::public_key, em::public_key_shim > storage_type
std::string to_string(const fc::yield_function_t &yield=fc::yield_function_t()) const
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
bip::allocator< T, pinnable_mapped_file::segment_manager > allocator
void unpack(Stream &s, std::deque< T > &value)
void pack(Stream &s, const std::deque< T > &value)
size_t pack_size(const T &v)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
constexpr uint64_t billable_size_v
fc::crypto::public_key public_key_type
std::variant< fc::ecc::public_key_shim, fc::crypto::r1::public_key_shim, shared_string, fc::em::public_key_shim > shared_public_key_data
boost::interprocess::vector< T, allocator< T > > shared_vector
bool validate(const Authority &auth)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
unsigned __int64 uint64_t
authority(public_key_type k, uint32_t delay_sec=0)
authority(uint32_t t, vector< key_weight > k, vector< permission_level_weight > p={}, vector< wait_weight > w={})
friend bool operator!=(const authority &lhs, const authority &rhs)
friend bool operator==(const authority &lhs, const authority &rhs)
vector< wait_weight > waits
vector< permission_level_weight > accounts
authority(permission_level p, uint32_t delay_sec=0)
vector< key_weight > keys
friend bool operator==(const key_weight &lhs, const key_weight &rhs)
friend bool operator==(const permission_level_weight &lhs, const permission_level_weight &rhs)
permission_level permission
permission_name permission
size_t get_billable_size() const
shared_authority(chainbase::allocator< char > alloc)
shared_vector< permission_level_weight > accounts
authority to_authority() const
shared_vector< wait_weight > waits
shared_authority & operator=(const authority &a)
shared_vector< shared_key_weight > keys
friend bool operator==(const shared_key_weight &lhs, const shared_key_weight &rhs)
static shared_key_weight convert(chainbase::allocator< char > allocator, const key_weight &k)
shared_key_weight(shared_public_key_data &&k, const weight_type &w)
shared_public_key_data pubkey
friend bool operator==(const public_key_type &l, const shared_public_key &r)
friend bool operator==(const shared_public_key &lhs, const shared_public_key &rhs)
std::string to_string() const
shared_public_key(shared_public_key_data &&p)
friend bool operator==(const shared_public_key &l, const public_key_type &r)
friend bool operator==(const wait_weight &lhs, const wait_weight &rhs)