From 6ffa6fc56e9b62dfd2f29112766bdf7771af94af Mon Sep 17 00:00:00 2001 From: shum Date: Thu, 29 Oct 2026 10:25:58 +0000 Subject: [PATCH] store: add the names codes_only setting --- .../src/StoreService/Config.hs | 7 +++++-- .../store_service.ini.example | 2 ++ scripts/store-service/store_service.ini.example | 2 ++ tests/Bots/StoreService/ConfigTests.hs | 14 ++++++++++++++ tests/Bots/StoreService/NamesOrdersTests.hs | 1 + tests/Bots/StoreService/NamesSearchTests.hs | 1 + 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/apps/simplex-store-service/src/StoreService/Config.hs b/apps/simplex-store-service/src/StoreService/Config.hs index b5539ee94e..e1914e1ff2 100644 --- a/apps/simplex-store-service/src/StoreService/Config.hs +++ b/apps/simplex-store-service/src/StoreService/Config.hs @@ -174,6 +174,8 @@ data NamesConfig = NamesConfig nTermSlackSeconds :: Int, nRevealMarginSeconds :: Int, nMaxOrderMoves :: Int, + -- | Only prepaid codes pay for names: every order that would take money for one is refused. + nCodesOnly :: Bool, nTerms :: TermsConfig, -- | The operator's community names, keyed by the label hash's bytes, as search receives a name. nCommunity :: Map ByteString Text, @@ -376,7 +378,7 @@ knownSettings = ("group", ["display_name", "description"]), ("dev", ["accept_unverified_store_receipts", "check_store_during_coverage", "credit_test_purchases"]), ("issuer", ["index", "private_key", "dev_keys"]), - ("names", ["tld", "terms_version", "terms_url", "years", "term_start", "term_slack_seconds", "reveal_margin_seconds", "max_order_moves"]), + ("names", ["tld", "terms_version", "terms_url", "years", "term_start", "term_slack_seconds", "reveal_margin_seconds", "max_order_moves", "codes_only"]), ("chain", ["rpc_url", "chain_id", "controller", "sponsor", "base_registrar", "resolver", "service_key", "confirmations", "gas_limit_cap", "max_fee_per_gas"]) ] @@ -602,10 +604,11 @@ parseConfig ini = do nTermSlackSeconds <- atLeast 0 "names" "term_slack_seconds" 3600 nRevealMarginSeconds <- atLeast 0 "names" "reveal_margin_seconds" 900 nMaxOrderMoves <- atLeast 0 "names" "max_order_moves" 3 + nCodesOnly <- bool "names" "codes_only" False nTerms <- termsSetting nCommunity <- communityList nTLD nChain <- chainSection - pure (Just NamesConfig {nTLD, nYears, nTermStart, nTermSlackSeconds, nRevealMarginSeconds, nMaxOrderMoves, nTerms, nCommunity, nChain}) + pure (Just NamesConfig {nTLD, nYears, nTermStart, nTermSlackSeconds, nRevealMarginSeconds, nMaxOrderMoves, nCodesOnly, nTerms, nCommunity, nChain}) tldSetting = required "names" "tld" >>= \case "simplex" -> Right TLDSimplex diff --git a/apps/simplex-store-service/store_service.ini.example b/apps/simplex-store-service/store_service.ini.example index 22ce74194c..75639bf68a 100644 --- a/apps/simplex-store-service/store_service.ini.example +++ b/apps/simplex-store-service/store_service.ini.example @@ -116,6 +116,8 @@ idle_seconds = 60 ;reveal_margin_seconds = 900 ; how many times one order may move to another name ;max_order_moves = 3 +; on: only prepaid codes register names, and every paid name order answers 403 codes_only +;codes_only = off ; ; community names, with [names] only: one line per name, `