Skip to main content

ControlMethod

Enum ControlMethod 

Source
#[non_exhaustive]
pub enum ControlMethod {
Show 61 variants Status, ConfigGet, ConfigSetUpstream, ConfigSetMirrorAdvertiseUrls, LogSetLevel, CacheGet, CacheSetCap, CacheClear, HostedStoresList, HostedStoresPin, HostedStoresUnpin, HostedStoresStatus, CapsuleFetch, SyncStatus, SyncTrigger, UpdaterStatus, UpdaterSetChannel, UpdaterPause, UpdaterResume, UpdaterCheckNow, PairingList, PairingApprove, PairingRevoke, PeerStatus, PeerCounts, PeersConnect, PeersDisconnect, ChiaPeersAdd, ChiaPeersList, ChiaPeersRemove, Subscribe, Unsubscribe, ListSubscriptions, WalletBalance, WalletCoins, WalletCoinById, WalletCoinSpend, WalletCoinsByParent, WalletArrivals, WalletOperatorAddress, WalletPeak, WalletSyncStatus, WalletBroadcast, WalletWatch, WalletUnwatch, WalletWatched, WalletReservationsHeld, WalletReservationsReserve, WalletReservationsRelease, WalletResetCoinDb, SpendsList, CollateralRequirement, CollateralMarginGet, CollateralMarginSet, CollateralBuffer, MirrorBondStates, MirrorReconcile, ProfilePutBody, ProfileGetBody, PairingRequest, PairingPoll,
}
Expand description

A dig-node CONTROL method.

#[non_exhaustive] so adding a method in a minor release is additive; downstream matches must carry a _ => … arm. Convert to/from the wire name with ControlMethod::name / ControlMethod::from_name.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Status

control.status — a rich node status snapshot.

§

ConfigGet

control.config.get — the node’s effective configuration.

§

ConfigSetUpstream

control.config.setUpstream — persist an upstream-RPC override (effective on restart).

§

ConfigSetMirrorAdvertiseUrls

control.config.setMirrorAdvertiseUrls — override (or clear) the URLs this node advertises in its mirror-coin memos (dig-node#562). The result states whether that took effect immediately or needs a restart — see crate::results::SetMirrorAdvertiseUrlsResult.

§

LogSetLevel

control.log.setLevel — live-swap the running node’s tracing level filter.

§

CacheGet

control.cache.get — the on-disk cache view (cap/used/dir/shared).

§

CacheSetCap

control.cache.setCap — set the cache size cap (floored at 64 MiB).

§

CacheClear

control.cache.clear — delete all locally cached content.

§

HostedStoresList

control.hostedStores.list — every held/pinned store with its cached capsules.

§

HostedStoresPin

control.hostedStores.pin — pin a store (and pre-fetch when a root is given).

§

HostedStoresUnpin

control.hostedStores.unpin — unpin a store and evict its cached capsules.

§

HostedStoresStatus

control.hostedStores.status — per-store pinned flag + cached capsules.

§

CapsuleFetch

control.capsule.fetch — start (or report already-cached) a P2P whole-capsule pull for one store+root, over the recursive discover-then-dial path rather than the §21 HTTP sync.

§

SyncStatus

control.sync.status — whether authenticated whole-store sync is available + pin coverage.

§

SyncTrigger

control.sync.trigger — trigger a §21 sync for one capsule (storeId + root).

§

UpdaterStatus

control.updater.status — the DIG auto-update beacon’s current status.

§

UpdaterSetChannel

control.updater.setChannel — set the beacon’s update channel.

§

UpdaterPause

control.updater.pause — suspend auto-updates (optionally until a unix time).

§

UpdaterResume

control.updater.resume — resume auto-updates.

§

UpdaterCheckNow

control.updater.checkNow — force an immediate update check.

§

PairingList

control.pairing.list — list pending pairing requests + issued paired tokens.

§

PairingApprove

control.pairing.approve — approve a pending pairing, minting a scoped token.

§

PairingRevoke

control.pairing.revoke — revoke an issued paired token.

§

PeerStatus

control.peerStatus — live peer-pool + relay-reservation snapshot.

§

PeerCounts

control.peerCounts — how many peers this node holds on EACH network (DIG and Chia).

§

PeersConnect

control.peers.connect — dial a peer by address / resolve a connected peer_id.

§

PeersDisconnect

control.peers.disconnect — drop a pooled peer by peer_id.

§

ChiaPeersAdd

control.chiaPeers.add — trust a Chia full node you RUN, bypassing corroboration for it.

§

ChiaPeersList

control.chiaPeers.list — the trusted Chia full-node peers this node tracks.

§

ChiaPeersRemove

control.chiaPeers.remove — stop trusting a Chia full node (optionally banning it).

§

Subscribe

control.subscribe — subscribe the node to a store (watch + gap-fill).

§

Unsubscribe

control.unsubscribe — stop watching a store.

§

ListSubscriptions

control.listSubscriptions — the node’s persisted subscription set.

§

WalletBalance

control.wallet.balance — read an address’s confirmed spendable balance for an asset.

§

WalletCoins

control.wallet.coins — read an address’s spendable coin records for an asset.

§

WalletCoinById

control.wallet.coinById — read ONE coin record by coin id, spent or unspent.

§

WalletCoinSpend

control.wallet.coinSpend — read the SPEND that spent a coin (puzzle reveal + solution).

§

WalletCoinsByParent

control.wallet.coinsByParent — read the direct children a coin’s spend created (one hop).

§

WalletArrivals

control.wallet.arrivals — read confirmed INCOMING funds since a cursor position.

§

WalletOperatorAddress

control.wallet.operatorAddress — read the address of the node’s OWN machine wallet.

§

WalletPeak

control.wallet.peak — read the node’s current chain peak height.

§

WalletSyncStatus

control.wallet.syncStatus — read whether the wallet’s chain replica is being kept current.

§

WalletBroadcast

control.wallet.broadcast — push an ALREADY-SIGNED spend bundle to the network.

§

WalletWatch

control.wallet.watch — enrol PUBLIC keys for the node’s chain replica to follow.

§

WalletUnwatch

control.wallet.unwatch — deregister enrolled public keys, so the following stops.

§

WalletWatched

control.wallet.watched — list the public keys currently enrolled.

§

WalletReservationsHeld

control.wallet.reservations.held — read which coins are committed to in-flight spends.

§

WalletReservationsReserve

control.wallet.reservations.reserve — atomically hold coins, all of them or none.

§

WalletReservationsRelease

control.wallet.reservations.release — free a hold now, ahead of its TTL.

§

WalletResetCoinDb

control.wallet.resetCoinDb — discard the cached coin database and re-sync from chain.

§

SpendsList

control.spends.list — read the record of spends this node made WITHOUT asking.

§

CollateralRequirement

control.collateral.requirement – this epoch’s per-store collateral requirement.

§

CollateralMarginGet

control.collateral.margin.get – read the node’s local safety margin, in basis points.

§

CollateralMarginSet

control.collateral.margin.set – set the node’s local safety margin, in basis points.

§

CollateralBuffer

control.collateral.buffer – the $DIG this node recommends holding, and its funding state.

§

MirrorBondStates

control.mirror.bondStates – the per-(store, root) mirror bond state, and the $DIG those bonds have locked.

§

MirrorReconcile

control.mirror.reconcile – reconcile this node’s mirror coins to its CURRENT advertise URL: reclaim every coin advertising a stale URL, then recreate it advertising the URL this node advertises today. Shared by the manual “reset mirrors” action and the same primitive the node’s DAILY detector runs (dig-node#570) – ONE reconcile primitive, exposed two ways. See crate::results::MirrorReconcileResult for the three outcomes a caller must be able to tell apart, and dig_ecosystem#3203 for why refused must mean NOTHING was spent.

§

ProfilePutBody

control.profile.putBody — hand the node the profile body a CONFIRMED chain root commits to.

§

ProfileGetBody

control.profile.getBody — read back the profile body this node holds at a given root.

§

PairingRequest

pairing.request — request a control-token pairing (returns a code to compare).

§

PairingPoll

pairing.poll — poll a pairing; once the operator approves, returns the scoped token once.

Implementations§

Source§

impl ControlMethod

Source

pub const ALL: &'static [ControlMethod]

Every catalogued method, in a stable order — the enumeration a machine reads to discover the full control surface, and the anchor the conformance KATs pin against.

Source

pub const fn name(self) -> &'static str

The stable JSON-RPC wire name. Never derived from anything else — the published contract.

Source

pub fn from_name(name: &str) -> Option<ControlMethod>

Resolve a wire name back to its ControlMethod, or None for an unknown name.

Source

pub const fn requires_auth(self) -> bool

Does calling this method require the local control token?

Three groups are reachable WITHOUT one, and they are open for two different reasons:

  • the pairing bootstrap (pairing.request / pairing.poll), so a token-less client can obtain a token at all;
  • the PEER COUNTS (control.peerCounts), which disclose three integers about this node’s own connectivity and no address, endpoint or secret;
  • the wallet CALLER-ADDRESSED CHAIN READS (control.wallet.balance / .coins / .coinById / .coinSpend / .coinsByParent) and the node’s own chain POSITION (.peak / .syncStatus), because each needs only PUBLIC chain data the CALLER already named — an address, or a coin id; never a seed, a key, or a signature — and dig-node has served control.wallet.balance open since #1851. A person whose node runs as a service with an unreadable token file can still see their own money.

Five wallet methods are deliberately NOT in that second group:

  • control.wallet.broadcast puts bytes on the network, so the token is what stands between a local process and a broadcast — a mutation on the chain state itself;
  • control.wallet.watch and .unwatch aim what this node follows, so they are mutations of this node’s own watched-key set;
  • control.wallet.arrivals and .watched take nothing from the caller and answer back with this node’s OWN state — watched puzzle hashes and enrolled public keys respectively.

See ControlMethod::is_open_read. On all five, UNAUTHORIZED genuinely means unauthorized.

Source

pub const fn is_open_read(self) -> bool

Is this an OPEN READ — served without a control token?

Two kinds of method qualify, and they are open for different reasons:

  • the wallet CHAIN READS (control.wallet.balance / .coins / .coinById / .coinSpend / .coinsByParent / .peak / .syncStatus), which need only PUBLIC chain data — an address, or a coin id; never a seed, a key, or a signature. On the first five the CALLER supplies the address or coin id, so the node relays a public fact and discloses no association with itself; the last two name the node’s own chain position and no address at all;
  • control.peerCounts, which is NOT a chain read: it discloses three integers about this node’s own connectivity, and no address, endpoint, peer identity or secret. The identity and topology half of the same subject stays gated behind control.peerStatus.

Naming both reasons matters more than it looks. The test for membership is does this disclose only data that is already public, or a bare count of this node’s own state? — NOT is it a chain read? A future method judged against the narrower phrasing, and found to contradict a member that was already there, invites widening the predicate by analogy rather than against the rule.

control.wallet.arrivals is the worked example, and it was briefly a member. It passes the narrower phrasing — every field it returns is a public chain fact — and fails the rule: the caller supplies NOTHING, so the node volunteers its OWN watched puzzle hashes together with the full receive history behind them. The individual facts are public; the ASSOCIATION between this node and those addresses is not, and that association is the whole answer. A token-less caller could then feed those addresses back into the caller-addressed reads. Membership turns on who names the address, never on whether the bytes are on chain.

Stated on the contract rather than discovered by calling, because the two refusals a client can get here demand OPPOSITE remedies. On an open read, UNAUTHORIZED can only come from a node build that predates the method and gates it generically, so the remedy is an upgrade. On a gated method — the push — UNAUTHORIZED means exactly what it says, and the remedy is the token. A client that maps the two the same way sends somebody to fix the wrong thing.

Source

pub const fn is_pairing_admin(self) -> bool

Is this a PAIRING-ADMINISTRATION method that requires the MASTER control token specifically?

A paired (scoped) token can drive ordinary control.* mutations but MUST NOT mint more tokens or revoke itself — so listing/approving/revoking pairings requires the master token (a local file read), never a paired token.

This names the pairing LIFECYCLE only. The predicate an auth gate consults is ControlMethod::requires_master_token, of which this is a strict subset.

Source

pub const fn requires_master_token(self) -> bool

Does this method require the MASTER control token — the local file read — rather than any valid token?

This, not ControlMethod::is_pairing_admin, is the predicate an auth gate consults. The master tier is not “pairing administration”; it is every method whose effect OUTLIVES the token that invoked it, and pairing administration is one instance of that shape.

The rule, stated so a later method can be judged against it rather than by analogy: a method belongs here when a caller holding a paired token could use it to acquire authority it keeps AFTER that token is revoked. pairing.revoke is the designated remedy for a compromised paired app, so any method that survives it has escaped the remedy.

The two members outside the pairing lifecycle are control.chiaPeers.add and control.chiaPeers.remove, and they are here for exactly that reason. add writes a standing entry into the peer store the wallet replica reads, and a peer in that set is believed WITHOUT corroboration — it can dictate money-bearing chain facts (peak height, and therefore confirmation counts). Once written, the caller no longer needs the token at all, and revoking the token does not remove the entry. A paired token must therefore not be able to write one. remove is the only un-trust remedy and is gated with it, so a paired token cannot strip the peers an operator deliberately trusts.

control.chiaPeers.list deliberately stays on the ordinary token tier: it is a READ, it grants nothing that outlives the token, and gating it would leave a paired client unable to show the operator the trust state it is subject to. That matches control.wallet.arrivals, which is gated at the ordinary tier for disclosing an association without conferring authority.

control.config.setMirrorAdvertiseUrls ALSO stays ordinary, and for the same reason as control.chiaPeers.list rather than by analogy to its own persistence: “outlives the token” is necessary but not sufficient (see this repo’s #40, which argues control.config.setUpstream should be promoted for exactly this gap). The persisted override survives pairing.revoke just as setUpstream’s does, but it installs no principal this node will thereafter believe, obey, or forward requests to — it changes only what THIS node broadcasts about itself in its own mirror-coin memo. The node never dials the value, never trusts bytes read FROM it, and never routes a call TO it. A caller cannot use it to make the node trust or obey anyone new, which is the same reason cache.setCap and log.setLevel stay ordinary despite also persisting past the call that set them.

Source

pub const fn routing(self) -> Routing

How the node routes this method (shell-owned, engine-delegated, or open bootstrap).

Source

pub const fn category(self) -> Category

The functional area this method belongs to.

Source

pub const fn summary(self) -> &'static str

A one-line human/agent description for the discovery catalogue.

Trait Implementations§

Source§

impl Clone for ControlMethod

Source§

fn clone(&self) -> ControlMethod

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ControlMethod

Source§

impl Debug for ControlMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ControlMethod

Source§

impl Hash for ControlMethod

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ControlMethod

Source§

fn eq(&self, other: &ControlMethod) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ControlMethod

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.