Add get_permission_lower_bound intrinsic and expandauth action#253
Merged
Add get_permission_lower_bound intrinsic and expandauth action#253
Conversation
Add a new host function that allows contracts to read account permission authorities, and an expandauth system contract action that uses it to add keys or account permissions to an existing authority. Host function (get_permission_lower_bound): - Declared in interface.hpp, implemented in permission.cpp - Registered in sys-vm.cpp, intrinsic_mapping.hpp, genesis_intrinsics.cpp - Lower-bound search on permission_index<by_owner>, serializes (perm_name, parent_name, last_updated, authority) System contract (expandauth): - Requires system contract auth; uses account's own permission to authorize the inline updateauth (privileged contract pattern) - Reads current authority via the new intrinsic, deduplicates and sorts added keys/accounts, sends inline updateauth Tests (9 cases): - Add K1 key, add ETH (EM) key, add account permission - Duplicate skipping, auth checks, error cases - End-to-end ETH key signing verification
The get_permission_lower_bound intrinsic changed the genesis chain state, making the pre-built consensus_blockchain snapshot fixture stale. Regenerated via --save-blockchain to fix verify_block_compatibitity test.
The new whitelisted intrinsic shifted the intrinsics index, causing snapshot integrity hash mismatches in test_compatible_versions tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_permission_lower_boundhost function allowing contracts to read account permission authoritiesexpandauthsystem contract action that adds keys and/or account permissions to an existing authorityDetails
Host function: Lower-bound search on
permission_index<by_owner>, serializes(perm_name, parent, last_updated, authority). Registered across all runtimes (sys-vm, sys-vm-oc, native-module) and the genesis intrinsics whitelist.expandauth action: Requires system contract auth. Reads the current authority via the new intrinsic, deduplicates and sorts added keys/accounts, then sends an inline
updateauthusing the account's own permission (privileged contract pattern).Companion CDT PR: Wire-Network/wire-cdt#37