Skip to content

AdMob (#90): pin the AdMob claim template from a real proof #96

Closed

Description

@Lin1er

Owner: @Lexirieru, with @Lin1er · Branch: tools/admob-template · Parent: #90 · Was blocked by: #93, done 2026-10-26 (both parts) · Start: now on the branch, pending @Lexirieru's go on #90 for merging before 2026-10-30 (otherwise after 2026-11-08) · Label: out-of-sow · Also blocked by: the relay issue (one real AdMob proof)

Pin the AdMob claim template and provider_hash on the advance contract, derived from a real AdMob proof.

What

  1. Extend tools/pin_template.py (tools(#61): derive the claim template from a real proof, and prove it three ways #83) to the AdMob shape.
    • The literal parts carry the escaped JSON body.
    • The values are interleaved in the order the contract issue fixes.
  2. Prove the derivation the same three ways as tools(#61): derive the claim template from a real proof, and prove it three ways #83.
  3. Call set_claim_template(source = AdMob, …) on the production contract, and on the rehearsal contract if useful.
    • Mind the fee: set_claim_template cost 21,370 XLM on 2026-10-25 (docs/deployments.md). Size the AdMob template call before sending it.

Done when

  • claim_template for AdMob reads back as pinned.
  • One real AdMob proof verifies through verify_claim (simulated at least).
  • The tx is recorded in docs/deployments.md.

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. Lexirieru commented on Oct 25, 2026

    @Lexirieru
    Collaborator

    Scope correction for this issue, from #93. On #90 I wrote that tools/pin_template.py "should take the AdMob shape with little more than a different value layout". That was too optimistic, and I have now proven it against the tool itself — details and output on #94.

    Two parts of the tool are AdSense-shaped, not source-neutral:

    1. values_for() returns [pub_id, sy, sm, sd, ey, em, ed]. AdMob needs [sy, sm, sd, ey, em, ed, pub_id], because body sorts before url in the canonical parameters. In the AdSense order, split_parts refuses an AdMob proof outright — it searches left to right and the dates sit before pub_id, at offset 65 against 386. The refusal is correct behaviour, and it means the tool cannot be pointed at an AdMob proof as it stands.

    2. check()'s structure assertions are wrong for a JSON body. It requires part 0 to end with / and every separator to end with =. On an AdMob-shaped proof, part 0 ends \"year\":, all six separators end with :, and the last ends /accounts/. Every assertion fails.

    That second one needs care rather than deletion. Those assertions are the only check that catches a split landing on the wrong occurrence of a one-character value like "1" or "7" — the round trip passes for a wrong split, and the signature check passes too, because the identifier is recomputed from the rebuilt string either way. Drop them and the tool loses the thing it exists for. For AdMob the equivalent is that each date value must sit immediately after \"year\":, \"month\": or ,\"day\":, and pub_id immediately after /accounts/ — tighter than the AdSense rule, because the JSON key names are in the separator.

    The --self-test needs an AdMob fixture alongside the AdSense one, so CI keeps proving both derivations before the day they matter. Same reasoning as the existing self-test: a tool that runs once, on the most consequential day, has to be known-good before it.

    Still blocked by #93 part 2 and still after 2026-11-08.

  2. added
    ready-to-devUnblocked: development can start on the issue's branch
    on Oct 26, 2026
  3. Lin1er commented on Oct 26, 2026

    @Lin1er
    CollaboratorAuthor

    The tool half is in draft as #101, on top of #100. It adds --source admob, the value order per source, per-source structure rules (tighter for AdMob), and a self-test that runs both sources. Each source refuses the other's value order. The AdMob fixture is the relay's own request, and it is cross-checked by a BE test. What is left is running it on the first real AdMob proof.

  4. Lin1er commented on Oct 26, 2026

    @Lin1er
    CollaboratorAuthor

    The AdMob template, derived from the first real AdMob proof

    prove:admob was run on 2026-10-26 against the account outside the team, with its owner's agreement (#77). The proof is signed by the production attestor 0x2448…9072, timestampS 1793028882, and it passed the audit. Then #101's tool:

    pin_template.py PROOF --source admob --pub-id pub-<redacted> --start 2026-07-01 --end 2026-09-30
      values     ['2026', '7', '1', '2026', '9', '30', 'pub-<redacted>']
      round trip ....... the parts and values reproduce the signed parameters exactly
      structure ........ every value sits immediately after its own admob separator
      signature ........ identifier recomputes to 0xa1ff3d94…17b2, which the attestor signed
    
    provider_hash: 0x5d9a2fc4a5dc937ea6e0ad71539419ec47138cd8728d46a9b94b026b78238006
    
      [0]   65B  '{"body":"{\\"reportSpec\\":{\\"dateRange\\":{\\"startDate\\":{\\"year\\":'
      [1]   11B  ',\\"month\\":'
      [2]    9B  ',\\"day\\":'
      [3]   24B  '},\\"endDate\\":{\\"year\\":'
      [4]   11B  ',\\"month\\":'
      [5]    9B  ',\\"day\\":'
      [6]  825B  '}},\\"metrics\\":[…] … ob.googleapis.com/v1/accounts/'
      [7]   25B  '/networkReport:generate"}'
    
    • The real signed parameters are byte-identical to tools/fixtures/admob-claim.json once the publisher id is swapped. The attestor signed exactly what the relay built. Neither the content-type header nor the body escaping surprised us.
    • The value order is [sy, sm, sd, ey, em, ed, pub_id], as @Lexirieru proved on AdMob (#90): contract, a revenue source in the template, the nullifier and sizing #94. The template has 8 parts and contains no publisher id or figure, so it is safe to publish.

    But it cannot be used yet. See #102. The production contract rebuilds the attestor's owner as the borrower, while a real proof's owner is our Reclaim app id. So no real proof verifies, for AdSense or AdMob. That has to ride in the same upgrade as #94.

  5. added 4 commits that reference this issue on Oct 29, 2026
  6. added 3 commits that reference this issue on Oct 30, 2026
  7. Lexirieru commented on Oct 30, 2026

    @Lexirieru
    Collaborator

    pin_template.py --source admob is merged (#101, 2ea1e15) and rebased onto main — I moved it off feat/admob-relay since #100 was squash-merged, so its diff is the four files it owns and nothing else.

    Run here before merging, both sources:

    self-test (admob) against tools/fixtures/admob-claim.json
      values     ['2026', '7', '1', '2026', '9', '30', 'pub-1234567890123456']
      signature ........ identifier recomputes to 0x4f3b53c4…8aba6, which the attestor signed
      wrong window ..... refused, as it must be
      adsense order .... refused, as it must be
    

    That identifier is byte-identical to what make_claim_fixture.py derives independently from docs/interface.md, and the tagged nullifier b4e99442…d93a58 now has three agreeing derivations too (the contract's Rust, #107's TypeScript, a Python one). CI runs --self-test for both sources on every push, so the tool stays known-good until the day it is used.

    v0.5.0 is proposed on both contracts, executable 2026-10-31 13:49:10 UTC (#102 has the hashes). After execute_upgrade and set_claim_owner, pinning happens in this order:

    1. AdSense (Pin the AdSense claim template on the deployed advance contract #61), from the real AdSense proof.
    2. AdMob, from @Lin1er's real prove:admob proof — he has offered to run pin_template.py --source admob on it and send the exact command, which is the right division of labour since the proof is his and the admin key is mine.

    The fee gets read at simulation on each, not estimated. #76's set_claim_template wanted 21,370 XLM in rent against a balance that is now 29,433 XLM, and two templates have to fit. It cannot be simulated before the upgrade, because the two-argument signature is not on the deployed wasm yet. I will post each figure before submitting.

    One timing constraint worth repeating from @Lin1er: a Reclaim proof is accepted for about an hour, so the account owner signs in after the templates are pinned, not before.

  8. Lexirieru commented on Oct 31, 2026

    @Lexirieru
    Collaborator

    Pinned on both contracts. Closing this.

    Contract Transaction Read-back
    production CCQFL2Q6…I2HS 01cc1878…3d00a7 claim_template_for --source AdMob → 8 parts, byte-identical to what was sent
    dev CD25Q4TD…HQN4 e9b1f0ed…cc9e43 same

    provider_hash_for --source AdMob reads back as 0x5d9a2fc4a5dc937ea6e0ad71539419ec47138cd8728d46a9b94b026b78238006 on both. Simulated fee 0.3368 XLM, actual 0.2926 XLM — the full record is in docs/deployments.md at b9f7990.

    @Lin1er's eight parts were re-derived independently rather than pasted: all 8 identical, lengths 65/11/9/24/11/9/825/25. It is pinned on dev as well as production so the AdMob path can be rehearsed on the contract that holds 2 USDC rather than 105.

    This issue is about pinning the template, and the template is pinned. What it does not prove is that a proof verifies against it — that is #102, and it stays open until @Lin1er's tester signs in. The one value with no check on our side is the provider hash, which exists only in a real proof's signed context; if it is wrong the failure is ClaimMismatch, and set_claim_template can be run again.

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

Metadata

Metadata

Labels

out-of-sowNot an Instawards deliverableready-to-devUnblocked: development can start on the issue's branch

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions