feat: capabilities() bitmap #772
Merged
greatest0fallt1me merged 1 commit intoJun 29, 2026
Merged
Conversation
…map via new capabilities() entrypoint with 26 capability flags on bits 0-25, public named constants, tests, and docs
|
@Osifowora Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #716
Description
Exposes contract capabilities as a u64 bitmap via a new
capabilities()entrypoint. Clients can discover which features are available without inspecting the Wasm binary or relying on version-number heuristics. Each publicly-advertised contract feature occupies one bit in the returnedu64.This is a pure read — it performs no storage writes and emits no events, so it's safe to call at any time on any network (testnet, mainnet, future).
Changes
contracts/predictify-hybrid/src/capabilities.rs(new)capabilitysub-module: 26 named bit constants (VERSIONING,BETTING,DISPUTES,ORACLE_INTEGRATION, etc.) with full rustdoccapability_name()helper: Maps a single capability bit to its human-readable namecapabilities()function: Returns the full capabilities bitmap as au64by bitwise-OR-ing all active capability flagscontracts/predictify-hybrid/src/lib.rspub mod capabilities;module declaration (public so clients can import named constants)capabilities(env: Env) -> u64entrypoint in#[contractimpl], delegating tocrate::capabilities::capabilities(&env)contracts/predictify-hybrid/src/test.rstest_capabilities_list_and_no_state_change: now uses u64 bitmap with namedcapability::*constants instead ofVec<String>comparisontest_version_and_capabilities_after_upgrade: now uses u64 bitmap assertions with named constantsdocs/CAPABILITIES.md(new)Bit Assignments
0x0000_0000_00010x0000_0000_00020x0000_0000_00040x0000_0000_00080x0000_0000_00100x0000_0000_00200x0000_0000_00400x0000_0000_00800x0000_0000_01000x0000_0000_02000x0000_0000_04000x0000_0000_08000x0000_0000_10000x0000_0000_20000x0000_0000_40000x0000_0000_80000x0000_0001_00000x0000_0002_00000x0000_0004_00000x0000_0008_00000x0000_0010_00000x0000_0020_00000x0000_0040_00000x0000_0080_00000x0000_0100_00000x0000_0200_0000Bits 26–63 are reserved for future capabilities (read as 0).