feat(iota-core,iota-node): cleanup indexes config values - #12652
Draft
muXxer wants to merge 6 commits into
Draft
Conversation
…ining docs Review of task 1 found leftover references to the retired enable-index-processing flag that the initial repo-wide grep missed (--include glob failed silently under zsh): - the iota-swarm-config snapshot test, which broke cargo nextest - CLI help and a code comment in iota-tool - a sample node config in iota-proxy's README - sample validator/SSFN configs under setups/validator/
…ex-processing A config file is loaded with unknown keys ignored, so a node upgraded with `enable-index-processing` left in place would drop that key and take the `enable-jsonrpc-api` default of `true` — mounting a JSON-RPC listener and blocking startup on a full index rebuild on exactly the nodes the old flag was set to turn indexing off. `NodeConfig` now captures the renamed key and `check_renamed_keys` refuses it; `IotaNode::start_async` calls that first, ahead of any expensive work. The field is never serialized, so it cannot reach a config the node writes. Also state the `enable-jsonrpc-api` default the right way round, name the config keys in the kebab-case operators actually grep for, and reject a retention of `0` before announcing the index store.
4 tasks
- `EpochBuckets::prune` records that `0` keeps the newest bucket exactly as `1` does, so the caller's clamp to at least 1 is visibly redundant rather than silently so. - `prune_checkpoints` no longer argues against a constructor with an `epochs_to_retain` override; that constructor now exists. - The retention block in the pruning guide follows the file's alignment.
12 tasks
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.
Description of change
Makes a node that serves an API serve every endpoint of that API, and honours the configured index retention verbatim.
Two inconsistencies were left behind by the unified
rpc_indexesstore:enable-index-processingdecided too little. It controlled whether the JSON-RPC index tables were maintained, but the JSON-RPC server started unconditionally on every fullnode. A node could advertiseiotax_getOwnedObjects,iotax_getCoins,iotax_queryTransactionBlocksand the rest while they all answeredIndexStoreNotAvailable, so a client that could open a connection still had to probe method by method to learn what the node would actually answer.It is replaced by
enable-jsonrpc-api(defaulttrue), which gates the API and its index together — the same shapeenable-grpc-apialready has. With it off,build_http_serverreturnsOk(None)and nothing is mounted onjson-rpc-address, the/healthendpoint included, mirroring gRPC's health check, which is a method on the ledger service and disappears with the gRPC API. Metrics and the admin interface start independently of both flags, so a node serving neither API stays observable.num-epochs-to-retain-for-indexeswas not honoured. AMIN_EPOCHS_TO_RETAIN_FOR_INDEXES = 7floor silently raised any smaller value to 7. The floor is gone; the configured value is now used as written. Retention counts the current epoch, so1keeps the current epoch only and2the current plus the previous. Unset still means retain everything and remains the default — no default changed.0is rejected at startup rather than clamped: the running epoch's history is written whatever the retention says, because checkpoint ingest reads that epoch's transaction digests to tell an already-indexed transaction from a new one. Since every other value is now honoured exactly, silently reinterpreting one of them would reintroduce the surprise this change removes. Separately, and not the same thing,RpcIndexesStore::pruneguards the newest bucket at its own API boundary, because tests and tools reachprunewithout passing through config validation.Upgrade behaviour.
NodeConfighas nodeny_unknown_fields, so a config still carryingenable-index-processingwould have had that key silently dropped and fallen back toenable-jsonrpc-api: true— quietly giving a node explicitly configured not to serve JSON-RPC both a public listener on the0.0.0.0:9000default and a blocking full index rebuild at startup. The old key is therefore retained solely as a tripwire: a node whose config still names it refuses to start, with a message pointing at the replacement.Stacked on #12645.
Links to any relevant issues
How the change has been tested
cargo clippy -p iota-config -p iota-node -p iota-core -p iota-swarm-config -p iota-swarm -p test-cluster -p iota-e2e-tests --all-targets --all-features -- -D warningsclean;IOTA_SKIP_SIMTESTS=1 cargo nextest run -p iota-core --lib -p iota-config -p iota-swarm-config854/854;cargo simtest -p iota-e2e-tests291/291;cargo check --workspace --all-targetsclean.New tests: every index-backed JSON-RPC method answers on a node serving the API; a node with the API off mounts nothing on its JSON-RPC address (driven through
Swarm, since aTestClustercannot be built against a node with no JSON-RPC client); retention of 1 and 2 retain exactly the expected epochs; pruning keeps the newest bucket whatever the retention, and that bucket stays writable for ingest; a config carrying the retired key fails startup.Release Notes
enable-index-processingis replaced byenable-jsonrpc-api(defaulttrue), which gates the JSON-RPC API itself as well as its index, so a node either serves every JSON-RPC method or mounts nothing on its JSON-RPC address — including the/healthendpoint, which now follows the API the way the gRPC health check follows the gRPC API, with the metrics and admin interfaces unaffected; a node whose config still carriesenable-index-processingrefuses to start rather than silently changing behaviour;num-epochs-to-retain-for-indexesis now honoured verbatim with no seven-epoch floor and counts the current epoch, so1keeps the current epoch only and0is rejected at startup.iotax_getOwnedObjects,iotax_getCoins, the balance and dynamic-field reads,iotax_queryTransactionBlocksandiotax_queryEventsno longer answerIndexStoreNotAvailableon a node that otherwise looks healthy.Breaking Changes Rollout
Affected Crates:
Required User Actions:
enable-index-processingtoenable-jsonrpc-apiin their node config; a node whose config still carries the old key refuses to start with a message naming the new one, rather than silently falling back to theenable-jsonrpc-apidefault oftrue. Operators probing/healthon a node that turns the JSON-RPC API off must move that probe to the gRPC health check or the metrics endpoint, since nothing is mounted on the JSON-RPC address any more. Operators who setnum-epochs-to-retain-for-indexesbelow 7 previously got 7 and now get the value they asked for, so index history shrinks accordingly; a value of0now fails startup and must become1or the API must be turned off.