Repository navigation
feat(#97): choose AdSense or AdMob on 2a, and prove the chosen one - #104
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A report with no row is how AdMob says the account earned nothing. That is not a shape the relay failed to expect, so the front end should not tell the creator to try again in a few minutes (asked on #104).
|
@Nabil-Aufa, answers to your two questions: 1. A code for AdMob at zero: done on #100 (
Only AdMob sends it. AdSense at zero still answers with a total row, so it is not a relay error; it would reach the offer as $0. Your "No AdMob revenue in these months" panel can key on 2. Two things it needs, both on the console side, so I am leaving the call to whoever holds the project there:
Until then |
|
Correction to point 1 above: I was wrong that AdSense at zero answers with a total row. I checked the AdSense report for the account outside the team: it is READY and earned nothing in Jul–Sep, and AdSense sent only Fixed on #100 (
|
|
@Nabil-Aufa, an update on question 2: the consent screen is now published (#86, 2026-10-27), and @Lin1er is adding That leaves two things before the browser flow works against the real relay:
The legal pages for the second scope are on #105. |
- 2a asks where the creator earns, AdSense (websites) or AdMob (apps). The Google sign-in asks for that source's read-only scope only, and a token without it counts as the creator stopping. - POST /proofs carries `source: "admob"` for AdMob only, so an AdSense request is what it was before. The kept job records its source, and a resumed job proves what it was started for. - The relay's `token` and `account` failures name AdMob for an AdMob proof (googleSignInAdmob, noAdmob). The waiting, checking and offer copy name the source. - An AdMob figure is sized from its micros truncated to cents (`provenUsd`). `request_advance` gets the signed micros; its AdMob arguments land with #94. - The mock answers AdMob the relay's way, so the flow runs without a relay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arrowest phones - relay.spec: choosing AdMob asks Google for admob.readonly only, sends `source: "admob"`, sizes the offer from the micros truncated to cents and names AdMob on the offer. A Google account with no AdMob gets the AdMob panel, and Prove again stays on AdMob. - The two source tiles sit side by side from about 19rem of card, and stack below it, where "AdSense" spilled out of its tile at 320 (layout.spec). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… pins which one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ays so From a strict review: - A job kept as AdMob made the choice again only for its own resume. After leaving and coming back, Prove again asked Google for adsense.readonly and the relay proved AdSense. `proofRunning` now returns the kept job's source, and `prove(src)` makes it the choice, so Prove again and Back stay on it. - "Reading your revenue" names the source, from the kept job on a resume. - The contract's refusals that name AdSense (10, 11, 14, 30) name AdMob for an AdMob proof. - The source tiles say "Websites" and "Apps", so neither wraps where the other does not, and the tile's ring is the only focus indicator. - An AdMob request without micros is cut to cents before `quote`, which refuses a third decimal place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c60531e to
17cf2a3
Compare
…urce, once the contract takes it #106 (#94) puts `source: Source` first in both calls. Behind NEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1 the front end sends it, as `vec[symbol("AdSense")]` or `vec[symbol("AdMob")]`; unset, the calls are what they were, so this can merge before the upgrade and the switch is one env change when it executes. The relay e2e build runs as against #106's contract and the mock build as before it. The stub sizes an AdMob request_advance from its micros, and the AdMob test now goes through to 2d. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A report with no row is how AdMob says the account earned nothing. That is not a shape the relay failed to expect, so the front end should not tell the creator to try again in a few minutes (asked on #104).
Lexirieru
left a comment
There was a problem hiding this comment.
Approving, @Nabil-Aufa. The part I came to check hardest — the encoding, and the decision to put AdMob's micros into a parameter literally named revenue_usd — is right, and right for a reason you state rather than assume.
Verified here
| What | Result |
|---|---|
pnpm vitest run in fe/ |
28 files, 201 tests, 201 pass |
sourceArg against #106's ABI |
scvVec([scvSymbol("AdSense" | "AdMob")]) is exactly how a Source unit variant encodes |
Argument order against the merged request_advance |
(env, source, borrower, revenue_usd, pub_id, window_start, window_end, timestamp_s, epoch, signature, recovery_id) — advanceArgs matches position for position |
Every nullifierFor / provenUsd / advanceArgs call site |
all pass the source through; none falls back to the AdSense default by omission |
On the micros: #106's revenue_cents dispatches on the source — parse_usd_cents for AdSense, parse_micros_cents for AdMob — and revenue_key picks revenueUsd or revenueMicros for the context rebuild. So the signed micros string belongs in revenue_usd, and sending the decimal there instead would be the bug. The parameter name is the thing that's wrong, and it's wrong in the contract, not here.
provenUsd truncates with BigInt(micros) / 10_000n, which is what parse_micros_cents does, down to refusing to round up.
The fallback fails loud — checked, not assumed
I went after the !req.revenueMicros path, where "0.004567" becomes "0.00", expecting it to turn a loud refusal into a silent $0 offer. It does not. Simulated against the live contract CCQFL2Q6…I2HS:
quote("0.00") -> HostError: Error(Contract, #31) // AdvanceTooSmall
So a sub-cent figure stops at the quote with a named error, before the wallet is involved. The fallback is safe, and only reachable if the relay omits revenueMicros, which #100 never does.
One thing for the sequence, and it is not about AdMob
The step your "After merge" list numbers 3 is the risky one, and it is riskier than the list makes it look:
@AncungAulia sets
NEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1onforepay-vue5and redeploys, right away.
Between execute_upgrade and that rebuild, AdSense is down too — not only AdMob. The live bundle sends nine arguments to a ten-argument function, so every advance fails at simulation, including the one the demo walks through. You say "nothing is lost", which is true, and I want to be precise about what is: no funds, no proofs, no state. Only the app, for as long as the rebuild takes.
Two things follow:
NEXT_PUBLIC_*is inlined at build time. Setting the variable in Vercel and not redeploying changes nothing at all, and the symptom is identical to not having set it. Your wording already says "redeploys" — I am underlining it because this is the step where that distinction bites.- This is a booked human handoff, not a note in a PR body. @AncungAulia has to be at a keyboard at the moment I run
execute_upgrade. I will not run it until that is agreed, and I will post the timestamp here and on #94 beforehand.
Not blocking, and already on your list
AdvanceDetails saying "AdSense revenue" for the first AdMob advance is the one that becomes visibly wrong rather than merely incomplete. #107 just merged and /advances now carries source per row, read from the call itself — so the data is there, and it needs no second contract read. Small follow-up, worth doing before the demo rather than after.
Merging. With the flag unset, every call this ships is byte for byte what main sends today, which I checked by reading withSource rather than by trusting the claim.
A report with no row is how AdMob says the account earned nothing. That is not a shape the relay failed to expect, so the front end should not tell the creator to try again in a few minutes (asked on #104).
…ST /proofs (#100) * feat(#95): an AdMob provider beside AdSense, selected by source on POST /proofs be/src/admob/ proves the trailing AdMob revenue the way be/src/adsense/ proves AdSense's: a POST to networkReport:generate whose JSON body carries the window (signed byte for byte, #93), with regexes written against the bytes #93 read from a real account, including the \n,\r\n separator. - The figure is extracted as revenueMicros, an integer; the contract truncates it to cents (#94). At zero AdMob sends no row, and the relay stops with provider before the attestor. - The AdSense audit takes a ClaimShape, so both sources share one allow-list, credential scan and signature check. AdSense's behaviour and its request JSON are unchanged. - POST /proofs takes source: "adsense" | "admob", defaulting to adsense. - prove:admob produces one real proof, with the token passed inline, as the input to the AdMob template (#96). - A test pins the signed value order for AdMob, dates before pub_id, which is what the contract has to rebuild (#94). docs/admob-provider.md and docs/api.md describe it. 117 BE tests pass. * fix(#95): AdMob at zero fails with its own code, empty, not provider A report with no row is how AdMob says the account earned nothing. That is not a shape the relay failed to expect, so the front end should not tell the creator to try again in a few minutes (asked on #104). * fix(#95): AdSense at zero fails as empty too An approved AdSense account with no earnings answers with only its headers and dates: no totals, no averages, no row count. That failed as provider, the same as a shape we did not expect. It is now empty, before the attestor, like AdMob. * test(#95): an AdMob proof is held to the relay's own claim owner too (#102)
Closes #97 once the flow completes for both sources against the relay (see "After merge").
Targets
main(#75 is merged). Ready for review, @Lexirieru.Safe to merge before #106. With
NEXT_PUBLIC_CONTRACT_TAKES_SOURCEunset, every call to the contract is byte for byte whatmainsends today. AdSense behaves exactly as now. An AdMob proof gets as far as the offer, and the deployed contract refuses it at simulation ("Forepay is not taking AdMob proofs yet"), before the wallet is asked to sign.What changed
f4eddd5POST /proofscarriessource: "admob"for AdMob only, so an AdSense request is byte for byte what it was. The kept job records its source.noAdmobandgoogleSignInAdmobpanels. The mock answers AdMob the relay's way.e3d8aaa980639d1cb136f17cf2a30b2a5d1sourcefirst inrequest_advanceandnullifier_for. Both calls now lead withvec[symbol("AdSense")]orvec[symbol("AdMob")], behindNEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1. Unit tests for the encoding, flag off and flag on. The relay build sets the flag, and e2e asserts which source each call carried.Fixes found in review:
adsense.readonly.proofRunningnow returns the kept job's source, which becomes the choice, so Prove again and Back stay on AdMob. An e2e test walks it across a real remount.How the AdMob figure is used
As
docs/api.mdon #100 describes it: the relay returnsrevenueMicros(the signed figure) andrevenueUsd(the exact decimal, display only).provenUsd).quoterefuses a third decimal place.$360.004567is quoted as$360.00.request_advancegets the signed micros string asrevenue_usd, behindadvanceArgs, as @Lin1er confirmed for feat(#94): AdMob as a second revenue source, and refuse an unpinned claim owner #106.After merge
In this order, from the front end's side (also on #106):
propose_upgrade, the 24-hour timelock, thenexecute_upgrade.NEXT_PUBLIC_CONTRACT_TAKES_SOURCE=1onforepay-vue5and redeploys, right away. Between 2 and 3 nobody can accept an advance, but nothing is lost: the refusal comes at simulation.set_claim_owner, then the AdSense and AdMob templates.Also needed for AdMob from the browser:
admob.readonlyon the OAuth client (#98).Answered on this PR
empty, on feat(#95): an AdMob provider beside AdSense, selected by source on POST /proofs #100. A "No AdMob revenue in these months" panel is a small follow-up once feat(#95): an AdMob provider beside AdSense, selected by source on POST /proofs #100 merges, since AdSense at zero sendsemptytoo.admob.readonlyis being added (AdMob (#90): consent screen and privacy policy, the second scope #98).For the board (@AncungAulia)
New on 2a, not on the board yet. A proposal in the board's tile style:
$radius-tile,$brandstroke and$brand-subtlefill when chosen, the same as the "Shape tile" token. It sits under the body copy, above the two lists:Board strings that now name the source:
New panels, "Prove again" + "Back" like their AdSense twins:
Not done here
BeforeYouStart, the empty ledger, the landing page metadata and the wallet kit's description. AlsoAdvanceDetailson Repayment ("AdSense revenue, …"). That one becomes wrong for the first AdMob advance, and should read the source from feat(#94): AdMob as a second revenue source, and refuse an unpinned claim owner #106'sadvance_sourceonce it is live.Checked
AdMob.sourcecommit passed an independent review.🤖 Generated with Claude Code