Skip to content

Commit

Permalink
Remove the reset service from the ledger api and the documentation [D…
Browse files Browse the repository at this point in the history
…PP-804] (#12472)

* Remove reset service from grpc and documentation [DPP-804]

CHANGELOG_BEGIN
Remove reset service from the ledger api protocol and the documentation
CHANGELOG_END

* remove reset service from two left-over places

* remove reset service from the protobuf structure test
  • Loading branch information
mziolekda authored Jan 19, 2022
1 parent 4885e61 commit 82534f9
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 168 deletions.
2 changes: 0 additions & 2 deletions docs/source/app-dev/authorization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ The following table summarizes what kind of claim is required to access each Led
+-------------------------------------+----------------------------+------------------------------------------+
| PruningService | All | admin |
+-------------------------------------+----------------------------+------------------------------------------+
| ResetService | All | admin |
+-------------------------------------+----------------------------+------------------------------------------+
| TimeService | GetTime | public |
| +----------------------------+------------------------------------------+
| | SetTime | admin |
Expand Down
3 changes: 0 additions & 3 deletions docs/source/app-dev/grpc/error-codes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ The following gRPC status codes have changed for submission rejections in Sandbo
|INVALID_ARGUMENT |NOT_FOUND |PARTY_NOT_KNOWN_ON_LEDGER is now returned on transaction rejections on unallocated parties. |PARTY_NOT_KNOWN_ON_LEDGER |
+-----------------------------------+---------------------------------------+--------------------------------------------------------------------------------------------+----------------------------------------+

**NOTE**: Additionally, UNAVAILABLE is now returned when trying to reset the Sandbox server during an ongoing re-initialization (was FAILED_PRECONDITION).


Daml Sandbox and VMBC
======================================

Expand Down
1 change: 0 additions & 1 deletion docs/source/app-dev/ledger-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ all cases, the Ledger API exposes the same services:
- Testing services (on Sandbox only, *not* for production ledgers)

- Use the :ref:`time service <time-service>` to obtain the time as known by the ledger.
- Use the :ref:`reset service <reset-service>` to reset the ledger state, as a quicker alternative to restarting the whole ledger application.

For full information on the services see :doc:`/app-dev/services`.

Expand Down
11 changes: 0 additions & 11 deletions docs/source/app-dev/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,6 @@ Use the **time service** to obtain the time as known by the ledger server.

For full details, see :ref:`the proto documentation for the service <com.daml.ledger.api.v1.testing.TimeService>`.

.. _reset-service:

Reset service
=============

Use the **reset service** to reset the ledger state, as a quicker alternative to restarting the whole ledger application.

This resets all state in the ledger, *including the ledger ID*, so clients will have to re-fetch the ledger ID from the identity service after hitting this endpoint.

For full details, see :ref:`the proto documentation for the service <com.daml.ledger.api.v1.testing.ResetService>`.

Services diagram
****************

Expand Down
1 change: 0 additions & 1 deletion language-support/hs/bindings/src/DA/Ledger/Services.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ import DA.Ledger.Services.LedgerIdentityService as X
import DA.Ledger.Services.PackageManagementService as X
import DA.Ledger.Services.PartyManagementService as X
import DA.Ledger.Services.PackageService as X
import DA.Ledger.Services.ResetService as X
import DA.Ledger.Services.TimeService as X
import DA.Ledger.Services.TransactionService as X

This file was deleted.

30 changes: 0 additions & 30 deletions language-support/hs/bindings/test/DA/Ledger/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ type SandboxTest = WithSandbox -> TestTree
sharedSandboxTests :: FilePath -> TestTree
sharedSandboxTests testDar = testGroupWithSandbox testDar Nothing "shared sandbox"
[ tGetLedgerIdentity
-- The reset service causes a bunch of issues so for now
-- we disable these tests.
-- , tReset
-- , tMultipleResets
, tListPackages
, tGetPackage
, tGetPackageBad
Expand Down Expand Up @@ -103,24 +99,6 @@ tGetLedgerIdentity withSandbox = testCase "getLedgerIdentity" $ run withSandbox
lid <- getLedgerIdentity
liftIO $ assertEqual "ledger-id" lid (LedgerId "my-ledger-id")

{-
tReset :: SandboxTest
tReset withSandbox = testCase "reset" $ run withSandbox $ \_ _ -> do
lid1 <- getLedgerIdentity
Ledger.reset lid1
lid2 <- getLedgerIdentity
liftIO $ assertBool "lid1 /= lid2" (lid1 /= lid2)
tMultipleResets :: SandboxTest
tMultipleResets withSandbox = testCase "multipleResets" $ run withSandbox $ \_pid _testId -> do
let resetsCount = 20
lids <- forM [1 .. resetsCount] $ \_ -> do
lid <- getLedgerIdentity
Ledger.reset lid
pure lid
liftIO $ assertEqual "Ledger IDs are unique" resetsCount (Set.size $ Set.fromList lids)
-}

tListPackages :: SandboxTest
tListPackages withSandbox = testCase "listPackages" $ run withSandbox $ \DarMetadata{mainPackageId,manifest} _testId -> do
lid <- getLedgerIdentity
Expand Down Expand Up @@ -682,14 +660,6 @@ makeSignedJwt' :: Secret -> TestId -> String
makeSignedJwt' secret tid =
makeSignedJwt (getSecret secret) [TL.unpack $ unParty $ p tid | p <- [alice, bob]]


-- resetSandbox :: Sandbox-> IO ()
-- resetSandbox sandbox = runWithSandbox sandbox $ do
-- lid <- getLedgerIdentity
-- Ledger.reset lid
-- lid2 <- getLedgerIdentity
-- unless (lid /= lid2) $ fail "resetSandbox: reset did not change the ledger-id"

----------------------------------------------------------------------
-- misc expectation combinators

Expand Down
22 changes: 8 additions & 14 deletions ledger-api/grpc-definitions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,22 @@ filegroup(
visibility = ["//visibility:private"],
)

ledger_api_haskellpb_sources_testing = [
"ResetService.hs",
"TimeService.hs",
]

genrule(
name = "ledger-api-haskellpb-sources-testing",
srcs = [
"@com_google_protobuf//:well_known_protos",
"@go_googleapis//google/rpc:status.proto",
":ledger-api-protos-fg-testing",
],
outs = ["Com/Daml/Ledger/Api/V1/Testing/" + b for b in ledger_api_haskellpb_sources_testing],
outs = ["Com/Daml/Ledger/Api/V1/Testing/TimeService.hs"],
cmd = """
for src in $(locations :ledger-api-protos-fg-testing); do
$(location @proto3-suite//:compile-proto-file) \
--includeDir """ + google_protobuf_src + """ \
--includeDir """ + google_rpc_src + """ \
--includeDir """ + ledger_api_proto_source_root + """ \
--proto com/daml/ledger/api/v1/testing/$$(basename $$src) \
--out $(@D)
done
$(location @proto3-suite//:compile-proto-file) \
--includeDir """ + google_protobuf_src + """ \
--includeDir """ + google_rpc_src + """ \
--includeDir """ + ledger_api_proto_source_root + """ \
--proto com/daml/ledger/api/v1/testing/time_service.proto \
--out $$(dirname $$(dirname $$(dirname $$(dirname $$(dirname $$(dirname $(@D)))))))
#6x dirname because @D works differently for a single output
""",
tools = [
"@proto3-suite//:compile-proto-file",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ ledgerIdMismatch:
changeExplanation: "The ledger id from the request does match the participant's ledger id."
selfServiceErrorCodeId: LEDGER_ID_MISMATCH
services:
SandboxResetService:
- reset
TimeService:
- getTimeSource
- setTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,3 @@ SandboxClassicRejections.#invalidLedgerTime:
services:
SandboxClassic.CommandCompletionService:
- CompletionStream

SandboxClassic.resetService:
change:
- FAILED_PRECONDITION
- UNAVAILABLE
changeExplanation: "UNAVAILABLE is now returned when trying to reset the Sandbox server during an ongoing re-initialization."
selfServiceErrorCodeId: SERVICE_NOT_RUNNING
services:
SandboxClassic:
- Reset
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ trait ServiceCallAuthTests
protected def expectInvalidArgument(f: Future[Any]): Future[Assertion] =
expectFailure(f, Status.Code.INVALID_ARGUMENT)

protected def expectUnimplemented(f: Future[Any]): Future[Assertion] =
expectFailure(f, Status.Code.UNIMPLEMENTED)

protected def expectFailure(f: Future[Any], code: Status.Code): Future[Assertion] =
f.failed.collect {
case GrpcException(GrpcStatus(`code`, _), _) => succeed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import com.daml.ledger.api.v1.ledger_identity_service.{
LedgerIdentityServiceGrpc,
}
import com.daml.ledger.api.v1.package_service.{ListPackagesRequest, PackageServiceGrpc}
import com.daml.ledger.api.v1.testing.reset_service.{ResetRequest, ResetServiceGrpc}
import com.daml.ledger.api.v1.testing.time_service.{GetTimeRequest, TimeServiceGrpc}
import com.daml.ledger.api.v1.transaction_service.{GetLedgerEndRequest, TransactionServiceGrpc}
import io.grpc
Expand Down Expand Up @@ -85,15 +84,6 @@ class LegacyServiceIT
}
}

private def expectUnimplemented[A](block: => A): Assertion = {
inside(Try(block)) {
case Success(_) => fail()
case Failure(exc: StatusRuntimeException) =>
exc.getStatus.getCode shouldBe Status.Code.UNIMPLEMENTED
case Failure(otherwise) => fail(otherwise)
}
}

"Ledger API Server" should {
"offer com.digitalasset.ledger.api.v1.ActiveContractsService" in {
expectNotUnimplemented {
Expand Down Expand Up @@ -159,14 +149,6 @@ class LegacyServiceIT
}
}

"offer com.digitalasset.ledger.api.v1.testing.ResetService" in {
expectUnimplemented {
val testingReset =
ResetServiceGrpc.blockingStub(channel).withInterceptors(legacyCallInterceptor)
testingReset.reset(ResetRequest(randomLedgerId))
}
}

"offer com.digitalasset.ledger.api.v1.testing.TimeService" in {
expectNotUnimplemented {
val testingTime =
Expand Down
1 change: 0 additions & 1 deletion release/test-protobuf-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ com/daml/ledger/api/v1/ledger_configuration_service.proto
com/daml/ledger/api/v1/ledger_identity_service.proto
com/daml/ledger/api/v1/ledger_offset.proto
com/daml/ledger/api/v1/package_service.proto
com/daml/ledger/api/v1/testing/reset_service.proto
com/daml/ledger/api/v1/testing/time_service.proto
com/daml/ledger/api/v1/transaction.proto
com/daml/ledger/api/v1/transaction_filter.proto
Expand Down

0 comments on commit 82534f9

Please sign in to comment.