Skip to main content

Module update_region

Module update_region 

Source
Expand description

decdn node update-region — (re)attest the operator’s region on-chain (ADR 030).

An operator who ran decdn node register with the wrong --region, or whose node has physically relocated, needs to correct the on-chain regionHint every downstream reader (getRegisteredNodes, off-chain DHT locality ranking, ADR 030 blacklist-scope ripening) keys on. register cannot fix it (a second call reverts NodeAlreadyRegistered), and the only other route is a hand-encoded cast send … updateRegion(string). This command is the one-command fix: it validates the code as ISO 3166-1 alpha-2, normalizes it, and submits CapacityBond.updateRegion from the operator Ethereum key.

The region is validated CLI-side because the contract only length-checks the string — an unvalidated code would be stored verbatim and read back as “no locality information” by every consumer that parses it with Region::parse. The value fully REPLACES the on-chain regionHint.

Like decdn node update-multiaddrs, the contract’s guardrails are read and checked before the send so they surface as named errors rather than a bare execution reverted: NodeNotActive (the operator must be registered) and the regionStabilityWindow cooldown between updates (RegionCooldownActive). The cooldown is compared against the head block timestamp — the same clock the contract uses — so the pre-check and the on-chain check agree. (The MAX_REGION_HINT_BYTES length ceiling needs no pre-check: a validated two-letter code never nears it.)

Functions§

run
Entry point for decdn node update-region.