Fix storage API gaps and compilation errors (issues #922-925) - #1
Open
owennashdev-ctrl wants to merge 4 commits into
Open
Fix storage API gaps and compilation errors (issues #922-925)#1owennashdev-ctrl wants to merge 4 commits into
owennashdev-ctrl wants to merge 4 commits into
Conversation
… compilation errors - Remove duplicate IssuerStats struct definition - Remove duplicate ContractConfig struct definition - Remove duplicate MultiSigProposal struct definition - Remove duplicate ExpirationHook struct definition - Remove orphaned code fragment in lib.rs - Add missing type imports to lib.rs Resolves type mismatch and duplicate definition compiler errors, enabling subsequent validation and constraint checks to compile correctly.
…im_type_constraints Add Storage::get_claim_type_constraints() to retrieve constraint configurations for specific claim types. This mirrors the existing set_claim_type_constraints() setter and enables the validate_claim_constraints() validation code path. Test verifies that: - Constraints can be stored and retrieved correctly - min_metadata_len, max_metadata_len, and require_metadata fields persist - Nonexistent claim types return None The function handles the None case gracefully, allowing validation to proceed when no constraints are configured for a claim type. Closes Haroldwonder#922
…ment_issuer_stats Add Storage::increment_issuer_stats() to atomically update issuer statistics counters on attestation operations. The function retrieves the current stats, increments the total_issued count, and stores the updated stats back to persistent storage using saturation arithmetic to prevent overflow. Test verifies that: - Initial stats start at 0 - Multiple calls increment correctly - Zero increments don't cause issues - Saturation arithmetic prevents overflow This function is called from attestation creation paths to track issuance counts per issuer, enabling confidence score calculations and reputation tracking. Closes Haroldwonder#924
…e_issuer_attestation Add Storage::remove_issuer_attestation() to properly remove attestations from an issuer's index when they are revoked, transferred, or deleted. The implementation delegates to ChunkedIndex::remove_issuer() to handle the chunked index maintenance, ensuring that transferred attestations are correctly purged from the old issuer's index and don't silently accumulate. Test verifies that: - Attestations are created for an issuer - Calling remove_issuer_attestation removes the attestation from the index - The attestation no longer appears in get_issuer_attestations results - Other attestations remain in the index This fixes the naming drift where transfer_attestation and other operations called a nonexistent function instead of using the correct ChunkedIndex API. Closes Haroldwonder#923
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
Fixes four related issues by implementing missing storage functions and fixing compilation errors.
Changes
Issue Haroldwonder#925: Remove duplicate type definitions and fix orphaned code
Issue Haroldwonder#922: Implement Storage::get_claim_type_constraints()
Issue Haroldwonder#924: Implement Storage::increment_issuer_stats()
Issue Haroldwonder#923: Implement Storage::remove_issuer_attestation()
Closes Haroldwonder#925 Haroldwonder#924 Haroldwonder#923 Haroldwonder#922