Skip to content

SIP: Permissionless Package Introspection - #69

Open
92GC wants to merge 2 commits into
sui-foundation:mainfrom
92GC:sip-package-introspection
Open

SIP: Permissionless Package Introspection#69
92GC wants to merge 2 commits into
sui-foundation:mainfrom
92GC:sip-package-introspection

Conversation

@92GC

@92GC 92GC commented Jan 5, 2026

Copy link
Copy Markdown

Summary

Add native functions to sui::package for querying package identity and metadata:

public native fun current_package_id(): address;
public native fun policy_for(package_id: address): u8;
public native fun is_immutable(package_id: address): bool;
public native fun version_for(package_id: address): u64;

// Added for completeness don't have need
public native fun original_package_id(package_id: address): address;
public native fun dependency_package(
    package_id: address,
    dependency_original_id: address,
): Option<address>;

## Problem

These require protocol support—UpgradeCap access cannot solve them:
Sui would need to moves upgradecaos to a global table like was done did with coin metadatacaps, so object passing or access is not required.

@admin-aftermath

Copy link
Copy Markdown
Contributor

Was anticipating writing a smaller SIP for the version_for function. Would simplify common package versioning pattern: replace const CURRENT_VERSION + Config.version + version check with a Config.min_acceptable_version + sui::package::version check. (I prefer version over version_for). No longer will you forget to update the const CURRENT_VERSION on a package upgrade.

I can see the other functions being useful in their own ways too. All in all, simple SIP but has an immediate impact.

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