Skip to content

Add get_permission_lower_bound intrinsic#37

Merged
heifner merged 2 commits intomasterfrom
feature/get-permissions
Mar 17, 2026
Merged

Add get_permission_lower_bound intrinsic#37
heifner merged 2 commits intomasterfrom
feature/get-permissions

Conversation

@heifner
Copy link
Copy Markdown
Contributor

@heifner heifner commented Mar 16, 2026

Summary

  • Expose get_permission_lower_bound host function so contracts can read account permission authorities
  • C/C++ API declarations, permission_record types, and get_permission() convenience wrapper
  • Native stubs and WASM import registration

Details

The intrinsic returns serialized permission data (perm_name, parent, last_updated, authority) for the first permission whose name is >= the requested name. The get_permission() wrapper calls the intrinsic twice (first to check name match, then full read). See EOSIO/eos#6657

Companion PR: wire-sysio feature/get-permission-host (host function implementation + expandauth system contract action) Wire-Network/wire-sysio#253

Expose the new get_permission_lower_bound host function so contracts can
read account permission authorities. The intrinsic returns serialized
permission data (name, parent, last_updated, authority) for the first
permission whose name is >= the requested name.

- C API declaration in permission.h
- C++ import, types (permission_record, perm_authority, etc.), and
  get_permission() convenience wrapper in permission.hpp
- Native stub in intrinsics.cpp and intrinsics_def.hpp
- Added to cdt.imports.in
Copy link
Copy Markdown
Collaborator

@jglanz jglanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but it does need a test

Test contract with three actions:
- getperm: exercises the get_permission() C++ convenience wrapper
- getpermraw: exercises the raw get_permission_lower_bound C intrinsic
- checktypes: round-trip serialize/deserialize of permission_record,
  perm_authority, perm_key_weight, and perm_level_weight types
@heifner heifner merged commit 76c01fe into master Mar 17, 2026
4 checks passed
@heifner heifner deleted the feature/get-permissions branch March 17, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants