Skip to content

control-plane, chain/arkiv, frontend: exact seeds on Arkiv, panel shows only the latest draw - #79

Merged
OfficialAbhinavSingh merged 1 commit into
mainfrom
fix/arkiv-exact-seed-latest-draw
Nov 6, 2026
Merged

OfficialAbhinavSingh merged 1 commit into
mainfrom
fix/arkiv-exact-seed-latest-draw

Conversation

@OfficialAbhinavSingh

Copy link
Copy Markdown
Member

Summary

Found by running the full Arkiv loop on the live site for the first time (draft plan, explore, write, read back), and checking the Rabdi chain directly.

  • Seeds landed on chain rounded. Postgres had 1065256257932064655; Rabdi has 1065256257932064640. The Node sidecar's JSON.parse rounds integers past 2^53, so the Arkiv copy could not replay the draw. decision_id, seed and budget_micros now go to the sidecar as decimal strings, and the sidecar refuses a u64 that arrives as a JSON number rather than store a wrong one.
  • The panel marked every older draw as "does not match the picks above". Every explore call is a new draw and stays on Arkiv, and the panel compared all of them with the picks on screen, which reads as tampering. It now shows only the newest draw (one draw's rows share one Postgres transaction, so one decided_at), in task order, counts the earlier ones, and checks matches only when that draw's seed is the one on screen (otherwise it says the new draw has not landed yet).
  • The sidecar crash-looped on a key without 0x. MetaMask exports private keys without the prefix. The sidecar now accepts either form and names the problem when the key is invalid.

Verified

  • Live, before this change: 3 entities per explore call written by the service wallet 0x5279…20Ab (gas paid, 10.0 → 9.9993 tGLM), read back by the panel with explorer links; this is where the seed mismatch was measured.
  • The sidecar against the real Rabdi RPC: a key without 0x starts; a numeric seed is refused (its own error shows the rounding); a string seed reaches gas estimation (throwaway unfunded wallet).
  • uv run pytest -q 557 passed; -m postgres 450 passed; ruff, ruff format, pyright clean.
  • Frontend: 510 vitest (new arkivDraw.test.ts), tsc, eslint, prettier, build clean.
  • e2e/live/run.spec.ts: 20/21 locally. The one failure ("an inconclusive task with no agent left…") fails the same way on clean main locally and passes in CI, so it is local-environment only and unrelated to this change.

After merge

The 9 entities already on Rabdi keep their rounded seeds (entities cannot be edited; they expire in 30 days). One fresh explore call after deploy should show the exact seed on chain.

…decar accepts keys without 0x

Found by running the full loop on the live site for the first time:

- Seeds landed on Rabdi rounded: 1065256257932064655 (Postgres) became
  1065256257932064640 on chain, because the Node sidecar's JSON.parse rounds
  integers past 2^53. That breaks replaying the draw from the Arkiv copy.
  decision_id, seed and budget_micros now go to the sidecar as decimal
  strings, and the sidecar refuses a u64 that arrives as a JSON number.
- The panel compared every draw on a plan with the picks on screen, so each
  older explore draw showed "does not match the picks above", which reads as
  tampering. It now shows only the newest draw (one draw's rows share one
  Postgres transaction, so one decided_at), in task order, counts the rest,
  and only checks matches when that draw's seed is the one on screen.
- The first live deploy crash-looped because MetaMask exports private keys
  without 0x. The sidecar now accepts either form and names the problem
  when the key is invalid.

Verified: the sidecar against the real Rabdi RPC (no-0x key starts; numeric
seed refused; string seed reaches gas estimation); 557 + 450 control-plane
tests, ruff/pyright; 510 vitest, tsc, eslint, prettier, build.
@github-project-automation github-project-automation Bot moved this to Backlog in Kanban Nov 6, 2026
@OfficialAbhinavSingh
OfficialAbhinavSingh merged commit 6c87df2 into main Nov 6, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Kanban Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant