feat(#748): add RBAC storage migration scripts and tests - #861
Open
VeronicDev wants to merge 3 commits into
Open
feat(#748): add RBAC storage migration scripts and tests#861VeronicDev wants to merge 3 commits into
VeronicDev wants to merge 3 commits into
Conversation
Add standalone migration script, SDK method, and comprehensive tests for migrating legacy Admin contracts to the new RBAC format with SuperAdmin role mapping. The migration is idempotent and maps the singular admin address to the SuperAdmin persistent storage entry. - Add `migrateAdmin()` to TypeScript SDK client - Create `migrations/rbac-migration.ts` with CLI and library interfaces - Add 5 new Rust integration tests for migration happy paths and edge cases - Update UPGRADE_GUIDE.md with migration script usage (CLI, SDK, standalone) - Add TypeScript tests for migrateAdmin, grantMinter, revokeMinter 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@VeronicDev 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.
Summary
Resolves #748 — Implements storage migration scripts for RBAC to ensure seamless transition from legacy Admin state to the new RBAC format.
Changes
Contract Tests (Rust)
contracts/admin/tests/upgrade_e2e.rs:test_migrate_admin_preserves_original_admin_entry— Verifies original admin entry unchanged after migrationtest_migrate_admin_enables_super_admin_guard— Confirms SuperAdmin guard is enabled post-migrationtest_migrate_admin_allows_role_delegation— Tests role granting works after migrationtest_migrate_admin_uninitialized_contract_is_noop— Ensures migration is safe on uninitialized contractstest_full_lifecycle_init_migrate_rbac_enforcement— Full init → migrate → RBAC enforcement flowTypeScript SDK
migrateAdmin()method tosdk/src/client.tsmigrateAdmin,grantMinter,revokeMinterinsdk/src/client.test.tsStandalone Migration Script
migrations/rbac-migration.tswith:migrateContract()— Full migration with verificationdryRunMigration()— Simulate without submitting--rpc-url,--network-passphrase,--contract-id,--admin-secret,--dry-runDocumentation
docs/UPGRADE_GUIDE.mdwith migration instructions for CLI, SDK, and standalone scriptStorage Migration Process
AdminKey::Admin(instance storage)AdminKey::SuperAdmin(admin)persistent entryThe migration is idempotent — safe to call multiple times.
Acceptance Criteria
closes #748