Repository navigation
Wizard steps 2–3: metadata write + pools + invert verification (hub-e19 increment C) - #94
Conversation
|
E2E fork demonstration added and passing ( Note what happened on the first run: the NO pool's real token ordering required This is the success-criterion mechanics (create → metadata → pools → verified) proven on a fork through the same modules the UI calls. The browser-level twin lands as an auto-qa harness scenario before merge. |
|
Increment D (wizard side) added in |
|
Full-journey demonstration now passing ( Demo liquidity amounts decide nothing about the deferred product defaults (§5a) — they exist to exercise the mechanics. What remains for the criterion is exactly the review/merge/deploy gates: this same journey through the deployed wizard UI is what the browser-level auto-qa scenario will replay once #93/#94 land. |
|
Browser-level E2E now passing ( Two gates proved themselves during test development: the metadata validator refused to write without a snapshot_id (the test had to fill it), and in the earlier scripted run the invert verification caught a real NO-pool inversion. Combined coverage: this UI run (steps 1–3) + |
d7ed549 to
4c068f9
Compare
4c068f9 to
30b96dd
Compare
cfbd2e5 to
143dd8f
Compare
|
Review (2026-09-26): APPROVE after the fixes pushed today, merge after #93. (Posted as a comment because GitHub does not let the author approve their own PR.) Today's changes:
This PR sends up to four wallet transactions: the org metadata write, the YES and NO pool creations, and a flags-only metadata update. None of them are token approvals. P1, fixed on the branch
Also fixed: only one metadata transaction is allowed per page load. Metadata and pool writes now switch to Gnosis and verify the chain before sending. P2, still open (not blocking a first supervised launch)
P3
Tests: 26/26 unit, 695/695 deterministic auto-QA, and lint on the changed files all pass, and |
…19 increment C) Step 2 (MetadataWritePanel): createAndAddProposalMetadata via the org owner/editor key — role gate read on-chain, simulate-first, TWAP timing recomputed at write time (never a page-load-stale draft), invert flags written false/false pending step-3 verification. Args assembled by the shared buildProposalMetadataArgs tuple. Step 3 (PoolsPanel): conditional tokens read via the existing fetchProposalFromChain (wrappedOutcome 0-3), YES/NO pools created through useCreatePool with a spot-prefilled, operator-confirmed initial price (wrong initial price = the seeded-1000x-off bug), then the verification pass: read each pool's token0, validate invert flags against the CONDITIONAL company token, and offer a single flags-only updateExtendedMetadata built with mergeMetadataForUpdate — the KIP-88/90 inverted-price bug class dies here. Steps unlock from ?proposal=0x… (resume after refresh) or the step-1 transactor result. Pure helpers in orgMetadataWrite.js; 17/17 unit tests. Spec: hub docs/specs/2026-08-06-selfserve-wizard-increment-C.md. ponytail: per-action stepper UI and the anvil-fork E2E scenario are the known ceiling — E2E lands with the auto-qa harness before merge.
node test/e2e-fork-demo.mjs spawns an anvil fork of Gnosis and drives the complete self-serve journey through the same modules the wizard UI calls: createProposal (shared calldata builder) -> org metadata write by the client as editor (timing recomputed, past-start gate asserted) -> both conditional pools (Algebra NFPM, wrappedOutcome tokens) -> invert verification against real token0 with a flags-only corrective updateExtendedMetadata. First run PASSED and caught a live inversion: the NO pool's token order required invertTwapPoolNo=true; the verification pass fixed it in one tx. 6 txs total, 0 from Kelvin's EOA (asserted), org owner appears exactly once (the mixed-mode setEditor grant, asserted).
…(hub-e19 increment D) Pasting a Snapshot proposal hash fetches the vote's end from hub.snapshot.org and autofills closeTimestamp; deriveTwapTiming anchors the 0xAlex window to it and openingTime lands 48h after close. Fails closed (bad id / unknown proposal / hub down -> no change, manual entry stands). With this, the wizard computes every timing field from the vote itself — the hand-aligned windows that shipped twice can't recur. 19/19 unit tests (new: autofill epoch fetch, fail-closed cases).
… (hub-e19) Extends the E2E demo through the goal's full success-criterion mechanics: whale-funded client splits collateral via FutarchyRouter, seeds both conditional pools full-range (~$10.8k currency side), floor gate reads LIVE (1.83% < 3%); then warps past openingTime, posts the Reality answer with a 1 xDAI bond, warps the 3.5d timeout, resolves permissionlessly via the factory's realityProxy, reads the CTF payout vector, and redeems the winning side back to collateral (1,200 sDAI returned). 21 txs total, 0 from Kelvin's EOA (asserted), org owner only the one-time setEditor grant (asserted). Demo amounts decide nothing about the deferred product liquidity defaults (dossier 5a). Run: node test/e2e-fork-demo.mjs --full
…e19) node test/e2e-ui-demo.mjs serves the built static export, routes every production Gnosis RPC to an anvil fork, injects an EIP-6963-announced EIP-1193 wallet backed by anvil's unlocked client account, and drives the real interface with Chromium: RainbowKit connect -> broadcast createProposal -> metadata write as org editor (the validator correctly blocked a missing snapshot_id until filled) -> both conditional pools -> invert-flag verification. Zero Kelvin-signed txs; org owner only the pre-UI setEditor grant. Reuses the auto-qa harness's playwright install read-only. LIVE seeding + resolution mechanics remain covered by e2e-fork-demo.mjs --full.
- Step 2 now takes the metadata contract from this transaction's ProposalCreatedAndAdded event (matched to our proposal) instead of the last entry in the organization's list, which another write could have changed. - The organization is locked once a proposal exists and is kept in the URL, so a resumed wizard cannot write metadata to a different organization. - Pool creation reports each new pool once through stable callbacks; before, it re-rendered forever after the first pool was created. - Metadata and pool writes switch to Gnosis and check the chain first.
After a refresh the form resets to defaults, and the close date, Snapshot autofill and question stay editable after step 1. Step 2 used those live values, so it could write a TWAP window or question that did not match the proposal. Step 2 now reads the proposal back from chain (question, token pair, Reality opening time), refuses to write if the tokens are not the selected organization's, and derives the close time from the opening time. It also allows only one metadata transaction per page load, so a retry cannot add a duplicate entry to the organization.
143dd8f to
cc3be7d
Compare
✅ Deploy Preview for futarchy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Stacked on #93 (base:
selfserve-wizard) so review units stay small — merge #93 first, then rebase this onto main.Implements the frozen spec
hub/docs/specs/2026-08-06-selfserve-wizard-increment-C.md:createAndAddProposalMetadatavia the org owner/editor key. Role gate read on-chain, simulate-first, TWAP timing recomputed at write time (a page-load-stale draft can never be written — the validator's past-start gate backs this), shared args tuple withOrganizationManagerModal.fetchProposalFromChain(wrappedOutcome0–3), YES/NO pools via the existinguseCreatePool, initial price prefilled from the org's spot ticker and operator-confirmed (a wrong initial price permanently distorts quotes — the RAGE-pool lesson).token0(), validate the on-chain metadata's invert flags against the conditional company token (the market page's authoritative rule), and offer a single flags-onlyupdateExtendedMetadatabuilt withmergeMetadataForUpdate— read-modify-write, nothing else touched. KIP-88/90 becomes unrepresentable through this flow.?proposal=0x…(refresh-safe resume).Proof:
npm run test:unit17/17 (new: args tuple, invert context/patch, end-to-end wrong-flag → flags-only merge) ·next buildgreen · exported HTML still timestamp-free.Not in scope (per spec): FLM bootstrap (hub-rslu gate), liquidity amounts (deferred decision), arb activation, Snapshot vote-timing autofill (increment D). Known ceiling: anvil-fork E2E scenario to land via the auto-qa harness before merge.