Skip to content

Improve config error message and add attester registry tests - #311

Open
Rayyanah0 wants to merge 2 commits into
Lafiya-xyz:mainfrom
Rayyanah0:fix/193-194-195-config-error-attester-tests
Open

Improve config error message and add attester registry tests#311
Rayyanah0 wants to merge 2 commits into
Lafiya-xyz:mainfrom
Rayyanah0:fix/193-194-195-config-error-attester-tests

Conversation

@Rayyanah0

Copy link
Copy Markdown

Summary

This PR addresses three issues:

#193 - Improve the error message when config/networks.toml is missing

  • Updated ConfigError::NotFound in crates/lafiya-config/src/lib.rs to display "config/networks.toml not found at {path}" instead of the generic "config file not found: {0}".
  • Added test missing_config_error_includes_path asserting the error message contains the attempted path.

#194 - Add a test verifying get_attester_count() stays accurate through mixed add/remove operations

  • Added test get_attester_count_stays_accurate_through_mixed_operations in contracts/attester-registry/src/test.rs that performs 7 interleaved add/remove operations and asserts get_attester_count() after each step.

#195 - Add a get_attester_info() test for an attester with no optional metadata

  • Added test get_attester_info_returns_empty_metadata_for_plain_add in contracts/attester-registry/src/test.rs that adds an attester via add_attester (not add_attester_with_info), then calls get_attester_info() and asserts it returns Some(AttesterInfo { license_hash: None, region: None }).

Files Changed

  • crates/lafiya-config/src/lib.rs
  • contracts/attester-registry/src/test.rs

Closes #193
Closes #194
Closes #195

Rayyan and others added 2 commits August 31, 2026 13:25
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
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@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! 🚀

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