Skip to content

fix(contracts): repair broken merge artifacts on main - #1041

Merged
Ejirowebfi merged 1 commit into
mainfrom
fix/main-broken-merge
Jul 23, 2026
Merged

fix(contracts): repair broken merge artifacts on main#1041
Ejirowebfi merged 1 commit into
mainfrom
fix/main-broken-merge

Conversation

@Ejirowebfi

Copy link
Copy Markdown
Collaborator

main has not compiled since #1033, #1034 and #1035 landed. Two conflict resolutions kept both sides of the conflict, so cargo check -p token-factory fails with 7 errors on origin/main as of 8654767.

This also explains why unrelated PRs (e.g. #1038) show red contract jobs — PR CI builds the merge with main.

What was broken

1. Duplicate error variant (lib.rs)

TooManyFeeSplitRecipients = 19,
TooManyFeeSplitRecipients = 18,   // <- both sides kept
AlreadyBackfilled = 19,           // <- discriminant collision

E0428 (defined multiple times) and E0081 (discriminant 19 assigned twice).

2. Duplicated statement in get_token_info_by_address (lib.rs) — the merge kept both #1034's new read_addr_keyed lookup and the superseded instance storage lookup, producing a syntactically invalid double let binding.

3. Three concatenated error tables in docs/contract-abi.md from the same bad merges, disagreeing with each other and with the code.

Fix

Verification

cargo fmt --all -- --check          # clean
cargo clippy --all-targets -D warnings  # clean
cargo test -p token-factory         # 146 passed, 0 failed

No behavioural change beyond making the crate compile; error discriminants are ABI, and the retained numbering is the one already published in the ABI docs.

main has not compiled since #1033/#1034/#1035 landed: two conflict
resolutions kept both sides.

- Error enum declared TooManyFeeSplitRecipients twice (= 19 and = 18),
  which also collided with AlreadyBackfilled = 19. Keep = 18, matching
  the canonical ABI table and the numbering #1033 established
  (18/19/20 = TooManyFeeSplitRecipients/AlreadyBackfilled/NotWhitelisted).
- get_token_info_by_address kept both the new read_addr_keyed lookup
  from #1034 and the superseded instance-storage lookup, leaving a
  syntactically invalid duplicated let binding. Keep the persistent-
  storage form.
- docs/contract-abi.md had three concatenated error tables from the same
  bad merges. Collapse to the single complete table, fix the recipient
  cap typo (20 -> 10), and correct the NotWhitelisted prose (code 18 -> 20).
- Allow clippy::identity_op on the deliberate 1-bps test formula from
  #1025, which the clippy job could not reach while the crate was broken.

cargo fmt, cargo clippy -D warnings, and 146 contract tests all pass.
@Ejirowebfi
Ejirowebfi merged commit 6524e58 into main Jul 23, 2026
17 of 18 checks passed
@Ejirowebfi
Ejirowebfi deleted the fix/main-broken-merge branch July 23, 2026 16:33
Ejirowebfi added a commit to Bigg770/Stellar-forge that referenced this pull request Jul 23, 2026
Resolve conflicts between the fee-split/metadata-URI PR and main's
persistent-storage (Favourorg#1034), exact-fee (Favourorg#1035), whitelist (Favourorg#1033) and
merge-repair (Favourorg#1041) changes:

- Error enum: keep main's published 18/19/20 discriminants and append the
  PR's new variants as InvalidMetadataUri=21, ZeroFeeSplitEntry=22,
  MetadataFrozen=23.
- set_metadata: keep the PR's URI validation and versioned-update/freeze
  semantics on top of main's persistent storage (migrate_addr_keyed /
  set_persistent), reentrancy lock, and charge-exactly-metadata_fee rule.
- Rewrite the ipfs:// prefix check with String::copy_into_slice — the
  PR's String::get(i) does not exist in soroban-sdk 27.
- freeze_metadata / views: migrate-aware persistent reads.
- distribute_fee: keep the PR's largest-remainder allocation; update the
  Favourorg#918 tests to the new remainder policy (remainder goes to the
  largest-frac recipient, not treasury) and drop the PR's duplicate
  test_set_fee_split_too_many_recipients_rejected.
- fuzz_fee_arithmetic: keep main's harness and invariants; rewrite
  model_distribute_fee to mirror the largest-remainder algorithm.
- Fix the PR's uri-too-long fixture (was 115 bytes, comment claimed 129).
- docs/contract-abi.md: merge both sides' set_metadata/set_fee_split
  sections, unified error table (18-23), union event table.

cargo fmt / clippy -D warnings clean; 158 contract tests pass; fuzz
workspace compiles.
github-actions Bot pushed a commit that referenced this pull request Jul 27, 2026
# [1.3.0](v1.2.0...v1.3.0) (2026-07-27)

### Bug Fixes

* **#1024,#1023:** fee-split edge cases and metadata URI validation ([#1036](#1036)) ([e3174cb](e3174cb)), closes [#1024](#1024) [#1023](#1023) [#1024](#1024) [#1023](#1023)
* **#1024,#1023:** fee-split edge cases and metadata URI validation ([#1037](#1037)) ([116d025](116d025)), closes [#1024](#1024) [#1023](#1023) [#1024](#1024) [#1023](#1023)
* align adm_upd topic and add CI drift detection ([#1032](#1032)) ([872baa9](872baa9))
* **contracts:** add distribute_fee test coverage at realistic split sizes ([#918](#918)) ([#1025](#1025)) ([f9ec953](f9ec953)), closes [#919](#919)
* **contracts:** charge exactly the required fee, not fee_payment ([#1035](#1035)) ([8654767](8654767)), closes [#1007](#1007) [#1007](#1007) [#1008](#1008) [#1008](#1008)
* **contracts:** make token-factory initialize atomic with deployment ([#1029](#1029)) ([3e12de2](3e12de2)), closes [#1005](#1005)
* **contracts:** move per-token bookkeeping to persistent storage ([#1034](#1034)) ([51c52bd](51c52bd)), closes [#1007](#1007) [#1007](#1007)
* **contracts:** prove multi-step migrate pattern with synthetic v2 tests ([#919](#919)) ([#1026](#1026)) ([f9ef384](f9ef384)), closes [#918](#918) [#918](#918)
* **contracts:** repair broken merge artifacts on main ([#1041](#1041)) ([6524e58](6524e58)), closes [1034/#1035](#1035) [#1033](#1033) [#1034](#1034) [#1025](#1025)
* **contracts:** seed max-supply counter with initial_supply ([#1006](#1006)) ([#1031](#1031)) ([4a3e90d](4a3e90d))
* **frontend:** resolve token identity from contract, not events ([#1018](#1018)) ([#1030](#1030)) ([66bcb19](66bcb19))
* **security:** validate uploaded image content, not client-declared M… ([#1055](#1055)) ([ab1f253](ab1f253)), closes [#1002](#1002) [#1002](#1002) [#1056](#1056) [#1057](#1057)
* **token-factory:** bound fee-split recipient count to prevent resource-exhaustion griefing ([#1027](#1027)) ([becd28f](becd28f))

### Features

* **frontend:** implement paginated global token listing (getAllTokens) ([#1028](#1028)) ([0e1b51e](0e1b51e)), closes [#1017](#1017)
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant