Skip to content

test(#256): cover verify_data with large byte payload - #620

Open
EmannuellaO wants to merge 3 commits into
zintarh:mainfrom
EmannuellaO:feat/256-verify-data-large-payload
Open

test(#256): cover verify_data with large byte payload#620
EmannuellaO wants to merge 3 commits into
zintarh:mainfrom
EmannuellaO:feat/256-verify-data-large-payload

Conversation

@EmannuellaO

Copy link
Copy Markdown

Closes #256

Summary

Adds coverage ensuring large off-chain JSON payloads do not surprise budget usage or hash verification behavior.

Changes

  • test.rs → new test verify_data_succeeds_with_representative_large_payload in verify_data_unit_tests:
    • builds a ~260KB representative off-chain JSON report (repeated analytics records),
    • asserts verify_data returns true for the exact bytes,
    • asserts the monotonic CPU budget grows while hashing,
    • asserts the ComputeSha256Hash cost tracker reports the full payload length as hashed input,
    • leaves the existing 1KB large-payload test untouched.

Acceptance criteria

  • Add a test with a representative large Bytes payload.
  • Assert verify_data returns true for the exact bytes.
  • Capture or assert budget usage if practical. (asserted via CPU delta + Sha256 cost tracker)

Verification

  • cargo fmt --check clean
  • cargo clippy --all-targets -- -D warnings 0 errors
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps 0 errors
  • RUSTFLAGS="-D warnings" cargo test → 175 passed / 0 failed / 1 ignored + 1 integration test

Note: this branch is stacked on #618 (baseline SDK 27 repair) so CI can compile.

…revoke

Add a persistent per-user last-updated marker (DataKey::LastUpdated)
that records the ledger timestamp of the most recent successful mint
(mint_wrap / mint_wrap_batch) or revoke. Expose it via a new
get_last_updated query and cover it with monotonicity tests.

The baseline main branch did not compile against Soroban SDK 27 (broken
merge ec4e11a plus pre-existing drift), so this change also repairs the
crate to green: FSM transitions (Draft/Pending->Expired, Active->Pending
for bridging), strict expiry deadline semantics, updated contract-error
codes in tests, stake tests now set an explicit ledger timestamp (SDK 27
defaults it to 0), SDK 27 event-buffer reset handling, and clippy/fmt/doc
cleanliness (-D warnings).
An all-zero Ed25519 public key has no known private key, so accepting it
would silently brick every future mint_wrap call while leaving the
contract in an initialized state. Reject it at initialize time with a new
InvalidAdminPubKey error and cover the behavior with tests:
- zero admin pubkey is rejected (Error(Contract, zintarh#52))
- a rejected zero-key attempt leaves the contract uninitialized so a
  valid initialize still succeeds
Add verify_data_succeeds_with_representative_large_payload, which mints a
wrap for a ~260KB off-chain JSON-style report and asserts:
- verify_data returns true for the exact bytes,
- the monotonic cpu budget grows,
- the ComputeSha256Hash cost tracker reports the full payload as hashed
  input, so large payloads do not surprise budget or hash behavior.
@drips-wave

drips-wave Bot commented Aug 1, 2026

Copy link
Copy Markdown

@EmannuellaO 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

Development

Successfully merging this pull request may close these issues.

test: Cover verify_data with large byte payload

1 participant