Skip to content

Latest commit

 

History

History
335 lines (298 loc) · 21.2 KB

execution.md

File metadata and controls

335 lines (298 loc) · 21.2 KB

Verified Lookup

Verified lookup is request-scoped schema-v2 behavior. The API reads declared topology and phase projections, may call an admitted chain provider, compares the answer with indexed state where the route requires it, and returns the result without writing a reusable cache outcome or durable execution trace.

Every API path is read-only. The lookup library retains a guarded resolution divergence ledger writer for non-API callers; API requests never create, refresh or clear its observations. The ledger is diagnostic only and is never consumed as a served answer.

Read planes

The API keeps these meanings separate:

  • indexed reads the phase projection and record inventory only;
  • verified attempts the admitted schema-v2 lookup path for the requested selector or primary-name tuple; and
  • auto uses a satisfying indexed answer and attempts verified lookup only for requested selectors that indexed state cannot satisfy.

Verified lookup never backfills the record or primary-claim families. Project owns those rows and their hydration overlays. An API provider answer affects only the current response.

Snapshot and canonicality

Before lookup, the API selects a readable project publication and exact chain positions from bigname_phase. Every admitted projection row must be at or before that selection and must resolve through bigname_phase.chain_lineage. The API revalidates the selected project generation before returning. A moved head, mismatched hash, future publication, missing canonical lineage, or projection-content-hash mismatch returns 409 stale; it does not fall back to an answer at another position.

Lookup captures the participating family publications: block number, block hash, projection content hash and marker sequence, together with the selected input revision, bindings, inventory boundary and real manifest provenance. A live publication may trail the stored head by the API's publication lag tolerance (BIGNAME_API_PUBLICATION_LAG_TOLERANCE_BLOCKS, one block by default). The database guard requires the same head and the same publication the lookup captured, so the lag admitted at capture still holds when it checks. Same-chain record and primary-name calls are pinned to the captured publication's block hash, the position the indexed comparison and the indexed primary-name claim also use; a Basenames record call runs on Ethereum at the position the projected name carries. The snapshot contains the full declared topology, including wildcards and any admitted cross-chain transport context.

API revalidation begins a fresh REPEATABLE READ, READ ONLY transaction after all provider calls, so state committed during those calls is visible. It uses no advisory or row locks. A physical streaming standby preserves the row versions used to compare manifest authority; logical replicas are not supported. Revalidation checks the captured marker generation and canonical lineage. A new family block, reset, same-height republication or overlapping Interpret/Project redo refuses the response or ledger mutation. An ordinary Project progress or status update does not change family publication identity. This tolerance does not relax route-level checks that indexed and verified answers share the reported position. No obsolete serving row or its PostgreSQL xmin supplies the comparison proof.

Provider calls use the selected block identity rather than latest. Missing provider configuration, unsupported topology, and unsupported selectors are reported through the route's explicit unsupported or failed result shapes.

Resolver-record lookup

ENS verified resolution uses the manifest-admitted Universal Resolver entrypoint on the deployment profile's Ethereum L1: Mainnet under manifests/mainnet,12 Sepolia under manifests/sepolia, using the official deployment. Both profiles apply the same route classes, gates, hash pinning, and provider limits; the profile only selects the chain and therefore the BIGNAME_API_CHAIN_RPC_URLS entry the API needs (ethereum-mainnet= or ethereum-sepolia=). Every ENS class below is additionally gated by the selected authority arm: the selected ens_execution manifest's verified_authority_arms (manifests.md § verified_authority_arms; absent means ["ens_v1"]) must list the name's projected arm, or the engine refuses before any provider call and the API reports exact_name_authority_not_verifiable for every requested key. A row whose authority selection records no arm (a registry-only serving row) is not arm-scoped. The supported topology classes are:

  • exact-surface direct resolution: a name bound through its selected declared_registry_path binding, on either arm, whose projected exact resolver is non-null. The snapshot reader composes this topology for bound ENS names whose binding resource has inventory, copying that inventory's record boundary (projections.md § Exact-name projection); a bound row without an inventory row has no topology and is unsupported with verified_records_not_supported. The official Mainnet and Sepolia profiles admit both arms. Sepolia's UniversalResolverV2, and Mainnet's once its proxies upgrade to it (mainnet deployment), resolves them by walking root→leaf through getSubregistry, keeping the deepest nonzero getResolver, and accepting an ancestor-selected resolver only when it implements ENSIP-10 (upstream: .refs/ens_v2/contracts/src/universalResolver/libraries/LibRegistry.sol:L21-L45 @ ens_v2@a971bd64) (upstream: .refs/ens_v2/contracts/src/universalResolver/UniversalResolverV2.sol:L73-L80 @ ens_v2@a971bd64) (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L73-L88 @ ens_v1@91c966f). A declared ENSv1 mirror resolver stays the exact resolver in the topology: that is the address the Universal Resolver reports and the divergence comparison is keyed on;
  • exact-surface wildcard-derived resolution with a declared wildcard source and matched labels; and
  • Universal Resolver ancestor discovery: exact-surface resolution on the profile's Ethereum L1 (Mainnet or Sepolia) with a null exact resolver and no linked-subregistry, projected wildcard, or transport path, executed through that chain's manifest-admitted Universal Resolver at the captured family publication's block. This last route has no indexed comparison and retains the exact resolver as null in the API response. The entrypoint walks to the nearest nonzero ancestor and accepts it only when it implements ENSIP-10 (upstream: .refs/ens_v1/contracts/universalResolver/RegistryUtils.sol:L25-L38 @ ens_v1@91c966f) (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L63-L88 @ ens_v1@91c966f).

Ancestor-selected paths, linked-subregistry ancestor selection, transport-assisted ENS paths, and CCIP-participating ENS paths remain explicit unsupported unless a retained route contract says otherwise.

Basenames verified resolution admits the exact-surface transport-assisted direct path through the manifest-selected L1 Resolver. That contract may use OffchainLookup and resolveWithProof for non-base.eth requests.345678 Other Basenames path classes remain explicit unsupported.

Requests identify records with normalized selector keys such as addr:<coin_type>, text:<key>, and contenthash. Decimal coin types are canonicalized to their unsigned 64-bit decimal spelling before deduplication; out-of-range values are invalid input. This is an intentional narrowing of the upstream resolver uint256 coinType surface and is recorded in upstream.md.910

Selector-local results use success, not_found, unsupported, or failed. One unsupported selector does not discard successful answers for other selectors in the same request.

For Universal Resolver ancestor discovery, ResolverNotFound(bytes) is a live not_found with reason resolver_not_found only when its embedded DNS name equals the request name. Other reverts fail execution, and OffchainLookup stays unsupported because ENS verified record resolution does not follow CCIP-Read. Every successfully decoded call for one name at one block must identify the same effective resolver. A ResolverNotFound outcome cannot coexist with a successfully decoded effective resolver; either inconsistency fails the request closed. Ordinary selector-local failed or unsupported outcomes remain mixed per key. Provider results remain request-scoped and are not cached or copied into a projection.

CCIP-Read gateway transport

A gateway URL is chosen by the contract that reverts, not by bigname, so the serving path treats it as untrusted input. Requests are bounded before the URL reaches the network:

  • Scheme. Only http and https are attempted. Anything else fails the gateway before a request is sent.
  • Redirects. Not followed. A 3xx is reported as an unsuccessful gateway status, so a URL that satisfied any origin check cannot bounce the request to a different host.
  • Response size. The body read is capped at 1 MiB; a longer response fails that gateway rather than streaming into the request.
  • Fan-out and time. Each gateway HTTP request has a 1000 ms connect and a 1500 ms total timeout; those bound one request, not the lookup. For each CCIP-Read step the resolver's URL list is tried in order, at most four URLs, and a timed-out or unreachable URL falls through to the next; a resolution follows at most four steps, each followed by one JSON-RPC callback bounded by BIGNAME_API_RPC_TIMEOUT_MS. The x-batch-gateway:true form is followed for at most 8 inner requests, runs at most 4 of them at a time in request order, and lets their decoded responses total at most the same 1 MiB; a longer batch fails the record in band before any request is launched, and a batch whose responses pass that total fails it during the fan-out. A batch the Universal Resolver builds holds one lookup per call it was asked to make: one for a plain resolver call, one per entry of a multicall() (upstream: .refs/ens_v1/contracts/universalResolver/ResolverCaller.sol:L98-L122 @ ens_v1@91c966f; upstream: .refs/ens_v1/contracts/ccipRead/CCIPBatcher.sol:L42-L53 @ ens_v1@91c966f), and bigname asks for one record per call, so the cap sits well above what a legitimate batch carries. Across all of that, the gateway side of one CCIP-Read resolution shares a single 6 s budget: it is initialised once, every gateway request runs under whatever remains, and each completed request's elapsed time is subtracted, so later steps and URLs get only the remainder — four steps never get 6 s each. The budget is measured around the gateway requests only; the callback eth_calls between steps are bounded by BIGNAME_API_RPC_TIMEOUT_MS and do not draw on it, so a slow provider cannot starve a healthy gateway. When the budget runs out the record fails in band as resolver_call_failed, the same way a configured RPC timeout does, whatever phase the in-flight gateway request was in — a connection that had not completed when the budget expired fails in band too, so the connect-phase whole-request 500 applies only to a request that fails within its own per-request timeouts — instead of holding the request until the 30 s BIGNAME_API_REQUEST_TIMEOUT_MS fails it as a whole. The worst case for one record is therefore 6 s of gateway time in total plus up to four callbacks at the RPC timeout.

What is deliberately not enforced in process: destination host or IP. The gateway may resolve to any address the container can route to, including link local and cluster internal ranges. Who chooses that destination differs by path.

For Basenames the URL set is a single gateway URL read from the L1 resolver's contract-level url storage (upstream: .refs/basenames/src/L1/L1Resolver.sol:L28-L29 @ basenames@1809bbc) (upstream: .refs/basenames/src/L1/L1Resolver.sol:L171-L173 @ basenames@1809bbc). Only the contract owner can change it, through setUrl under onlyOwner, which emits UrlChanged (upstream: .refs/basenames/src/L1/L1Resolver.sol:L92-L100 @ basenames@1809bbc); no name owner or caller can substitute a URL on this path, and bigname calls the manifest-declared L1 resolver address directly and rejects an OffchainLookup from any other sender. The URL is fixed only until that owner rotates it — upstream ships an operator script for exactly that (upstream: .refs/basenames/script/configure/SetL1ResolverUrl.s.sol:L13-L16 @ basenames@1809bbc) — and bigname does not index UrlChanged, so a rotation is observed only through the live revert. Egress policy for this path should pin the host the contract currently returns, not assume it is immutable.

For the ENS primary-name path the reverse leg is plain eth_calls — registry resolver(node), then name(node) on the reverse resolver, or, only when that resolver is zero, nameForAddr(address) on the manifest-declared default.reverse registrar — that never follow CCIP-Read, so neither the reverse resolver nor the registrar can supply URLs. An empty name from a nonzero reverse resolver ends the leg with no primary name, as the ENSv2 Universal Resolver's reverse does (upstream: .refs/ens_v1/contracts/universalResolver/RegistryUtils.sol:L33-L37 @ ens_v1@91c966f) (upstream: .refs/ens_v2_sepolia_20261001/contracts/src/universalResolver/AbstractNormalizedUniversalResolver.sol:L247-L249 @ ens_v2_sepolia_20261001@07e55a05). ENS's ETH reverse resolver gives the name(node) call a 100,000 gas stipend (upstream: .refs/ens_v1/contracts/reverseResolver/ETHReverseResolver.sol:L54-L69 @ ens_v1@91c966f). bigname's name(node) call reproduces only that gas bound: it sets its gas to 100,000 plus the transaction's intrinsic cost, 21,000 base plus 16 gas per nonzero and 4 per zero calldata byte, so the resolver frame receives 100,000 when the provider's gas cap admits that limit (121,576 when all 36 bytes of the name(node) calldata are nonzero). It is a plain top-level eth_call from the zero address, not a static call from ETHReverseResolver (divergence). A call that runs out of gas or reverts ends the lookup as execution_failed; the other reverse-leg calls carry no gas field. The forward addr:60 leg is different: it calls the Universal Resolver's resolve(name, data) with CCIP-Read following enabled, and the Universal Resolver forwards the target resolver's OffchainLookup.urls unchanged — directly when the resolver supports ERC-7996 (upstream: .refs/ens_v1/contracts/ccipRead/CCIPReader.sol:L72-L94 @ ens_v1@91c966f), or wrapped in a batch-gateway request otherwise (upstream: .refs/ens_v1/contracts/ccipRead/CCIPBatcher.sol:L107-L126 @ ens_v1@91c966f), which bigname unwraps and fetches itself. Because the Universal Resolver wraps the calldata in ENSIP-10 resolve(name, data) for any resolver that advertises IExtendedResolver (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L73-L88 @ ens_v1@91c966f) (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L330-L337 @ ens_v1@91c966f), the URLs are chosen by whoever controls the forward name's resolver, or a wildcard resolver on one of its ancestors. An address that controls its reverse record — the address itself, an ENS operator it approved, a registrar controller, or the owner of an Ownable contract at that address (upstream: .refs/ens_v1/contracts/reverseRegistrar/ReverseRegistrar.sol:L40-L49 @ ens_v1@91c966f) — chooses only which name the forward leg looks up; in practice that is enough, because it can point the claim at a name whose resolver it also controls. bigname applies no allowlist to the resolver address or the gateway host before following; the only pre-fetch check is that the OffchainLookup.sender equals the Universal Resolver. Egress restriction for that case belongs to network policy around the API container, not to this client, and no such policy is described in the deployment docs today. Treat it as a prerequisite before /v2 is admitted at the public edge, and see production.md for the current edge posture.

Primary-name lookup

The verified primary-name product path supports ENS on coin type 60. It performs a fresh reverse lookup at the selected Ethereum position; a composed declared primary claim is not required. When a projected claim exists, the route consults it before live execution so unsupported exact-name coverage or an unverifiable selected authority arm can refuse the forward call. An arm is verifiable when the selected ens_execution manifest lists it in verified_authority_arms (manifests.md § verified_authority_arms, and absent means ["ens_v1"]. The official mainnet and sepolia manifests list ens_v2 as well, as documented in the mainnet and Sepolia deployment inventories). After the reverse leg, the same exact-name gate applies to the live claim. An absent readable exact-name row admits the forward call. The live reverse claim must already be byte-normalized, and the route accepts it only when the forward address matches the requested address. A reverse claim alone is not proof of a primary name.111213

Invalid or non-normalized claims remain non-primary. A successful claim whose publication has no matching canonical phase-lineage row makes snapshot-selected lookup stale. Other namespace and coin-type tuples are explicit unsupported unless the API contract admits them.

Primary-name lookup writes neither projections nor divergence observations.

Divergence ledger

Non-API lookup callers may use fixed-search_path, security-definer functions that revalidate the selected lookup state and then create, refresh, or clear an active resolution-divergence observation. LookupEngine::new retains this behavior; the API exclusively constructs LookupEngine::read_only. The API role receives the snapshot guard privilege only, with no ledger table or writer access. Existing observations stop being refreshed or cleared by API agreement.

The guard holds shared locks on the captured publications, canonical lineage, manifest selection and relevant Interpret/Project phase rows through the ledger transaction. It checks overlapping redo even when the head, marker and manifest values have not changed. Both creating an observation and clearing one use the same guard and exact refusal results. Provider calls happen before this transaction; no call runs while the guard's locks are held.

An observation records the logical name, resolver identity, request kind, selected positions, and indexed/live comparison. The indexed side is the same evaluator the records route serves: an unsupported record inventory row compares as unsupported, never as a retained entry value. Reorg handling clears active observations whose recorded positions include an orphaned block. The ledger is diagnostic evidence only; indexed projection reads and verified provider reads do not consume it as an answer.

Removed legacy artifacts

The old execution crate, execution_traces, execution_steps, and execution_cache_outcomes have been deleted. There is no worker trace inspector, persisted-execution explain route, legacy cache invalidator, or serving fallback to those tables. Unsupported behavior must remain explicit rather than being hidden behind a stale cached result.


Footnotes

  1. https://docs.ens.domains/resolvers/universal/ (official Universal Resolver proxy) ↩

  2. (upstream: .refs/ens_v1/deployments/mainnet/UniversalResolver.json:L2 @ ens_v1@91c966f) ↩

  3. (upstream: .refs/basenames/README.md:L22 @ basenames@1809bbc) ↩

  4. (upstream: .refs/basenames/README.md:L69 @ basenames@1809bbc) ↩

  5. (upstream: .refs/basenames/README.md:L70 @ basenames@1809bbc) ↩

  6. (upstream: .refs/basenames/src/L1/L1Resolver.sol:L154 @ basenames@1809bbc) ↩

  7. (upstream: .refs/basenames/src/L1/L1Resolver.sol:L173 @ basenames@1809bbc) ↩

  8. (upstream: .refs/basenames/src/L1/L1Resolver.sol:L191 @ basenames@1809bbc) ↩

  9. (upstream: .refs/ens_v1/contracts/resolvers/profiles/IAddressResolver.sol:L14 @ ens_v1@91c966f) ↩

  10. (upstream: .refs/basenames/src/L2/resolver/AddrResolver.sol:L93 @ basenames@1809bbc) ↩

  11. (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L217 @ ens_v1@91c966f) ↩

  12. (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L263 @ ens_v1@91c966f) ↩

  13. (upstream: .refs/ens_v1/contracts/universalResolver/AbstractUniversalResolver.sol:L269 @ ens_v1@91c966f) ↩