fix(cli): reconcile stale selector System IDs without World upgrades - #2
Closed
JackieXu wants to merge 4 commits into
Closed
fix(cli): reconcile stale selector System IDs without World upgrades#2JackieXu wants to merge 4 commits into
JackieXu wants to merge 4 commits into
Conversation
Author
|
Superseded by the versioned application migration in Liquid-Ice-Studios/valhalla-services#356. Live access verification showed that the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
mud deployso an existing World selector that points at a stale System ID is reconciled through the World’s existing Store API. This does not upgrade the World, replace its RegistrationSystem, or change protocol 2.0.2.The fork release remains CLI-only:
@latticexyz/cli@2.2.24-floki.1depends on the official MUD2.2.23packages, including@latticexyz/world@2.2.23.Root cause
ensureFunctionspreviously treated any existing World selector as registered. It warned when the configured System ID differed, but skipped the selector anyway. Because System IDs contain the configured System name, renaming a System could permanently leave old selectors routed to the obsolete implementation.Reconciliation behavior
ensureFunctionsnow reads the completeFunctionSelectorstuple directly from the World at an authoritative latest block and classifies each configured route:(System ID, System function selector)tuple: skip;0(systemId) throughWorld.setField;Before a repair, the CLI requires the destination
Systemsrow to be active and verifies that the deployer has Store access to either theworldnamespace or theFunctionSelectorstable. It re-reads the exact source route immediately before every write, waits for receipts, and verifies all configured route tuples afterward. Authoritative block snapshots explicitly bypass viem's short-lived block-number cache so an immediate post-receipt check cannot inspect the pre-write block.The protocol-2.0.2 Store API has no compare-and-swap write, so the latest read and
setFieldtransaction cannot be atomic. Deployments that can mutate routes or Systems must remain serialized. Config is authoritative for same-selector System-ID reconciliation.Existing-World permission prerequisite
The current application namespace owners on Valhalla’s dev, testnet, staging, and production Worlds do not have direct access to the
world/FunctionSelectorstable. The existingworldnamespace owner must therefore grant the normal deployment identity access to that table once before the first repairing deployment. If it has not, the CLI fails with the exact deployer, table ID, and grant instruction before submitting a repair transaction.This PR does not retire legacy Systems. Calls routed through the affected World selectors are fixed, but an obsolete public System can remain reachable through
World.call(oldSystemId, ...)until handled as a separate, explicitly reviewed operation.Fork compatibility and release packaging
Fork builds normalize forge-generated source links back to the existing canonical Lattice documentation URLs, avoiding generated-doc churn caused solely by the GitHub repository owner.
The tag-triggered fork release workflow:
@latticexyz/cli;@latticexyz/*dependencies to official2.2.23;mud --help;SHA256SUMS;The workflow creates no tag. No package or GitHub Release is published by this PR.
Validation
setFieldrepair succeeds from the dev World namespace owner and reverts from the current application owner, matching the permission preflight.Final rebuilt CLI artifact SHA-256:
f71d456bca199e0be799340ecca348bd905ace87fb1817dd196df119131e5d4e.