Skip to content

feat: Credential delegation chain with depth-limited transitive trust and revocation propagation (#68) - #74

Merged
michaelvic123 merged 2 commits into
laugh-tales:mainfrom
jotel-dev:issue-68-credential-delegation-chain
Jul 30, 2026
Merged

feat: Credential delegation chain with depth-limited transitive trust and revocation propagation (#68)#74
michaelvic123 merged 2 commits into
laugh-tales:mainfrom
jotel-dev:issue-68-credential-delegation-chain

Conversation

@jotel-dev

Copy link
Copy Markdown
Contributor

Description

Closes #68.

This PR implements multi-hop hierarchical credential delegation chains. Root issuers can delegate issuance authority to delegate addresses with depth constraints, trust fraction decay, circular delegation prevention, and cascading recursive revocation.

Changes Made

  • Data Model: Added DelegationLink storing (parent, delegate, max_depth, trust_fraction, created_at, revoked).
  • Storage Keys: Added DataKey::DelegationLink(Address, Address), DelegateChildren(Address), DelegateParent(Address).
  • Trust Decay: Computes delegated trust level using fixed-point integer math across hops:
    $$\text{delegated_trust} = \text{root_trust} \times \frac{\text{fraction}_1}{10000} \times \frac{\text{fraction}_2}{10000} \times \dots$$
  • Safety Features:
    • Circular delegation detection on create_delegation.
    • Basis points validation (trust_fraction <= 10000).
    • Cascading recursive revocation (revoke_delegation) propagating revocation to all descendant sub-delegates.
  • Public Interface:
    • create_delegation(env, parent, delegate, max_depth, trust_fraction)
    • resolve_delegation_chain(env, delegate) -> Vec<Address>
    • compute_delegated_trust(env, delegate) -> u32
    • revoke_delegation(env, parent, delegate)
    • get_delegation_link(env, parent, delegate) -> DelegationLink
  • Integration: Updated require_active_issuer and issuance methods to support delegated trust verification.
  • Documentation: Documented delegation chain mechanics in docs/ARCHITECTURE.md.

Test Plan & Verification

  • test_delegation_chain_trust_decay_and_revocation: Verifies multi-hop trust decay (80 -> 40 -> 32), credential issuance by delegates, and cascading revocation of sub-delegates.
  • All unit tests passing via cargo test.

@michaelvic123
michaelvic123 merged commit 1036bb6 into laugh-tales:main Jul 30, 2026
0 of 3 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

Development

Successfully merging this pull request may close these issues.

Implement credential delegation chain with depth-limited transitive trust and revocation propagation

2 participants