fix(contract): persist campaign tags on-chain - #892
Open
Rafiat30 wants to merge 3 commits into
Open
Conversation
Implementation to follow. Tracks the createCampaign() bug where the tags parameter is silently dropped on the non-mock contract-call path. Refs Iris-IV#558
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
createCampaign() accepted tags but never sent them to the real (non-mock) contract call and never encoded them into the off-chain POH_EXT description blob the way coverImageUrl/milestones already are — so tags were silently dropped for every real campaign. decodeCampaign() then read tags from fields["tags"], a contract field that never exists per the actual CreateCampaignParams schema (creator, title, description, funding_goal, duration_days, category, has_revenue_sharing, revenue_share_percentage, max_contribution_per_user), so tags always decoded to [] for real campaigns. Encodes tags into the existing POH_EXT blob in createCampaign() and parses them back out in decodeCampaign(), falling back to the contract field only for older/mock records. Also fixes the shared contractClient.test.ts mock's getAccount() return value, which was missing sequenceNumber() and silently broke every non-mock mutation test (including the pre-existing "non-mock branch runs core read/write flows" test). Refs Iris-IV#558
|
@Rafiat30 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! 🚀 |
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
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 #558
Summary
createCampaign()insrc/lib/contractClient.tsaccepts atags: string[]parameter and uses it on the mock code path, but on the real (non-mock) Stellar contract call it is never sent as a contract argument and never encoded into the description's off-chainPOH_EXTblob (unlikecoverImageUrl/milestones, which already use that mechanism). Tags are silently dropped for real campaigns, even thoughdecodeCampaign()expects to read atagsfield back on read.Changes
src/lib/contractClient.ts— added aTODO(#558)comment directly abovecreateCampaign()documenting the exact bug (tags accepted as a parameter, dropped on the non-mock path) so the fix location is unambiguous for whoever picks this up next.Why
This surfaces and pins down the root cause precisely (contract-call path vs. off-chain description encoding vs. mock path) ahead of the full fix, which will extend the existing
POH_EXToff-chain encoding pattern to includetags, and updatedecodeCampaign()to parse them back out.Tests
No behavioral change in this PR — comment-only. The full fix (tracked under this same issue) will include:
decodeCampaignround-trip test assertingtagssurvive encode/decode via the off-chain blob.createCampaigntest assertingtagsare no longer dropped on the non-mock path.How to test
npm run typecheck— confirms no regressions from the comment addition.