From 577ab18c4ea3948467c1f90435620f25f2497261 Mon Sep 17 00:00:00 2001 From: shum Date: Thu, 22 Oct 2026 07:37:11 +0000 Subject: [PATCH] store: show no register tx when judged by ownerOf --- .../src/StoreService/Names/Orders.hs | 8 ++++---- tests/Bots/StoreService/NamesWorkerTests.hs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/simplex-store-service/src/StoreService/Names/Orders.hs b/apps/simplex-store-service/src/StoreService/Names/Orders.hs index 5d59d98e37..00d2b87bb6 100644 --- a/apps/simplex-store-service/src/StoreService/Names/Orders.hs +++ b/apps/simplex-store-service/src/StoreService/Names/Orders.hs @@ -44,7 +44,6 @@ module StoreService.Names.Orders ) where -import Control.Applicative ((<|>)) import qualified Control.Exception as E import Control.Monad (forM, unless, when) import Control.Monad.Except (ExceptT (..), runExceptT) @@ -334,7 +333,7 @@ versionWritten = \case -- went through with only its confirmation lost. The order then becomes registered by a compare-and-set on the version read, a code order spending its code. -- The caller holds the turn of the order's label hash and passes the order as registrationAt reads it. confirmLanded :: OrdersEnv -> NameRegistration -> IO Landing -confirmLanded OrdersEnv {oeStore, oeContracts, oeTurns, oeNow} r@NameRegistration {nrId, nrOwner, nrLabelHash, nrPayment, nrRegisterTx, nrRegisterBlock} = do +confirmLanded OrdersEnv {oeStore, oeContracts, oeTurns, oeNow} r@NameRegistration {nrId, nrOwner, nrLabelHash, nrPayment} = do txs <- withTransaction oeStore (`registrationTransactions` nrId) let mined = [(ntHash, ntMinedBlock) | NameTransaction {ntFor = TxRegister _, ntStatus = TSMined, ntHash, ntMinedBlock} <- txs] runExceptT (landed mined) >>= \case @@ -353,8 +352,9 @@ confirmLanded OrdersEnv {oeStore, oeContracts, oeTurns, oeNow} r@NameRegistratio let registered = r { nrPhase = PRegistered, - nrRegisterTx = (fst <$> tx) <|> nrRegisterTx, - nrRegisterBlock = (snd =<< tx) <|> nrRegisterBlock, + -- judged by ownerOf alone, no hash is known to have mined: none is shown (contract section 6) + nrRegisterTx = fst <$> tx, + nrRegisterBlock = snd =<< tx, nrExpiresAt = Just expiry, nrRegisteredAt = Just now, nrFailedAt = Nothing, diff --git a/tests/Bots/StoreService/NamesWorkerTests.hs b/tests/Bots/StoreService/NamesWorkerTests.hs index f30da13784..0ea350563d 100644 --- a/tests/Bots/StoreService/NamesWorkerTests.hs +++ b/tests/Bots/StoreService/NamesWorkerTests.hs @@ -516,8 +516,9 @@ testFailedOnlySettled = withWorker $ \w@W {wCtx = ctx@Ctx {cNode}, wSender} -> d answerOwner ctx "alicebakery" (nrOwner r2) answerExpiry ctx "alicebakery" expiry steps w r2 >>= done + -- judged from chain state with no hash known to have mined: no register transaction (contract section 6) x2 <- stored ctx r2 - (nrPhase x2, nrExpiresAt x2) `shouldBe` (PRegistered, Just expiry) + (nrPhase x2, nrExpiresAt x2, nrRegisterTx x2, nrRegisterBlock x2) `shouldBe` (PRegistered, Just expiry, Nothing, Nothing) testLapseFailed :: IO () testLapseFailed = withWorker $ \w@W {wCtx = ctx} -> do