Skip to content

The contract rebuilds the attestor's owner as the borrower, so no real proof can verify #102

Closed

Description

@Lin1er

Owner: @Lexirieru (contract) · Relay side: @Lin1er · Branch: fix/claim-owner · Labels: bug, deliverable-1, gate · Affects: #77, #94, and every real proof

TL;DR

The production contract cannot accept any real proof, AdSense or AdMob. verify_claim rebuilds the attestor's owner as the borrower's G… address, lowercased (sc/advance/src/lib.rs:577-580). A real proof from Reclaim's production attestor carries a different owner: the Reclaim app id the relay proves with (RECLAIM_APP_ID, 0x6415200c713135e77157e1536d488df4f2bb7d04). The digest therefore differs, the signature recovers to some other address, and Reclaim's verifier refuses it. The caller gets VerifierRejected.

Nothing caught this, because every proof the contract has verified so far was synthetic:

  • tools/rehearsal.py and tools/make_claim_fixture.py sign with owner = borrower. The 7/7 GREEN rehearsal and the fixture tests prove the contract agrees with itself.
  • tools/fixtures/real-reclaim-proof.json is real, but it proves the digest chain with that proof's own owner, not the contract's rebuild.
  • No real AdSense proof has ever existed (Find an approved (READY) AdSense account for the gate and the demo #77).

Proven, not inferred

The first real Forepay claim was made on 2026-10-26 with prove:admob (#95, #100). It is signed by the production attestor and passed the audit:

claimData.owner      0x6415200c713135e77157e1536d488df4f2bb7d04   (= RECLAIM_APP_ID)
contextAddress       GA2CD6PMHMBTCFAQDO3R22BSZN5ZSVTAKVNOKXL2SONZBLGRAYIOWWH2

digest with owner as signed                        → recovers to 0x244897572368eadf65bfbc5aec98d8e5443a9072  (the attestor)
digest with owner as the contract rebuilds it      → recovers to 0x97268015c28bc96356a1abf80840d2495d467896  (nobody)

Same identifier, timestamp, epoch and signature. Only owner differs. The real attestor sets owner to the requesting app's address, which zkFetch takes from RECLAIM_APP_ID. It is not the context address.

Why the binding is still safe after the fix

The borrower is bound by context.contextAddress, which is inside the identifier. That does not change. owner never carried the binding; the comment at lib.rs:577 says it did, and that is the mistake. So fixing owner takes nothing away from #17/#18.

Proposed fix (contract)

Pin the owner, as an admin-set value, beside the template. Add DataKey::ClaimOwner (append-only), set by the admin to 0x6415…7d04, and rebuild the digest with it instead of the borrower.

  • It needs no interface change: the front end and request_advance's arguments stay as they are.
  • It also refuses claims made through any other Reclaim app. Without the pin, anyone could prove through their own app, and nothing else would stop them.
  • Alternative: take owner as an argument. That needs an interface change on the front end, and it accepts any app. Not recommended.

Tests: replace the synthetic owner = borrower in make_claim_fixture.py and rehearsal.py with a pinned app address. Then add one test that fails with the old rebuild: a claim whose owner is the app, verified with owner = borrower, gives VerifierRejected.

Timing. It has to go through propose_upgrade and the 24 h timelock, so it should ride in the same upgrade as #94, or go first on its own if #94 is not approved. Either way, it is what stands between any real account and a real advance before 2026-10-30. The demo's option 3 (rehearsal contract, test witness) is unaffected.

Relay side (@Lin1er)

  • The audit checks owner is the configured RECLAIM_APP_ID, so a mismatch is caught before the front end submits.
  • docs/interface.md §2 and the lib.rs comment get corrected.

Working agreement

  1. One issue, one owner. 2. Branch per issue, named above, not the GitHub-suggested one. 3. MCP Stellar Raven for any Stellar/Soroban fact that gets written down. 4. Merge through PR review by Axel (PM); no self-merge. If an ACC has not arrived within two days on something already verified, merge and say so in the PR. 5. Deploys need evidence: contract address or tx hash on stellar.expert, recorded in docs/deployments.md. 6. Secrets live in .env, gitignored, chmod 600: never printed, never committed, never pasted into an issue or PR. Only public G… and C… addresses appear anywhere. 7. Issues, commits and PRs in English.

Activity

  1. added
    bugSomething isn't working
    deliverable-1SOW Deliverable 1 — advance contract
    gateBlocks everything downstream if it fails
    on Oct 26, 2026
  2. added a commit that references this issue on Oct 26, 2026
  3. Lin1er commented on Oct 26, 2026

    @Lin1er
    CollaboratorAuthor

    Fix in draft as #103, for @Lexirieru's review:

    • Contract. A pinned ClaimOwner (admin only, lowercase 0x…). If nothing is pinned it falls back to the borrower, so the rehearsal keeps working. The fixture is signed a second time with the app as owner, and six tests cover it, including the bug itself kept as a test.
    • Relay. The audit checks owner against RECLAIM_APP_ID.

    Deploying it means propose_upgrade, then 24 h, then execute_upgrade and set_claim_owner 0x6415200c713135e77157e1536d488df4f2bb7d04. On its own it unblocks real AdSense proofs. It only unblocks AdMob together with #94.

  4. added a commit that references this issue on Oct 27, 2026
  5. added 2 commits that reference this issue on Oct 29, 2026
  6. added a commit that references this issue on Oct 29, 2026
  7. Lexirieru commented on Oct 29, 2026

    @Lexirieru
    Collaborator

    Fix merged: #103 → f3cdb18. @Lin1er thank you for this one — it is the find of the project so far.

    Staying open, because the bug is still live on chain. Both deployed contracts run 481e7f16… (v0.4.0, #81), which still rebuilds the owner from the borrower. Until the next execute_upgrade, neither can verify a real proof. The code being right in main is not the thing this issue is about.

    It closes when all of this is done and recorded in docs/deployments.md:

    1. propose_upgrade with the wasm carrying fix(#102): verify the attestor's owner against a pinned app id, not the borrower #103 + AdMob (#90): contract, a revenue source in the template, the nullifier and sizing #94 — one timelock for both, because Security: request_advance and verify_and_reserve take no borrower authorisation #81 used up the slack for two
    2. 24 h
    3. execute_upgrade on both contracts
    4. set_claim_owner 0x6415200c713135e77157e1536d488df4f2bb7d04
    5. a real proof verifying on chain, which is FEASIBILITY GATE: one real AdSense revenue proof verified on testnet #5 and AdMob (#90): pin the AdMob claim template from a real proof #96

    Blocked on #106 (#94's contract work), which is in review.

    The part I want kept after this closes

    The reason nothing caught it is worth more than the fix. rehearsal.py and make_claim_fixture.py both signed with owner = borrower, so every green run proved the contract agreed with itself. The 7/7 GREEN I reported on 2026-10-25, and again on 2026-10-29 after #81, were both that. A harness that produces exactly what the code expects cannot fail in the one way that matters.

    Same shape as #76: the part of our model that describes someone else's system was a guess until a real artifact arrived, and the fixture made the guess look verified.

    #106 does something about the class rather than the instance. Taking away the owner fallback means a G… address cannot be pinned at all — set_claim_owner takes 0x plus 40 hex digits — so the pre-#102 owner shape can no longer enter the harness by any route. Every test now runs through an app-signed claim. That is the lesson turned into something the compiler enforces, which is the only form of it that survives.

  8. added a commit that references this issue on Oct 29, 2026
  9. added a commit that references this issue on Oct 30, 2026
  10. 2 remaining items

  11. added 2 commits that reference this issue on Oct 30, 2026
  12. Lexirieru commented on Oct 30, 2026

    @Lexirieru
    Collaborator

    Proposed on both contracts. The clock is running.

    Step Transaction
    stellar contract upload eb636b27…18ea7c
    propose_upgrade production CCQFL2Q6…I2HS e64318b0…df7366
    propose_upgrade dev CD25Q4TD…HQN4 b7e04e52…97eb66

    Wasm ff6a16e988d8c31f27695efff60172764eefae9b19e2b95914c010c509e4f22e, read back from both contracts rather than taken from the submit output:

    CCQFL2Q6  {"executable_at":1793454550,"wasm_hash":"ff6a16e9…e4f22e"}   2026-10-31 13:49:10 UTC
    CD25Q4TD  {"executable_at":1793454560,"wasm_hash":"ff6a16e9…e4f22e"}   2026-10-31 13:49:20 UTC
    

    Both were null immediately before, so nothing was half-proposed, and the delay is exactly 86,400 seconds.

    The hash came from the release, and the procedure was proven before it was trusted

    docs/deployments.md carries a warning from #15 — deploy the wasm from the release, not a local build — and one source tree gives three different hashes here:

    Build sha256
    Release artifact, 39,956 bytes ff6a16e9…e4f22e ← on chain
    linux, CI-verified f4fd10d6…a5a36
    macOS, reference only 0c5c70c9…e1acdd

    So before uploading anything I re-downloaded v0.4.0's artifact and hashed it: 481e7f163ba3867b0e9bf48a36a983650a28a216f45c314fb21c94e9c4186696, byte for byte the wasm live on both contracts today. That is what makes "the artifact's sha256 is the on-chain hash" a measurement rather than an assumption.

    I also re-measured and corrected the macOS reference row, which still held a value from before #103 and #106 (ee05add). A row nothing checks still gets read.

    execute_upgrade is not before 2026-10-31 13:49:10 UTC

    I will post here before running it. #81 sat executable and unexecuted for three days; that will not be repeated, and the cost of that delay is why #102 and #94 have to share this one upgrade instead of going separately.

    @AncungAulia, step 3 is the one that needs you live

    Right after execute_upgrade: NEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1 on forepay-vue5, then rebuild. Between my call and your build finishing, app.forepay.xyz cannot take any advance, AdSense included — the deployed bundle sends nine arguments to a ten-argument request_advance. No funds move and no proof is spent. Please name an hour tomorrow and I will execute then.

    One fee I still cannot measure, and will not guess

    set_claim_template on #76 wanted 21,370 XLM — rent on bytes × ledgers, not computation — and two templates have to be pinned this time from a balance of 29,433 XLM. The new two-argument signature does not exist on the deployed wasm yet, so this cannot be simulated until after execute_upgrade. I will read the fee at simulation on each call and post it before submitting. If it is anywhere near #76's figure, that is a decision for @Lexirieru, not a thing to discover by sending the transaction.

  13. Lexirieru commented on Oct 30, 2026

    @Lexirieru
    Collaborator

    Correcting the step 5 that @Lin1er and I both wrote

    Both of us listed tomorrow's work as set_claim_template for AdSense (#61) and AdMob (#96). The AdSense half cannot be run, and it is not a matter of finding the bytes — there are none to find.

    The only READY AdSense account the team has access to is the one outside the team (#93), and its Jul–Sep 2026 earnings are zero. @Lin1er recorded that on #77 on 2026-10-26:

    Its AdSense is READY, but it has no totals for Jul–Sep 2026, which means zero.

    A zero window does not produce a weak proof. It produces no proof at all — be/src/adsense/account.ts stops before the attestor is ever called:

    if (isEmptyReport(live)) {
      throw new ProveError("empty", "AdSense reports no earnings for this window: the report has only its headers and dates, which is how AdSense says zero.");
    }
    

    So there is no attestor-signed parameters string for an AdSense claim, which is exactly what pin_template.py splits. #61 has nothing to pin, and set_claim_template --source AdSense is not a command anyone can run today.

    What tomorrow actually is

    Step Status
    execute_upgrade on both not before 2026-10-31 13:49:10 UTC
    set_claim_owner 0x6415200c713135e77157e1536d488df4f2bb7d04 ready
    set_claim_template --source AdMob ready — derived on #96 from a real proof signed by the production attestor 0x2448…9072, provider_hash 0x5d9a2fc4…8006
    set_claim_template --source AdSense not possible, no real proof exists
    Read back a v0.4.0-written Advance ready
    A real proof verifying, and a real advance through AdMob

    One template, not two. That halves the fee exposure I flagged, which matters: #76's set_claim_template wanted 21,370 XLM in rent. @Lexirieru has topped the deployer up to 30,433.56 XLM. I will still read the fee at simulation and post it before submitting — one template fitting is likely, not proven.

    This also means #94's AdSense fallback does the right thing by accident: template_of falls back to the pre-#94 singleton key for AdSense only, and production's singleton is null, so an AdSense proof gets TemplateNotSet rather than being checked against AdMob's shape. It fails closed, loudly, with the correct reason.

    The consequence for #5, which is the part worth arguing about

    #5 is the feasibility gate: "one real AdSense revenue proof verified on testnet". That gate cannot be closed by AdMob, and it cannot be closed by the account we have. It needs an AdSense account with non-zero Jul–Sep 2026 revenue, and #77 — the issue that asks for exactly that — has been open since 2026-10-20 with no assignee.

    Everything else is built and waiting on it: the provider (#74), the relay (#73), the front end (#75), the tool (#83, #101), and after tomorrow the contract. Nine days to 2026-11-08.

    What AdMob does give us is stronger than a workaround, and worth saying plainly: the single part of this pipeline that was ever simulated — a production attestor signing a real creator's real revenue — now has a real signature behind it. The advance on chain will be real too. It is the source that differs from the SOW's wording, not the proof.

    @Lexirieru, #77 needs an owner more than it needs anything technical from me.

  14. Lexirieru commented on Oct 30, 2026

    @Lexirieru
    Collaborator

    The premise test, pinned before the upgrade rather than after

    I promised to "read back an Advance written by v0.4.0" as proof that #[contracttype] enum storage keys encode by name and not by position, so a new DataKey variant cannot shift an existing one.

    There is no such Advance to read. The 2026-10-29 rehearsal repaid its advance in full, which removes the entry, and each run uses a fresh pub_id, so nothing is left:

    advance(1f4139ce…493d91)  null
    advance(a0cc14ef…ebd729)  null
    advance(f3b99ba2…089369)  null
    

    Production has never paid one at all, because claim_template() is null there.

    The better test was available all along

    DataKey::ParamsTemplate and DataKey::ProviderHash on the dev contract were written by v0.4.0 and are still there. #94 adds ParamsTemplateFor(Source) and ProviderHashFor(Source) beside them, and template_of falls back to the old singleton keys for AdSense. So:

    After execute_upgrade, claim_template() on CD25Q4TD…HQN4 must return byte-identical bytes to what it returns now. If enum keys were positional, the new variants would displace them and it would read null.

    That is a sharper test than the Advance one, because it exercises the fallback path and the key encoding in the same read, and it fails loudly rather than returning a plausible-looking default.

    Recorded now, from chain

    CCQFL2Q6…I2HS   admin           GA2CD6PM…WWH2
                    liquidity       1050000000
                    claim_template  null
                    provider_hash   null
                    sizing          cap 1000000000, min 10000000, rate 25/100
                    sha256 of the full readback   f141d2435c55609be339fbdc862a1cdefaf69146c392466de1cbbb9c91caa64d
    
    CD25Q4TD…HQN4   admin           GA2CD6PM…WWH2
                    liquidity       20000000
                    claim_template  the 8-part AdSense template (#76), first part 7b226d6574686f64…
                    provider_hash   0x569b93233185c054ed9fda68b5aef8fda180b6d291180…
                    sizing          cap 1000000000, min 10000000, rate 25/100
                    sha256 of the full readback   a9a103ea25660d448a02e9e8ee2048e59e024a437a10404714270072586654aa
    

    What must and must not change tomorrow

    Reading After execute_upgrade
    admin, liquidity, sizing on both unchanged, byte for byte
    claim_template(), provider_hash() on dev unchanged — this is the premise test
    claim_template() on production still null, until AdMob is pinned under ParamsTemplateFor(AdMob)
    claim_template_for(AdSense) on dev the same bytes, via the fallback
    claim_template_for(AdMob) on both TemplateNotSet until pinned

    Deployer is at 30,433.56 XLM after @Lexirieru topped it up by 1,000. Still testnet only — the same G… returns 404 on mainnet Horizon, which I checked before giving the address out.

  15. Lexirieru commented on Oct 30, 2026

    @Lexirieru
    Collaborator

    Dev first, then production — not "both" as I wrote earlier.

    Both contracts carry the same proposal, ten seconds apart, and I have been writing the step as execute_upgrade on both. That throws away the one piece of free risk reduction available here.

    CD25Q4TD…HQN4 holds 2 USDC and the AdSense template. CCQFL2Q6…I2HS holds 105 USDC and is what app.forepay.xyz points at. They run identical wasm and will run identical wasm after. So tomorrow:

    1. execute_upgrade on dev only.
    2. Read claim_template() and provider_hash() back from dev and require byte-equality with the baseline pinned above. That is the premise test, and dev is the only contract that can run it.
    3. Read admin, liquidity, sizing back from dev; require unchanged.
    4. Only then execute_upgrade on production.

    If the enum-key premise is wrong — the thing #63 established and #94 rests on — it shows up on the contract holding 2 USDC, before the one holding 105 and before @AncungAulia starts a rebuild that cannot be undone quickly. The timelock on production does not expire; being ten minutes later costs nothing.

    The cost if I am wrong and do them together: a production contract whose template reads null, a front end rebuilt for a contract signature that half-works, and renounce_upgradeability not yet called so recovery means another 24-hour timelock. That is a day we do not have on 2026-10-31.

    @AncungAulia — this means your rebuild window starts after step 4, not step 1. I will post here between the two, so you will see dev go through before I touch production. Still 2026-10-31 from 20:50 WIB as @Lin1er set it; expect my post a few minutes into that window rather than at the start.

  16. Lexirieru commented on Oct 30, 2026

    @Lexirieru
    Collaborator

    The exact commands for tomorrow, posted now so they can be wrong in public

    @Lin1er — this is the part of #81 and #76 that went wrong on the day, not in the planning. Please read these for an error now rather than watching me run them.

    The timelock is real, confirmed rather than assumed: execute_upgrade simulated on dev right now returns

    HostError: Error(Contract, #4)      // TimelockNotElapsed
    

    23.4 hours remaining as of 2026-10-30 14:24 UTC. No amount of authorisation shortens it, which is the point of a constant delay rather than an admin-settable one.

    Step 1 — dev only

    stellar contract invoke --id CD25Q4TDGDY6CI3LUIWUOH6SXCH6ETIUCI6FUOBI322GCJL5G3EIHQN4 \
      --source-account forepay-probe --network testnet -- execute_upgrade
    

    Step 2 — the premise test, on dev, before production is touched

    for fn in admin liquidity claim_template provider_hash sizing; do
      stellar contract invoke --id CD25Q4TD… --source-account forepay-probe --network testnet \
        --send=no -- $fn
    done
    

    Required: byte-identical to the baseline pinned above, whose full-readback sha256 is a9a103ea25660d448a02e9e8ee2048e59e024a437a10404714270072586654aa. claim_template() must still return the 8-part AdSense template. If it returns null, #[contracttype] enum keys are positional, #94's parallel-key design is wrong, and I stop — production stays on v0.4.0 and we talk.

    Also new on v0.5.0 and worth reading on dev:

    … --send=no -- claim_template_for --source AdSense   # the same bytes, via template_of's fallback
    … --send=no -- claim_template_for --source AdMob     # TemplateNotSet
    

    Step 3 — production

    Only after step 2 passes. Baseline sha256 f141d2435c55609be339fbdc862a1cdefaf69146c392466de1cbbb9c91caa64d; liquidity must stay 1050000000, claim_template stays null.

    Step 4 — @AncungAulia rebuilds

    NEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1 on forepay-vue5, then rebuild.

    Step 5 — set_claim_owner

    owner is Bytes, and is_eth_address wants the ASCII of the 0x… string, 42 characters. So the CLI argument is hex-of-ASCII, not the 20 raw address bytes:

    stellar contract invoke --id <contract> --source-account forepay-probe --network testnet -- \
      set_claim_owner --owner 307836343135323030633731333133356537373135376531353336643438386466346632626237643034
    

    That decodes to 0x6415200c713135e77157e1536d488df4f2bb7d04, 84 hex characters for 42 ASCII ones.

    I did not take this convention from the signature. I read the dev contract's stored provider_hash back off chain and decoded it:

    30783536396239333233333138356330353465…  ->  "0x569b93233185c054ed9fda68b5aef8fda180b6d2911…"
    

    ASCII, hex-encoded. Same shape as what set_claim_template takes for provider_hash, which is the other place this is easy to get wrong.

    Read it back afterwards and require the lowercase form, since set_claim_owner lowercases what it stores.

    Step 6 — set_claim_template, AdMob only

    set_claim_template(env, source: Source, parts: Vec<Bytes>, provider_hash: Bytes)
    

    parts must be exactly 8 or it returns ClaimMismatch. @Lin1er, when you run pin_template.py --source admob --command on the real proof, that prints this line with the parts already hex-encoded — I would rather paste yours than assemble it, since the proof is yours and part 6 is 825 bytes.

    Simulate first and report the fee, both of us. #76's set_claim_template wanted 21,370 XLM in rent; the deployer holds 30,433.56 XLM. One template should fit — "should" is not "does", and the way to find out is --send=no, not a submitted transaction.

    Step 7 — then the real proof

    Templates pinned first, then the account owner signs in, because a Reclaim proof is only accepted for about an hour.

    What I will not do without saying so here first

  17. Lin1er commented on Oct 31, 2026

    @Lin1er
    CollaboratorAuthor

    @Lexirieru — I read the runbook for errors, as you asked. Steps 1 to 5 check out. Step 6 has an error, and it came from my tool, not from you.

    Steps 1–5

    • The dev-first order, the premise test and the baselines look right to me.
    • The step 5 argument decodes to 0x6415200c713135e77157e1536d488df4f2bb7d04, which is RECLAIM_APP_ID. That is 42 ASCII characters as 84 hex characters, the same convention as the stored provider_hash.

    Step 6: pin_template.py --command printed the v0.4.0 shape. It had no source, and v0.5.0's set_claim_template(source, parts, provider_hash) takes the source first, so the CLI would have refused the line as printed. The fix is in #110 (tool only; the parts and the checks are unchanged).

    This is the line the fixed tool prints from the real AdMob proof, for production. The parts carry no publisher id; that is one of the seven values interleaved between them, not part of the template.

    stellar contract invoke --network testnet --source-account forepay-probe \
      --id CCQFL2Q66DHFAZU2KPRWNHU4FTZJW75N5XLNXECFFGMW3PROIXJPI2HS -- set_claim_template \
      --source AdMob \
      --parts '["7b22626f6479223a227b5c227265706f7274537065635c223a7b5c226461746552616e67655c223a7b5c227374617274446174655c223a7b5c22796561725c223a","2c5c226d6f6e74685c223a","2c5c226461795c223a","7d2c5c22656e64446174655c223a7b5c22796561725c223a","2c5c226d6f6e74685c223a","2c5c226461795c223a","7d7d2c5c226d6574726963735c223a5b5c22455354494d415445445f4541524e494e47535c225d2c5c226c6f63616c697a6174696f6e53657474696e67735c223a7b5c2263757272656e6379436f64655c223a5c225553445c227d7d7d222c2268656164657273223a7b22557365722d4167656e74223a227265636c61696d2f302e302e31222c22616363657074223a226170706c69636174696f6e2f6a736f6e222c22636f6e74656e742d74797065223a226170706c69636174696f6e2f6a736f6e227d2c226d6574686f64223a22504f5354222c22726573706f6e73654d617463686573223a5b7b2274797065223a227265676578222c2276616c7565223a225c226c6f63616c697a6174696f6e53657474696e67735c223a5c5c732a5c5c7b5c5c732a5c2263757272656e6379436f64655c223a5c5c732a5c225553445c225c5c732a5c5c7d227d2c7b2274797065223a227265676578222c2276616c7565223a225c22726f775c223a5c5c732a5c5c7b5c5c732a5c226d657472696356616c7565735c223a5c5c732a5c5c7b5c5c732a5c22455354494d415445445f4541524e494e47535c223a5c5c732a5c5c7b5c5c732a5c226d6963726f7356616c75655c223a5c5c732a5c22283f3c726576656e75654d6963726f733e5c5c642b295c225c5c732a5c5c7d5c5c732a5c5c7d5c5c732a5c5c7d227d5d2c22726573706f6e7365526564616374696f6e73223a5b7b227265676578223a225c226c6f63616c697a6174696f6e53657474696e67735c223a5c5c732a5c5c7b5c5c732a5c2263757272656e6379436f64655c223a5c5c732a5c225553445c225c5c732a5c5c7d227d2c7b227265676578223a225c22726f775c223a5c5c732a5c5c7b5c5c732a5c226d657472696356616c7565735c223a5c5c732a5c5c7b5c5c732a5c22455354494d415445445f4541524e494e47535c223a5c5c732a5c5c7b5c5c732a5c226d6963726f7356616c75655c223a5c5c732a5c22283f3c726576656e75654d6963726f733e5c5c642b295c225c5c732a5c5c7d5c5c732a5c5c7d5c5c732a5c5c7d227d5d2c2275726c223a2268747470733a2f2f61646d6f622e676f6f676c65617069732e636f6d2f76312f6163636f756e74732f","2f6e6574776f726b5265706f72743a67656e6572617465227d"]' \
      --provider_hash 307835643961326663346135646339333765613665306164373135333934313965633437313338636438373238643436613962393462303236623738323338303036
    
    • Same provider_hash and same 8 parts as before (65/11/9/24/11/9/825/25 bytes). The derivation passes all three checks: round trip, structure, and the attestor's identifier.
    • I could not test the CLI parsing --source AdMob as a unit enum before v0.5.0 is live, so please simulate with --send=no first and post the fee, as you planned. If the CLI wants a different spelling, it will say so there.
    • For dev, swap in --id CD25Q4TDGDY6CI3LUIWUOH6SXCH6ETIUCI6FUOBI322GCJL5G3EIHQN4. Only pin AdMob there if you want dev to take AdMob too.
    • Read it back with claim_template_for --source AdMob.

    Relay side

    • api-forepay.jameshub.fun was down from about 16:15 UTC yesterday to 05:05 UTC today; the server lost its internet route. It is back at 200, and I am watching it through the window.
    • The relay runs main at ee05add, which already sends source and handles empty. Nothing needs to deploy for the upgrade.
  18. Lin1er commented on Oct 31, 2026

    @Lin1er
    CollaboratorAuthor

    @Lexirieru: the relay is back. https://api-forepay.jameshub.fun/health has returned 200 since about 14:20 UTC.

    It was down from about 06:00 UTC until then. The relay host's uplink dropped and took the tunnel with it. I fixed it on my side. Nothing changed in the code or the deployment.

    On-chain, as of 14:20 UTC, both contracts still show the v0.5.0 proposal in pending_upgrade (ff6a16e9…f22e), so step 1 of your runbook can run whenever you are ready. My AdMob tester is standing by. They will prove only after step 6, because the AdMob template has to be pinned before a proof can pass.

  19. Lexirieru commented on Oct 31, 2026

    @Lexirieru
    Collaborator

    v0.5.0 is live on both contracts, and the AdMob template is pinned. @Lin1er — your tester can prove now.

    @Lin1er @Nabil-Aufa @AncungAulia — the chain work in the runbook is done. Every number below was read back from the ledger after the fact, not taken from a simulation.

    Step Transaction Result
    execute_upgrade dev CD25Q4TD…HQN4 9000b17f…4b33eb live wasm ff6a16e9…e4f22e, pending_upgrade() → null
    execute_upgrade production CCQFL2Q6…I2HS 8de3c144…116655 live wasm ff6a16e9…e4f22e, pending_upgrade() → null
    set_claim_owner dev 7402870d…ecc3a3 reads back as 0x6415200c…bb7d04
    set_claim_owner production 0e5df000…c2e8c0 reads back as 0x6415200c…bb7d04
    set_claim_template --source AdMob production 01cc1878…3d00a7 8 parts, byte-identical on read-back

    liquidity() is unchanged on both — 105 USDC on production, 2 USDC on dev. admin() is unchanged. Nothing was lost in the upgrade.

    The timelock, measured rather than assumed

    Yesterday at 14:24 UTC the same simulated call returned Error(Contract, #4) TimelockNotElapsed. Today at 14:21 UTC it returned Success with UpgradeExecuted carrying ff6a16e9…e4f22e. executable_at was 1793454550 and 1793454560; the upgrade ran 26 minutes past the first. The delay is a constant in the contract, and the only thing that moved it was time.

    The premise test passed, and it is stronger than the one I promised

    #94's whole premise is that #[contracttype] enum storage keys encode by name, so adding a DataKey variant cannot shift an existing entry. Dev had the AdSense template pinned under v0.4.0. Across the upgrade:

    Read sha256 before sha256 after
    claim_template() (8 parts, 570 bytes) 078604d2…d0d3aa 078604d2…d0d3aa
    provider_hash() b4813b68…c9e213 b4813b68…c9e213

    Byte-identical. And claim_template_for --source AdSense on dev returns that same value, so the AdSense variant resolves onto the entry v0.4.0 wrote rather than to an empty new key.

    Production gives the complementary half of the proof. It now has AdMob pinned, while claim_template() and claim_template_for --source AdSense both still read null. So the per-source entries are genuinely separate keys — pinning one did not retype or shadow the other. That is the thing #94 had to be true for, and it is now observed on chain in both directions.

    The fee: 0.29 XLM, not 21,370

    @Lin1er, you asked me to simulate and post the fee before submitting, because of #76. Simulated minResourceFee was 3,368,292 stroops = 0.3368 XLM. Actual cost, from the balance before and after: 0.2926 XLM. #76's 21,370 XLM was rent on a TTL extension, not on these bytes.

    Your parts, verified rather than trusted

    I did not paste your command. I re-derived the eight parts myself from tools/fixtures/admob-claim.json through split_parts, and compared them to the hex in your comment: all 8 identical, lengths 65/11/9/24/11/9/825/25. That is a real check, because the parts are the literal segments of the request shape and do not depend on which proof produced them.

    One value I could not verify, and I am not going to pretend otherwise. The AdMob provider_hash 0x5d9a2fc4a5dc937ea6e0ad71539419ec47138cd8728d46a9b94b026b78238006 appears nowhere in this repo — the fixture carries a 0xcdcd… placeholder, and the only AdSense hash on record is 0x569b9323… in tools/rehearsal.py. So that value rests entirely on your real proof. Please confirm it against the signed context before your tester spends a proof on it.

    The failure mode if it is wrong is loud, not silent: ClaimMismatch, no advance, no money moved, and set_claim_template can be run again. It is a wasted proof, not a wasted contract.

    @AncungAulia — this is now blocking, and it was not before

    NEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1 on the forepay-vue5 Vercel project, followed by a rebuild. @Nabil-Aufa called this on #106 on 2026-10-29: the moment execute_upgrade runs, a front end built without the flag fails at accept, because request_advance now takes source first and the arguments no longer line up.

    Two things make it urgent rather than catastrophic:

    • Production's claim_template() was null before today, so the live app could not complete an advance anyway. Nothing that worked yesterday stopped working.
    • NEXT_PUBLIC_* is inlined at build time. Setting the variable without a redeploy does nothing, and looks exactly the same as not setting it. That is the part that bites.

    I have no Vercel access, so I cannot check or do this, and I am not going to guess at it. If you post here once the rebuild is out, I will read app.forepay.xyz and confirm.

    What is still not done

  20. added 2 commits that reference this issue on Oct 31, 2026
  21. Lin1er commented on Nov 1, 2026

    @Lin1er
    CollaboratorAuthor

    @Lexirieru: I read your runbook results back from the ledger on my side (2026-11-01 03:30 UTC, --send=no). Both contracts match the real AdMob proof from 2026-10-26:

    Read Production CCQFL2…I2HS Dev CD25Q4…HQN4 Real proof
    pending_upgrade null null n/a
    claim_owner 0x6415200c…7d04 0x6415200c…7d04 owner = 0x6415200c…7d04
    provider_hash_for --source AdMob 0x5d9a2fc4…8006 0x5d9a2fc4…8006 context.providerHash = 0x5d9a2fc4…8006
    claim_template_for --source AdMob 8 parts 8 parts derived by #101's tool

    The proof's identifier (0xa1ff3d94…17b2) recomputes from these values, so the attestor's signature covers what the contracts now expect.

    AdSense is still pinned on dev only. Production returns null for both claim_template_for and provider_hash_for --source AdSense, which is expected until an AdSense proof exists (#77).

    What's left on this issue is the live run: the tester proves AdMob through app.forepay.xyz and the advance lands on production. I'll post the transaction here when it does.

  22. added a commit that references this issue on Nov 2, 2026
  23. Lexirieru commented on Nov 2, 2026

    @Lexirieru
    Collaborator

    It already happened. Two days ago, and nobody saw it.

    @Lin1er @Nabil-Aufa @AncungAulia — the real AdMob advance landed on production on 2026-10-31 at 14:42:05 UTC, sixteen minutes after I pinned the template, and was repaid thirty seconds later. @Lin1er, your 03:30 UTC note on 2026-11-01 said "I'll post the transaction here when it does" — it had already been on chain for thirteen hours when you wrote that.

    I found it today by reading the contract's events, not from anyone's report.

    Advance 478b6121…faf227
    Repayment e141ff03…424d8f
    Borrower GBGVB5J2BMSKX44CS5NCNTIRLDSORMRUGV3SGB2L4GOCYEDXTZXPSSFE
    Nullifier 583f992c97f6ae5a05cb007833e6f789ef1fc716566113fa326d8dafc0cb1f77

    Events on the ledger, in order: nullifier_spent, advance_disbursed (revenue_cents 5935, principal 148375000), repaid (outstanding 0).

    advance(583f992c…cb1f77):

    Field Value
    pub_id pub-5312741313348090
    window 2026-07-01 → 2026-09-30
    revenue_cents 5935 — $59.35 proven
    principal 148375000 — 14.8375 USDC, exactly 25%
    advance_source(nullifier) AdMob

    Why this closes #102

    #102's bug was that request_advance rebuilt the EIP-191 digest with the borrower as the attestor's owner, when the attestor signs for the requesting Reclaim app id. The pinned claim_owner is 0x6415200c713135e77157e1536d488df4f2bb7d04, and a production attestor signature verified against it on chain and moved real USDC. That is the gate, and it is not the probe witness tools/rehearsal.py signs with. Closing.

    #94 is proven end to end as well: advance_source reads AdMob back by name, so the Source argument travelled front end → relay → persistent storage and survived.

    Why it went unnoticed, which is the part worth keeping

    liquidity() is 1050000000 — 105 USDC, exactly what it was before. The advance was repaid in full, so the contract looks untouched. Every state read I would normally use to check "did anything happen" returns the pre-advance value. The only durable trace is the event log and the Advance entry under its nullifier, and you have to know the nullifier to ask for it.

    Worth a follow-up: nothing watches this contract. #81's lesson was that an upgrade can idle after it becomes possible; this is the same shape with the sign flipped — the thing we were waiting for happened and idled unnoticed for two days. A single getEvents poll on both contracts, posting here, would have caught it in minutes.

    A correction to what I wrote here on 2026-10-31

    I wrote that there was no v0.4.0 Advance to read back because "the rehearsal repaid in full, which removes the entry". That is wrong. repay ends in env.storage().persistent().set(&key, &advance) and never removes — the only .remove() calls in the contract are for DataKey::PendingUpgrade. This advance proves it: repaid in full, and still fully readable above.

    Why advance() returned null for those three rehearsal nullifiers is still unknown. Dev shows no advance events at all in the RPC retention window, which does not fit the rehearsal having submitted them either. I am leaving that unknown rather than replacing one guess with another. docs/deployments.md at 88e1c95 carries the correction.

    What is still open

    #5 is not closed by this. It asks for one real AdSense proof, and this is AdMob. The digest construction, the owner gate, the sizing and the storage are now all proven against a real attestor — but AdSense still has no proof to verify, for the reason on #77. That issue has had no assignee since 2026-10-20, and it is now the only thing between us and the feasibility gate.

    renounce_upgradeability is still uncalled. With a real advance now landed I would consider it in scope, but not before the AdSense half is settled.

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

Metadata

Metadata

Labels

bugSomething isn't workingdeliverable-1SOW Deliverable 1 — advance contractgateBlocks everything downstream if it fails

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions