test(#256): cover verify_data with large byte payload - #620
Open
EmannuellaO wants to merge 3 commits into
Open
Conversation
…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.
|
@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! 🚀 |
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.
Closes #256
Summary
Adds coverage ensuring large off-chain JSON payloads do not surprise budget usage or hash verification behavior.
Changes
test.rs→ new testverify_data_succeeds_with_representative_large_payloadinverify_data_unit_tests:verify_datareturnstruefor the exact bytes,ComputeSha256Hashcost tracker reports the full payload length as hashed input,Acceptance criteria
Bytespayload.verify_datareturns true for the exact bytes.Verification
cargo fmt --checkcleancargo clippy --all-targets -- -D warnings0 errorsRUSTDOCFLAGS="-D warnings" cargo doc --no-deps0 errorsRUSTFLAGS="-D warnings" cargo test→ 175 passed / 0 failed / 1 ignored + 1 integration testNote: this branch is stacked on #618 (baseline SDK 27 repair) so CI can compile.