Repository navigation
test: add adversarial coverage for commit_snapshot in src/lib.rs - #1303
Closed
blesswill88 wants to merge 3 commits into
Closed
blesswill88 wants to merge 3 commits into
blesswill88 wants to merge 3 commits into
Conversation
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.
Overview
This PR adds focused adversarial test coverage for the public
commit_snapshotmethod exposed insrc/lib.rs. The new tests exercise valid calls, boundary values for each parameter (env: Env,issuer: Address,namespace: Symbol,token: Address,snapshot_ref: u64,content_hash: BytesN<32>), unauthorized callers, and verify that state is unchanged after rejected operations.Related Issue
Changes
🧪 Snapshot Finalization Tests
src/test_snapshot_finalization.rscommit_snapshotsuccess and failure paths.issuer,namespace,token,snapshot_ref, andcontent_hash, then asserts the resulting state is observable.snapshot_ref: u64(e.g. zero and large values) andcontent_hash: BytesN<32>(all-zero and all-0xFFhashes).commit_snapshotfrom an address that is not the expectedissuerand asserts the call is rejected.Verification Results
src/test_snapshot_finalization.rscommit_snapshotsignature or behavior; tests onlysnapshot_refandcontent_hashCloses #1137