Skip to content

335 336 337 338 features - #390

Merged
fejilaup-cloud merged 3 commits into
AtomicIP:mainfrom
Dev-Vik-Tor:335-336-337-338-features
Apr 26, 2026
Merged

335 336 337 338 features#390
fejilaup-cloud merged 3 commits into
AtomicIP:mainfrom
Dev-Vik-Tor:335-336-337-338-features

Conversation

@Dev-Vik-Tor

Copy link
Copy Markdown
Contributor

IP Registry Enhancement: Strength Scoring, Categorization, PoW, and Delegation

Overview

This PR implements four interconnected features for the IP Registry contract, enhancing security, organization, and operational flexibility for IP commitment management on Stellar Soroban.

Changes Implemented

Issue #335: IP Commitment Strength Scoring

  • Added commitment_strength: u8 field to IpRecord (0-100 scale)
  • Implemented calculate_commitment_strength(secret_length, pow_difficulty) -> u8 function
    • Formula: min(100, (secret_length * 2) + (pow_difficulty * 3))
  • Implemented get_ip_strength(env, ip_id) -> u8 to retrieve strength score
  • Strength calculated at commitment time based on secret length and PoW difficulty
  • Helps users understand cryptographic strength of their IP protection

Issue #336: IP Compartmentalization by Category

  • Added category: Bytes field to IpRecord for organizing IPs by type
  • Added CategoryIps(Bytes) storage key for efficient category-based indexing
  • Implemented list_ip_by_category(env, category) -> Vec<u64> for filtering IPs
  • Implemented update_ip_category(env, ip_id, new_category) (owner-only)
    • Maintains category index when updating
    • Removes IP from old category, adds to new category
  • Enables users to organize IPs by domain (software, hardware, design, etc.)

Issue #337: IP Commitment Proof of Work Requirement

  • pow_difficulty: u32 parameter integrated into commit_ip() function
  • Implemented require_pow(env, commitment_hash, difficulty) -> bool validation
    • Verifies commitment hash has required leading zero bits
    • Difficulty measured in leading zero bits (0-256)
  • Spam prevention: PoW increases cost of registering frivolous IPs
  • Flexible difficulty: can be adjusted per commitment

Issue #338: IP Commitment Delegation

  • Added IpDelegates(Address) storage key to track delegates per owner
  • Implemented delegate_commitment_authority(env, owner, delegate_address) (owner-only)
    • Allows owner to delegate commitment authority to trusted agents
    • Supports multiple delegates per owner
  • Implemented revoke_delegation(env, owner, delegate_address) (owner-only)
    • Removes delegate access
  • Implemented is_delegate(env, owner, delegate_address) -> bool for verification
  • Implemented commit_ip_delegated(env, owner, commitment_hash, pow_difficulty) -> u64
    • Allows delegates to commit IP on behalf of owner
    • Maintains owner as IP record owner
    • Useful for law firms, IP management companies, etc.

Data Structure Updates

IpRecord Enhancement

rust
pub struct IpRecord {
pub ip_id: u64,
pub owner: Address,
pub commitment_hash: BytesN<32>,
pub timestamp: u64,
pub revoked: bool,
pub expiry_timestamp: u64,
pub metadata: Bytes,
pub priority: u8, // NEW: 0-10 priority scale
pub category: Bytes, // NEW: category for organization
pub commitment_strength: u8, // NEW: 0-100 strength score
pub co_owners: Vec

,
}

Storage Keys

  • CategoryIps(Bytes) - Maps category to Vec of IP IDs
  • IpDelegates(Address) - Maps owner to Vec of delegates
  • SuggestedPrice(u64) - Stores suggested price for IP

Testing

  • Added 8 comprehensive test cases covering:
    • Strength calculation with various PoW difficulties
    • Strength capping at 100
    • Category updates and filtering
    • Delegation and revocation workflows
    • Delegated IP commitment
  • All tests pass with mock_all_auths() environment

Benefits

  • Security: PoW requirement prevents spam commitments
  • Organization: Category system improves IP discoverability
  • Transparency: Strength scoring helps users assess protection level
  • Flexibility: Delegation enables professional IP management services
  • Backward Compatible: Existing IPs work with new fields (defaults applied)

Closes

- Add commitment_strength field to IpRecord (0-100 scale)
- Implement calculate_commitment_strength() function
- Implement get_ip_strength() to retrieve strength score
- Calculate strength based on secret length and PoW difficulty
- pow_difficulty parameter already in commit_ip function
- require_pow() validates commitment hash meets difficulty
- Difficulty measured in leading zero bits
- Tests verify PoW validation with various difficulties
@drips-wave

drips-wave Bot commented Apr 26, 2026

Copy link
Copy Markdown

@Dev-Vik-Tor 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! 🚀

Learn more about application limits

@fejilaup-cloud
fejilaup-cloud merged commit e37545b into AtomicIP:main Apr 26, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants