feat(core): add SetOptionsOperation model and explain_set_options() explainer#142
Merged
Tinna23 merged 1 commit intoStellarCommons:mainfrom Feb 26, 2026
Conversation
Tinna23
approved these changes
Feb 26, 2026
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.
feat(core): add SetOptionsOperation model and explain_set_options() explainer
Summary
Implements a first-class explainer for
set_optionsoperations. Previously, everyset_optionstransaction fell through toOtherOperationand produced no explanation. This PR delivers the full explainer alongside a necessary infrastructure fix — several contributor-added explainer files (manage_offer,path_payment,change_trust,create_account) were referencing models and service methods that did not yet exist in the codebase, causing the project to fail to compile entirely.Both problems are resolved in this PR. All 273 tests pass (127 lib + 131 bin + 15 doc-tests).
closes #88
Changes
src/models/operation.rsSetOptionsOperationstruct with all 11 optional fields (inflation_dest,clear_flags,set_flags,master_weight,low_threshold,med_threshold,high_threshold,home_domain,signer_key,signer_weight,source_account)CreateAccountOperation,ChangeTrustOperation,ManageOfferOperation+OfferTypeenum,PathPaymentOperation+PathPaymentTypeenum — required by existing explainer files that could not compile without themOperationenumFrom<HorizonOperation>to map all 8 operation types (payment,set_options,create_account,change_trust,manage_offer,manage_sell_offer,manage_buy_offer,path_payment_strict_send,path_payment_strict_receive)is_set_options()helper and updatedid()to cover all variantsformat_asset()helper used by DEX and path payment mappingsrc/services/horizon.rsmemo_typeandmemofields toHorizonTransaction— required byservices/explain.rswhich was reading these fieldsfetch_fee_stats()— required byroutes/tx.rsis_reachable()— required byroutes/health.rsfetch_account_transactions()— required byroutes/account.rsfetch_stellar_toml_org_name()with in-memory 10-minute cache — required byhorizon_test.rsHorizonOperationto support the new operation typesHorizonAccountTransaction, pagination link structs, and fee stats structs to support the new methodssrc/explain/operation/set_options.rs(new file)Core deliverable for Issue #27:
SetOptionsExplanationstruct withsummary,account, andchangesfieldsexplain_set_options()collects every changed field into plain-English descriptionsmaster_weight = 0→ "disabled the master key",signer_weight = 0→ "removed signer", emptyhome_domain→ "cleared the home domain"AUTH_REQUIRED,AUTH_REVOCABLE,AUTH_IMMUTABLE,CLAWBACK_ENABLEDGABC...WXYZfor readabilitysrc/explain/operation/mod.rspub mod set_options;src/services/explain.rsHorizonTransactionfields (memo_type,memo)src/explain/transaction.rsmemofield handling with the correctOption<Memo>signature onTransactionCargo.tomltower = "0.4"— was missing but required bymain.rsgovernor = "0.6"— required to referencegovernor::middleware::NoOpMiddlewareinmain.rsutoipa-swagger-ui = "6"toutoipa-swagger-ui = { version = "6", features = ["axum"] }—SwaggerUiis feature-gated and was compiling to nothing without thissrc/main.rsuse axum::middlewareimport toaxum_middlewareto resolve naming conflict withmod middlewaredeclared in the same fileGovernorLayerusage fortower_governor0.4 API:.per_second(1)instead of.per_minute(60), layer takesArc<GovernorConfig>directly, return type annotated with explicit genericsuse utoipa::OpenApisoApiDoc::openapi()resolvestests/integration.rsmod integration;with a comment — having bothtests/integration.rsdeclaringmod integrationandtests/integration/mod.rsexisting simultaneously triggers Rust error E0761. The actual integration tests intests/integration/mod.rscontinue to run automatically.Test Results
set_options tests (16 new tests all passing)
Acceptance Criteria