docs(#210): sync README interface with current mint_wrap signature - #621
Merged
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.
The README documented the older mint flow: - mint_wrap was missing the payload_version parameter (now mint_wrap(user, period, archetype, data_hash, payload_version, signature)) - the signature-payload description used a stale '0x01 version byte' layout instead of the real MINT_DOMAIN_SEPARATOR + XDR(fields) encoding - the CLI example omitted --payload_version Update the public-interface write-method list to the exact current signatures (also adding mint_wrap_batch, revoke_wrap, transfer_wrap, expire_wrap, upgrade), document the canonical versioned payload, and fix the mint example to pass payload_version in the correct order.
|
@web3nova 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 #210
Summary
The README documented an older mint flow:
mint_wrapwas missing thepayload_versionparameter, the signature-payload description used a stale0x01 version bytelayout, and the CLI example omitted--payload_version.Changes
mint_wraptomint_wrap(e, user, period, archetype, data_hash, payload_version, signature)and added the currently-exposed write methods that were missing (mint_wrap_batch,revoke_wrap,transfer_wrap,expire_wrap,upgrade).0x01 version bytedescription with the actual encoding —MINT_DOMAIN_SEPARATOR("stellar-wrap-v1"raw bytes) followed byXDR(payload_version),XDR(contract_id),XDR(user),XDR(period),XDR(archetype),XDR(data_hash)— and linkeddocs/signing-payload.mdas the full reference.user,period,archetype,data_hash,payload_version,signaturein the correct order and adds--payload_version 1to both the sign and invoke CLI examples.Acceptance criteria
user,period,archetype,data_hash, andsignaturein the correct order.mint_wrapexamples remain.Verification
Docs-only change;
cargo test→ 175 passed / 0 failed / 1 ignored + 1 integration test unchanged.Note: branch stacked on #618 (baseline SDK 27 repair) so CI can compile.