Skip to content

fix(contracts): resolve remaining merge damage — full workspace green - #1093

Closed
joelpeace48-cell wants to merge 0 commit into
mainfrom
fix/contracts-full-green
Closed

fix(contracts): resolve remaining merge damage — full workspace green#1093
joelpeace48-cell wants to merge 0 commit into
mainfrom
fix/contracts-full-green

Conversation

@joelpeace48-cell

Copy link
Copy Markdown
Contributor

Follow-up to the previous contracts-merge-corruption fix. That commit
resolved the unclosed-delimiter parse failures; this one resolves
everything the fuller cargo test --workspace / cargo clippy / wasm
build surfaced once the code could actually run.

campaign contract:

  • do_register: the referral-count increment block had the exact same
    disease as the earlier do_register fix — a missing } after the
    if !already_attributed guard let its content bleed into an
    unconditional second increment further down, double-counting every
    referral. Closed the block, removed the duplicate, moved the
    (genuinely separate) referral-lock stamp after it.
  • register(): the participation barrier (issue Contracts: Nullifier to prevent re-registration / double-claim after merkle root rotation #740) fired even when a
    participant was still currently active, turning ordinary idempotent
    re-registration calls into a hard error. Scoped the barrier to only
    apply when the participant is not currently registered, which is
    the scenario the barrier was actually meant to catch (re-registration
    after deregistration) — verified against Contracts: Nullifier to prevent re-registration / double-claim after merkle root rotation #740's own passing test,
    which only asserts on the deregistered-then-blocked case.
  • test.rs: a 3-way function-name/body shuffle from the same merge
    scrambled test_clear_participation_allows_re_registration,
    test_referral_locked_allows_reregister_same_referrer, and
    test_referral_locked_prevents_referrer_switch_on_reregister
    each name had a different test's body. Traced every affected function
    back to its origin commit (2efd49e, 15605f0, 976b2b9) and replaced
    the whole corrupted block wholesale with correctly-matched
    name/body pairs, fixing the argument order for the ones sourced from
    the pre-invite-code signature along the way.
  • test_root_rotation_does_not_allow_double_registration had a second
    test's body pasted in front of its own content; removed the leaked
    block.
  • One test had an admin-nonce off-by-one (&1 instead of &0 for the
    first post-initialize admin call).
  • 8 tests whose scenario is deregister-then-reregister now correctly
    expect NullifierAlreadyUsed (the participation barrier, confirmed
    intentional and permanent) instead of the referral-loop/lock errors
    they predate — those code paths are provably unreachable via this
    vector now (a referral loop requires the referrer to already be
    registered when the cycle-closing registration is attempted, which
    requires them to have deregistered first, which the barrier now
    blocks before loop-detection is ever reached).
  • fuzz_test.rs: one stray extra argument in two set_merkle_root calls,
    one clippy needless_range_loop.

rewards contract:

  • Renumbered the governance/multisig error block (was 21-31, colliding
    three ways with the SEP-41 block, a simpler multisig scheme matching
    campaign contract's, and each other) to 36-46/47-51 — confirmed via
    docs/CONTRACTS_API.md that only the SEP-41 codes (21-29) are actually
    published to clients; the colliding ranges aren't documented anywhere
    and are free to move.
  • Gated the Poseidon-hash Merkle experiment (poseidon.rs, merkle.rs)
    behind an off-by-default poseidon-experimental feature — it
    depends on ark_bn254 and light_poseidon, neither ever declared in
    Cargo.toml, so it has never compiled since the commit that added it.
    Nothing in the contract's public API calls into it.
  • One clippy collapsible_if.

Workflows: contracts-ci.yml already had the fix for this — Soroban
dropped support for wasm32-unknown-unknown on Rust 1.82+, and
dtolnay/rust-toolchain@stable now installs whatever the latest stable
is. Applied the same wasm32v1-none target across every other workflow
and script that still referenced the old target (ci-performance.yml,
performance-gate.yml, testnet-integration.yml, docs.yml,
release-bindings.yml, package.json's build:contracts fallback) so none
of them silently break the next time stable Rust ships.

Verified end to end: cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings -A deprecated, cargo test --workspace (campaign 84/84, rewards 99/99, all others green), and
cargo build --target wasm32v1-none --release for both contracts all
pass clean.

purged.push({ table, count: result.changes });
log.info(`[pii-purge] Deleted ${result.changes} rows from ${table} for campaign ${campaignId}`);
log.info(
`[pii-purge] Deleted ${result.changes} rows from ${table} for campaign ${campaignId}`,
Comment thread scripts/check-ttl-rent.js
`--fn ${fn}`,
args,
].filter(Boolean).join(' ');
const output = execSync(cmd, { encoding: 'utf8', timeout: 15_000 });
return proverReady;
}

self.onmessage = async (event: MessageEvent) => {
@joelpeace48-cell
joelpeace48-cell force-pushed the fix/contracts-full-green branch from b6afdbe to 4dbae3b Compare July 30, 2026 05:48
@joelpeace48-cell
joelpeace48-cell deleted the fix/contracts-full-green branch July 30, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants