slippage protection to the tip entrypoint added - #1430
Open
smith961 wants to merge 2 commits into
Open
Conversation
|
@smith961 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! 🚀 |
…he-tip-entrypoint
Owner
|
Please resolve the conflicts |
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.
Description
If min-tip or fee config changes between a user signing a tip and the transaction landing, the on-chain outcome can differ from what the UI showed.
send_tipnow accepts optionalexpected_min_tipandexpected_fee_bpsso callers can pin those values. A mismatch returnsConfigMismatchbefore any storage mutation or event. PassingNonefor both skips the checks and preserves prior tip behaviour.Closes #1165
Type of Change
Please mark the options that are relevant:
Changes Made
contracts/tipz/src/lib.rs,tips.rs:send_tiptakes optionalexpected_min_tip/expected_fee_bps; mismatch aborts withConfigMismatchbefore TTL, rate-limit, transfer, or events.contracts/tipz/src/errors.rs: addConfigMismatch = 50(Soroban error-enum cap is 50;RefundRequestExpiredis now an alias ofInvalidInput).contracts/tipz/src/subscription.rs: recurring tips passNone/Noneso existing behaviour is unchanged.contracts/tipz/src/test/test_tip_expectations.rs: tests for matching pins, mismatched min, mismatched fee, and omitted params.frontend-scaffold/src/hooks/useContract.ts:sendTipencodes the new optional args (defaults toNone).How to Test
contracts/tipz, run:cargo test tip_expectations -- --test-threads=1test_send_tip_matching_expectationstest_send_tip_mismatched_min_tiptest_send_tip_mismatched_fee_bpstest_send_tip_omitted_expectationsNone/Noneand confirm it still credits the creator as before. Send again with a staleexpected_min_tiporexpected_fee_bpsand confirmConfigMismatchwith no balance or event change.Checklist
💻 Smart Contract Changes (if applicable)
cargo fmt -- --checkpasses successfully.cargo clippy -- -D warningsruns without any warnings.cargo test.🎨 Frontend Changes (if applicable)
npm run typecheckornpx tsc --noEmit).npm run lintshows no linting errors.npm run build.⚙️ General
console.logor debug code remains in production files.mainbranch.Screenshots / Demos (if applicable)
N/A — contract ABI / logic change only.