Improve config error message and add attester registry tests - #311
Open
Rayyanah0 wants to merge 2 commits into
Open
Improve config error message and add attester registry tests#311Rayyanah0 wants to merge 2 commits into
Rayyanah0 wants to merge 2 commits into
Conversation
PROC-01 (Lafiya-xyz#103): Re-land add_attesters/remove_attesters batch operations that were dropped in the PR Lafiya-xyz#94 merge. Both functions are admin-gated, paused-checked, enforce BATCH_LIMIT=40 (BATCH_LIMIT exported), skip already-present/absent addresses idempotently, and emit one event per address actually changed. Error::BatchTooLarge = 8 added and documented in docs/error-codes.md. Nine unit tests cover success, batch-limit rejection, idempotency, auth, and pause-gate paths. ARCH-01 (Lafiya-xyz#104): Add missing extend_ttl calls to all state-mutating functions in attester-registry (initialize, propose_admin, accept_admin, pause, unpause, remove_attester, set_max_attesters, suspend_attester, reinstate_attester, upgrade, migrate) so that instance storage TTL is bumped on every write path, not only on add_attester variants. In attestation-registry, attest() now also extends the TTL of the specific Attestation(record_hash, sequence) persistent entry it writes, preventing archival of individual attestation records independently of instance storage. ARCH-02 (Lafiya-xyz#105): Fill in ADR-0006 Decision section and move status to Accepted. Explicit choice: attestations are immutable historical records (Option A). Responders check current attester status independently via is_attester; revoke_attestation is available for surgical per-record admin removal. Rationale, trade-offs, and follow-up items documented. Closes Lafiya-xyz#103 Closes Lafiya-xyz#104 Closes Lafiya-xyz#105
- Update ConfigError::NotFound to include the expected file path
"config/networks.toml not found at {path}" so contributors can
immediately see what's wrong when running from the wrong directory.
- Add test asserting the error message contains the attempted path.
- Add test verifying get_attester_count() stays accurate through
interleaved add/remove operations (5+ operations).
- Add test verifying get_attester_info() returns empty metadata
for an attester added via add_attester (no optional metadata).
Closes Lafiya-xyz#193
Closes Lafiya-xyz#194
Closes Lafiya-xyz#195
|
@Rayyanah0 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
This PR addresses three issues:
#193 - Improve the error message when config/networks.toml is missing
ConfigError::NotFoundincrates/lafiya-config/src/lib.rsto display"config/networks.toml not found at {path}"instead of the generic"config file not found: {0}".missing_config_error_includes_pathasserting the error message contains the attempted path.#194 - Add a test verifying get_attester_count() stays accurate through mixed add/remove operations
get_attester_count_stays_accurate_through_mixed_operationsincontracts/attester-registry/src/test.rsthat performs 7 interleaved add/remove operations and assertsget_attester_count()after each step.#195 - Add a get_attester_info() test for an attester with no optional metadata
get_attester_info_returns_empty_metadata_for_plain_addincontracts/attester-registry/src/test.rsthat adds an attester viaadd_attester(notadd_attester_with_info), then callsget_attester_info()and asserts it returnsSome(AttesterInfo { license_hash: None, region: None }).Files Changed
crates/lafiya-config/src/lib.rscontracts/attester-registry/src/test.rsCloses #193
Closes #194
Closes #195