Skip to content

Add tenant suport#2857

Open
juan-malbeclabs wants to merge 3 commits intomainfrom
jo/add_tenant
Open

Add tenant suport#2857
juan-malbeclabs wants to merge 3 commits intomainfrom
jo/add_tenant

Conversation

@juan-malbeclabs
Copy link
Contributor

This pull request introduces comprehensive support for "tenant" management across the onchain programs, SDKs (Python/TypeScript), and both the doublezero and doublezero-admin CLI tools. The changes add a new Tenant account type, implement program-derived address (PDA) derivation for tenants, and provide full CRUD and administrator management capabilities in both the SDKs and CLI interfaces.

Major changes include:

Onchain Programs and Account Model

  • Added a new Tenant account type, with immutable code-based PDA derivation, support for VRF ID, administrator management, and reference counting for safe deletion. New instructions for adding/removing administrators and updating/deleting tenants are included. Reference counting is integrated into user/tenant relationships for safe resource management.

SDK Enhancements

  • Python SDK:
    • Added Tenant account type and deserialization logic in state.py. [1] [2]
    • Implemented derive_tenant_pda in pda.py for deterministic tenant address derivation. [1] [2]
  • TypeScript SDK:
    • Added ACCOUNT_TYPE_TENANT, Tenant interface, and deserialization logic in state.ts. [1] [2]
    • Implemented deriveTenantPda in pda.ts for code-based PDA derivation. [1] [2]

CLI Additions

  • doublezero and doublezero-admin CLIs:
    • Added a new tenant subcommand with support for create, update, delete, get, list, add-administrator, and remove-administrator operations. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
    • Implemented the AddAdministratorTenantCliCommand for adding administrators to tenants.

Smartcontract CLI Integration

  • Extended the CliCommand trait and its implementation to support all tenant-related operations (create, get, list, update, delete, add/remove administrator), and exposed these via the CLI. [1] [2] [3] [4] [5]

Documentation

  • Updated the CHANGELOG.md to document all new tenant-related features, CLI commands, and SDK additions.

Testing Verification

  • Show evidence of testing the change

PROGRAM_CONFIG = 9
CONTRIBUTOR = 10
ACCESS_PASS = 11
TENANT = 13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd that this is 13 and not 12?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because ResourceExtension is 12.

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