Skip to content

feat: authorization validation, storage migration, TTL strategy, and shared test utils#360

Open
zainabbaba31-source wants to merge 1 commit into
bridgelet-org:mainfrom
zainabbaba31-source:feature/zainabbaba-storage-and-auth
Open

feat: authorization validation, storage migration, TTL strategy, and shared test utils#360
zainabbaba31-source wants to merge 1 commit into
bridgelet-org:mainfrom
zainabbaba31-source:feature/zainabbaba-storage-and-auth

Conversation

@zainabbaba31-source

Copy link
Copy Markdown

Summary

Implements four improvements for authorization, storage management, and testing:

#147 - SweepController authorization validation

  • Added explicit format checks for Ed25519 signature (64 bytes) and public key (32 bytes) via validate_signer_key() and validate_signature_length() helpers.
  • Documented the 5-step authorization validation flow with clear error codes for each failure mode.
  • Defence-in-depth validation provides clearer error messages than raw crypto panics.

#146 - Storage migration pattern

  • Created contracts/sweep_controller/src/migration.rs with StorageVersion type and migrate() function that reads stored version and runs pending migrations in order.
  • Added migrate() and get_version() entry points to SweepController.
  • Added StorageVersion key to DataKey enum. Migrations are idempotent and safe to call repeatedly.

#145 - Storage TTL strategy

  • Created docs/storage-ttl-strategy.md classifying all storage entries as instance/persistent/temporary with rationale.
  • All bridgelet-core entries use instance storage (no manual TTL management needed).
  • Documented future TTL extension pattern for persistent storage if added later.

#140 - Shared test utilities

  • Created contracts/shared/src/test_utils.rs with setup_env(), create_test_accounts(), random_address(), address_pair(), address_triple(), fixed_bytes_32(), zero_signature_64(), and seeded_bytes_32() helpers.
  • Import via bridgelet_shared::test_utils::* in both contracts test modules.

Closes #147
Closes #146
Closes #145
Closes #140

…shared test utils

- bridgelet-org#147: Enhance SweepController authorization validation with explicit
  format checks for Ed25519 signature (64 bytes) and public key (32 bytes).
  Added validate_signer_key() and validate_signature_length() helpers.
  Documented the 5-step authorization validation flow with clear error
  codes for each failure mode.
- bridgelet-org#146: Establish storage migration pattern. Created
  contracts/sweep_controller/src/migration.rs with StorageVersion type,
  migrate() function that reads stored version and runs pending migrations,
  and get_storage_version()/set_storage_version() helpers. Added
  migrate() and get_version() entry points to SweepController. Added
  StorageVersion key to DataKey enum.
- bridgelet-org#145: Define storage TTL strategy. Created docs/storage-ttl-strategy.md
  classifying all storage entries as instance/persistent/temporary with
  rationale. All bridgelet-core entries use instance storage (no manual
  TTL management needed). Documented future TTL extension pattern for
  persistent storage if added later.
- bridgelet-org#140: Create shared test utilities. Created
  contracts/shared/src/test_utils.rs with setup_env(), create_test_accounts(),
  random_address(), address_pair(), address_triple(), fixed_bytes_32(),
  zero_signature_64(), and seeded_bytes_32() helpers. Includes unit tests.
  Import via bridgelet_shared::test_utils::* in both contracts' test modules.

Closes bridgelet-org#147
Closes bridgelet-org#146
Closes bridgelet-org#145
Closes bridgelet-org#140
@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

@zainabbaba31-source 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant