Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
authorization_manager.cpp
Go to the documentation of this file.
10#include <boost/tuple/tuple_io.hpp>
14
15
16namespace sysio { namespace chain {
17
22 >;
23
26
28 authorization_index_set::add_indices(_db);
29 }
30
34
35 namespace detail {
36 template<>
40
43 res.name = value.name;
44 res.owner = value.owner;
45 res.last_updated = value.last_updated;
46 res.auth = value.auth.to_authority();
47
48 // lookup parent name
49 const auto& parent = db.get(value.parent);
50 res.parent = parent.name;
51
52 // lookup the usage object
53 const auto& usage = db.get<permission_usage_object>(value.usage_id);
54 res.last_used = usage.last_used;
55
56 return res;
57 };
58
60 value.name = row.name;
61 value.owner = row.owner;
62 value.last_updated = row.last_updated;
63 value.auth = row.auth;
64
65 value.parent = 0;
66 if (value.id == 0) {
67 SYS_ASSERT(row.parent == permission_name(), snapshot_exception, "Unexpected parent name on reserved permission 0");
68 SYS_ASSERT(row.name == permission_name(), snapshot_exception, "Unexpected permission name on reserved permission 0");
69 SYS_ASSERT(row.owner == name(), snapshot_exception, "Unexpected owner name on reserved permission 0");
70 SYS_ASSERT(row.auth.accounts.size() == 0, snapshot_exception, "Unexpected auth accounts on reserved permission 0");
71 SYS_ASSERT(row.auth.keys.size() == 0, snapshot_exception, "Unexpected auth keys on reserved permission 0");
72 SYS_ASSERT(row.auth.waits.size() == 0, snapshot_exception, "Unexpected auth waits on reserved permission 0");
73 SYS_ASSERT(row.auth.threshold == 0, snapshot_exception, "Unexpected auth threshold on reserved permission 0");
74 SYS_ASSERT(row.last_updated == time_point(), snapshot_exception, "Unexpected auth last updated on reserved permission 0");
75 value.parent = 0;
76 } else if ( row.parent != permission_name()){
77 const auto& parent = db.get<permission_object, by_owner>(boost::make_tuple(row.owner, row.parent));
78
79 SYS_ASSERT(parent.id != 0, snapshot_exception, "Unexpected mapping to reserved permission 0");
80 value.parent = parent.id;
81 }
82
83 if (value.id != 0) {
84 // create the usage object
85 const auto& usage = db.create<permission_usage_object>([&](auto& p) {
86 p.last_used = row.last_used;
87 });
88 value.usage_id = usage.id;
89 } else {
90 value.usage_id = 0;
91 }
92 }
93 };
94 }
95
97 authorization_index_set::walk_indices([this, &snapshot]( auto utils ){
98 using section_t = typename decltype(utils)::index_t::value_type;
99
100 // skip the permission_usage_index as its inlined with permission_index
101 if (std::is_same<section_t, permission_usage_object>::value) {
102 return;
103 }
104
105 snapshot->write_section<section_t>([this]( auto& section ){
106 decltype(utils)::walk(_db, [this, &section]( const auto &row ) {
107 section.add_row(row, _db);
108 });
109 });
110 });
111 }
112
114 authorization_index_set::walk_indices([this, &snapshot]( auto utils ){
115 using section_t = typename decltype(utils)::index_t::value_type;
116
117 // skip the permission_usage_index as its inlined with permission_index
118 if (std::is_same<section_t, permission_usage_object>::value) {
119 return;
120 }
121
122 snapshot->read_section<section_t>([this]( auto& section ) {
123 bool more = !section.empty();
124 while(more) {
125 decltype(utils)::create(_db, [this, &section, &more]( auto &row ) {
126 more = section.read_row(row, _db);
127 });
128 }
129 });
130 });
131 }
132
135 permission_id_type parent,
136 const authority& auth,
137 time_point initial_creation_time
138 )
139 {
140 for(const key_weight& k: auth.keys)
141 SYS_ASSERT(k.key.which() < _db.get<protocol_state_object>().num_supported_key_types, unactivated_key_type,
142 "Unactivated key type used when creating permission");
143
144 auto creation_time = initial_creation_time;
145 if( creation_time == time_point() ) {
146 creation_time = _control.pending_block_time();
147 }
148
149 const auto& perm_usage = _db.create<permission_usage_object>([&](auto& p) {
150 p.last_used = creation_time;
151 });
152
153 const auto& perm = _db.create<permission_object>([&](auto& p) {
154 p.usage_id = perm_usage.id;
155 p.parent = parent;
156 p.owner = account;
157 p.name = name;
158 p.last_updated = creation_time;
159 p.auth = auth;
160
161 if (auto dm_logger = _control.get_deep_mind_logger()) {
162 dm_logger->on_create_permission(p);
163 }
164 });
165 return perm;
166 }
167
170 permission_id_type parent,
171 authority&& auth,
172 time_point initial_creation_time
173 )
174 {
175 for(const key_weight& k: auth.keys)
176 SYS_ASSERT(k.key.which() < _db.get<protocol_state_object>().num_supported_key_types, unactivated_key_type,
177 "Unactivated key type used when creating permission");
178
179 auto creation_time = initial_creation_time;
180 if( creation_time == time_point() ) {
181 creation_time = _control.pending_block_time();
182 }
183
184 const auto& perm_usage = _db.create<permission_usage_object>([&](auto& p) {
185 p.last_used = creation_time;
186 });
187
188 const auto& perm = _db.create<permission_object>([&](auto& p) {
189 p.usage_id = perm_usage.id;
190 p.parent = parent;
191 p.owner = account;
192 p.name = name;
193 p.last_updated = creation_time;
194 p.auth = std::move(auth);
195
196 if (auto dm_logger = _control.get_deep_mind_logger()) {
197 dm_logger->on_create_permission(p);
198 }
199 });
200 return perm;
201 }
202
204 for(const key_weight& k: auth.keys)
205 SYS_ASSERT(k.key.which() < _db.get<protocol_state_object>().num_supported_key_types, unactivated_key_type,
206 "Unactivated key type used when modifying permission");
207
208 _db.modify( permission, [&](permission_object& po) {
209 auto dm_logger = _control.get_deep_mind_logger();
210
211 std::optional<permission_object> old_permission;
212 if (dm_logger) {
213 old_permission = po;
214 }
215
216 po.auth = auth;
217 po.last_updated = _control.pending_block_time();
218
219 if (auto dm_logger = _control.get_deep_mind_logger()) {
220 dm_logger->on_modify_permission(*old_permission, po);
221 }
222 });
223 }
224
226 const auto& index = _db.template get_index<permission_index, by_parent>();
227 auto range = index.equal_range(permission.id);
228 SYS_ASSERT( range.first == range.second, action_validate_exception,
229 "Cannot remove a permission which has children. Remove the children first.");
230
231 _db.get_mutable_index<permission_usage_index>().remove_object( permission.usage_id._id );
232
233 if (auto dm_logger = _control.get_deep_mind_logger()) {
234 dm_logger->on_remove_permission(permission);
235 }
236
237 _db.remove( permission );
238 }
239
241 const auto& puo = _db.get<permission_usage_object, by_id>( permission.usage_id );
242 _db.modify( puo, [&](permission_usage_object& p) {
243 p.last_used = _control.pending_block_time();
244 });
245 }
246
248 return _db.get<permission_usage_object, by_id>( permission.usage_id ).last_used;
249 }
250
252 { try {
253 SYS_ASSERT( !level.actor.empty() && !level.permission.empty(), invalid_permission, "Invalid permission" );
254 return _db.find<permission_object, by_owner>( boost::make_tuple(level.actor,level.permission) );
255 } SYS_RETHROW_EXCEPTIONS( chain::permission_query_exception, "Failed to retrieve permission: ${level}", ("level", level) ) }
256
258 { try {
259 SYS_ASSERT( !level.actor.empty() && !level.permission.empty(), invalid_permission, "Invalid permission" );
260 return _db.get<permission_object, by_owner>( boost::make_tuple(level.actor,level.permission) );
261 } SYS_RETHROW_EXCEPTIONS( chain::permission_query_exception, "Failed to retrieve permission: ${level}", ("level", level) ) }
262
263 std::optional<permission_name> authorization_manager::lookup_linked_permission( account_name authorizer_account,
264 account_name scope,
265 action_name act_name
266 )const
267 {
268 try {
269 // First look up a specific link for this message act_name
270 auto key = boost::make_tuple(authorizer_account, scope, act_name);
271 auto link = _db.find<permission_link_object, by_action_name>(key);
272 // If no specific link found, check for a contract-wide default
273 if (link == nullptr) {
274 boost::get<2>(key) = {};
275 link = _db.find<permission_link_object, by_action_name>(key);
276 }
277
278 // If no specific or default link found, use active permission
279 if (link != nullptr) {
280 return link->required_permission;
281 }
282 return std::optional<permission_name>();
283 } FC_CAPTURE_AND_RETHROW((authorizer_account)(scope)(act_name))
284 }
285
286 std::optional<permission_name> authorization_manager::lookup_minimum_permission( account_name authorizer_account,
287 account_name scope,
288 action_name act_name
289 )const
290 {
291 // Special case native actions cannot be linked to a minimum permission, so there is no need to check.
292 if( scope == config::system_account_name ) {
293 SYS_ASSERT( act_name != updateauth::get_name() &&
294 act_name != deleteauth::get_name() &&
295 act_name != linkauth::get_name() &&
296 act_name != unlinkauth::get_name() &&
297 act_name != canceldelay::get_name(),
298 unlinkable_min_permission_action,
299 "cannot call lookup_minimum_permission on native actions that are not allowed to be linked to minimum permissions" );
300 }
301
302 try {
303 std::optional<permission_name> linked_permission = lookup_linked_permission(authorizer_account, scope, act_name);
304 if( !linked_permission )
305 return config::active_name;
306
307 if( *linked_permission == config::sysio_any_name )
308 return std::optional<permission_name>();
309
310 return linked_permission;
311 } FC_CAPTURE_AND_RETHROW((authorizer_account)(scope)(act_name))
312 }
313
314 void authorization_manager::check_updateauth_authorization( const updateauth& update,
315 const vector<permission_level>& auths
316 )const
317 {
318 SYS_ASSERT( auths.size() == 1, irrelevant_auth_exception,
319 "updateauth action should only have one declared authorization" );
320 const auto& auth = auths[0];
321
322 // ** OR statement is custom, added to allow for sysio to add 'auth.ext' and 'auth.session' to users via our custom 'onlinkauth' from system contract.
323 SYS_ASSERT( (auth.actor == update.account || auth.actor == name("sysio")), irrelevant_auth_exception,
324 "the owner of the affected permission needs to be the actor of the declared authorization" );
325
326 // ** New: Prevents users from updating / adding 'auth.ext' and 'auth.session' special permissions.
327 if(update.permission == name("auth.ext") || update.permission == name("auth.session")) {
328 SYS_ASSERT( auth.actor == name("sysio"), invalid_permission, "Special permission, only assignable by 'sysio' as a result of 'onlinkauth'" );
329 } else {
330 const auto* min_permission = find_permission({update.account, update.permission});
331 if( !min_permission ) { // creating a new permission
332 min_permission = &get_permission({update.account, update.parent});
333 }
334
335 SYS_ASSERT( get_permission(auth).satisfies( *min_permission,
336 _db.get_index<permission_index>().indices() ),
337 irrelevant_auth_exception,
338 "updateauth action declares irrelevant authority '${auth}'; minimum authority is ${min}",
339 ("auth", auth)("min", permission_level{update.account, min_permission->name}) );
340 }
341 }
342
343 void authorization_manager::check_deleteauth_authorization( const deleteauth& del,
344 const vector<permission_level>& auths
345 )const
346 {
347 SYS_ASSERT( auths.size() == 1, irrelevant_auth_exception,
348 "deleteauth action should only have one declared authorization" );
349 const auto& auth = auths[0];
350 SYS_ASSERT( auth.actor == del.account, irrelevant_auth_exception,
351 "the owner of the permission to delete needs to be the actor of the declared authorization" );
352
353 const auto& min_permission = get_permission({del.account, del.permission});
354
355 SYS_ASSERT( get_permission(auth).satisfies( min_permission,
356 _db.get_index<permission_index>().indices() ),
357 irrelevant_auth_exception,
358 "updateauth action declares irrelevant authority '${auth}'; minimum authority is ${min}",
359 ("auth", auth)("min", permission_level{min_permission.owner, min_permission.name}) );
360 }
361
362 void authorization_manager::check_linkauth_authorization( const linkauth& link,
363 const vector<permission_level>& auths
364 )const
365 {
366 SYS_ASSERT( auths.size() == 1, irrelevant_auth_exception,
367 "link action should only have one declared authorization" );
368 const auto& auth = auths[0];
369 SYS_ASSERT( auth.actor == link.account, irrelevant_auth_exception,
370 "the owner of the linked permission needs to be the actor of the declared authorization" );
371
372 if( link.code == config::system_account_name
374 {
376 "Cannot link sysio::updateauth to a minimum permission" );
378 "Cannot link sysio::deleteauth to a minimum permission" );
380 "Cannot link sysio::linkauth to a minimum permission" );
382 "Cannot link sysio::unlinkauth to a minimum permission" );
384 "Cannot link sysio::canceldelay to a minimum permission" );
385 }
386
387 const auto linked_permission_name = lookup_minimum_permission(link.account, link.code, link.type);
388
389 if( !linked_permission_name ) // if action is linked to sysio.any permission
390 return;
391
392 SYS_ASSERT( get_permission(auth).satisfies( get_permission({link.account, *linked_permission_name}),
393 _db.get_index<permission_index>().indices() ),
394 irrelevant_auth_exception,
395 "link action declares irrelevant authority '${auth}'; minimum authority is ${min}",
396 ("auth", auth)("min", permission_level{link.account, *linked_permission_name}) );
397 }
398
399 void authorization_manager::check_unlinkauth_authorization( const unlinkauth& unlink,
400 const vector<permission_level>& auths
401 )const
402 {
403 SYS_ASSERT( auths.size() == 1, irrelevant_auth_exception,
404 "unlink action should only have one declared authorization" );
405 const auto& auth = auths[0];
406 SYS_ASSERT( auth.actor == unlink.account, irrelevant_auth_exception,
407 "the owner of the linked permission needs to be the actor of the declared authorization" );
408
409 const auto unlinked_permission_name = lookup_linked_permission(unlink.account, unlink.code, unlink.type);
410 SYS_ASSERT( unlinked_permission_name, transaction_exception,
411 "cannot unlink non-existent permission link of account '${account}' for actions matching '${code}::${action}'",
412 ("account", unlink.account)("code", unlink.code)("action", unlink.type) );
413
414 if( *unlinked_permission_name == config::sysio_any_name )
415 return;
416
417 SYS_ASSERT( get_permission(auth).satisfies( get_permission({unlink.account, *unlinked_permission_name}),
418 _db.get_index<permission_index>().indices() ),
419 irrelevant_auth_exception,
420 "unlink action declares irrelevant authority '${auth}'; minimum authority is ${min}",
421 ("auth", auth)("min", permission_level{unlink.account, *unlinked_permission_name}) );
422 }
423
424 fc::microseconds authorization_manager::check_canceldelay_authorization( const canceldelay& cancel,
425 const vector<permission_level>& auths
426 )const
427 {
428 SYS_ASSERT( auths.size() == 1, irrelevant_auth_exception,
429 "canceldelay action should only have one declared authorization" );
430 const auto& auth = auths[0];
431
432 SYS_ASSERT( get_permission(auth).satisfies( get_permission(cancel.canceling_auth),
433 _db.get_index<permission_index>().indices() ),
434 irrelevant_auth_exception,
435 "canceldelay action declares irrelevant authority '${auth}'; specified authority to satisfy is ${min}",
436 ("auth", auth)("min", cancel.canceling_auth) );
437
438 const auto& trx_id = cancel.trx_id;
439
440 const auto& generated_transaction_idx = _control.db().get_index<generated_transaction_multi_index>();
441 const auto& generated_index = generated_transaction_idx.indices().get<by_trx_id>();
442 const auto& itr = generated_index.lower_bound(trx_id);
443 SYS_ASSERT( itr != generated_index.end() && itr->sender == account_name() && itr->trx_id == trx_id,
444 tx_not_found,
445 "cannot cancel trx_id=${tid}, there is no deferred transaction with that transaction id",
446 ("tid", trx_id) );
447
448 auto trx = fc::raw::unpack<transaction>(itr->packed_trx.data(), itr->packed_trx.size());
449 bool found = false;
450 for( const auto& act : trx.actions ) {
451 for( const auto& auth : act.authorization ) {
452 if( auth == cancel.canceling_auth ) {
453 found = true;
454 break;
455 }
456 }
457 if( found ) break;
458 }
459
461 "canceling_auth in canceldelay action was not found as authorization in the original delayed transaction" );
462
463 return (itr->delay_until - itr->published);
464 }
465
467
469
470 void
472 const flat_set<public_key_type>& provided_keys,
473 const flat_set<permission_level>& provided_permissions,
474 fc::microseconds provided_delay,
475 const std::function<void()>& _checktime,
476 bool allow_unused_keys,
477 bool check_but_dont_fail,
478 const flat_set<permission_level>& satisfied_authorizations
479 )const
480 {
481 const auto& checktime = ( static_cast<bool>(_checktime) ? _checktime : _noop_checktime );
482
483 auto delay_max_limit = fc::seconds( _control.get_global_properties().configuration.max_transaction_delay );
484
485 auto effective_provided_delay = (provided_delay >= delay_max_limit) ? fc::microseconds::maximum() : provided_delay;
486
487 auto checker = make_auth_checker( [&](const permission_level& p){ return get_permission(p).auth; },
488 _control.get_global_properties().configuration.max_authority_depth,
489 provided_keys,
490 provided_permissions,
491 effective_provided_delay,
492 checktime
493 );
494
495 map<permission_level, fc::microseconds> permissions_to_satisfy;
496
497 for( const auto& act : actions ) {
498 bool special_case = false;
499 fc::microseconds delay = effective_provided_delay;
500
501 if( act.account == config::system_account_name ) {
502 special_case = true;
503
504 if( act.name == updateauth::get_name() ) {
505 check_updateauth_authorization( act.data_as<updateauth>(), act.authorization );
506 } else if( act.name == deleteauth::get_name() ) {
507 check_deleteauth_authorization( act.data_as<deleteauth>(), act.authorization );
508 } else if( act.name == linkauth::get_name() ) {
509 check_linkauth_authorization( act.data_as<linkauth>(), act.authorization );
510 } else if( act.name == unlinkauth::get_name() ) {
511 check_unlinkauth_authorization( act.data_as<unlinkauth>(), act.authorization );
512 } else if( act.name == canceldelay::get_name() ) {
513 delay = std::max( delay, check_canceldelay_authorization(act.data_as<canceldelay>(), act.authorization) );
514 } else {
515 special_case = false;
516 }
517 }
518
519 for( const auto& declared_auth : act.authorization ) {
520
521 checktime();
522
523 if( !special_case ) {
524 auto min_permission_name = lookup_minimum_permission(declared_auth.actor, act.account, act.name);
525 if( min_permission_name ) { // since special cases were already handled, it should only be false if the permission is sysio.any
526 const auto& min_permission = get_permission({declared_auth.actor, *min_permission_name});
527 SYS_ASSERT( get_permission(declared_auth).satisfies( min_permission,
528 _db.get_index<permission_index>().indices() ),
529 irrelevant_auth_exception,
530 "action declares irrelevant authority '${auth}'; minimum authority is ${min}",
531 ("auth", declared_auth)("min", permission_level{min_permission.owner, min_permission.name}) );
532 }
533 }
534
535 if( satisfied_authorizations.find( declared_auth ) == satisfied_authorizations.end() ) {
536 auto res = permissions_to_satisfy.emplace( declared_auth, delay );
537 if( !res.second && res.first->second > delay) { // if the declared_auth was already in the map and with a higher delay
538 res.first->second = delay;
539 }
540 }
541 }
542 }
543
544 // Now verify that all the declared authorizations are satisfied:
545
546 // Although this can be made parallel (especially for input transactions) with the optimistic assumption that the
547 // CPU limit is not reached, because of the CPU limit the protocol must officially specify a sequential algorithm
548 // for checking the set of declared authorizations.
549 // The permission_levels are traversed in ascending order, which is:
550 // ascending order of the actor name with ties broken by ascending order of the permission name.
551 for( const auto& p : permissions_to_satisfy ) {
552 checktime(); // TODO: this should eventually move into authority_checker instead
553 SYS_ASSERT( checker.satisfied( p.first, p.second ) || check_but_dont_fail, unsatisfied_authorization,
554 "transaction declares authority '${auth}', "
555 "but does not have signatures for it under a provided delay of ${provided_delay} ms, "
556 "provided permissions ${provided_permissions}, provided keys ${provided_keys}, "
557 "and a delay max limit of ${delay_max_limit_ms} ms",
558 ("auth", p.first)
559 ("provided_delay", provided_delay.count()/1000)
560 ("provided_permissions", provided_permissions)
561 ("provided_keys", provided_keys)
562 ("delay_max_limit_ms", delay_max_limit.count()/1000)
563 );
564
565 }
566
567 if( !allow_unused_keys || check_but_dont_fail) {
568 SYS_ASSERT( checker.all_keys_used(), tx_irrelevant_sig,
569 "transaction bears irrelevant signatures from these keys: ${keys}",
570 ("keys", checker.unused_keys()) );
571 }
572 }
573
574 void
576 permission_name permission,
577 const flat_set<public_key_type>& provided_keys,
578 const flat_set<permission_level>& provided_permissions,
579 fc::microseconds provided_delay,
580 const std::function<void()>& _checktime,
581 bool allow_unused_keys
582 )const
583 {
584 const auto& checktime = ( static_cast<bool>(_checktime) ? _checktime : _noop_checktime );
585
586 auto delay_max_limit = fc::seconds( _control.get_global_properties().configuration.max_transaction_delay );
587
588 auto checker = make_auth_checker( [&](const permission_level& p){ return get_permission(p).auth; },
589 _control.get_global_properties().configuration.max_authority_depth,
590 provided_keys,
591 provided_permissions,
592 ( provided_delay >= delay_max_limit ) ? fc::microseconds::maximum() : provided_delay,
593 checktime
594 );
595
596 SYS_ASSERT( checker.satisfied({account, permission}), unsatisfied_authorization,
597 "permission '${auth}' was not satisfied under a provided delay of ${provided_delay} ms, "
598 "provided permissions ${provided_permissions}, provided keys ${provided_keys}, "
599 "and a delay max limit of ${delay_max_limit_ms} ms",
600 ("auth", permission_level{account, permission})
601 ("provided_delay", provided_delay.count()/1000)
602 ("provided_permissions", provided_permissions)
603 ("provided_keys", provided_keys)
604 ("delay_max_limit_ms", delay_max_limit.count()/1000)
605 );
606
607 if( !allow_unused_keys ) {
608 SYS_ASSERT( checker.all_keys_used(), tx_irrelevant_sig,
609 "irrelevant keys provided: ${keys}",
610 ("keys", checker.unused_keys()) );
611 }
612 }
613
614 flat_set<public_key_type> authorization_manager::get_required_keys( const transaction& trx,
615 const flat_set<public_key_type>& candidate_keys,
616 fc::microseconds provided_delay
617 )const
618 {
619 auto checker = make_auth_checker( [&](const permission_level& p){ return get_permission(p).auth; },
620 _control.get_global_properties().configuration.max_authority_depth,
621 candidate_keys,
622 {},
623 provided_delay,
625 );
626
627 for (const auto& act : trx.actions ) {
628 for (const auto& declared_auth : act.authorization) {
629 SYS_ASSERT( checker.satisfied(declared_auth), unsatisfied_authorization,
630 "transaction declares authority '${auth}', but does not have signatures for it.",
631 ("auth", declared_auth) );
632 }
633 }
634
635 return checker.used_keys();
636 }
637
638} }
const mie::Vuint & p
Definition bn.cpp:27
std::string name
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
#define SYS_RETHROW_EXCEPTIONS(exception_type, FORMAT,...)
const generic_index< MultiIndexType > & get_index() const
void modify(const ObjectType &obj, Modifier &&m)
const ObjectType * find(CompatibleKey &&key) const
void remove(const ObjectType &obj)
const ObjectType & create(Constructor &&con)
generic_index< MultiIndexType > & get_mutable_index()
const ObjectType & get(CompatibleKey &&key) const
size_t which() const
constexpr int64_t count() const
Definition time.hpp:26
static constexpr microseconds maximum()
Definition time.hpp:14
authorization_manager(controller &c, chainbase::database &d)
fc::time_point get_permission_last_used(const permission_object &permission) const
static std::function< void()> _noop_checktime
void add_to_snapshot(const snapshot_writer_ptr &snapshot) const
std::optional< permission_name > lookup_minimum_permission(account_name authorizer_account, scope_name code_account, action_name type) const
Find the lowest authority level required for authorizer_account to authorize a message of the specifi...
void update_permission_usage(const permission_object &permission)
void read_from_snapshot(const snapshot_reader_ptr &snapshot)
void check_authorization(const vector< action > &actions, const flat_set< public_key_type > &provided_keys, const flat_set< permission_level > &provided_permissions=flat_set< permission_level >(), fc::microseconds provided_delay=fc::microseconds(0), const std::function< void()> &checktime=std::function< void()>(), bool allow_unused_keys=false, bool check_but_dont_fail=false, const flat_set< permission_level > &satisfied_authorizations=flat_set< permission_level >()) const
Check authorizations of a vector of actions with provided keys, permission levels,...
const permission_object & get_permission(const permission_level &level) const
void remove_permission(const permission_object &permission)
const permission_object & create_permission(account_name account, permission_name name, permission_id_type parent, const authority &auth, time_point initial_creation_time=time_point())
const permission_object * find_permission(const permission_level &level) const
void modify_permission(const permission_object &permission, const authority &auth)
flat_set< public_key_type > get_required_keys(const transaction &trx, const flat_set< public_key_type > &candidate_keys, fc::microseconds provided_delay=fc::microseconds(0)) const
permission_object::id_type permission_id_type
const global_property_object & get_global_properties() const
const chainbase::database & db() const
deep_mind_handler * get_deep_mind_logger() const
bool is_builtin_activated(builtin_protocol_feature_t f) const
time_point pending_block_time() const
Maintains global state information about consensus protocol rules.
#define FC_CAPTURE_AND_RETHROW(...)
void delay(websocketpp::connection_hdl, long duration)
void unpack(Stream &s, std::deque< T > &value)
Definition raw.hpp:540
constexpr microseconds seconds(int64_t s)
Definition time.hpp:32
constexpr std::size_t get_index()
chainbase::shared_multi_index_container< permission_link_object, indexed_by< ordered_unique< tag< by_id >, >, ordered_unique< tag< by_action_name >, composite_key< permission_link_object, BOOST_MULTI_INDEX_MEMBER(permission_link_object, account_name, account), BOOST_MULTI_INDEX_MEMBER(permission_link_object, account_name, code), > >, ordered_unique< tag< by_permission_name >, composite_key< permission_link_object, BOOST_MULTI_INDEX_MEMBER(permission_link_object, account_name, account), BOOST_MULTI_INDEX_MEMBER(permission_link_object, permission_name, required_permission), > > > > permission_link_index
chainbase::shared_multi_index_container< permission_object, indexed_by< ordered_unique< tag< by_id >, member< permission_object, permission_object::id_type, &permission_object::id > >, ordered_unique< tag< by_parent >, composite_key< permission_object, member< permission_object, permission_object::id_type, &permission_object::parent >, member< permission_object, permission_object::id_type, &permission_object::id > > >, ordered_unique< tag< by_owner >, composite_key< permission_object, member< permission_object, account_name, &permission_object::owner >, member< permission_object, permission_name, &permission_object::name > > >, ordered_unique< tag< by_name >, composite_key< permission_object, member< permission_object, permission_name, &permission_object::name >, member< permission_object, permission_object::id_type, &permission_object::id > > > > > permission_index
key Invalid authority Invalid transaction Invalid block ID Invalid packed transaction Invalid chain ID Invalid symbol Signature type is not a currently activated type Block can not be found Unlinkable block Block does not guarantee concurrent execution without conflicts Block exhausted allowed resources Block is from the future Block is not signed by expected producer Block includes an ill formed protocol feature activation extension Block includes an ill formed additional block signature extension transaction_exception
key Invalid authority Invalid transaction Invalid block ID Invalid packed transaction Invalid chain ID Invalid symbol Signature type is not a currently activated type Block can not be found Unlinkable block Block does not guarantee concurrent execution without conflicts Block exhausted allowed resources Block is from the future Block is not signed by expected producer Block includes an ill formed protocol feature activation extension Block includes an ill formed additional block signature extension Error decompressing transaction Transaction should have at least one required authority Expired Transaction Invalid Reference Block Duplicate deferred transaction The transaction can not be found Transaction is too big Invalid transaction extension Transaction includes disallowed Transaction exceeded transient resource limit action_validate_exception
sysio::chain::action_name action_name
std::shared_ptr< snapshot_writer > snapshot_writer_ptr
Definition snapshot.hpp:155
auto make_auth_checker(PermissionToAuthorityFunc &&pta, uint16_t recursion_depth_limit, const flat_set< public_key_type > &provided_keys, const flat_set< permission_level > &provided_permissions=flat_set< permission_level >(), fc::microseconds provided_delay=fc::microseconds(0), const std::function< void()> &_checktime=std::function< void()>())
authority_checker
chainbase::shared_multi_index_container< generated_transaction_object, indexed_by< ordered_unique< tag< by_id >, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, generated_transaction_object::id_type, id)>, ordered_unique< tag< by_trx_id >, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, transaction_id_type, trx_id)>, ordered_unique< tag< by_expiration >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, time_point, expiration), > >, ordered_unique< tag< by_delay >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, time_point, delay_until), > >, ordered_unique< tag< by_sender_id >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, account_name, sender), > > > > generated_transaction_multi_index
std::shared_ptr< snapshot_reader > snapshot_reader_ptr
Definition snapshot.hpp:294
name account_name
Definition types.hpp:120
chainbase::shared_multi_index_container< permission_usage_object, indexed_by< ordered_unique< tag< by_id >, member< permission_usage_object, permission_usage_object::id_type, &permission_usage_object::id > > > > permission_usage_index
#define value
Definition pkcs11.h:157
vector< key_weight > keys
static action_name get_name()
uint32_t max_transaction_delay
the maximum number of seconds that can be imposed as a delay requirement by authorization checks
static action_name get_name()
static snapshot_permission_object to_snapshot_row(const permission_object &value, const chainbase::database &db)
static void from_snapshot_row(snapshot_permission_object &&row, permission_object &value, chainbase::database &db)
public_key_type key
Definition authority.hpp:96
static action_name get_name()
Immutable except for fc::from_variant.
Definition name.hpp:43
name(std::string_view str)
Definition name.hpp:56
authority auth
authority required to execute this permission
permission_name parent
parent permission
time_point last_updated
the last time this authority was updated
account_name owner
the account this permission belongs to
permission_name name
human-readable name for the permission
time_point last_used
when this permission was last used
vector< action > actions
static action_name get_name()
static action_name get_name()
uint8_t key[16]
Definition yubico_otp.c:41
CK_ULONG d